/* ==========================================================
   Quarter · design system
   Ink + sand + burnt orange. Numbers are the hero.
   ========================================================== */
:root {
  --ink: #111922;
  --ink-2: #1B2632;
  --ink-3: #2A3846;
  --text: #17212B;
  --text-2: #4A5664;
  --text-3: #7C8692;
  --canvas: #F4F1EB;
  --card: #FFFFFF;
  --line: #E4DFD5;
  --line-2: #EFEBE4;
  --sand: #F8F4EC;
  --sand-2: #EFE7D8;
  --accent: #C2641C;
  --accent-2: #E38A3F;
  --accent-soft: #FBEADB;
  --money: #1E6B51;
  --money-soft: #E2F1EA;
  --warn: #B4321F;
  --warn-soft: #FAE4DF;
  --info: #2F5C8A;
  --info-soft: #E3ECF6;
  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 1px 2px rgba(17, 25, 34, .05), 0 6px 18px -8px rgba(17, 25, 34, .12);
  --shadow-lg: 0 24px 60px -18px rgba(17, 25, 34, .35);
  --side: 248px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
.num { direction: ltr; unicode-bidi: isolate; display: inline-block; }
td.num, th.num { display: table-cell; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.hide { display: none !important; }

/* ---------------- layout ---------------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  background: var(--ink);
  color: #C8D0D9;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 18px 14px;
  overflow: hidden;
}
.side::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 5px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 9px, var(--accent-2) 9px 18px);
}
.logo { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 6px, var(--accent-2) 6px 12px);
  position: relative;
}
.logo-mark::after {
  content: "Q"; position: absolute; inset: 5px; border-radius: 6px; background: var(--ink);
  color: #fff; font-weight: 700; font-size: 16px; display: grid; place-items: center; font-family: Georgia, serif;
}
.logo .t { color: #fff; font-weight: 700; font-size: 17px; line-height: 1.2; }
.logo .s { font-size: 11px; color: #8592A0; }
.nav-label { font-size: 11px; color: #6E7B89; padding: 14px 10px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px; margin-bottom: 2px;
  color: #BAC4CE; font-weight: 500; position: relative;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.on { background: var(--ink-3); color: #fff; }
.nav a.on::before {
  content: ""; position: absolute; right: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px 0 0 3px; background: var(--accent-2);
}
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav .badge {
  margin-inline-start: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px;
}
.side-foot { margin-top: auto; padding: 12px 8px 14px; font-size: 11.5px; color: #7D8996; }
.role {
  display: flex; background: var(--ink-2); border-radius: 10px; padding: 3px; margin-bottom: 10px;
}
.role button { flex: 1; padding: 6px 4px; border-radius: 8px; font-size: 12px; color: #9AA6B2; font-weight: 600; }
.role button.on { background: #fff; color: var(--ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  height: 64px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; border-bottom: 1px solid var(--line);
  background: rgba(244, 241, 235, .88); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.crumb { font-size: 12.5px; color: var(--text-3); }
.crumb b { color: var(--text); font-weight: 600; }
.search {
  margin-inline-start: auto; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 10px 7px 8px; min-width: 260px; color: var(--text-3); font-size: 13px;
}
.search kbd {
  margin-inline-start: auto; font-family: inherit; font-size: 11px; direction: ltr;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--sand);
}
.today { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.view { padding: 26px 28px 60px; max-width: 1320px; width: 100%; margin: 0 auto; animation: rise .28s ease-out; }
@keyframes rise { from { transform: translateY(6px); } to { transform: none; } }

/* ---------------- headings ---------------- */
.page-h { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-h .k { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .02em; margin-bottom: 2px; }
.page-h h1 { font-size: 26px; line-height: 1.3; font-weight: 700; }
.page-h p { color: var(--text-2); font-size: 13.5px; max-width: 640px; }
.page-h .act { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
h2.sec { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
h2.sec .muted { font-weight: 400; font-size: 12.5px; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; font-weight: 600; font-size: 13px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { border-color: #CFC8BB; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #AE5714; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--sand-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.danger { color: var(--warn); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------------- cards ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card.pad { padding: 18px 20px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { font-size: 14.5px; font-weight: 700; }
.card-h .r { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.mt { margin-top: 16px; }
.mt2 { margin-top: 26px; }

/* ---------------- KPI ---------------- */
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .l { font-size: 12.5px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 26px; font-weight: 700; line-height: 1.25; margin-top: 6px; direction: ltr; text-align: right; letter-spacing: -.01em; }
.kpi .v small { font-size: 12px; font-weight: 600; color: var(--text-3); margin-right: 4px; }
.kpi .f { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; }
.kpi.neg .v { color: var(--warn); }

/* hero */
.hero {
  background: var(--ink); color: #fff; border-radius: 18px; padding: 22px 24px; position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 26px;
}
.hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 9px, var(--accent-2) 9px 18px);
}
.hero .l { color: #9AA7B4; font-size: 12.5px; font-weight: 500; }
.hero .big { font-size: 40px; font-weight: 700; line-height: 1.15; direction: ltr; text-align: right; margin: 4px 0 2px; letter-spacing: -.02em; }
.hero .big small { font-size: 15px; color: #9AA7B4; margin-right: 6px; }
.hero .row { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.hero .row .v { font-size: 17px; font-weight: 700; direction: ltr; text-align: right; }
.hero .row .l2 { font-size: 11.5px; color: #8E9BA8; }
.hero .chip { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; background: rgba(255, 255, 255, .08); border-radius: 20px; padding: 3px 10px; color: #E4E9EE; }
.hero .chip.warn { background: rgba(227, 138, 63, .18); color: #F5C49B; }

/* week bars */
.week { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; height: 200px; }
.day { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-height: 0; }
.day .stack { flex: 1; min-height: 0; display: flex; flex-direction: column-reverse; gap: 2px; justify-content: flex-start; }
.day .cap { flex: none; }
.day .seg { border-radius: 4px; min-height: 3px; transition: opacity .15s; }
.day .seg:hover { opacity: .8; }
.day .cap { text-align: center; font-size: 11.5px; color: #9AA7B4; line-height: 1.3; }
.day .cap b { display: block; color: #fff; font-size: 13px; direction: ltr; }
.day.empty .stack::after { content: ""; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .12); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: #A7B3BF; margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-left: 5px; vertical-align: -1px; }

/* ---------------- tables ---------------- */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th {
  text-align: right; font-weight: 600; font-size: 11.5px; color: var(--text-3);
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--sand); white-space: nowrap;
}
.t td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .12s; }
.t tbody tr:hover { background: #FBF9F5; }
.t .n { text-align: left; direction: ltr; white-space: nowrap; }
.t tr.total td { background: var(--sand); font-weight: 700; border-top: 1px solid var(--line); }
.t tr.click { cursor: pointer; }
.t .pos { color: var(--money); }
.t .neg { color: var(--warn); }

/* tags */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 9px; border-radius: 20px; white-space: nowrap; line-height: 1.7; }
.tag.ok { background: var(--money-soft); color: var(--money); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.ask { background: var(--accent-soft); color: var(--accent); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.mute { background: var(--line-2); color: var(--text-2); }

/* ---------------- forms ---------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  height: 38px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; padding: 0 11px; outline: none;
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
textarea.input { height: 76px; padding: 8px 11px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194, 100, 28, .15); }
.input.ltr { direction: ltr; text-align: right; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.seg-ctl { display: inline-flex; background: var(--sand-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-ctl button { padding: 5px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.seg-ctl button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* ---------------- trips matrix ---------------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .sp { flex: 1; }
.weekpick { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.weekpick .lbl { padding: 0 10px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.weekpick button { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); }
.weekpick button:hover { background: var(--sand-2); }
.worktabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; scrollbar-width: thin; }
.wtab {
  flex: none; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 14px; text-align: right;
  min-width: 132px; transition: border-color .15s, background .15s;
}
.wtab .n1 { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.wtab .n2 { font-size: 11.5px; color: var(--text-3); direction: ltr; text-align: right; }
.wtab.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.wtab.on .n2 { color: #9AA7B4; }
.wtab .dotc { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-left: 6px; }

table.mx { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.mx th { position: sticky; top: 0; background: var(--sand); z-index: 1; font-weight: 600; font-size: 11.5px; color: var(--text-3); padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.mx th .d { display: block; color: var(--text); font-size: 12.5px; }
.mx th.on { background: var(--accent-soft); color: var(--accent); }
.mx td { border-bottom: 1px solid var(--line-2); padding: 4px 4px; text-align: center; }
.mx td.plate { text-align: right; padding-right: 16px; font-weight: 700; direction: ltr; white-space: nowrap; }
.mx td.plate .sub { display: block; font-weight: 400; font-size: 11px; color: var(--text-3); direction: rtl; }
.cell {
  width: 100%; min-width: 46px; height: 34px; border: 1px solid transparent; border-radius: 8px; text-align: center;
  background: transparent; outline: none; direction: ltr; font-weight: 600; transition: background .12s, border-color .12s;
}
.cell:hover { background: var(--sand); }
.cell:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194, 100, 28, .15); }
.cell.has { background: #FBF7F1; }
.cell.calc { color: var(--money); font-weight: 600; }
.cell.ded { color: var(--warn); }
.cell[readonly] { cursor: not-allowed; color: var(--text-2); }
.mx td.sum { font-weight: 700; direction: ltr; white-space: nowrap; padding: 0 10px; }
.mx td.money { color: var(--money); font-weight: 700; direction: ltr; white-space: nowrap; padding: 0 12px 0 16px; text-align: left; }
.mx tr.total td { background: var(--ink); color: #fff; font-weight: 700; border: 0; padding: 10px 6px; direction: ltr; }
.mx tr.total td:first-child { border-radius: 0 10px 10px 0; text-align: right; padding-right: 16px; direction: rtl; }
.mx tr.total td:last-child { border-radius: 10px 0 0 10px; color: #8FE0BF; }
.mx tr.addrow td { padding: 8px; text-align: right; }
.lock {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px;
  background: var(--info-soft); color: var(--info); font-size: 13px; margin-bottom: 12px; font-weight: 500;
}
.lock .btn { margin-inline-start: auto; }

/* ---------------- statement paper ---------------- */
.paper { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 34px 38px; max-width: 860px; margin: 0 auto; position: relative; }
.paper::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; border-radius: 6px 6px 0 0; background: repeating-linear-gradient(-45deg, var(--ink) 0 10px, var(--ink-3) 10px 20px); }
.paper .ph { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 16px; gap: 20px; }
.paper .co { display: flex; gap: 12px; align-items: center; }
.paper .co .logo-mark { width: 44px; height: 44px; }
.paper .co b { display: block; font-size: 16px; }
.paper .no { text-align: left; }
.paper .no .x { font-size: 30px; font-weight: 700; line-height: 1.1; direction: ltr; }
.paper .meta { display: flex; gap: 26px; font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; flex-wrap: wrap; }
.paper .meta b { color: var(--text); }
.paper table.t th { background: transparent; border-bottom: 1.5px solid var(--ink); color: var(--text-2); }
.paper .grand { display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 8px; margin-top: 12px; }
.paper .grand .v { font-size: 24px; font-weight: 700; direction: ltr; }
.paper .sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.paper .sign div { border-top: 1px solid var(--ink); padding-top: 6px; font-size: 12px; color: var(--text-2); }
.stamp {
  position: absolute; left: 40px; top: 120px; transform: rotate(-12deg);
  border: 2.5px solid var(--money); color: var(--money); border-radius: 10px; padding: 4px 14px; font-weight: 700; font-size: 15px; opacity: .85;
}
.stamp.draft { border-color: var(--accent); color: var(--accent); }

/* ---------------- project cards ---------------- */
.pcard { padding: 16px 18px; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; display: flex; flex-direction: column; gap: 10px; }
.pcard:hover { transform: translateY(-2px); border-color: #D5CDBF; box-shadow: 0 10px 24px -12px rgba(17, 25, 34, .25); }
.pcard .h { display: flex; align-items: center; gap: 8px; }
.pcard .h b { font-size: 15px; }
.pcard .bal { font-size: 22px; font-weight: 700; direction: ltr; text-align: right; }
.pcard .bal small { font-size: 11.5px; color: var(--text-3); margin-right: 3px; }
.bar { height: 7px; border-radius: 6px; background: var(--line-2); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.pcard .foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); }
.rules { display: flex; gap: 5px; flex-wrap: wrap; }

/* ledger */
.ledger td.run { font-weight: 700; }

/* ---------------- review list ---------------- */
.issue { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); align-items: start; }
.issue:last-child { border-bottom: 0; }
.issue .chk { width: 20px; height: 20px; border: 1.8px solid var(--text-3); border-radius: 6px; margin-top: 2px; display: grid; place-items: center; transition: all .15s; }
.issue.done .chk { background: var(--money); border-color: var(--money); }
.issue.done .chk::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.issue.done .tt { text-decoration: line-through; color: var(--text-3); }
.issue .tt { font-weight: 600; }
.issue .where { font-size: 12px; color: var(--text-3); }

/* ---------------- activity ---------------- */
.feed { list-style: none; }
.feed li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line-2); align-items: center; }
.feed li:last-child { border-bottom: 0; }
.feed .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }
.feed .ic svg { width: 16px; height: 16px; }
.feed .ic.in { background: var(--money-soft); color: var(--money); }
.feed .ic.out { background: var(--warn-soft); color: var(--warn); }
.feed .a { font-weight: 700; direction: ltr; white-space: nowrap; }
.feed .a.in { color: var(--money); }

/* ---------------- modal / palette / toast ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(17, 25, 34, .45); backdrop-filter: blur(3px); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { background: rgba(17, 25, 34, 0); } }
.modal { background: var(--card); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.97) translateY(6px); } }
.modal .mh { padding: 18px 22px 6px; display: flex; align-items: center; gap: 10px; }
.modal .mh h3 { font-size: 17px; }
.modal .mh .x { margin-inline-start: auto; }
.modal .mb { padding: 12px 22px 6px; }
.modal .mf { padding: 14px 22px 20px; display: flex; gap: 8px; justify-content: flex-start; }
.palette { width: min(600px, 100%); align-self: start; margin-top: 10vh; }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; height: 56px; font-size: 16px; padding: 0 20px; width: 100%; outline: none; background: transparent; }
.palette ul { list-style: none; max-height: 52vh; overflow: auto; padding: 6px; }
.palette li { padding: 9px 14px; border-radius: 10px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.palette li .g { margin-inline-start: auto; font-size: 11.5px; color: var(--text-3); }
.palette li.on { background: var(--sand-2); }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px;
  border-radius: 12px; font-weight: 500; z-index: 60; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; animation: toast .25s ease-out;
}
.toast i { width: 8px; height: 8px; border-radius: 50%; background: #8FE0BF; }
@keyframes toast { from { transform: translate(-50%, 10px); } }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty-state b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; background: var(--sand); border: 1px solid var(--line-2); color: var(--text-2); }
.note.warn { background: var(--warn-soft); border-color: #F2CFC7; color: #7E2416; }
.note.ask { background: var(--accent-soft); border-color: #F1D3B6; color: #7A3E0E; }
.note svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }

.mob-nav { display: none; }

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .hero { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 0 16px; height: 56px; }
  .search { min-width: 0; flex: 1; }
  .search kbd, .today { display: none; }
  .search span.lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .view { padding: 18px 16px 96px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .page-h h1 { font-size: 21px; }
  .page-h .act { margin-inline-start: 0; width: 100%; }
  .hero .big { font-size: 32px; }
  .paper { padding: 24px 18px; }
  .paper .sign { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .mob-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--ink); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .mob-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: #9AA7B4; padding: 5px 0; border-radius: 10px; }
  .mob-nav a.on { color: #fff; background: var(--ink-3); }
  .mob-nav svg { width: 20px; height: 20px; }
}
@media (max-width: 480px) {
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .v { font-size: 20px; }
  .kpi { padding: 13px 14px; }
}

/* ---------------- print ---------------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .side, .top, .mob-nav, .page-h .act, .no-print, .toast { display: none !important; }
  .shell { display: block; }
  .view { padding: 0; max-width: none; animation: none; }
  .paper { box-shadow: none; border: 0; padding: 0; max-width: none; }
  .paper::before { display: none; }
  .page-h { display: none; }
}
.lock svg, .note svg { width: 18px; height: 18px; flex: none; }
.small svg { width: 14px; height: 14px; vertical-align: -2px; }

/* ==========================================================
   v2 · simple screens
   ========================================================== */
.mb { margin-bottom: 14px; }
.lnk { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.pos { color: var(--money); }
.neg { color: var(--warn); }
.warn { color: var(--warn); }
.kpi { display: block; }
a.kpi:hover { border-color: #D5CDBF; }
.kpi .v.pos { color: var(--money); }
.kpi .v.neg { color: var(--warn); }
.kpi.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi.dark .l { color: #9AA7B4; }
.side .nav a span { flex: 1; }

/* onboarding */
.welcome { padding: 22px 24px; position: relative; overflow: hidden; }
.welcome::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: repeating-linear-gradient(-45deg, var(--accent) 0 9px, var(--accent-2) 9px 18px); }
.w-h { display: flex; gap: 20px; align-items: center; justify-content: space-between; }
.w-h .k { color: var(--accent); font-weight: 700; font-size: 12px; }
.w-h h2 { font-size: 22px; }
.w-h p { color: var(--text-2); font-size: 13.5px; max-width: 560px; }
.ring { --p: 0; width: 74px; height: 74px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--money) calc(var(--p) * 360deg), var(--line-2) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #fff; }
.ring b { position: relative; font-size: 16px; direction: ltr; }
.steps { list-style: none; margin-top: 16px; display: grid; gap: 8px; }
.steps a { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, background .15s; }
.steps a:hover { border-color: var(--accent); background: #FFFCF8; }
.steps .no { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.steps .no svg { width: 16px; height: 16px; }
.steps a > div { flex: 1; }
.steps b { display: block; }
.steps small { color: var(--text-3); font-size: 12.5px; }
.steps a > svg { color: var(--text-3); width: 18px; height: 18px; }
.steps li.ok a { background: var(--money-soft); border-color: transparent; }
.steps li.ok .no { background: var(--money); }
.steps li.ok b { color: var(--money); }
.demo-cta { margin-top: 14px; display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 14px; border-radius: 12px; background: var(--sand); border: 1px dashed #D7CCB8; flex-wrap: wrap; }
.demo-cta b { display: block; }
.demo-cta small { color: var(--text-3); }

/* quick actions */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.q { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 18px; border-radius: 16px; text-align: right; color: #fff; position: relative; overflow: hidden; min-height: 104px; transition: transform .12s, box-shadow .15s; }
.q:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -14px rgba(17,25,34,.5); }
.q svg { width: 24px; height: 24px; margin-bottom: auto; opacity: .9; }
.q b { font-size: 16px; margin-top: 10px; }
.q small { font-size: 12px; opacity: .8; }
.q1 { background: var(--accent); }
.q2 { background: var(--money); }
.q3 { background: var(--warn); }
.q4 { background: var(--ink); }

/* week bars (light) */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; height: 220px; padding: 16px 20px 14px; align-items: end; }
.bcol { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; height: 100%; gap: 4px; text-align: center; }
.bcol i { display: block; background: var(--sand-2); border-radius: 6px 6px 3px 3px; min-height: 3px; transition: background .15s; }
.bcol:hover i { background: #E3D4BB; }
.bcol.on i { background: var(--accent); }
.bv { font-size: 11.5px; font-weight: 700; direction: ltr; min-height: 16px; }
.bl { font-size: 11.5px; color: var(--text-3); line-height: 1.3; }
.bcol.on .bl { color: var(--accent); font-weight: 700; }

/* trips */
.daybar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.daybar .sp { flex: 1; }
.daypick { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 14px; }
.daypick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.daystat { display: flex; gap: 6px; }
.daystat span { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 5px 12px; font-weight: 700; direction: ltr; white-space: nowrap; }
.daystat small { color: var(--text-3); font-weight: 500; }
.mlabel { font-size: 16px; padding: 0 10px; }
.entry { padding: 16px 18px; border-width: 1.5px; }
.entry.editing { border-color: var(--accent); background: #FFFCF8; }
.entry-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.entry-h svg { width: 18px; height: 18px; color: var(--accent); }
.entry-h .muted { margin-inline-start: 6px; }
.entry-g { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) repeat(4, minmax(80px, .55fr)); gap: 10px 10px; }
.entry-g .grow { grid-column: span 4; }
.input.big { height: 44px; font-size: 18px; font-weight: 700; }
.entry-g .input.big { height: 38px; font-size: 16px; }
.entry-f { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.calc { flex: 1; display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.entry-f .btn { height: 42px; padding: 0 26px; font-size: 14px; }
.mdot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-left: 7px; }
.t td.acts { white-space: nowrap; text-align: left; width: 1%; }
.t td.acts .btn { padding: 0 7px; }
.lockic { color: var(--info); display: inline-grid; place-items: center; padding: 0 8px; cursor: help; }
.lockic svg { width: 16px; height: 16px; }
.t tr.sel td { background: var(--accent-soft); }
.t tfoot tr.total td { background: var(--ink); color: #fff; font-weight: 700; border: 0; }

/* accounts */
.seg-ctl.big { margin-top: -4px; }
.seg-ctl.big a { padding: 8px 18px; border-radius: 8px; font-weight: 600; color: var(--text-2); font-size: 13.5px; }
.seg-ctl.big a.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.toolbar.card { align-items: flex-end; }
.toolbar .kpi { padding: 0; }
.toolbar .kpi .v { font-size: 22px; margin-top: 0; }
.bigbtn { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.bigbtn svg { width: 22px; height: 22px; color: var(--accent); }

/* settings */
.logo-up { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-up img { width: 52px; height: 52px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.logo-up input[type=file] { display: none; }
.d-logo.sm { width: 52px; height: 52px; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 20px; box-shadow: inset 0 -8px 0 var(--accent); }

/* invoice line editor */
.t.lines td { padding: 6px 8px; }
.t.lines .input { height: 34px; }
.t.lines td:nth-child(3), .t.lines td:nth-child(4) { width: 120px; }
.t.lines td:nth-child(2) { width: 120px; }
.lines-f { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--text-2); }
.lines-f label { display: flex; align-items: center; gap: 6px; }
.lines-f label.grow { flex: 1; min-width: 220px; }
.input.xs { width: 64px; height: 32px; }

/* dialogs */
.modal.wide { width: min(720px, 100%); }
.m-err { margin-top: 12px; padding: 9px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 13px; }
.confirm-t { font-size: 14px; color: var(--text-2); line-height: 1.8; }
.btn.danger-fill { background: var(--warn); border-color: var(--warn); }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.kinds label { padding: 7px 14px; border: 1px solid var(--line); border-radius: 20px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); }
.kinds label.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.kinds input { display: none; }
.lbl2 { font-size: 12px; font-weight: 700; color: var(--text-2); margin: 4px 0 8px; }
.prices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; background: var(--sand); border-radius: 12px; padding: 10px; }
.prices.three { grid-template-columns: repeat(3, 1fr); }
.prices label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.prices small { color: var(--text-3); font-weight: 400; }
.toast span { flex: 1; }
.toast a { color: #F5C49B; font-weight: 700; }

@media (max-width: 1100px) {
  .entry-g { grid-template-columns: repeat(2, minmax(0, 1fr)) repeat(2, minmax(0, 1fr)); }
  .entry-g .grow { grid-column: 1 / -1; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .entry-g { grid-template-columns: 1fr 1fr; }
  .daystat { width: 100%; }
  .daystat span { flex: 1; text-align: center; }
  .sheet-wrap { padding: 10px; border-radius: 10px; }
  .doc-bar .t { display: none; }
  .w-h .ring { width: 60px; height: 60px; }
  .bars { gap: 4px; padding: 12px 10px; height: 180px; }
  .prices.three { grid-template-columns: 1fr 1fr 1fr; }
  .q { min-height: 92px; padding: 14px; }
  .t.lines td:nth-child(2) { display: none; }
}

/* ---------------- v3: two companies, yard, cheques ---------------- */
.co-switch { width: 100%; text-align: right; border-radius: 12px; margin-bottom: 4px; transition: background .15s; }
.co-switch:hover { background: var(--ink-2); }
.co-switch .s { display: flex; align-items: center; gap: 4px; }
.co-switch .s svg { width: 12px; height: 12px; }
.co-mark { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px;
  background: var(--ink-3); box-shadow: inset 0 -5px 0 var(--accent); }
.co-img { width: 38px; height: 38px; border-radius: 10px; object-fit: contain; background: #fff; flex: none; }
.co-chip { font-weight: 700; color: var(--accent); }
.co-chip:hover { text-decoration: underline; }

body.picking .side, body.picking .top, body.picking .mob-nav { display: none !important; }
body.picking .shell { display: block; }
body.picking .view { max-width: none; padding: 0; }
.picker { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ink);
  background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.025) 0 14px, transparent 14px 28px); }
.picker-in { width: min(760px, 100%); }
.picker-h { text-align: center; color: #fff; margin-bottom: 26px; }
.picker-h h1 { font-size: 30px; font-weight: 700; }
.picker-h p { color: #9AA7B4; margin-top: 6px; font-size: 14px; }
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pick { background: #fff; border-radius: 20px; padding: 30px 22px 22px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); }
.pick::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 7px; background: repeating-linear-gradient(-45deg, var(--c) 0 9px, var(--c2) 9px 18px); }
.pick:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -12px rgba(0,0,0,.6); }
.pick-mark { width: 92px; height: 92px; border-radius: 24px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 44px; font-weight: 700; box-shadow: inset 0 -12px 0 var(--c); margin-bottom: 6px; }
.pick img { width: 92px; height: 92px; object-fit: contain; margin-bottom: 6px; }
.pick b { font-size: 21px; }
.pick small { color: var(--text-3); font-size: 12.5px; }
.pick-go { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; background: var(--c); color: #fff; font-weight: 700; padding: 8px 20px; border-radius: 30px; font-size: 14px; }
.pick-go svg { width: 16px; height: 16px; }
@media (max-width: 600px) { .picks { grid-template-columns: 1fr; } .pick { padding: 24px 18px 18px; } .pick-mark { width: 70px; height: 70px; font-size: 34px; } }

.tk { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.tk-buy { background: var(--info-soft); color: var(--info); }
.tk-direct { background: var(--money-soft); color: var(--money); }
.tk-yard { background: var(--accent-soft); color: var(--accent); }
.tk-service { background: var(--line-2); color: var(--text-2); }

.chq-due { align-items: center; }
.chq-due:hover { filter: brightness(.98); }
tr.late td { background: #FFF6F3; }
.mix-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin-bottom: 8px; }

.su-h { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 10px; }
.su-h.pos { color: var(--money); } .su-h.neg { color: var(--warn); }
.su-g { border: 1px solid var(--line-2); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.su-t { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; background: var(--sand); font-weight: 700; font-size: 13px; }
.su-t b.pos { color: var(--money); } .su-t b.neg { color: var(--warn); }
.su-g ul { list-style: none; }
.su-g li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.seg-ctl.big { max-width: 100%; flex-wrap: wrap; }
@media (max-width: 600px) { .seg-ctl.big a { padding: 7px 11px; font-size: 12.5px; } }

/* ---------------- v4 · server: login, sync status, photos ---------------- */
.picker-in.narrow { width: min(400px, 100%); }
.login-mark { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 20px; background: #fff; color: var(--ink); display: grid; place-items: center; font-size: 36px; font-weight: 700; box-shadow: inset 0 -10px 0 #C2641C, 0 10px 30px -10px rgba(0,0,0,.5); }
.login-card { padding: 22px; }
.login-card .m-err { margin-top: 12px; }
.big-btn { width: 100%; justify-content: center; padding: 12px; font-size: 16px; }
.picker-who { margin-top: 22px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #C9D2DB; font-size: 14px; }
.picker-who svg { width: 16px; height: 16px; }
.picker-who .btn { color: #fff; border-color: rgba(255,255,255,.25); }
.boot { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 50vh; color: var(--text-3); }
.boot i, .att-add.loading::after { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; display: inline-block; }
.att-add.loading::after { content: ""; }
@keyframes spin { to { transform: rotate(360deg); } }

.sync-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 20px; background: var(--line-2); color: var(--text-2); white-space: nowrap; }
.sync-chip i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sync-chip.ok { background: var(--money-soft); color: var(--money); }
.sync-chip.busy { background: var(--info-soft); color: var(--info); }
.sync-chip.busy i { animation: pulse 1s ease-in-out infinite; }
.sync-chip.off, .sync-chip.err { background: #FDECE6; color: var(--warn); }
@keyframes pulse { 50% { opacity: .3; } }
#sync + .today { margin-inline-start: 12px; }
@media (max-width: 700px) { #sync + .today { display: none; } }

.att { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.att-i { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--sand); }
.att-i img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-pdf { display: grid; place-items: center; width: 100%; height: 100%; font-weight: 700; font-size: 13px; color: var(--warn); }
.att-x { position: absolute; top: 2px; inset-inline-end: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(17,25,34,.75); color: #fff; font-size: 14px; line-height: 20px; text-align: center; }
.att-add { cursor: pointer; }
.btn.clip svg { width: 15px; height: 15px; }
.btn.clip.has { color: var(--accent); }
.btn.clip span { font-size: 11.5px; font-weight: 700; margin-inline-start: 2px; }
