:root {
  --ink: #1b1f2a;
  --ink-soft: #4a5163;
  --muted: #8b91a1;
  --line: #e6e8ee;
  --surface: #ffffff;
  --canvas: #f6f7f9;
  --raised: #fbfcfd;
  --accent: #3f5bd9;        /* considered indigo, not the usual terracotta */
  --accent-soft: #eef1fd;
  --accent-ink: #2c40a8;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 24, 35, .06), 0 8px 24px rgba(20, 24, 35, .08);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--raised); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- form fields ---------- */
.field, label.field { display: block; margin-bottom: 11px; }
.field > span, label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=datetime-local],
select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: 13px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; min-height: 52px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.checkline input { width: auto; }

.msg { padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; }
.msg-error { background: var(--danger-soft); color: var(--danger); }
.msg-ok { background: #e8f6ee; color: #1e7d47; }

/* ---------- status pill ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.brand { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 2px 0 22px; }
.auth-tabs { display: flex; gap: 4px; background: var(--canvas); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.auth-tabs button { flex: 1; border: none; background: transparent; padding: 7px; border-radius: 5px; font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.auth-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.dept-picker { border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 150px; overflow: auto; padding: 4px; }
.dept-picker label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 5px; font-size: 13px; cursor: pointer; }
.dept-picker label:hover { background: var(--canvas); }
.dept-picker input { width: auto; }
.dept-head-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px; }
.dept-head-row .dh-member { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; flex: 1; }
.dept-head-row .dh-head { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }
.dept-head-row input { width: auto; }
.hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-rows: auto 1fr; height: 100%; }
/* Three columns: brand | search, centred on the page | everything else. */
.topbar { display: grid; grid-template-columns: 1fr minmax(180px, 380px) 1fr; align-items: center; gap: 14px;
  padding: 0 14px; height: 40px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-right { justify-self: end; display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .brand-mark { width: 22px; height: 22px; font-size: 12px; }
.topbar .brand-name { font-size: 15px; }
.topbar .spacer { flex: 1; }
.who { font-size: 13px; color: var(--ink-soft); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .btn { white-space: nowrap; flex-shrink: 0; }
.who b { color: var(--ink); font-weight: 600; }
.role-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent-ink); background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; margin-left: 6px; }

.body { display: grid; grid-template-columns: 232px 1fr; min-height: 0; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); overflow: auto; padding: 12px 8px; }
.side-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 10px; }
.side-item { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 6px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.side-item:hover { background: var(--canvas); }
.side-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side-folder { font-weight: 600; color: var(--ink); }
.side-list-group { }
.side-list { padding-left: 28px; font-size: 12.5px; }
.side-caret { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted); user-select: none; border-radius: 4px; margin-left: -2px; }
.side-caret:hover { background: var(--line); color: var(--ink); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
/* One slim toolbar: flat text buttons, no boxes; a soft fill marks what's on. */
.main-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 2px; padding: 3px 8px; min-height: 38px;
  border-bottom: 1px solid var(--line); background: var(--surface); }
.view-tabs, .scope-tabs { display: flex; gap: 1px; }
.view-tabs button, .scope-tabs button, .tb-btn, .tb-icon, .tb-select {
  border: none; background: transparent; padding: 4px 7px; border-radius: 5px; font-size: 12.5px; font-weight: 500;
  color: var(--ink-soft); line-height: 1.3; }
.view-tabs button:hover, .scope-tabs button:hover, .tb-btn:hover, .tb-icon:hover, .tb-select:hover { background: var(--canvas); color: var(--ink); }
.view-tabs button.active { color: var(--ink); background: var(--canvas); font-weight: 600; }
.scope-tabs button.active { color: var(--accent-ink); background: var(--accent-soft); }
.tb-icon { font-size: 17px; line-height: 1; padding: 2px 7px; }
.tb-select { cursor: pointer; font-family: inherit; width: auto; appearance: none; -webkit-appearance: none; padding-right: 20px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5l3 3 3-3' fill='none' stroke='%234a5163' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 6px center; }
.tb-select:hover { background-color: var(--canvas); }
.tb-sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.cal-nav { display: flex; align-items: center; gap: 1px; }
.cal-title { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 4px 0 2px; white-space: nowrap; }
.btn-xs { padding: 4px 10px; font-size: 12.5px; margin-left: 4px; }
.main-head .spacer { flex: 1; }
.filter-note { font-size: 12px; color: var(--muted); }

.view-area { flex: 1; overflow: auto; padding: 6px 10px; min-height: 0; }
#calendar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; height: 100%; overflow: hidden; }
#calendar .fc-scrollgrid { border-left: none; border-top: none; }

/* ---------- table view ---------- */
.tf-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tf-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--raised); }
.tf-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
.tf-table tr:last-child td { border-bottom: none; }
.tf-table tbody tr:hover { background: var(--canvas); cursor: pointer; }
.avatars { display: inline-flex; }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; display: grid; place-items: center; margin-left: -5px; border: 1.5px solid var(--surface); }
.avatar:first-child { margin-left: 0; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14px; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 24, 35, .38); display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 50; }
.overlay.show { display: flex; }
.modal { width: 100%; max-width: 560px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-head .spacer { flex: 1; }
.icon-btn { border: none; background: transparent; font-size: 20px; line-height: 1; color: var(--muted); padding: 2px 6px; border-radius: 5px; }
.icon-btn:hover { background: var(--canvas); color: var(--ink); }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }

/* assignee picker */
.assignee-box { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.assignee-search { border: none; border-bottom: 1px solid var(--line); border-radius: 0; }
.assignee-list { max-height: 150px; overflow: auto; padding: 4px; }
.assignee-list label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 5px; font-size: 13px; cursor: pointer; }
.assignee-list label:hover { background: var(--canvas); }
.assignee-list input { width: auto; }
.tag-imported { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

/* subtasks */
.subtasks { margin-top: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.subtask { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.subtask:last-child { border-bottom: none; }
.subtask .st-title { flex: 1; }
.subtask-add { display: flex; gap: 6px; padding: 8px; }
.subtask-add input { flex: 1; }
.readonly-note { font-size: 12px; color: var(--muted); background: var(--canvas); padding: 8px 10px; border-radius: var(--radius-sm); margin-bottom: 12px; }

/* ---------- admin ---------- */
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }
.admin-back { font-size: 13px; margin-bottom: 16px; display: inline-block; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.card h2 { margin: 0 0 4px; font-size: 15px; }
.card .card-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }
.chip { display: inline-block; font-size: 11px; background: var(--canvas); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; margin: 0 3px 3px 0; }

/* FullCalendar tuning to match the app palette */
.fc { --fc-border-color: var(--line); --fc-today-bg-color: #f3f6ff; --fc-now-indicator-color: var(--accent); font-size: 12.5px; }
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 8px; }
.fc .fc-toolbar-title { font-size: 15px; font-weight: 600; }
.fc .fc-button { background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); box-shadow: none; font-size: 12.5px; padding: 4px 9px; text-transform: capitalize; }
.fc .fc-button:hover { background: var(--raised); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.fc .fc-col-header-cell-cushion { color: var(--ink-soft); font-weight: 600; padding: 5px 4px; }
.fc .fc-timegrid-event { border-radius: 5px; border: none; padding: 1px 4px; box-shadow: none; }
.fc .fc-event-title { font-weight: 500; }
.fc .fc-daygrid-event { border-radius: 4px; padding: 1px 4px; }

/* table view: filter bar + sortable headers */
.table-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.table-filters select { width: auto; min-width: 130px; padding: 6px 9px; font-size: 12.5px; }
.tf-search { width: auto; flex: 1; min-width: 180px; max-width: 300px; padding: 7px 11px; font-size: 13px; }
.tf-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.tf-table th.sortable:hover { color: var(--ink); background: var(--canvas); }
.sort-arrow { color: var(--accent); font-size: 10px; }

/* folder colour dot in the sidebar */
.folder-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; cursor: pointer; border: 1px solid rgba(0,0,0,.12); }
.folder-dot:hover { transform: scale(1.15); }

/* scope pickers + colour-mode control (second row) */
.scope-pickers { display: flex; gap: 6px; }
.picker-btn { border: none; background: transparent; color: var(--ink-soft); padding: 4px 7px; border-radius: 5px; font-size: 12.5px; font-weight: 500; }
.picker-btn:hover { background: var(--canvas); color: var(--ink); }
.picker-btn.active { background: var(--accent-soft); color: var(--accent-ink); }
.color-control { display: flex; align-items: center; gap: 1px; }

/* floating popover (swatches, multi-selects) */
#popover { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; display: none; }
#popover.show { display: block; }
.swatch-grid { display: grid; grid-template-columns: repeat(6, 22px); gap: 6px; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); cursor: pointer; padding: 0; }
.swatch:hover { transform: scale(1.12); }
.swatch.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.ms-list { max-height: 240px; overflow: auto; min-width: 200px; }
.ms-list label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 5px; font-size: 13px; cursor: pointer; }
.ms-list label:hover { background: var(--canvas); }
.ms-list input { width: auto; }
.ms-foot { display: flex; justify-content: flex-end; gap: 6px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }

/* radio chips (status / priority / department in the task modal) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-radio { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border: 1px solid var(--line);
  border-radius: 999px; font-size: 12.5px; cursor: pointer; color: var(--ink-soft); background: var(--surface); user-select: none; }
.chip-radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-radio:hover { background: var(--canvas); }
.chip-radio:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip-radio input:disabled ~ span { opacity: .6; }
.chip-radio .dot { width: 8px; height: 8px; border-radius: 50%; }

/* sidebar gear */
.side-head { display: flex; align-items: center; }
.side-gear { margin-left: auto; border: none; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; padding: 2px 6px; border-radius: 5px; line-height: 1; }
.side-gear:hover { background: var(--canvas); color: var(--ink); }

/* notification bell + count badges */
.bell-btn { position: relative; border: none; background: transparent; font-size: 16px; cursor: pointer; padding: 4px 6px; border-radius: 6px; line-height: 1; }
.bell-btn:hover { background: var(--canvas); }
.admin-link-btn { position: relative; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.notif-head { font-weight: 600; font-size: 13px; padding: 2px 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.notif-list { max-height: 320px; overflow: auto; min-width: 260px; max-width: 320px; }
.notif-item { padding: 8px; border-radius: 6px; font-size: 13px; }
.notif-item.unread { background: var(--accent-soft); }
.notif-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.notif-empty { padding: 12px 8px; color: var(--muted); font-size: 13px; }

/* pending tag in the sidebar */
.pending-tag { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: #b45309; background: #fef3c7; border-radius: 4px; padding: 1px 5px; vertical-align: middle; }

/* new-folder button under the sidebar tree */
.new-folder-btn { width: calc(100% - 16px); margin: 8px; padding: 7px; border: 1px dashed var(--line); background: transparent;
  color: var(--ink-soft); border-radius: 6px; font-size: 12.5px; cursor: pointer; }
.new-folder-btn:hover { background: var(--canvas); color: var(--ink); border-color: var(--muted); }

/* recurrence controls */
.repeat-detail { margin-top: 8px; padding: 10px 12px; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rd-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.rd-row > label { font-size: 12px; font-weight: 600; color: var(--ink-soft); min-width: 44px; }
.rd-row input[type=number], .rd-row input[type=date], .rd-row select { padding: 5px 8px; font-size: 12.5px; }
.rd-row #rep-unit { font-size: 12.5px; color: var(--ink-soft); }
.weekday-picker { display: flex; gap: 4px; }
.weekday-picker .wd { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); font-size: 11.5px; font-weight: 600; cursor: pointer; padding: 0; }
.weekday-picker .wd:hover { background: var(--raised); }
.weekday-picker .wd.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.weekday-picker .wd:disabled { opacity: .5; cursor: not-allowed; }
#rep-summary { margin-top: 2px; }

.series-banner { background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--radius-sm);
  padding: 9px 11px; font-size: 12.5px; margin-bottom: 12px; }

/* this-occurrence / whole-series prompt */
.scope-choice { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; font-size: 13px; }
.scope-choice:hover { background: var(--canvas); }
.scope-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.scope-choice input { width: auto; margin-top: 2px; }
.scope-choice small { color: var(--muted); font-size: 11.5px; }

/* Zimbra connection status */
.zimbra-status { padding: 9px 11px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 12px; }
.zimbra-status.ok { background: #e8f6ee; color: #1e7d47; }
.zimbra-status.bad { background: var(--danger-soft); color: var(--danger); }

@media (max-width: 760px) {
  .body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ---------- search (top bar) ---------- */
.search-wrap { position: relative; width: 100%; }
.global-search { width: 100%; padding: 5px 58px 5px 11px; font-size: 12.5px; border-radius: 8px; background: var(--canvas); cursor: text; }
.global-search:focus { background: var(--surface); }
.search-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 600 10.5px var(--font); color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; background: var(--surface); pointer-events: none; }
.search-results { display: none; position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: min(560px, 92vw); max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 60; padding: 6px 0; }
.search-results.show { display: block; }
.sr-group { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 8px 14px 4px; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 7px 14px; cursor: pointer; font-size: 13px; }
.sr-item.active, .sr-item:hover { background: var(--accent-soft); }
.sr-item .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sr-main { flex: 1; min-width: 0; }
.sr-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-title mark { background: #fff3b0; color: inherit; border-radius: 2px; }
.sr-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sr-empty { padding: 14px; color: var(--muted); font-size: 13px; }
@media (max-width: 900px) { .topbar .brand-name, .search-kbd, .who { display: none; } }

/* ---------- task activity (right side of the task dialog) ---------- */
.modal.wide { max-width: 1000px; }
.modal-main { display: flex; align-items: stretch; }
.modal-main > .modal-body { flex: 1; min-width: 0; }
.activity-panel { width: 360px; flex: none; border-left: 1px solid var(--line); background: var(--raised); display: flex; flex-direction: column; }
.activity-head { padding: 14px 16px 8px; font-weight: 600; font-size: 14px; }
.activity-created { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.activity-list { padding: 0 16px 14px; overflow: auto; max-height: 640px; }
.act { display: flex; gap: 10px; padding: 7px 0; font-size: 12.5px; line-height: 1.4; border-bottom: 1px solid var(--line); }
.act:last-child { border-bottom: none; }
.act-text { flex: 1; color: var(--ink-soft); }
.act-text b { color: var(--ink); font-weight: 600; }
.act-when { flex: none; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
@media (max-width: 860px) {
  .modal-main { flex-direction: column; }
  .activity-panel { width: auto; border-left: none; border-top: 1px solid var(--line); }
}

/* ---------- task dialog: compact, ClickUp-style ---------- */
/* Header and footer stay put; the form (and the activity) scroll between them. */
#task-modal { max-width: 660px; display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
#task-modal.wide { max-width: 1060px; }
#overlay { padding-top: 16px; padding-bottom: 16px; }
#task-modal .modal-head { padding: 10px 16px; }
#task-modal .modal-foot { padding: 10px 16px; background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
#task-modal .modal-main { flex: 1; min-height: 0; }
#task-modal .modal-main > .modal-body { overflow: auto; padding: 12px 16px; }
#task-modal .activity-list { max-height: none; flex: 1; min-height: 0; }
#task-modal .activity-panel { min-height: 0; }

.title-input { border: none !important; outline: none !important; padding: 2px 0 !important; font-size: 18px !important; font-weight: 600; margin-bottom: 4px; }
.desc-input { border-color: transparent !important; background: var(--raised) !important; min-height: 0 !important; padding: 6px 8px !important;
  font-size: 13px; margin-bottom: 10px; }
.desc-input:focus { border-color: var(--accent) !important; background: var(--surface) !important; }

.props { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; align-items: start; }
.prop { display: contents; }
.prop-label { font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 6px; }
.prop-value { min-width: 0; }
.prop-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.props select, .props input[type=datetime-local], .props input[type=date], .props input[type=number] { padding: 5px 8px; font-size: 12.5px; }
.prop-select { width: auto; max-width: 100%; flex: 1 1 260px; }
.props input[type=datetime-local] { width: auto; }
.prop-arrow { color: var(--muted); }
.props .checkline { font-size: 12.5px; margin-left: 4px; }
.link-btn { border: none; background: transparent; color: var(--accent); font-size: 12.5px; font-weight: 500; padding: 4px 6px; border-radius: 5px; }
.link-btn:hover { background: var(--accent-soft); }
.props .chips { gap: 4px; }
.props .chip-radio { padding: 3px 10px; font-size: 12px; }
.props .assignee-list { max-height: 128px; }
.props .assignee-list label { padding: 4px 8px; font-size: 12.5px; }
.props .assignee-search { padding: 6px 9px; font-size: 12.5px; }
.props .repeat-detail { margin-top: 6px; }
#task-modal .series-banner { margin: 0 0 10px; }
@media (max-width: 860px) {
  .props { grid-template-columns: 1fr; gap: 2px; } .prop-label { padding-top: 6px; }
  #task-modal .modal-main { overflow: auto; } #task-modal .modal-main > .modal-body { overflow: visible; }
}

/* ---------- reports page ---------- */
.reports-topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
.report-tabs { min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.report-tabs button { flex-shrink: 0; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.report-tabs-empty { font-weight: 600; font-size: 13px; color: var(--ink-soft); padding: 0 8px; }
.report-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--canvas); }
.report-frame { flex: 1; width: 100%; border: none; background: var(--surface); }
.report-note { margin: 40px auto; color: var(--muted); font-size: 14px; text-align: center; max-width: 420px; }

/* ---------- secret boxes (see fields.js) ---------- */
.secret { -webkit-text-security: disc; }
.secret::placeholder { -webkit-text-security: none; }

/* ---------- cancelled tasks ---------- */
.fc-event.is-cancelled .fc-event-title, .fc-event.is-cancelled .fc-event-time { text-decoration: line-through; }
.fc-event.is-cancelled { opacity: .8; }
.tf-table tr.is-cancelled td:first-child b { text-decoration: line-through; color: var(--muted); }

/* ---------- right-click menu on a task ---------- */
.ctx-menu { position: fixed; z-index: 70; display: none; min-width: 210px; max-width: 280px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; }
.ctx-menu.show { display: block; }
.ctx-head { padding: 6px 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ctx-item { position: relative; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; padding: 6px 10px;
  border: 0; border-radius: 5px; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.ctx-item:hover, .ctx-item.open { background: var(--canvas); }
.ctx-item small { flex-basis: 100%; font-size: 11px; color: var(--muted); }
.ctx-item.off { color: var(--muted); cursor: default; }
.ctx-item.off:hover { background: none; }
.ctx-arrow { margin-left: auto; color: var(--muted); }
.ctx-check { margin-left: auto; color: var(--accent); font-weight: 700; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.ctx-note { padding: 6px 10px 4px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px; }
.ctx-sub { display: none; position: absolute; top: -5px; left: 100%; min-width: 190px; padding: 4px; margin-left: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.ctx-menu.flip .ctx-sub { left: auto; right: 100%; margin: 0 2px 0 0; }
.ctx-item.has-sub:not(.off):hover > .ctx-sub, .ctx-item.has-sub.open:not(.off) > .ctx-sub { display: block; }

/* ---------- pick a list or a task ---------- */
.pick-modal { max-width: 460px; }
.pick-q { width: 100%; margin-bottom: 8px; }
.pick-list { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.pick-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pick-item { display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 13px;
  color: var(--ink); text-align: left; cursor: pointer; }
.pick-item small { display: block; font-size: 11px; color: var(--muted); }
.pick-item:hover, .pick-item.active { background: var(--accent-soft); }
.pick-item.current { color: var(--muted); cursor: default; background: none; }
.pick-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); z-index: 80; max-width: min(560px, 90vw);
  padding: 9px 16px; border-radius: 8px; background: #1f2433; color: #fff; font-size: 13px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Color: Status | Folder switch ---------- */
.color-switch { align-items: center; }
.color-switch-label { font-size: 13px; color: var(--muted); padding: 0 6px 0 2px; }

/* ---------- sidebar: add a list to a folder ---------- */
.side-folder .side-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-add { margin-left: auto; width: 20px; height: 20px; flex: none; border: 0; border-radius: 4px; background: none;
  color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; opacity: 0; }
.side-folder:hover .side-add, .side-add:focus { opacity: 1; }
.side-add:hover { background: var(--line); color: var(--ink); }
@media (hover: none) { .side-add { opacity: 1; } }
.side-empty { color: var(--muted); font-size: 12px; font-style: italic; }
#nf-lists { width: 100%; resize: vertical; }

/* ---------- admin: menu on the left, one section at a time ---------- */
.admin-shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); height: 100vh; }
.admin-nav { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 10px; overflow: auto; }
.admin-nav .admin-back { margin: 0 8px 14px; }
.admin-nav .brand { margin: 0 8px 14px; }
.admin-nav nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav nav a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; font-size: 13.5px;
  color: var(--ink-soft); text-decoration: none; }
.admin-nav nav a:hover { background: var(--canvas); color: var(--ink); }
.admin-nav nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.admin-nav nav .badge { position: static; margin-left: auto; }
.admin-main { overflow: auto; padding: 22px 28px 60px; }
.admin-main > * { max-width: 960px; }
.admin-section h1 { font-size: 19px; margin: 0 0 14px; }
.admin-filter { width: 100%; max-width: 320px; margin-bottom: 10px; }
.admin-main .card { overflow-x: auto; }
#folder-lists { resize: vertical; min-height: 36px; }
@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .admin-nav { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px 8px; }
  .admin-nav .brand { display: none; }
  .admin-nav .admin-back { margin: 0 0 8px; }
  .admin-nav nav { flex-direction: row; overflow-x: auto; }
  .admin-nav nav a { white-space: nowrap; }
  .admin-main { padding: 16px; }
}
