/* Falom CRM — restrained business UI in Falom AI brand colours, light + dark themes. No external assets. */
/* Brand palette from falom.ai: navy #050d22 / #0b1736, blue #1e6bff, cyan #19e3ff, violet #9b5cf6. */
:root {
  color-scheme: light;
  --brand-blue: #1e6bff; --brand-cyan: #19e3ff; --brand-violet: #9b5cf6; --brand-black: #050d22; --brand-navy: #0b1736;
  --brand-gradient: linear-gradient(135deg, var(--brand-cyan) 0%, var(--brand-blue) 45%, var(--brand-violet) 100%);
  --navy-900: #050d22; --navy-800: #0b1736; --navy-700: #14244a; --navy-600: #1d3160;
  --side-bg: #050d22; --side-hover: #0f1d3f; --side-active: #16285a; --side-line: #14244a;
  --ink: #0b1736; --ink-2: #424245; --ink-3: #86868b;
  --bg: #f5f5f7; --surface: #ffffff; --surface-2: #fafafc; --line: #e8e8ed; --line-2: #d2d2d7;
  --accent: #1e6bff; --accent-hover: #1656d9; --accent-ink: #ffffff; --accent-soft: #eaf1ff; --accent-line: #c4d7ff;
  --chip: #eef0f4; --hover: rgba(11, 23, 54, .06); --count-bg: rgba(11, 23, 54, .08);
  --gold: #ffc21a;
  --ok: #1f7a4d; --ok-soft: #e4f4ec; --ok-line: #a9d8bd;
  --warn: #b25b00; --warn-soft: #fff3e3; --warn-line: #f6d3a5;
  --danger: #c4281c; --danger-soft: #fdecea; --danger-line: #f5c6c0;
  --note-bg: #fffbea; --note-soft: #fff1c2; --note-ink: #7a5a00; --note-line: #f1e3a6;
  --violet-soft: #f1e9fe; --violet-ink: #5b2fb0;
  --backdrop: rgba(5, 13, 34, .5);
  --radius: 10px; --shadow: 0 1px 2px rgba(11, 23, 54, .05), 0 4px 16px rgba(11, 23, 54, .04);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 228px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --side-bg: #030916; --side-hover: #0c1834; --side-active: #142650; --side-line: #101e3e;
  --ink: #f5f5f7; --ink-2: #c7c7cc; --ink-3: #8a93ab;
  --bg: #050d22; --surface: #0b1736; --surface-2: #0e1b3d; --line: #1a2a52; --line-2: #283a66;
  --accent: #3d82ff; --accent-hover: #5a95ff; --accent-soft: rgba(30, 107, 255, .16); --accent-line: rgba(61, 130, 255, .45);
  --chip: #16264d; --hover: rgba(255, 255, 255, .06); --count-bg: rgba(255, 255, 255, .1);
  --ok: #3ccf86; --ok-soft: rgba(60, 207, 134, .14); --ok-line: rgba(60, 207, 134, .4);
  --warn: #ffab4a; --warn-soft: rgba(255, 154, 31, .14); --warn-line: rgba(255, 154, 31, .4);
  --danger: #ff776b; --danger-soft: rgba(255, 107, 94, .14); --danger-line: rgba(255, 107, 94, .4);
  --note-bg: rgba(255, 194, 26, .07); --note-soft: rgba(255, 194, 26, .18); --note-ink: #ffd36b; --note-line: rgba(255, 194, 26, .3);
  --violet-soft: rgba(155, 92, 246, .2); --violet-ink: #c9adff;
  --backdrop: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 8px; font-weight: 650; }
code, .mono { font-family: var(--mono); font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 4px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius); }
.skip-link:focus { left: 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.pre { white-space: pre-wrap; }
.clamp { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.text-danger { color: var(--danger) !important; }

/* ---------- layout */
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: auto 56px 1fr; grid-template-areas: "banner banner" "side top" "side main"; min-height: 100vh; }
.demo-banner { grid-area: banner; background: var(--gold); color: var(--navy-900); font-weight: 600; font-size: 12.5px; padding: 6px 16px; text-align: center; position: sticky; top: 0; z-index: 30; }
.demo-banner-inline { grid-area: auto; position: static; border-radius: var(--radius); margin-bottom: 16px; }
.sidebar { grid-area: side; background: var(--side-bg); color: #d9dee8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; font-weight: 700; color: #fff; font-size: 15px; }

.nav { list-style: none; margin: 8px 0; padding: 0 10px; }
.nav a { display: flex; gap: 10px; align-items: center; color: #c6cdda; padding: 9px 10px; border-radius: 6px; font-weight: 500; }
.nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand-blue); }
.nav-icon { width: 18px; text-align: center; opacity: .8; }
.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--side-line); display: grid; gap: 10px; }
.me { display: flex; gap: 10px; align-items: center; }
.me-name { color: #fff; font-weight: 600; font-size: 13px; }
.me-role { font-size: 12px; color: #9aa5b8; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--navy-600); color: #fff; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; background: var(--accent-soft); color: var(--accent); }
.topbar { grid-area: top; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.demo-banner ~ .topbar { top: 30px; }
.demo-banner ~ .sidebar { top: 30px; height: calc(100vh - 30px); }
.main { grid-area: main; padding: 22px 24px 48px; min-width: 0; outline: none; }
.menu-toggle { display: none; }
/* No top bar on desktop: each page carries its own Add button. */
.topbar { display: none !important; }
.layout { grid-template-rows: auto 0 1fr; }
.demo-pill { display: none; background: var(--gold); color: var(--navy-900); font-weight: 800; font-size: 11px; padding: 3px 7px; border-radius: 4px; letter-spacing: .05em; }

/* ---------- controls */
input, select, textarea { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 9px; min-height: 34px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
textarea { width: 100%; resize: vertical; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.btn { font: inherit; font-weight: 550; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 7px 12px; min-height: 34px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; opacity: .7; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { filter: brightness(.92); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
[data-theme="dark"] .btn-success, [data-theme="dark"] .btn-danger { color: var(--brand-black); }
.btn-ghost { background: transparent; border-color: transparent; color: inherit; }
.sidebar .btn-ghost { color: #c6cdda; border-color: var(--side-active); }
.sidebar .btn-ghost:hover { background: var(--side-hover); }
.btn-link { background: none; border: none; color: var(--accent); padding: 2px 4px; min-height: 0; cursor: pointer; font: inherit; font-weight: 500; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { padding: 4px 9px; min-height: 28px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: none; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; padding: 4px 8px; border-radius: 6px; min-height: 30px; }
.btn-icon:hover { background: var(--hover); }
.btn-add { flex: none; }
.segmented { display: inline-flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; background: var(--surface); }
.segmented .btn { border: none; border-radius: 0; border-right: 1px solid var(--line); }
.segmented .btn:last-child { border-right: none; }
.segmented .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---------- page structure */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }

.detail-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.notice { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }

.empty { color: var(--ink-3); padding: 18px 4px; text-align: center; }
.empty p { margin: 0 0 10px; }
.loading { color: var(--ink-3); padding: 28px; text-align: center; }
.error-state { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger); padding: 14px; border-radius: var(--radius); }
.panel-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; }

/* ---------- dashboard */
.dash-greeting { margin-bottom: 24px; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.dash-greeting h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.dash-date { color: var(--ink-3); margin-top: 2px; }
.dash-scope { margin-left: auto; }
.dash-sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.dash-section { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 16px; display: flex; flex-direction: column; min-height: 360px; }
.dash-section::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--brand-gradient); }
.dash-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.dash-section-head h2 { font-size: 16px; margin: 0 0 4px; }
.dash-explain { margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.dash-count { background: none; border: none; padding: 0; font: inherit; font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ink); cursor: pointer; }
.dash-section.is-zero .dash-count { color: var(--ink-3); }
.is-answer:not(.is-zero) .dash-count { background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.is-late:not(.is-zero) .dash-count { color: var(--warn); }
.dash-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.dash-stat { background: var(--warn-soft); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.dash-stat-value { font-size: 18px; font-weight: 700; color: var(--warn); }
.dash-stat-label { font-size: 12px; color: var(--ink-3); }
.dash-list { list-style: none; margin: 0; padding: 0; flex: 1; }
.dash-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); }
.dash-item:first-child { border-top: none; }
.dash-item-link { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); flex: 1; min-width: 0; border-radius: 8px; }
.dash-item-link:hover { text-decoration: none; }
.dash-item-link:hover .dash-item-title { color: var(--accent); }
.dash-item-main { flex: 1; min-width: 0; }
.dash-item-title { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; overflow-wrap: anywhere; }
.dash-item-time { font-weight: 400; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.dash-item-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.dash-item-snippet { font-size: 13px; color: var(--ink-2); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dash-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; border: 2px solid var(--accent); }
.dash-dot.is-unread { background: var(--accent); }
.dash-dot-task { border-radius: 3px; border-color: var(--line-2); }
.dash-dot-task.pri-dot-high { border-color: var(--warn); }
.dash-dot-task.pri-dot-urgent { border-color: var(--danger); }

.dash-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--ink-3); padding: 24px 8px; border: 1px dashed var(--line-2); border-radius: 12px; }
.dash-section-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; }
@media (max-width: 1100px) { .dash-sections { grid-template-columns: 1fr 1fr; } .dash-section.is-answer { grid-column: 1 / -1; min-height: 0; } }
@media (max-width: 860px) { .dash-sections { grid-template-columns: 1fr; } .dash-section { min-height: 0; padding: 18px; } .dash-count { font-size: 36px; } }

/* ---------- clients: status + system */
.sys-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .01em; }
.sys-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sys-relix { background: var(--accent-soft); color: var(--accent); }
.sys-restaulix { background: var(--warn-soft); color: var(--warn); }
.sys-legalix { background: var(--violet-soft); color: var(--violet-ink); }
.sys-none { background: var(--chip); color: var(--ink-3); font-weight: 600; }
.sys-none::before { background: transparent; border: 1.5px solid currentColor; width: 5px; height: 5px; }
.status-tabs .seg-count { margin-left: 6px; font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-card { display: grid; gap: 8px; }
.status-card-main { font-size: 15px; }
.status-card .actions { margin-top: 2px; }
.system-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.system-option { position: relative; border: 1.5px solid var(--line-2); border-radius: 12px; padding: 16px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font-weight: 700 !important; color: var(--ink) !important; font-size: 15px !important; }
.system-option input { position: absolute; opacity: 0; pointer-events: none; }
.system-option::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.system-option.opt-relix::before { background: var(--accent); }
.system-option.opt-restaulix::before { background: var(--warn); }
.system-option.opt-legalix::before { background: var(--violet-ink); }
.system-option:hover { border-color: var(--accent-line); }
.system-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.system-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.system-picker { border: none; padding: 0; margin: 0; }

/* ---------- theme switch (sidebar) */
.theme-switch { display: flex; gap: 2px; background: var(--side-hover); border-radius: 8px; padding: 2px; }
.theme-switch button { flex: 1; background: none; border: none; color: #9aa5b8; font: inherit; font-size: 12px; font-weight: 600; padding: 5px 4px; border-radius: 6px; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--side-active); color: #fff; }

/* ---------- lists, tables, badges */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: none; }
.list > li.done { opacity: .6; }
.list > li.overdue { border-left: 3px solid var(--warn); padding-left: 8px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { border: none; box-shadow: none; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); white-space: nowrap; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.done td { opacity: .55; }
.table.compact th, .table.compact td { padding: 6px 8px; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }

.row-actions { white-space: nowrap; text-align: right; }

.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.pager .muted { margin-right: auto; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--chip); color: var(--ink-2); white-space: nowrap; vertical-align: 1px; }
.badge-info { background: var(--accent-soft); color: var(--accent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.co-client, .st-completed { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: var(--danger-soft); color: var(--danger); }
.st-scheduled { background: var(--accent-soft); color: var(--accent); }
.pri-high { background: var(--warn-soft); color: var(--warn); }
.pri-urgent { background: var(--danger-soft); color: var(--danger); }
.chips { list-style: none; padding: 0; margin: 0 0 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--chip); border-radius: 999px; padding: 2px 4px 2px 10px; display: inline-flex; align-items: center; gap: 2px; }
.chip .btn-icon { font-size: 14px; min-height: 22px; padding: 0 6px; }

/* ---------- filters */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.filter { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.filter select, .filter input { min-width: 120px; color: var(--ink); font-weight: 400; font-size: 13.5px; }

/* ---------- forms & modals */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field legend { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-full { grid-column: 1 / -1; }
.field-check { flex-direction: row; align-items: center; gap: 8px; }
.field-check input { min-height: 0; }
.req { color: var(--danger); }
.hint { font-size: 12px; color: var(--ink-3); margin: 0; }
.field-error, .form-error { color: var(--danger); font-size: 12.5px; }
.field-error:empty, .form-error:empty { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.form-actions.wrap { flex-wrap: wrap; justify-content: flex-start; }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.check-row { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.copy-field { width: 100%; font-family: var(--mono); font-size: 12px; margin: 6px 0; }
.secret { font-size: 15px; letter-spacing: .1em; background: var(--surface-2); padding: 4px 8px; border-radius: 4px; }
.modal { border: none; border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 16px 48px rgba(20, 27, 39, .25); color: var(--ink); }
.modal-wide { width: min(760px, calc(100vw - 24px)); }
.modal::backdrop { background: var(--backdrop); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px 18px; }
.confirm-msg ul { padding-left: 18px; }

/* ---------- toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 1000; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--navy-800); color: #fff; padding: 10px 10px 10px 14px; border-radius: 8px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.toast span { flex: 1; }
.toast .btn-link { color: var(--gold); font-weight: 600; }
.toast-success { background: #17402c; }
[data-theme="dark"] .toast { border: 1px solid var(--line-2); background: #13224a; }
.toast-error { background: var(--danger); }

/* ---------- detail pages */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 12px; }
.facts dt { color: var(--ink-3); font-size: 12.5px; font-weight: 600; padding-top: 2px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs [role="tab"] { background: none; border: none; border-bottom: 2px solid transparent; padding: 9px 12px; font: inherit; font-weight: 550; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 8px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); border: 2px solid var(--surface); }
.timeline time { display: block; font-size: 12px; color: var(--ink-3); }

/* ---------- inbox */
.inbox { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.conv-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 260px); overflow: auto; }
.conv-items { list-style: none; margin: 0; padding: 0; }
.conv-item { display: grid; gap: 2px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
.conv-item:hover { background: var(--surface-2); text-decoration: none; }
.conv-item.active { background: var(--accent-soft); }
.conv-item.unread strong { font-weight: 800; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; }
.conv-pane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-height: 300px; min-width: 0; }
.conv-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.conv-head h2 { margin: 0 0 4px; }
.conv-tools { display: flex; gap: 8px; align-items: flex-end; }
.conv-back { display: none; }
.messages { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.msg { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; max-width: 88%; }
.msg.dir-inbound { justify-self: start; }
.msg.dir-outbound { justify-self: end; background: var(--surface-2); }
.msg.dir-internal { justify-self: stretch; max-width: 100%; background: var(--note-bg); border-color: var(--note-line); }
.msg-meta { margin-bottom: 4px; }
.msg-actions { margin-top: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.msg-external { background: var(--ok-soft); color: var(--ok); }
.msg-logged { background: var(--chip); color: var(--ink-2); }
.msg-note { background: var(--note-soft); color: var(--note-ink); }
.msg-demo { background: var(--violet-soft); color: var(--violet-ink); }
.msg-draft { background: var(--warn-soft); color: var(--warn); }
.msg.msg-draft { border-style: dashed; }
.composer { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.composer-extra { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- calendar */
.cal-toolbar { justify-content: space-between; }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.cal-grid { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.cal-grid.days-7 { grid-template-columns: 52px repeat(7, minmax(110px, 1fr)); }
.cal-grid.days-1 { grid-template-columns: 52px 1fr; }
.cal-corner { border-bottom: 1px solid var(--line); }
.cal-dayhead { background: var(--surface-2); border: none; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 8px; font: inherit; font-weight: 600; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.cal-dayhead.today { color: var(--accent); }
.cal-hours { grid-row: 2; }
.cal-hours div { font-size: 11px; color: var(--ink-3); text-align: right; padding: 0 6px; border-top: 1px solid var(--line); box-sizing: border-box; }
.cal-col { grid-row: 2; position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); background-size: 100% 48px; }
.cal-col.today { background-color: var(--surface-2); }
.cal-event { position: absolute; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--ink); border-radius: 5px; padding: 2px 5px; font: inherit; font-size: 11.5px; text-align: left; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; box-sizing: border-box; }
.cal-event:hover { border-color: var(--accent); z-index: 2; }
.cal-event.st-completed { background: var(--ok-soft); border-color: var(--ok-line); }
.ev-time { font-weight: 700; }
.ev-title { font-weight: 600; }
.ev-sub { color: var(--ink-3); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mhead { padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.mcell { min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mcell.other { background: var(--surface-2); color: var(--ink-3); }
.mcell.today .mday { background: var(--accent); color: #fff; }
.mday { align-self: flex-start; background: none; border: none; font: inherit; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 7px; cursor: pointer; color: inherit; }
.mevent { background: var(--accent-soft); border: none; border-radius: 4px; padding: 1px 5px; font: inherit; font-size: 11.5px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; color: var(--ink); }
.mevent.st-completed { background: var(--ok-soft); }

/* ---------- auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--navy-900), var(--navy-700)); }
.auth-card { background: var(--surface); border-radius: 12px; padding: 28px; width: min(440px, 100%); display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.auth-card h1 { font-size: 20px; }
.auth-card p { margin: 0; }
.demo-users { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.demo-user { justify-content: flex-start; gap: 10px; padding: 10px 12px; }
.demo-user .avatar { background: var(--accent-soft); color: var(--accent); }

/* ---------- responsive */
@media (max-width: 1100px) {
  
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "banner" "top" "main"; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .15s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(20, 27, 39, .4); }
  .menu-toggle { display: inline-block; }
  .demo-banner { position: static; }
  .demo-banner ~ .topbar { top: 0; }
  .demo-pill { display: inline-block; }
  /* Phones keep the menu button on the dashboard, nothing else. */
  /* Phones keep a slim strip with the menu button and the DEMO tag. */
  .topbar { display: flex !important; }
  .layout { grid-template-rows: auto 56px 1fr; }
  .topbar { padding: 0 12px; gap: 8px; }
  .main { padding: 16px 12px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  
  .inbox { grid-template-columns: 1fr; }
  .inbox.has-selection .conv-list { display: none; }
  .inbox:not(.has-selection) .conv-pane { display: none; }
  .conv-back { display: inline-flex; }
  .conv-list { max-height: none; }
  .msg { max-width: 100%; }
  .btn-add { padding: 7px 10px; }
  .cal-grid.days-7 { grid-template-columns: 44px repeat(7, minmax(84px, 1fr)); }
  .mcell { min-height: 64px; }
  .mevent { font-size: 10.5px; }
  .filter select, .filter input { min-width: 0; }
  .filter { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- clients list (owner · company · phone) */
.client-search-wrap { margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.client-search-wrap .client-search { flex: 1 1 280px; }
.btn-add { min-height: 40px; }
.client-search { width: 100%; max-width: 560px; min-height: 40px; font-size: 15px; padding: 8px 12px; }
.client-table td { padding-top: 12px; padding-bottom: 12px; vertical-align: middle; }
.client-table tr.row-link { cursor: pointer; }
.client-owner { font-weight: 650; font-size: 15px; color: var(--ink); }
.client-owner:hover { color: var(--accent); }
.client-company { color: var(--ink-2); }
.client-phone { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }

.form-section { margin: 6px 0 -2px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; }
/* "More details": calm card, chevron, smooth open/close (where the browser supports it). */
:root { interpolate-size: allow-keywords; }
.more-details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); transition: border-color .2s ease, background-color .2s ease; }
.more-details:hover { border-color: var(--line-2); }
.more-details[open] { background: var(--surface); }
.more-details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 600; color: var(--ink-2); border-radius: 12px; user-select: none; }
.more-details > summary::-webkit-details-marker { display: none; }
.more-details > summary:hover { color: var(--ink); }
.more-details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.more-chevron { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .25s ease; margin-left: 2px; }
.more-details[open] .more-chevron { transform: rotate(45deg); }
.more-details::details-content { block-size: 0; overflow: hidden; opacity: 0; transition: block-size .3s ease, opacity .25s ease, content-visibility .3s allow-discrete; }
.more-details[open]::details-content { block-size: auto; opacity: 1; }
.more-details > .form-grid { padding: 4px 14px 14px; }
@media (max-width: 860px) {
  .client-table thead { display: none; }
  .client-table tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .client-table td { border: none; padding: 0; }
  .client-table td:nth-child(1) { grid-column: 1; }
  .client-table td:nth-child(2) { grid-column: 1; font-size: 13px; }
  .client-table td:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}

/* ---------- client details card (owner, company, address) */
.details-card .details-facts dd { font-size: 15px; font-weight: 600; color: var(--ink); }
.details-card .form-grid { margin-top: 4px; }

/* ---------- client profile header card */
.profile-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 18px; position: relative; overflow: hidden; }
.profile-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--brand-gradient); }
.profile-top { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: start; padding: 22px 22px 16px; }
.profile-avatar { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-gradient); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 19px; letter-spacing: .02em; }
.profile-main { min-width: 0; }
.profile-main h1 { font-size: 24px; }
.profile-facts { display: grid; grid-template-columns: minmax(140px, auto) minmax(140px, auto) minmax(220px, 1fr); gap: 10px 28px; margin: 12px 0 0; }
.profile-fact dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 3px; }
.profile-fact dd { margin: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.profile-fact dd a { color: var(--accent); }
.profile-actions { justify-content: flex-end; }
.profile-card .tabs { margin: 0; padding: 0 14px; border-top: 1px solid var(--line); border-bottom: none; }
@media (max-width: 1000px) {
  .profile-top { grid-template-columns: auto 1fr; }
  .profile-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .profile-facts { grid-template-columns: 1fr 1fr; }
  .profile-fact-wide { grid-column: 1 / -1; }
}
@media (max-width: 560px) { .profile-facts { grid-template-columns: 1fr; } .profile-avatar { width: 44px; height: 44px; border-radius: 12px; font-size: 15px; } }

/* ---------- collapsible "Recent history" card on the client page */
.history-card { padding: 0; }
.history-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius); user-select: none; }
.history-card > summary::-webkit-details-marker { display: none; }
.history-card > summary h2 { margin: 0; }
.history-card > summary:hover h2 { color: var(--accent); }
.history-card > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.history-card[open] .more-chevron { transform: rotate(45deg); }
.history-count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--ink-3); background: var(--chip); border-radius: 999px; padding: 1px 8px; }
.history-card::details-content { block-size: 0; overflow: hidden; opacity: 0; transition: block-size .3s ease, opacity .25s ease, content-visibility .3s allow-discrete; }
.history-card[open]::details-content { block-size: auto; opacity: 1; }
.history-body { padding: 0 16px 14px; }

/* ---------- client notes */
.note-form textarea { width: 100%; min-height: 140px; font-size: 15px; }
.note-form .hint { margin: 6px 0 0; }
.notes-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
/* Pop-ups that blur the page behind them */
.modal-blur::backdrop { background: rgba(5, 13, 34, .28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-blur[open] { animation: modal-in .18s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.notes-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; max-height: 420px; overflow: auto; }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.note-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 4px; }
.note-meta time { font-size: 12px; }

.note-body { font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.notes-empty { text-align: center; padding: 10px 0; font-size: 13px; }

/* ---------- client page: month calendar (this client's appointments only) */
.client-cal { padding: 14px 16px; }
.client-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.client-cal-head h2 { margin: 0; font-size: 16px; }
.client-month .mcell { min-height: 84px; cursor: pointer; transition: background-color .15s ease; }
.client-month .mcell:hover { background: var(--accent-soft); }
.client-month .mcell.other:hover { background: var(--surface-2); }
.client-month .mday { pointer-events: none; }
.client-month .mevent.st-cancelled { text-decoration: line-through; opacity: .6; background: var(--chip); }
.client-cal .hint { margin-top: 8px; }

@media (max-width: 700px) { .client-month .mcell { min-height: 56px; } .client-month .mevent { font-size: 10px; } }

/* ---------- client page: Tasks card */
.client-tasks .card-head { align-items: flex-start; margin-bottom: 6px; }
.task-stats { display: flex; gap: 14px; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.task-stat strong { color: var(--ink); font-size: 14px; }
.task-stat.is-late, .task-stat.is-late strong { color: var(--warn); }

.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); transition: border-color .15s ease; }
.task-row:hover { border-color: var(--line-2); }
.task-row.is-late { border-left: 3px solid var(--warn); }
.task-row.is-today { border-left: 3px solid var(--accent); }
.task-row.is-finished { background: var(--surface-2); }
.task-row.is-finished .task-title { color: var(--ink-3); text-decoration: line-through; }
.task-check { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.task-due { font-weight: 600; color: var(--ink-2); }
.task-due.is-late { color: var(--warn); }
.task-due.is-today { color: var(--accent); }
.task-desc { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-edit { flex: none; }
.task-empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 28px 12px; margin-top: 10px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--ink-3); }
.task-empty p { margin: 0; }
.task-empty-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: 18px; }
.task-done-group { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.task-done-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--ink-2); padding: 4px 0 8px; }
.task-done-group > summary::-webkit-details-marker { display: none; }
.task-done-group[open] .more-chevron { transform: rotate(45deg); }
@media (max-width: 700px) { .task-desc { display: none; } }

/* Task groups: Late (red) · Today (yellow) · Tomorrow (green) · Later (neutral) */
.client-tasks { --g-late: var(--danger); --g-late-soft: var(--danger-soft); --g-today: #b8860b; --g-today-soft: #fff6d6; --g-tomorrow: var(--ok); --g-tomorrow-soft: var(--ok-soft); }
[data-theme="dark"] .client-tasks { --g-today: #ffd24a; --g-today-soft: rgba(255, 194, 26, .14); }
.task-group { margin-top: 12px; border-radius: 12px; padding: 10px 12px 12px; border: 1px solid var(--line); background: var(--surface-2); }
.task-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.task-group-head h3 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.task-group-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.task-group-count { margin-left: auto; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; background: var(--surface); }
.task-group-empty { margin: 0; font-size: 13px; color: var(--ink-3); }
.group-late { background: var(--g-late-soft); border-color: color-mix(in srgb, var(--g-late) 35%, transparent); }
.group-late .task-group-dot { background: var(--g-late); }
.group-late h3, .group-late .task-group-count { color: var(--g-late); }
.group-today { background: var(--g-today-soft); border-color: color-mix(in srgb, var(--g-today) 40%, transparent); }
.group-today .task-group-dot { background: var(--g-today); }
.group-today h3, .group-today .task-group-count { color: var(--g-today); }
.group-later { background: var(--g-tomorrow-soft); border-color: color-mix(in srgb, var(--g-tomorrow) 35%, transparent); }
.group-later .task-group-dot { background: var(--g-tomorrow); }
.group-later h3, .group-later .task-group-count { color: var(--g-tomorrow); }
.task-group .task-row { border-left-width: 1px; border-left-color: var(--line); }
.group-late .task-due.is-late { color: var(--g-late); }
.group-today .task-due.is-today { color: var(--g-today); }

/* Task sections as drop-downs: header with arrow; content slides open/closed. */
.task-group { padding: 0; }
.task-group > summary.task-group-head { list-style: none; cursor: pointer; margin: 0; padding: 11px 12px; border-radius: 12px; user-select: none; }
.task-group > summary::-webkit-details-marker { display: none; }
.task-group > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task-group-count { margin-left: auto; }
.task-group-arrow { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: 0 4px 3px 6px; transition: transform .25s ease; color: var(--ink-3); }
.task-group[open] > summary .task-group-arrow { transform: rotate(-135deg); margin-bottom: -3px; }
.group-late .task-group-arrow { color: var(--g-late); }
.group-today .task-group-arrow { color: var(--g-today); }
.group-later .task-group-arrow { color: var(--g-tomorrow); }
.task-group > summary:hover h3 { text-decoration: underline; text-underline-offset: 3px; }
.task-group > .task-list, .task-group > .task-group-empty { padding: 0 12px 12px; }
.task-group::details-content { block-size: 0; overflow: hidden; opacity: 0; transition: block-size .3s ease, opacity .25s ease, content-visibility .3s allow-discrete; }
.task-group[open]::details-content { block-size: auto; opacity: 1; }

/* ---------- client page: conversation thread (chat style) */
.chat-card { padding-bottom: 8px; }
.chat-thread { max-height: 520px; min-height: 220px; overflow-y: auto; padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.chat-day { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.chat-day::before, .chat-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chat-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 72%; }
.chat-msg.is-client { align-self: flex-start; }
.chat-msg.is-us { align-self: flex-end; flex-direction: row-reverse; }
.chat-avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--chip); color: var(--ink-2); }
.chat-bubble-wrap { display: flex; flex-direction: column; min-width: 0; }
.chat-msg.is-us .chat-bubble-wrap { align-items: flex-end; }
.chat-bubble { padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.is-client .chat-bubble { background: var(--surface); border: 1.5px solid var(--line-2); color: var(--ink); border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(11, 23, 54, .05); }
.chat-msg.is-us .chat-bubble { background: var(--accent); color: #fff; border: 1.5px solid var(--accent-hover); border-bottom-right-radius: 4px; box-shadow: 0 1px 2px rgba(11, 23, 54, .08); }
.chat-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; padding: 0 4px; }
.chat-empty { text-align: center; color: var(--ink-3); padding: 40px 12px; border: 1px dashed var(--line-2); border-radius: 12px; }
@media (max-width: 700px) { .chat-msg { max-width: 92%; } }

/* Chat window frame + message box */
.chat-window { border: 1.5px solid var(--line-2); border-radius: 18px; background: var(--surface-2); overflow: hidden; display: flex; flex-direction: column; }
.chat-composer-wrap { border-top: 1px solid var(--line); background: var(--surface); padding: 10px 12px 8px; }
.chat-composer { display: flex; align-items: flex-end; gap: 8px; }
.chat-input { flex: 1; resize: none; min-height: 42px; max-height: 140px; padding: 10px 14px; border-radius: 21px; border: 1.5px solid var(--line-2); background: var(--surface-2); font-size: 14px; line-height: 1.4; overflow-y: auto; }
.chat-input:focus { border-color: var(--accent); background: var(--surface); outline: 2px solid var(--accent-soft); outline-offset: 0; }
.chat-send { border-radius: 21px; min-height: 42px; padding: 0 18px; }
.chat-hint { font-size: 11.5px; color: var(--ink-3); margin: 6px 6px 0; }
.chat-status { font-size: 12px; color: var(--ink-2); margin: 2px 6px 0; min-height: 0; }
.chat-status:empty { display: none; }
.chat-tag { margin-left: 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 1px 6px; }
.chat-empty { margin: 30px 10px; }

/* ---------- Inbox: client list + shared chat window */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.inbox-side { padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: calc(100vh - 150px); }
.inbox-tools { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.inbox-search { width: 100%; border-radius: 20px; padding: 8px 14px; }
.inbox-tools-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.inbox-owner { min-height: 30px; font-size: 13px; padding: 4px 8px; max-width: 160px; }
.inbox-list { overflow-y: auto; }
.inbox-items { list-style: none; margin: 0; padding: 4px; }
.inbox-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px; color: var(--ink); position: relative; }
.inbox-item:hover { background: var(--hover); text-decoration: none; }
.inbox-item.active { background: var(--accent-soft); }
.inbox-avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--chip); color: var(--ink-2); }
.inbox-item.needs-answer .inbox-avatar { background: var(--accent); color: #fff; }
.inbox-item-main { flex: 1; min-width: 0; }
.inbox-item-top { display: flex; justify-content: space-between; gap: 8px; }
.inbox-item-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item.needs-answer .inbox-item-top strong { font-weight: 800; }
.inbox-time { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.inbox-company { font-size: 12.5px; color: var(--ink-3); }
.inbox-preview { font-size: 13px; color: var(--ink-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-dot { position: absolute; right: 10px; bottom: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.inbox-more { padding: 8px 12px; }
.inbox-pane .chat-card { margin-bottom: 0; }
.inbox-pane .chat-thread { max-height: calc(100vh - 360px); min-height: 300px; }
.inbox-chat-title { display: flex; align-items: center; gap: 8px; }
.inbox-chat-title h2 { margin: 0; }
.inbox-back { display: none; font-size: 20px; padding: 0 10px; }
.inbox-placeholder { min-height: 300px; display: grid; place-items: center; }
@media (max-width: 860px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox.has-selection .inbox-side { display: none; }
  .inbox:not(.has-selection) .inbox-pane { display: none; }
  .inbox-side { max-height: none; }
  .inbox-back { display: inline-flex; }
}

/* ---------- Calendar: name of the month on screen */
.cal-period { margin: 0 8px; font-size: 20px; font-weight: 700; white-space: nowrap; text-transform: capitalize; }

/* ---------- Sidebar: Falom logo (from falom.ca) */
.brand-logo { width: 30px; height: 30px; object-fit: contain; flex: none; }

/* ---------- Dashboard: two sections (due today, late) */
.dash-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .dash-sections { grid-template-columns: 1fr; } }

/* ---------- Notes: @mentions */
.mention-wrap { position: relative; }
.mention-wrap textarea { width: 100%; }
.mention-pop { position: absolute; left: 12px; right: 12px; top: 100%; z-index: 20; list-style: none; margin: 4px 0 0; padding: 4px; max-height: 240px; overflow-y: auto;
  background: var(--card, #fff); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(5, 13, 34, .18); }
.mention-opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.mention-opt.active, .mention-opt:hover { background: var(--accent-soft); }
.mention-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; min-height: 4px; }
.mention-chips .chip { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.mention { color: var(--accent); font-weight: 600; background: var(--accent-soft); border-radius: 4px; padding: 0 3px; }

/* ---------- Team: access rights */
.access-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.access-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.access-box h3 { margin: 0 0 6px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.access-box ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.role-select { min-height: 30px; padding: 2px 8px; font-size: 13px; }
.invite-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.invite-row:last-child { border-bottom: 0; }
.invite-who { flex: 1; min-width: 220px; }
.invite-who .small { display: block; }
.invite-actions { display: flex; gap: 6px; }
.email-log details summary { cursor: pointer; }
.email-log pre { white-space: pre-wrap; font-size: 13px; background: var(--hover); padding: 10px; border-radius: 8px; }
@media (max-width: 860px) { .access-grid { grid-template-columns: 1fr; } }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.mention-opt.mention-all { border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; margin-bottom: 2px; }

/* ---------- Calendar on phones: the date row wraps instead of widening the page */
@media (max-width: 560px) {
  .cal-nav { flex-wrap: wrap; row-gap: 8px; }
  .cal-period { font-size: 17px; margin: 0 4px; }
  #cal-date { flex: 1 1 100%; }
}
