/* Wabanaki dashboard. Forest green background, white cards, deep orange accent. */

:root {
  --bg: #1f3d2a;
  --on-bg: #f1f5ef;
  --on-bg-muted: #b5c7b8;
  --on-bg-accent: #ffb07a;
  --on-bg-line: rgba(255, 255, 255, 0.16);
  --surface: #ffffff;
  --surface-2: #f6f8f5;
  --ink: #17251b;
  --ink-2: #3a4a3e;
  --muted: #69786c;
  --line: #e0e6df;
  --line-2: #edf1ec;
  --brand: #142b1d;
  --brand-2: #1c3826;
  --accent: #b8420a;
  --accent-hover: #9c3707;
  --accent-soft: #fbe3d3;
  --ok: #2f7d4f;
  --ok-soft: #e3f2e8;
  --warn: #9a5a00;
  --warn-soft: #fdf0d8;
  --danger: #b3261e;
  --danger-soft: #fbe4e2;
  --info: #2a5d8f;
  --info-soft: #e4eef8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 36, 51, 0.05), 0 6px 18px rgba(20, 36, 51, 0.05);
  --focus: 0 0 0 3px rgba(184, 66, 10, 0.3);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #142a1c;
    --on-bg: #e9f0ea;
    --on-bg-muted: #9fb3a3;
    --on-bg-accent: #f59a62;
    --on-bg-line: rgba(255, 255, 255, 0.12);
    --surface: #1a2e21;
    --surface-2: #1f3627;
    --ink: #e8efe9;
    --ink-2: #c2cfc5;
    --muted: #8fa394;
    --line: #2b4232;
    --line-2: #233a2b;
    --brand: #0c1c12;
    --brand-2: #12271a;
    --accent: #d4560f;
    --accent-hover: #e2671f;
    --accent-soft: #3d2212;
    --ok: #6cc28f;
    --ok-soft: #173326;
    --warn: #e8b35c;
    --warn-soft: #362a14;
    --danger: #f1867d;
    --danger-soft: #3b1d1b;
    --info: #8db8e3;
    --info-soft: #172a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:not(.btn):not(.kpi):not(.card):hover { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
code { font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pre { white-space: pre-line; }
.accent { color: var(--accent); }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }
[hidden] { display: none !important; }

.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }


/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
  padding: 20px 14px;
  background: var(--brand); color: #dfe9e1;
  border-right: 1px solid var(--on-bg-line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px; text-decoration: none; color: #fff; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 16px; letter-spacing: 0.01em; }
.brand small { font-size: 11.5px; color: #a9c2ae; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: #c9d8cc; text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff !important; }
.nav a.active { background: rgba(255, 255, 255, 0.1); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav .icon { width: 18px; height: 18px; }
.sidebar-foot { margin-top: auto; }

main { padding: 28px 36px 64px; max-width: 1240px; width: 100%; transition: opacity 0.15s; }
main.is-loading { opacity: 0.85; }
main:focus { outline: none; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- page header ---------- */

/* Text that sits directly on the green background */
.crumbs { font-size: 13px; color: var(--on-bg-muted); margin-bottom: 6px; }
.crumbs a { text-decoration: none; color: var(--on-bg-muted); }
.crumbs a:hover { color: var(--on-bg) !important; }
.crumbs span { margin: 0 4px; opacity: 0.6; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; color: var(--on-bg); }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--on-bg-accent); text-transform: uppercase; letter-spacing: 0.06em; }
.sub { margin: 4px 0 0; color: var(--on-bg-muted); }
.sub a { color: var(--on-bg); }
.sub a:hover { color: var(--on-bg-accent) !important; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions select { width: auto; max-width: 240px; }
.description { margin: -8px 0 20px; color: var(--on-bg-muted); max-width: 70ch; white-space: pre-line; }
main > .btn.ghost, .editor-actions .btn.ghost, .settings > .editor-actions .btn.ghost { color: var(--on-bg); }
.editor-actions .btn.ghost:hover { background: rgba(255, 255, 255, 0.08); }

/* ---------- buttons and inputs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 550; font-size: 14px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, .icon-btn:focus-visible, .link:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn.primary, .btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, .btn.accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; gap: 5px; }
.btn.small .icon { width: 14px; height: 14px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 28px; height: 28px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--danger); }
.link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link.danger { color: var(--danger); }

input, select, textarea {
  width: 100%; min-width: 0;
  padding: 8px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14.5px;
}
input, select { height: 38px; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[type='checkbox'] { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
input[readonly] { background: var(--surface-2); }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label .opt { font-weight: 400; color: var(--muted); }
.check-line, .check-inline { flex-direction: row; align-items: center; gap: 9px; font-weight: 500; font-size: 14px; }
.field-hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 18px; margin-bottom: 16px; }
.grid-fields:last-child { margin-bottom: 0; }

/* ---------- cards and layout ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card, .settings .card + .card { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head a { text-decoration: none; color: var(--muted); }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 13px; }
.card-foot a { color: var(--muted); text-decoration: none; }
.empty { padding: 22px 8px; text-align: center; color: var(--muted); }
.card.empty { padding: 40px 20px; }
.card.empty h2 { margin-bottom: 8px; color: var(--ink); }

.layout-today { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.layout-invoice { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.layout-2 > .card + .card, .layout-today > .card + .card { margin-top: 0; }

/* ---------- KPIs ---------- */

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi {
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  text-decoration: none; transition: border-color 0.12s, transform 0.12s;
}
.kpi:hover { border-color: var(--accent); }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 25px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 13px; color: var(--muted); }
.kpi.danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: linear-gradient(0deg, var(--danger-soft), var(--surface) 70%); }
.kpi.danger .kpi-value { color: var(--danger); }
.kpi.good .kpi-value { color: var(--ok); }

/* ---------- tabs, badges, chips ---------- */

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--on-bg-line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; text-decoration: none; color: var(--on-bg-muted); font-weight: 550; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--on-bg) !important; }
.tabs a.active { color: var(--on-bg); border-bottom-color: var(--on-bg-accent); }
.tabs .tab-end { margin-left: auto; }

.badge, .pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 650; letter-spacing: 0.02em; white-space: nowrap; vertical-align: middle;
}
h1 .badge { height: 26px; font-size: 13px; }
.badge.draft { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.sent { background: var(--info-soft); color: var(--info); }
.badge.overdue { background: var(--danger-soft); color: var(--danger); }
.badge.paid { background: var(--ok-soft); color: var(--ok); }
.badge.void { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.pill.active { background: var(--ok-soft); color: var(--ok); }
.pill.on_hold { background: var(--warn-soft); color: var(--warn); }
.pill.completed { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip {
  display: inline-flex; align-items: center; max-width: 180px; height: 22px; padding: 0 8px;
  border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-2);
  font-size: 12px; color: var(--ink-2); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.due { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-weight: 550; }
.due.today { color: var(--accent); }
.due.late { color: var(--danger); }
.flag { font-size: 11px; font-weight: 700; color: var(--danger); text-transform: uppercase; letter-spacing: 0.05em; }
.tag { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 11.5px; color: var(--info); }
.tag .icon { width: 12px; height: 12px; }

/* ---------- tasks ---------- */

.quick-add { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.quick-add input[name='title'], .quick-add input[name='description'], .quick-add input[name='to'] { flex: 1 1 220px; }
.quick-add select { flex: 0 1 200px; }
.quick-add input[type='date'] { flex: 0 0 150px; }
.quick-add input[type='number'] { flex: 0 0 110px; }

.group-label {
  display: flex; align-items: center; gap: 8px; margin: 16px 0 4px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.group-label span { font-weight: 600; opacity: 0.7; }
.group-label.late { color: var(--danger); }
.group-label.today { color: var(--accent); }
.group-label .icon { width: 14px; height: 14px; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex; align-items: center; gap: 10px; padding: 7px 4px;
  border-bottom: 1px solid var(--line-2); transition: opacity 0.2s;
}
.task:last-child { border-bottom: 0; }
.task.prio-2 { box-shadow: inset 3px 0 0 var(--danger); padding-left: 10px; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.task.done { opacity: 0.7; }
.task-title {
  flex: 1; min-width: 0; padding: 2px 0; border: 0; background: none; text-align: left;
  font: inherit; color: var(--ink); cursor: pointer;
}
.task-title small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-title:hover { color: var(--accent); }
.task-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.check { position: relative; display: block; width: 20px; height: 20px; flex: none; cursor: pointer; }
.check input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.check span {
  display: block; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--surface); transition: all 0.15s;
}
.check:hover span { border-color: var(--accent); }
.check input:focus-visible + span { box-shadow: var(--focus); }
.check input:checked + span {
  border-color: var(--ok); background: var(--ok)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}
.done-tasks { margin-top: 14px; }
.done-tasks summary { cursor: pointer; color: var(--muted); font-size: 13px; }

/* ---------- invoice + project lists on Today ---------- */

.inv-list, .proj-list, .mini-list, .time-list { list-style: none; margin: 0; padding: 0; }
.inv-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.inv-row:last-child { border-bottom: 0; }
.inv-row.overdue { box-shadow: inset 3px 0 0 var(--danger); padding-left: 10px; }
.inv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; }
.inv-main span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-amt { display: flex; flex-direction: column; align-items: flex-end; font-weight: 650; font-variant-numeric: tabular-nums; }
.inv-amt small { font-weight: 500; color: var(--muted); font-size: 12px; }
.inv-row.overdue .inv-amt small { color: var(--danger); }
.inv-actions { display: flex; gap: 6px; }
.proj-list li a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); text-decoration: none; }
.proj-list li:last-child a { border-bottom: 0; }
.proj-name { display: flex; flex-direction: column; min-width: 0; }
.proj-name small { color: var(--muted); font-size: 13px; }
.proj-stats { display: flex; gap: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; justify-content: flex-end; }
.mini-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.mini-list li:last-child { border-bottom: 0; }

/* ---------- projects ---------- */

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.project-grid .card + .card { margin-top: 0; }
.project-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; transition: border-color 0.12s; }
.project-card:hover { border-color: var(--accent); }
.project-card h3 { font-size: 16px; margin-top: 8px; }
.project-card p { margin: 0; font-size: 13.5px; }
.pc-top { display: flex; justify-content: space-between; align-items: center; }
.pc-stats { display: flex; gap: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pc-stats b { color: var(--ink); }

.time-form { display: grid; grid-template-columns: minmax(0, 1fr) 96px auto auto; gap: 8px; align-items: center; margin-bottom: 12px; }
.time-form input[name='description'] { grid-column: 1 / -1; order: 5; }
.time-list li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto 64px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.time-list li:last-child { border-bottom: 0; }
.time-list li.billed { color: var(--muted); }
.te-date { color: var(--muted); font-size: 13px; }
.te-hours { font-weight: 650; font-variant-numeric: tabular-nums; }
.time-list .chip, .time-list .icon-btn { justify-self: end; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table a { text-decoration: none; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn + .btn { margin-left: 4px; }

/* ---------- invoice view ---------- */

.paper { padding: 28px; }
.paper-top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.label { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.paper-meta { display: grid; grid-template-columns: auto auto; gap: 4px 16px; margin: 0; font-size: 14px; }
.paper-meta dt { color: var(--muted); text-align: right; }
.paper-meta dd { margin: 0; font-weight: 600; text-align: right; }
.paper-meta dd.big { font-size: 20px; }
.items-view td { vertical-align: top; }
.totals { display: flex; flex-direction: column; gap: 6px; margin-left: auto; max-width: 320px; margin-top: 14px; font-variant-numeric: tabular-nums; }
.totals > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); }
.totals > div span:last-child { color: var(--ink); }
.totals .grand { border-top: 2px solid var(--ink); padding-top: 8px; margin-top: 4px; font-size: 18px; font-weight: 700; color: var(--ink); }
.paper-notes { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.paper-notes p { margin: 0; }
.copy-field { display: flex; gap: 6px; }
.copy-field input { font-size: 13px; height: 32px; }
.link-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 14px; }
.link-row a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-2); }
.recurring { background: linear-gradient(0deg, var(--accent-soft), var(--surface) 80%); }
.recurring p { margin: 0; font-size: 14px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 4px; font-size: 13.5px; }
.timeline li::before { content: ''; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.timeline li.good::before { border-color: var(--ok); background: var(--ok); }
.timeline li.failed { color: var(--danger); }
.timeline li.failed::before { border-color: var(--danger); }
.timeline li span { display: block; overflow-wrap: anywhere; }
.timeline time { color: var(--muted); font-size: 12.5px; }
.subtle-actions { display: flex; gap: 18px; padding: 14px 20px; font-size: 14px; }

/* ---------- invoice editor ---------- */

.editor .card + .card { margin-top: 16px; }
.items-edit { width: 100%; border-collapse: collapse; }
.items-edit th { text-align: left; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 0 6px 8px; }
.items-edit td { padding: 6px; vertical-align: top; }
.items-edit .qty { width: 110px; }
.items-edit .rate { width: 130px; }
.items-edit .amt { width: 120px; }
.items-edit .x { width: 36px; }
.items-edit textarea { min-height: 38px; overflow: hidden; resize: none; }
.items-edit input { text-align: right; }
.line-amt { padding-top: 15px !important; font-weight: 600; }
.desc-cell { min-width: 220px; }
.item-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.small-select { width: auto; height: 30px; padding: 0 8px; font-size: 13px; }
.editor-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.editor-notes { display: flex; flex-direction: column; gap: 12px; }
.recur-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor-totals { margin-top: 0; max-width: none; }
.inline-field input { width: 110px; height: 32px; text-align: right; }
.inline-field span { display: flex; align-items: center; gap: 6px; }
.inline-field .tax-name { width: 70px; text-align: left; }
.editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- sections and payment split ---------- */

.items-view .section-row td { padding-top: 16px; font-weight: 700; font-size: 15px; border-bottom: 0; }
.items-view tbody tr:first-child.section-row td { padding-top: 8px; }
.items-edit .section-row td { padding-top: 14px; }
.items-edit .section-input { font-weight: 700; font-size: 15px; background: var(--surface-2); text-align: left; }
.totals .split { font-size: 13.5px; }
.split-preview { margin: 2px 0 0; text-align: right; }
.inline-field .pct input { width: 72px; }
.code-preview { align-self: end; padding-bottom: 10px; margin: 0; }
.colors input[type='color'] { padding: 3px; height: 40px; cursor: pointer; }
.form-foot { display: flex; justify-content: flex-end; margin-top: 14px; }
.layout-2.flush { margin-top: 0; }
.saved-items { margin-top: 16px; }
.tabs .icon { width: 15px; height: 15px; }

/* ---------- monthly billing ---------- */

.billing-strip {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); text-decoration: none; font-size: 14px;
}
.billing-strip:hover { outline: 1px solid var(--accent); }
.plans-table tr.paused td { opacity: 0.6; }
.plans-table .num .muted.small { margin-left: 2px; }
.pill.freq { background: var(--info-soft); color: var(--info); }
.pill.freq.semiannual { background: var(--warn-soft); color: var(--warn); }
.pill.freq.yearly { background: var(--ok-soft); color: var(--ok); }
.bulk-table .freq { width: 200px; }
.stack.spaced { margin-top: 16px; }
.billing-day { max-width: 560px; }
.billing-day input[name='billing_day'] { max-width: 120px; }
.bulk-table { width: 100%; border-collapse: collapse; }
.bulk-table th { text-align: left; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 0 6px 8px; }
.bulk-table td { padding: 5px 6px; vertical-align: top; }
.bulk-table td:first-child { width: 34%; }
.bulk-table .amt { width: 120px; }
.bulk-table .x { width: 36px; }
.bulk-table input[name='amount'] { text-align: right; }
.new-client-fields { display: grid; gap: 6px; margin-top: 6px; }
.bulk-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.bulk-foot label { flex: 0 1 220px; }
.plan-lines-head, .plan-line { display: grid; grid-template-columns: minmax(0, 1fr) 80px 110px 28px; gap: 8px; align-items: center; }
.plan-lines-head { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.plan-lines { display: flex; flex-direction: column; gap: 6px; }
.plan-line input[type='number'] { text-align: right; }
.notice + .card { margin-top: 16px; }
.kpis + .notice { margin-bottom: 16px; }

/* ---------- hosting ---------- */

.hosting-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hosting-mini div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.hosting-mini span { font-size: 12.5px; color: var(--muted); }
.hosting-mini b { font-size: 18px; font-variant-numeric: tabular-nums; }
.hosting-mini + p { margin: 10px 0 0; }
.hosting-table select { min-width: 170px; height: 34px; padding: 4px 8px; font-size: 14px; }
.table tfoot td { border-top: 2px solid var(--line); padding-top: 10px; }
.good-text { color: var(--ok); }
.align-end { align-self: end; padding-bottom: 10px; }

/* ---------- settings ---------- */

.settings .card label + label, .settings .card .check-line { margin-top: 14px; }
.settings .card .grid-fields label { margin-top: 0; }
.settings .card .check-line:first-of-type { margin-top: 0; }
.details-list, .details dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 14px; }
.details-list dt, .details dt { color: var(--muted); }
.details-list dd, .details dd { margin: 0; overflow-wrap: anywhere; }
.notice { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 13.5px; margin: 0; }

/* ---------- modal ---------- */

dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: 14px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 60px rgba(10, 20, 30, 0.3);
}
dialog.wide { width: min(720px, calc(100vw - 32px)); }
dialog#confirm { width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 20, 30, 0.45); backdrop-filter: blur(2px); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-form header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 0; }
.modal-form h2 { font-size: 18px; }
.modal-body { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px; overflow-y: auto; }
.modal-body p { margin: 0; }
.modal-body .link { align-self: flex-start; font-size: 14px; }
.modal-form footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line-2); }
.modal-error { flex: 1; margin: 0; color: var(--danger); font-size: 13.5px; }

/* ---------- toasts ---------- */

#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  max-width: 380px; padding: 11px 16px; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(10, 20, 30, 0.25);
  animation: toast-in 0.2s ease-out; transition: opacity 0.4s, transform 0.4s;
}
.toast.error { background: var(--danger); }
.toast.warn { background: #8a5200; }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- login ---------- */

.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: radial-gradient(1200px 500px at 50% 110%, color-mix(in srgb, var(--accent) 22%, transparent), transparent), var(--brand); }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 32px; border-radius: 16px; background: var(--surface); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); }
.login-card h1 { font-size: 22px; }
.login-card p { margin: -8px 0 4px; }

.form-error { min-height: 1em; margin: 0; color: var(--danger); font-size: 13.5px; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .layout-invoice { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px;
  }
  .brand small, .sidebar-foot { display: none; }
  .brand { padding: 0; }

  .nav { flex-direction: row; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  .nav a { padding: 7px 10px; }
  .nav a span { font-size: 14px; }
  .nav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  main { padding: 20px 16px 48px; }
  .layout-today, .layout-2, .editor-bottom { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .brand b { font-size: 15px; }
  .nav a .icon { display: none; }
  .kpis, .kpis.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 20px; }
  .page-head { align-items: flex-start; }
  .actions .btn { flex: 1 1 auto; }
  .quick-add input[type='date'], .quick-add select { flex: 1 1 140px; }
  .inv-row { flex-wrap: wrap; }
  .inv-actions { width: 100%; justify-content: flex-end; }
  .recur-row { grid-template-columns: 1fr; }
  .task { flex-wrap: wrap; row-gap: 2px; }
  .task-meta { flex-basis: 100%; padding-left: 30px; flex-wrap: wrap; }
  .time-form { grid-template-columns: 1fr 1fr; }
  .items-edit thead { display: none; }
  .items-edit tr { display: grid; grid-template-columns: 1fr 1fr 36px; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .items-edit td { padding: 0; }
  .items-edit td.desc-cell { grid-column: 1 / -1; min-width: 0; }
  .items-edit td.line-amt { display: none; }
  .table-wrap { margin: 0; }
  .card { padding: 16px; }
  .paper { padding: 18px; }
  .row-actions .btn { padding: 0 8px; }
}
