/* ── Curo Calendar — calendar.css ── */
#calroot {
  padding: 0 0 40px;
}

/* ── Calendar header bar ── */
.cal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-top: 6px;
}
.cal-nav-btn {
  background: none;
  border: 1px solid var(--line2);
  color: var(--ink);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  font-family: inherit;
}
.cal-nav-btn:hover { background: var(--hover); border-color: var(--line1); }
.cal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
  min-width: 120px;
}
.cal-view-toggle {
  display: flex;
  border: 1px solid var(--line2);
  border-radius: 8px;
  overflow: hidden;
}
.cal-view-btn {
  background: none;
  border: none;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mut);
  cursor: pointer;
  transition: background .13s, color .13s;
  font-family: inherit;
}
.cal-view-btn.active {
  background: var(--gold);
  color: #000;
}
.cal-new-btn {
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
}
.cal-new-btn:hover { opacity: .85; }

.cal-acct-btn {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.cal-acct-btn:hover { background: var(--hover); border-color: var(--line1); }

/* ── External-accounts panel ── */
.cal-acct-sub { color: var(--muted, #889); font-size: 12.5px; margin: 2px 0 12px; line-height: 1.4; }
.cal-acct-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.cal-acct-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line2); border-radius: 10px; padding: 9px 11px;
}
.cal-acct-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.cal-acct-meta { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-width: 0; }
.cal-acct-name { color: var(--ink); font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-acct-status { color: var(--muted, #889); font-size: 11.5px; }
.cal-acct-status.err { color: var(--err, #e05); }
.cal-acct-act {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line2);
  border-radius: 7px; padding: 4px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; flex: 0 0 auto;
}
.cal-acct-act:hover { background: var(--hover); }
.cal-acct-act.del { border-color: var(--err, #e05); color: var(--err, #e05); }
.cal-acct-act:disabled { opacity: .5; cursor: default; }
.cal-acct-connect { border-top: 1px solid var(--line2); padding-top: 14px; }
.cal-acct-connect-title { color: var(--ink); font-size: 12.5px; font-weight: 700; margin-bottom: 9px; }
.cal-acct-providers { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-prov-btn {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line2);
  border-radius: 9px; padding: 9px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background .15s, border-color .15s;
}
.cal-prov-btn:hover:not(.off) { background: var(--hover); border-color: var(--gold); }
.cal-prov-btn.off { opacity: .55; cursor: not-allowed; }
.cal-prov-note { color: var(--muted, #889); font-size: 11px; font-weight: 400; display: block; margin-top: 2px; }
.cal-caldav-form { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.cal-caldav-form input {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line2);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit;
}
.cal-caldav-actions { display: flex; gap: 8px; align-items: center; }
.cal-meet-days { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0; }
.cal-meet-day { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink);
  border: 1px solid var(--line2); border-radius: 7px; padding: 4px 8px; cursor: pointer; }
.cal-meet-day input { width: 15px; height: 15px; accent-color: var(--gold); cursor: pointer; }
.cal-meet-tl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mut); }
.cal-meet-tl input { background: var(--bg); color: var(--ink); border: 1px solid var(--line2);
  border-radius: 7px; padding: 6px 8px; font-family: inherit; }

/* ── Month grid ── */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--line2);
  border-radius: 10px;
  overflow: hidden;
}
.cal-dow-head {
  background: var(--bg2);
  text-align: center;
  padding: 7px 2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--mut);
  border-bottom: 1px solid var(--line2);
}
.cal-day-cell {
  min-height: 88px;
  border-right: 1px solid var(--line2);
  border-bottom: 1px solid var(--line2);
  padding: 4px 5px 3px;
  cursor: pointer;
  transition: background .12s;
  position: relative;
  background: var(--bg);
}
.cal-day-cell:hover { background: var(--hover); }
.cal-day-cell.other-month { background: var(--bg2); }
.cal-day-cell.other-month .cal-day-num { color: var(--mut2); }
.cal-day-cell.today { background: rgba(217,177,105,.07); }
.cal-day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  margin-bottom: 2px;
}
.cal-day-cell.today .cal-day-num {
  background: var(--gold);
  color: #000;
}
/* remove right/bottom border on last cells to avoid double-border */
.cal-day-cell:nth-child(7n) { border-right: none; }
.cal-month-grid .cal-day-cell:nth-last-child(-n+7) { border-bottom: none; }

.cal-chip {
  display: block;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  background: var(--gold);
  color: #000;
  font-weight: 600;
  transition: opacity .12s;
}
.cal-chip:hover { opacity: .82; }
.cal-chip-more {
  font-size: 10px;
  color: var(--mut);
  padding: 1px 2px;
  cursor: pointer;
}
.cal-chip-more:hover { color: var(--gold); }

/* ── Week view ── */
.cal-week-wrap {
  border: 1px solid var(--line2);
  border-radius: 10px;
  overflow: hidden;
}
.cal-week-allday-row {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 2px solid var(--line2);
  background: var(--bg2);
}
.cal-week-allday-label {
  font-size: 10px;
  color: var(--mut2);
  text-align: right;
  padding: 4px 6px 0 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.cal-week-allday-cell {
  border-left: 1px solid var(--line2);
  min-height: 26px;
  padding: 2px 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}
.cal-week-allday-cell:hover { background: var(--hover); }
.cal-week-head-row {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1px solid var(--line2);
  background: var(--bg2);
}
.cal-week-head-corner { /* empty corner */ }
.cal-week-head-day {
  text-align: center;
  padding: 6px 2px;
  border-left: 1px solid var(--line2);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.cal-week-head-day.today {
  color: var(--gold);
}
.cal-week-head-day .cal-week-head-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin: 0 auto;
}
.cal-week-head-day.today .cal-week-head-num {
  background: var(--gold);
  color: #000;
}
.cal-week-body {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  overflow-y: auto;
  max-height: 560px;
  position: relative;
}
.cal-week-time-col {
  display: flex;
  flex-direction: column;
}
.cal-week-time-label {
  height: 48px;
  padding-right: 6px;
  text-align: right;
  font-size: 10px;
  color: var(--mut2);
  line-height: 48px;
  position: relative;
  top: -8px;
}
.cal-week-col {
  border-left: 1px solid var(--line2);
  position: relative;
  cursor: pointer;
}
.cal-week-col:hover { background: rgba(255,255,255,.02); }
.cal-week-hour-cell {
  height: 48px;
  border-bottom: 1px solid var(--line2);
}
.cal-week-event {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 5px;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
  background: var(--gold);
  color: #000;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: opacity .12s;
  min-height: 18px;
}
.cal-week-event:hover { opacity: .85; }

/* ── Error / empty state ── */
.cal-err {
  padding: 32px 16px;
  text-align: center;
  color: var(--err, #e05);
  font-size: 14px;
}
.cal-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--mut2);
  font-size: 14px;
}

/* ── Event Modal ── */
.cal-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.52);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cal-modal-card {
  background: var(--card, var(--bg2));
  border: 1px solid var(--line2);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  padding: 24px 24px 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,.38);
  max-height: 90vh;
  overflow-y: auto;
}
.cal-modal-head {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}
.cal-modal-head-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
}
.cal-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--mut);
  cursor: pointer;
  padding: 0 0 0 8px;
}
.cal-modal-close:hover { color: var(--ink); }
.cal-field {
  margin-bottom: 13px;
}
.cal-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--mut);
  margin-bottom: 5px;
}
.cal-field input[type="text"],
.cal-field input[type="date"],
.cal-field input[type="time"],
.cal-field textarea,
.cal-field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line2);
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color .15s;
}
.cal-field input:focus,
.cal-field textarea:focus,
.cal-field select:focus {
  outline: none;
  border-color: var(--gold);
}
.cal-field textarea { resize: vertical; min-height: 68px; }
.cal-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cal-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 13px;
}
.cal-check-row input[type="checkbox"] { accent-color: var(--gold); width: 15px; height: 15px; }
.cal-reminder-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cal-modal-err {
  color: var(--err, #e05);
  font-size: 13px;
  margin-bottom: 10px;
  min-height: 18px;
}
.cal-modal-foot {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}
.cal-modal-save {
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 8px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
}
.cal-modal-save:hover { opacity: .85; }
.cal-modal-save:disabled { opacity: .5; cursor: default; }
.cal-modal-del {
  background: none;
  border: 1px solid var(--err, #e05);
  color: var(--err, #e05);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-left: auto;
  transition: background .15s;
}
.cal-modal-del:hover { background: rgba(238,0,85,.1); }

@media (max-width: 600px) {
  .cal-header { gap: 6px; }
  .cal-title { font-size: 15px; }
  .cal-month-grid { font-size: 11px; }
  .cal-day-cell { min-height: 60px; }
  .cal-modal-card { padding: 16px; }
  .cal-field-row, .cal-reminder-row { grid-template-columns: 1fr; }
}
