/* =========================================================
   SolaraX CRM — app styles
   Clean admin look (Inter, white / slate, green accent) per client reference.
   tuned for dense, calm data screens. Light + dark themes.
   ========================================================= */
:root, [data-theme="light"] {
  --bg: #F9FAFB;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --surface-3: #F3F4F6;
  --ink: #111827;
  --text: #111827;
  --muted: #6B7280;
  --line: #E5E7EB;
  --line-2: #D1D5DB;
  --accent: #15803D;          /* green: bars, charts, highlights */
  --accent-soft: #DCFCE7;
  --volt: #DCFCE7;            /* legacy name used by highlights */
  --volt-ink: #166534;
  --primary: #111827;
  --primary-ink: #FFFFFF;
  --focus: #2563EB;
  --green: #15803D; --green-bg: #DCFCE7;
  --red: #DC2626;   --red-bg: #FEE2E2;
  --amber: #B45309; --amber-bg: #FEF3C7;
  --blue: #2563EB;  --blue-bg: #EFF6FF;
  --violet: #7C3AED; --violet-bg: #F5F3FF;
  --gray-bg: #F3F4F6;
  --shadow: 0 1px 2px rgba(16,24,40,.05);
  --shadow-lg: 0 20px 48px -16px rgba(16,24,40,.25);
  --r: 10px;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: var(--sans);
  --mono: var(--sans);
  --code: "SF Mono", Menlo, Consolas, monospace;
  --sb-w: 244px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0B1120;
  --surface: #111827;
  --surface-2: #0F172A;
  --surface-3: #1F2937;
  --ink: #F9FAFB;
  --text: #F3F4F6;
  --muted: #9CA3AF;
  --line: #1F2937;
  --line-2: #374151;
  --accent: #22C55E;
  --accent-soft: rgba(34,197,94,.15);
  --volt: rgba(34,197,94,.18);
  --volt-ink: #86EFAC;
  --primary: #F9FAFB;
  --primary-ink: #111827;
  --focus: #60A5FA;
  --green: #4ADE80; --green-bg: rgba(74,222,128,.12);
  --red: #F87171;   --red-bg: rgba(248,113,113,.12);
  --amber: #FBBF24; --amber-bg: rgba(251,191,36,.12);
  --blue: #60A5FA;  --blue-bg: rgba(96,165,250,.13);
  --violet: #A78BFA; --violet-bg: rgba(167,139,250,.13);
  --gray-bg: rgba(249,250,251,.06);
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 400 14.5px/1.5 var(--sans); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .02em; text-transform: uppercase; }
.ic { flex: none; }
[hidden] { display: none !important; }
.boot { height: 100vh; display: grid; place-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--text);
  font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn--primary:hover { background: var(--primary); filter: brightness(1.15); }
[data-theme="light"] .btn--primary:hover { background: #000; }
.btn--volt { background: var(--volt); color: var(--volt-ink); border-color: var(--volt); }
.btn--danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn--danger:hover { background: var(--red); filter: brightness(1.1); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn--block { width: 100%; height: 42px; font-size: 14px; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--primary-ink); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.more { width: 28px; height: 28px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 12.5px; }
.link-btn.danger { color: var(--red); }
.danger { color: var(--red); }

/* ---------- inputs ---------- */
.input {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236D695F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.input--sm { height: 30px; font-size: 12.5px; width: auto; min-width: 120px; }
.input--ro { display: flex; align-items: center; background: var(--surface-2); color: var(--muted); }
input[type="color"].input { padding: 3px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full, .fsection { grid-column: 1 / -1; }
.field > label { font-size: 12.5px; font-weight: 500; color: var(--text); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field small { color: var(--muted); font-size: 12px; }
.field .req { color: var(--red); font-style: normal; }
.field.bad .input, .field.bad .tagpick { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.field--check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.field--check input { width: 16px; height: 16px; accent-color: var(--ink); }
.fsection { font: 500 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--line); margin-top: 4px; }
.tagpick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); }
.chip-input { border: 1px dashed var(--line-2); border-radius: 999px; background: transparent; padding: 3px 10px; font: inherit; font-size: 12px; width: 90px; color: var(--text); }

/* ---------- chips, badges ---------- */
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); font-size: 12px; cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip--static { cursor: default; height: 22px; font-size: 11.5px; background: var(--surface-3); border-color: transparent; }
.chip--col { height: 22px; font-size: 11.5px; }
.chip--col.on { background: var(--surface-3); color: var(--text); border-color: var(--line-2); }
.chip--col:not(.on) { text-decoration: line-through; opacity: .6; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; text-transform: capitalize; }
.badge--green { background: var(--green-bg); color: var(--green); }
.badge--red { background: var(--red-bg); color: var(--red); }
.badge--amber { background: var(--amber-bg); color: var(--amber); }
.badge--blue { background: var(--blue-bg); color: var(--blue); }
.badge--gray { background: var(--gray-bg); color: var(--muted); }
.badge--volt { background: var(--green-bg); color: var(--green); }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text); font-weight: 600; flex: none; }
.avatar--sys { width: 26px; height: 26px; background: var(--volt); color: var(--volt-ink); }
.who { display: inline-flex; align-items: center; gap: 8px; }
.who small { display: block; color: var(--muted); font-size: 12px; }
.mention { color: var(--blue); font-weight: 600; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sb-w) 1fr; min-height: 100vh; transition: grid-template-columns .25s ease; }
.shell.collapsed { --sb-w: 64px; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface-2); border-right: 1px solid var(--line); overflow: hidden; }
.sb-brand { display: flex; align-items: center; gap: 10px; margin: 12px 10px 6px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; }
.sb-brand__mark { color: var(--ink); display: grid; }
.sb-brand__txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sb-brand__txt b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-brand__txt small { color: var(--muted); font-size: 11.5px; }
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 12px; scrollbar-width: thin; }
.sb-sec__h { font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 16px 10px 7px; white-space: nowrap; }
.sb-link { display: flex; align-items: center; gap: 11px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; font-size: 13.5px; text-align: left; white-space: nowrap; }
.sb-link:hover { background: var(--surface-3); }
.sb-brand { background: var(--surface); box-shadow: var(--shadow); }
.sb-link.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(16,24,40,.1), 0 0 0 1px var(--line); }
.sb-link.on .ic { color: var(--text); }
.sb-link .ic { color: var(--muted); }
.sb-link.on-parent { font-weight: 600; }
.sb-lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb-badge { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.sb-caret { display: grid; color: var(--muted); transition: transform .2s; }
.sb-group.open .sb-caret { transform: rotate(90deg); }
.sb-sub { display: none; margin: 2px 0 6px 20px; padding-left: 12px; border-left: 1px solid var(--line); }
.sb-group.open .sb-sub { display: block; }
.sb-sublink { display: block; padding: 6px 10px; border-radius: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.sb-sublink:hover { color: var(--text); background: var(--surface-3); }
.sb-sublink.on { color: var(--text); background: var(--surface); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.sb-foot { display: flex; justify-content: space-between; padding: 10px 18px; border-top: 1px solid var(--line); font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.collapsed .sb-brand__txt, .collapsed .sb-lbl, .collapsed .sb-caret, .collapsed .sb-sec__h, .collapsed .sb-sub, .collapsed .sb-foot, .collapsed .sb-badge { display: none; }
.collapsed .sb-brand { justify-content: center; padding: 9px 0; }
.collapsed .sb-link { justify-content: center; padding: 0; }
.collapsed .sb-sec { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }

.shell__main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 58px; padding: 0 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar__title { font: 600 20px/1 var(--serif); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__back { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); }
.topbar__back:hover { background: var(--surface-3); color: var(--text); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.userbtn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; margin-left: 6px; }
.userbtn__name { font-size: 13px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dotcount { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; }
.page { flex: 1; padding: 20px 22px 60px; outline: none; }
.page__inner { max-width: 1500px; margin: 0 auto; animation: pagein .35s cubic-bezier(.2,.8,.2,1); }
@keyframes pagein { from { opacity: 0; transform: translateY(6px); } }
.scrim { display: none; }
.only-mobile { display: none !important; }

/* ---------- menu / popovers ---------- */
.menu { position: fixed; z-index: 1000; min-width: 190px; max-width: 320px; padding: 5px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-lg); animation: pop .14s ease; }
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 9px; border: 0; border-radius: 7px; background: none; text-align: left; font-size: 13px; cursor: pointer; color: var(--text); }
.menu button:hover:not(:disabled) { background: var(--surface-3); }
.menu button:disabled { color: var(--muted); cursor: default; }
.menu button.danger { color: var(--red); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.bellpop { width: 360px; max-width: calc(100vw - 16px); padding: 0; }
.bellpop__head { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.bellpop__item { flex-direction: column; align-items: flex-start !important; gap: 2px !important; border-radius: 0 !important; padding: 10px 14px !important; border-bottom: 1px solid var(--line) !important; }
.bellpop__item.unread { background: color-mix(in srgb, var(--volt) 14%, transparent) !important; }
.bellpop__empty { padding: 24px 14px; text-align: center; }
.bellpop__all { display: block; padding: 10px; text-align: center; font-size: 13px; font-weight: 500; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 16px; background: rgba(15,15,13,.45); backdrop-filter: blur(3px); animation: fade .15s; }
.modal-back.out { animation: fade .15s reverse forwards; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(620px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal--wide { width: min(880px, 100%); }
.modal--sm { width: min(440px, 100%); }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.modal__head h3 { font: 600 18px/1.1 var(--serif); }
.modal__body { padding: 18px 20px; overflow-y: auto; }
.modal__body > p { margin-bottom: 10px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 9px; max-width: 380px; padding: 11px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 13px; animation: pop .2s ease; transition: opacity .3s, transform .3s; }
.toast--err { background: var(--red); color: #fff; }
.toast--info { background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-left: 4px solid var(--accent); }
.toast.out { opacity: 0; transform: translateX(20px); }

/* ---------- cards / panels / stats ---------- */
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.panel { margin-bottom: 16px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.panel__head h3 { font-size: 14.5px; font-weight: 600; }
.panel__title { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 10px; }
.panel__body { padding: 14px 16px; }
.panel__sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); text-align: left; min-width: 0; }
.stat--link { cursor: pointer; transition: transform .15s, border-color .15s; }
.stat--link:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: 0 6px 16px -8px rgba(16,24,40,.2); }
.stat__top { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); }
.stat__ic { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--blue-bg); color: var(--blue); }
.stat__ic.t-green { background: var(--green-bg); color: var(--green); }
.stat__ic.t-amber { background: var(--amber-bg); color: var(--amber); }
.stat__ic.t-violet { background: var(--violet-bg); color: var(--violet); }
.stat__ic.t-red { background: var(--red-bg); color: var(--red); }
.stat__val { font: 600 26px/1.1 var(--sans); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat__sub { font-size: 12px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid2 > .panel, .grid3 > .panel { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }
.section-title { font: 600 18px/1.2 var(--serif); margin: 22px 0 10px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h2 { font: 600 21px/1.1 var(--serif); }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 9px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: none; font-size: 13px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 500; }

/* ---------- charts ---------- */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar__top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar__track { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; color: var(--text); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend b { margin-left: auto; padding-left: 14px; font-weight: 500; }
.cols { display: flex; align-items: flex-end; gap: 6px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.col__bar { width: 100%; max-width: 38px; border-radius: 5px 5px 2px 2px; background: var(--accent); }
.col:hover .col__bar { background: var(--blue); }
.col__lbl { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- list screen ---------- */
.list__summary .stats { margin-bottom: 14px; }
.list__toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.list__search { position: relative; flex: 1 1 240px; max-width: 420px; }
.list__search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search { padding-left: 33px; }
.list__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 9px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: none; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.list__filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.filters__row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.custom-range { display: inline-flex; align-items: center; gap: 6px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chiprow__lbl { font-size: 12px; color: var(--muted); margin-right: 2px; }
.bulkbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 10px; background: var(--ink); color: var(--bg); border-radius: var(--r); font-size: 13px; }
.bulkbar span { margin-right: auto; font-weight: 500; }
.bulkbar .btn:not(.btn--danger) { background: transparent; color: var(--bg); border-color: rgba(255,255,255,.3); }
[data-theme="dark"] .bulkbar .btn:not(.btn--danger) { border-color: rgba(0,0,0,.3); }
.list__foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 2px; font-size: 13px; }
.pager { display: flex; align-items: center; gap: 6px; }
.pager__n { min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 12.5px; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th.asc::after { content: " ↑"; } .tbl th.desc::after { content: " ↓"; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .cb, .tbl .act { width: 40px; }
.tbl .act { text-align: right; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }
.tbl--sm td { padding: 6px 10px; }
.tbl tr.bad td { color: var(--red); }
.tbl input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--ink); }
.cell-main { font-weight: 500; }
.cell-sub { display: block; color: var(--muted); font-size: 12px; }
.cards { display: grid; gap: 12px; }
.cards--grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cards--list { grid-template-columns: 1fr; }
.rcard { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rcard.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.rcard.clickable:hover { border-color: var(--line-2); transform: translateY(-1px); }
.rcard__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; min-width: 0; }
.rcard__head > div { min-width: 0; }
.rcard__head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.kv span { display: inline-flex; align-items: center; gap: 5px; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kb-group { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.kb-col { background: var(--surface-3); border-radius: var(--r); padding: 8px; min-height: 280px; display: flex; flex-direction: column; transition: background .15s, outline .15s; }
.kb-col.over { outline: 2px dashed var(--ink); outline-offset: -2px; background: color-mix(in srgb, var(--volt) 20%, var(--surface-3)); }
.kb-col__head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 600; font-size: 13px; }
.kb-col__head b { font-weight: 500; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface); }
.kb-col__head small { margin-left: auto; font-weight: 400; }
.kb-col__body { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kb-card { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; cursor: grab; font-size: 13px; }
.kb-card.clickable { cursor: pointer; }
.kb-card[draggable="true"] { cursor: grab; }
.kb-card.drag { opacity: .45; }
.kb-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 12.5px; border: 1px dashed var(--line-2); border-radius: 9px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 56px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); }
.empty--sm { padding: 26px 10px; border: 0; background: none; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- calendar ---------- */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.cal__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.cal__head strong { font: 600 16px/1 var(--serif); }
.cal__nav { display: flex; align-items: center; gap: 4px; }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal__dow { padding: 8px; font: 500 11px/1 var(--mono); text-transform: uppercase; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.cal__day { min-height: 108px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal__day:nth-child(7n+7) { border-right: 0; }
.cal__day.out { background: var(--surface-2); }
.cal__day.out .cal__num { opacity: .4; }
.cal__num { font-size: 12px; font-weight: 500; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal__day.today .cal__num { background: var(--ink); color: var(--bg); }
.cal__items { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal__item { display: block; width: 100%; padding: 2px 6px; border: 0; border-left: 3px solid var(--c); border-radius: 4px; background: var(--surface-3); font-size: 11.5px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: var(--text); }
.cal__item:hover { background: color-mix(in srgb, var(--volt) 35%, var(--surface-3)); }
.cal__more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal--compact .cal__day { min-height: 54px; cursor: pointer; align-items: center; }
.cal--compact .cal__day.has { background: color-mix(in srgb, var(--volt) 22%, transparent); }
.cal__dot { font-size: 11px; font-weight: 600; }

/* ---------- record pages ---------- */
.rec { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.rec__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.rec__title { font: 600 26px/1.05 var(--serif); letter-spacing: -.01em; }
.rec__meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; color: var(--muted); font-size: 13px; }
.dgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.dgrid div.full { grid-column: 1 / -1; }
.dgrid dt, .info dt { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 5px; }
.dgrid dd, .info dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.info { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; margin: 0; }
.info dt { margin: 3px 0 0; }
.timeline { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.timeline--compact { margin-top: 0; gap: 10px; max-height: 480px; overflow-y: auto; }
.tl-item { display: flex; gap: 10px; }
.tl-meta { font-size: 12.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl-body { margin-top: 3px; font-size: 13.5px; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); margin: 6px 4px 0; flex: none; }
.diff { margin: 4px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.diff code { font-family: var(--code); font-size: 11.5px; color: var(--text); }
.diff s { opacity: .7; }
.note-add { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.files { display: flex; flex-direction: column; gap: 8px; }
.file { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.file .muted { margin-left: auto; font-size: 12px; }
.import-preview { margin-top: 10px; max-height: 300px; overflow: auto; }
.steps { margin: 0 0 12px; padding-left: 18px; color: var(--muted); }

/* ---------- misc widgets ---------- */
.avail-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.avail-ranges { display: flex; flex-direction: column; gap: 6px; }
.avail-range { display: flex; align-items: center; gap: 6px; }
.avail-range .input { width: 120px; }
.q-row { display: grid; grid-template-columns: 1fr 150px auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.linkbox { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font: 12.5px var(--mono); overflow-wrap: anywhere; }
.linkbox span { flex: 1; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: 0; margin-right: 6px; }
.et-card { border-top: 4px solid var(--c, var(--ink)); }
.notes-app { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 0; min-height: calc(100vh - 140px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.notes-tree { border-right: 1px solid var(--line); padding: 10px; overflow-y: auto; background: var(--surface-2); }
.notes-tree h4 { font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 14px 6px 6px; }
.nt-item { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.nt-item:hover { background: var(--surface-3); }
.nt-item.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.nt-item span.t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-item .icon-btn { width: 22px; height: 22px; opacity: 0; color: inherit; }
.nt-item:hover .icon-btn { opacity: .8; }
.nt-kids { margin-left: 14px; }
.notes-page { padding: 26px 40px; overflow-y: auto; }
.notes-title { width: 100%; border: 0; background: none; font: 600 29px/1.15 var(--serif); color: var(--text); padding: 0; margin: 6px 0 12px; }
.notes-title:focus { outline: none; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 12px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.rte-bar button { min-width: 30px; height: 28px; border: 0; border-radius: 6px; background: none; cursor: pointer; font-size: 13px; color: var(--text); }
.rte-bar button:hover { background: var(--surface-3); }
.rte { min-height: 380px; outline: none; font-size: 15px; line-height: 1.7; }
.rte:empty::before { content: attr(data-ph); color: var(--muted); }
.rte h1, .rte h2, .rte h3 { font-family: var(--serif); font-weight: 600; margin: .6em 0 .3em; }
.rte table { border-collapse: collapse; } .rte td, .rte th { border: 1px solid var(--line-2); padding: 6px 8px; }
.rte mark { background: var(--volt); color: var(--volt-ink); }
.rte img { max-width: 100%; }
.saved-label { font: 11.5px var(--mono); color: var(--muted); }
.inv-lines { width: 100%; border-collapse: collapse; }
.inv-lines th { font: 500 11px/1 var(--mono); text-transform: uppercase; color: var(--muted); text-align: left; padding: 6px 4px; }
.inv-lines td { padding: 4px; vertical-align: top; }
.inv-lines .input { height: 32px; }
.inv-totals { margin-left: auto; width: min(320px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 13.5px; }
.inv-totals b { font-size: 16px; }
.invoice-paper { background: #fff; color: #111827; padding: 40px; border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; }
.invoice-paper h2 { font: 600 32px/1 var(--serif); }
.invoice-paper table { width: 100%; border-collapse: collapse; margin: 22px 0; }
.invoice-paper th { text-align: left; font: 500 10.5px/1 var(--mono); text-transform: uppercase; color: #6B7280; padding: 8px 6px; border-bottom: 1.5px solid #111827; }
.invoice-paper td { padding: 9px 6px; border-bottom: 1px solid #E5E7EB; }
.invoice-paper .r { text-align: right; }
.ip-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.ip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; }
.ip-lbl { font: 500 10.5px/1 var(--mono); text-transform: uppercase; color: #6B7280; margin-bottom: 6px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.perm-col { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--surface); }
.perm-col h4 { margin-bottom: 8px; font-size: 14px; }
.perm-col label { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 13px; cursor: pointer; }
.perm-col input { accent-color: var(--ink); }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.progress i { display: block; height: 100%; background: var(--accent); }
.today-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.agenda { display: flex; flex-direction: column; }
.agenda__item { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.agenda__item:last-child { border-bottom: 0; }
.agenda__time { font: 500 12px var(--mono); }
.agenda__item:hover strong { text-decoration: underline; }

/* ---------- auth pages ---------- */
body.auth { background: var(--bg); }
.auth__split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth__brand { display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 40px 48px; background: #0F172A; color: #F9FAFB; position: relative; overflow: hidden; }
.auth__brand::after { content: ""; position: absolute; right: -160px; bottom: -160px; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgba(34,197,94,.35), transparent 65%); pointer-events: none; }
.auth__logo { display: inline-flex; align-items: center; gap: 10px; font: 500 18px var(--sans); color: #F9FAFB; }
.auth__logo i { color: #4ADE80; font-style: normal; }
.auth__brand h1 { font: 700 clamp(30px, 3.4vw, 44px)/1.1 var(--serif); letter-spacing: -.015em; max-width: 14ch; }
.auth__brand h1 em { color: #4ADE80; font-style: normal; }
.auth__brand p { color: #94A3B8; margin-top: 14px; max-width: 42ch; }
.auth__pills { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 560px; }
.auth__pills li { padding: 12px; border: 1px solid rgba(148,163,184,.25); border-radius: 10px; font-size: 12px; color: #94A3B8; }
.auth__pills b { display: block; color: #F9FAFB; font-weight: 500; margin-bottom: 3px; font-size: 13px; }
.auth__legal { color: #64748B; }
.auth__panel { display: grid; place-items: center; padding: 32px 20px; }
.auth__form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.auth__form h2 { font: 600 27px/1.05 var(--serif); }
.auth__form .input { height: 42px; font-size: 14px; }
.auth__link { font-size: 12.5px; color: var(--muted); font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.auth__alert { padding: 10px 12px; border-radius: 8px; background: var(--red-bg); color: var(--red); font-size: 13px; }
.auth__alert.ok { background: var(--green-bg); color: var(--green); }
.pw { position: relative; }
.pw .icon-btn { position: absolute; right: 5px; top: 5px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .rec { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; --sb-w: 270px; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 270px; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); }
  .collapsed .sb-brand__txt, .collapsed .sb-lbl, .collapsed .sb-caret, .collapsed .sb-sec__h, .collapsed .sb-foot { display: revert; }
  .only-desktop { display: none !important; }
  .only-mobile { display: inline-grid !important; }
  .userbtn__name { display: none; }
  .page { padding: 14px 16px 50px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr; }
  .dgrid { grid-template-columns: 1fr; }
  .info { grid-template-columns: 1fr; }
  .auth__split { grid-template-columns: 1fr; }
  .auth__brand { padding: 28px 22px; gap: 20px; }
  .auth__brand h1 { font-size: 34px; }
  .auth__pills { display: none; }
  .seg button span { display: none; }
  .list__actions { margin-left: 0; }
  .notes-app { grid-template-columns: 1fr; }
  .notes-tree { border-right: 0; border-bottom: 1px solid var(--line); max-height: 240px; }
  .notes-page { padding: 18px; }
  .cal__day { min-height: 70px; }
  .cal__item { font-size: 10px; padding: 1px 3px; }
  .avail-row { grid-template-columns: 1fr; }
  .q-row { grid-template-columns: 1fr 1fr; }
  .ip-grid { grid-template-columns: 1fr; }
  .invoice-paper { padding: 20px; }
  .topbar { padding: 0 10px; }
  .topbar__title { font-size: 21px; }
}
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; }
  body { background: #fff; }
  .invoice-paper { border: 0; box-shadow: none; padding: 0; }
  .rec { display: block; }
}
[data-motion="reduced"] *, [data-motion="reduced"] *::before, [data-motion="reduced"] *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
