:root {
  color-scheme: light;
  --bg: #fbf7f9;
  --card: #ffffff;
  --ink: #2a1a24;
  --ink-2: #5f4a57;
  --muted: #7a6571;
  --line: #f0e3ea;
  --line-2: #e6d3dd;
  --primary: #c2185b;
  --primary-hover: #a3134c;
  --primary-soft: #fce7ef;
  --primary-ink: #9d174d;
  --lav: #8b7fd6;
  --lav-soft: #eeebfb;
  --lav-ink: #5b4fb0;
  --ok: #157a3d;
  --ok-soft: #e5f5ea;
  --warn: #9a4a07;
  --warn-soft: #fdf0e1;
  --danger: #c62828;
  --chart-profit: #c2185b;
  --chart-asst: #8b7fd6;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(80, 20, 50, .05), 0 6px 20px rgba(80, 20, 50, .06);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Playfair Display", Georgia, serif;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; scroll-padding-bottom: 96px; }
button, a, input, summary, .day { touch-action: manipulation; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.noscroll { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary-ink); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; }
.err { color: var(--danger); min-height: 1.2em; margin: 4px 0 0; font-size: 14px; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
.page { padding: calc(var(--safe-t)) 16px calc(var(--nav-h) + var(--safe-b) + 24px); max-width: 1180px; margin: 0 auto; }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  margin: 0 -16px; padding: calc(10px + var(--safe-t)) 16px 10px; margin-top: calc(-1 * var(--safe-t));
  background: rgba(251, 247, 249, .9); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.top h1 { font: 700 26px/1.2 var(--serif); margin: 0; flex: 1; letter-spacing: -.01em; }
.sync {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); font-size: 13px; color: var(--ink-2);
}
.sync .ic { width: 16px; height: 16px; }
.sync.ok .ic { color: var(--ok); }
.sync.offline { color: var(--warn); border-color: #f3d6b5; background: var(--warn-soft); }
.sync.error { color: var(--danger); border-color: #f2c2c2; background: #fdeeee; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.nav {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--nav-h) + var(--safe-b)); padding: 0 6px var(--safe-b);
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.brand, .nav-add { display: none; }
.nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 48px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; border-radius: 12px;
}
.nav-btn.on { color: var(--primary); }
.nav-btn .ic { width: 22px; height: 22px; }
.nav-fab {
  justify-self: center; width: 56px; height: 56px; margin-top: -22px; border: 0; border-radius: 50%;
  background: var(--primary); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(194, 24, 91, .35); transition: transform .15s ease, background .15s ease;
}
.nav-fab .ic { width: 26px; height: 26px; }
.nav-fab:active { transform: scale(.94); }

.logo {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, #e0457f, #b0124f 60%, #7c3aed); color: #fff;
  font: 700 15px/1 var(--serif); letter-spacing: .02em;
}
.logo.big { width: 64px; height: 64px; border-radius: 20px; font-size: 26px; }

@media (min-width: 900px) {
  .page { padding: 0 32px 48px 272px; max-width: none; }
  .page > * { max-width: 1100px; }
  .top { margin: 0 -32px 0 -32px; padding: 20px 32px 14px; }
  .nav {
    top: 0; right: auto; width: 240px; height: auto; display: flex; flex-direction: column; align-items: stretch;
    gap: 4px; padding: 20px 14px; border-top: 0; border-right: 1px solid var(--line); background: var(--card);
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
  .brand-name { font: 700 20px/1 var(--serif); }
  .nav-add { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 14px; }
  .nav-fab { display: none; }
  .nav-btn { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; font-size: 15px; color: var(--ink-2); }
  .nav-btn:hover { background: var(--bg); }
  .nav-btn.on { background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }
}

/* ---------- buttons, chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary, .nav-add { background: var(--primary); color: #fff; border: 0; border-radius: 12px; min-height: 44px; font-weight: 600; }
.btn.primary:hover, .nav-add:hover { background: var(--primary-hover); }
.btn.ghost { background: var(--card); border-color: var(--line-2); color: var(--ink); }
.btn.ghost:hover { border-color: var(--primary); }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary-ink); }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 20px; background: var(--bg); color: var(--ink-2); white-space: nowrap;
}
.chip .ic { width: 13px; height: 13px; }
.chip.solid { background: var(--primary); color: #fff; }
.chip.rose { background: var(--primary-soft); color: var(--primary-ink); }
.chip.lav { background: var(--lav-soft); color: var(--lav-ink); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.grey { background: #eee; color: #555; }
.btnchip { border: 1px solid var(--line-2); background: var(--card); min-height: 36px; padding: 4px 12px; font-size: 13px; }
.btnchip:hover { border-color: var(--primary); color: var(--primary-ink); }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: #f3e9ee; overflow-x: auto; max-width: 100%; }
.seg button {
  border: 0; background: transparent; min-height: 38px; padding: 6px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.seg button.on { background: var(--card); color: var(--primary-ink); font-weight: 600; box-shadow: 0 1px 3px rgba(80, 20, 50, .12); }
.seg.sm button { min-height: 36px; padding: 4px 12px; }

/* ---------- cards & KPIs ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 6px 0 16px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; min-width: 0; display: flex; flex-direction: column; }
.kpi .kl { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .kv { font-size: 22px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi .ks { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.hero { background: linear-gradient(140deg, #c2185b, #9d174d); color: #fff; }
.kpi.hero .kl, .kpi.hero .ks { color: rgba(255, 255, 255, .85); }
@media (max-width: 420px) {
  .kpis.three .kpi { padding: 10px; }
  .kpis.three .kv { font-size: 18px; }
  .kpis.three .ks { white-space: normal; }
}
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpis:not(.three) { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 44px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; color: var(--muted);
}
.search:focus-within { border-color: var(--primary); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); min-width: 0; }

.group { margin-top: 18px; }
.gh { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 2px 8px; font-size: 15px; font-weight: 700; }
.gh .muted { font-size: 13px; font-weight: 500; }
.cards { display: grid; gap: 8px; }
@media (min-width: 1100px) { .group .cards { grid-template-columns: 1fr 1fr; } }

.job {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 12px; text-align: left;
  border: 1px solid transparent; transition: border-color .15s ease, transform .1s ease;
}
.job:hover { border-color: var(--line-2); }
.job:active { transform: scale(.99); }
.job.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow); }
.job.soon { background: linear-gradient(90deg, #fff5f9, #fff 60%); border-color: #f6d3e1; }
.job.cancelled { opacity: .6; }
.job.cancelled .client { text-decoration: line-through; }
.dtile {
  flex: none; width: 58px; display: flex; flex-direction: column; align-items: center; padding: 6px 2px;
  border-radius: 12px; background: var(--bg); line-height: 1.15;
}
.job.today .dtile { background: var(--primary); color: #fff; }
.job.today .dtile small, .job.today .dtile span { color: rgba(255, 255, 255, .9); }
.job.soon .dtile { background: var(--primary-soft); }
.dtile b { font-size: 22px; font-weight: 700; }
.dtile span { font-size: 11px; color: var(--ink-2); font-weight: 500; }
.dtile small { font-size: 10px; color: var(--muted); margin-top: 2px; }
.jbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.jline { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.time { flex: none; font-weight: 700; color: var(--primary-ink); font-variant-numeric: tabular-nums; }
.client { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jsub { display: flex; gap: 4px; align-items: center; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jsub .ic { width: 13px; height: 13px; }
.jbody .chips { margin-top: 3px; }
.jprice { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 40px 16px; color: var(--muted); text-align: center; }
.empty .ic { width: 36px; height: 36px; color: var(--line-2); margin-bottom: 6px; }
.empty b { color: var(--ink); }

/* ---------- calendar ---------- */
.cal-wrap { display: grid; gap: 14px; }
@media (min-width: 1100px) { .cal-wrap { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .dayp { position: sticky; top: 80px; } }
.cal { padding: 12px 8px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-title { display: flex; flex-direction: column; align-items: center; }
.cal-title b { font: 700 20px/1.2 var(--serif); }
.cal-title span { font-size: 12px; color: var(--muted); }
.cal-sub { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 8px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.wk, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.wk span { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.wk span:last-child { color: var(--primary-ink); }
.day {
  position: relative; display: flex; flex-direction: column; align-items: stretch; min-height: 58px; padding: 4px 3px;
  border: 1px solid transparent; border-radius: 10px; background: #fdfafb; text-align: left; min-width: 0; overflow: hidden;
}
.day:hover { border-color: var(--line-2); }
.day .dn { font-size: 14px; font-weight: 600; line-height: 1.2; padding-left: 2px; }
.day .ln { position: absolute; top: 5px; right: 5px; font-size: 10px; color: var(--muted); line-height: 1.2; }
.day .ln.key { color: var(--warn); font-weight: 700; }
.day.sun .dn { color: var(--primary-ink); }
.day.out { background: transparent; }
.day.out .dn, .day.out .ln { opacity: .4; }
.day.today .dn { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border-radius: 50%; background: var(--primary); color: #fff; }
.day.sel { border-color: var(--primary); background: var(--primary-soft); }
.day.has { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.day.sel.has { box-shadow: none; background: var(--primary-soft); }
.pills { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; min-width: 0; }
.pill { display: block; height: 5px; border-radius: 3px; background: #f4c6d8; }
.pill span { display: none; }
.pill.rose { background: var(--primary); }
.pill.soft { background: #f19ebf; }
.pill.lav { background: var(--lav); }
.pill.x { background: #ccc; }
.more { font-size: 10px; color: var(--muted); line-height: 1; }
.count { display: none; }
@media (min-width: 700px) {
  .day { min-height: 92px; padding: 6px; }
  .pill { height: auto; padding: 1px 5px; border-radius: 5px; font-size: 11px; line-height: 16px; background: var(--primary-soft); color: var(--primary-ink); }
  .pill span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pill.rose { background: var(--primary); color: #fff; }
  .pill.soft { background: var(--primary-soft); }
  .pill.lav { background: var(--lav-soft); color: var(--lav-ink); }
  .pill.x { background: #eee; color: #777; text-decoration: line-through; }
}
.legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 8px 0; color: var(--ink-2); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: #ccc; }
.sw.rose, .sw.profit { background: var(--chart-profit); }
.sw.soft { background: #f19ebf; }
.sw.lav, .sw.asst { background: var(--chart-asst); }
.sw.key { background: var(--warn); border-radius: 50%; }
.dayp { display: grid; gap: 10px; }
.dayp-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 2px; }
.dayp-head > div { display: flex; flex-direction: column; }
.dayp-head .muted { font-size: 13px; }

/* ---------- stats ---------- */
.years { margin: 4px 0 12px; }
.note { margin: -4px 0 16px; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.chart-card, .card.set, .card:has(.tbl) { padding: 16px; margin-bottom: 16px; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.chart-head h2, .ch { margin: 0; font-size: 16px; font-weight: 700; }
.chart-head .legend { padding: 0; }
.chart { position: relative; margin-top: 8px; touch-action: pan-y; }
.chart svg { display: block; }
.chart .gl { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--line-2); stroke-width: 1; }
.chart .ylab { fill: var(--muted); font-size: 11px; text-anchor: end; }
.chart .xlab { fill: var(--ink-2); font-size: 11px; text-anchor: middle; }
.chart .vlab { fill: var(--ink); font-size: 12px; font-weight: 700; text-anchor: middle; }
.chart .profit { fill: var(--chart-profit); }
.chart .asst { fill: var(--chart-asst); }
.chart .hit { fill: transparent; }
.chart .hit.on { fill: rgba(194, 24, 91, .06); }
.tip[hidden] { display: none; }
.tip {
  position: absolute; top: 0; z-index: 2; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; min-width: 190px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); font-size: 13px; pointer-events: none;
}
.tip span { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip span b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin: 10px -16px -16px; padding: 0 16px 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th, .tbl td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); }
.tbl th:first-child, .tbl td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 600; }
.tbl tr.zero td { color: var(--muted); }
.tbl tfoot td { font-weight: 700; border-bottom: 0; }

/* ---------- settings ---------- */
.set p { margin: 8px 0; color: var(--ink-2); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- form sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(42, 26, 36, .38); animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; max-height: calc(100% - 24px - var(--safe-t));
  display: flex; flex-direction: column; background: var(--card); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(42, 26, 36, .2); transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.sheet.in { transform: none; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 600px; max-height: 88vh; border-radius: 20px;
    transform: translate(-50%, -46%); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
  .sheet.in { transform: translate(-50%, -50%); opacity: 1; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 20px; }
.sheet-head h2 { margin: 0; font: 700 21px/1.2 var(--serif); }
.sheet-body { overflow-y: auto; padding: 4px 20px 12px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-foot {
  display: flex; gap: 8px; align-items: center; padding: 12px 16px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line);
}
.fld { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; min-width: 0; }
.fld > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fld input, .fld textarea, .items input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px;
  background: #fff; font-size: 16px; outline: 0; -webkit-appearance: none; appearance: none;
}
.fld textarea { resize: vertical; min-height: 80px; }
.fld input:focus, .fld textarea:focus, .items input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(194, 24, 91, .12); }
.fld input[type="date"], .fld input[type="time"] { display: block; }
.prev { font-size: 13px; color: var(--ok); min-height: 0; }
.prev:empty, .ferr:empty { display: none; }
.prev.bad, .ferr { color: var(--danger); font-size: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2.tight { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0 10px; }
.hint { margin: -4px 0 4px; font-size: 13px; color: var(--muted); min-height: 1em; }
.hint b { color: var(--warn); }
.money { position: relative; display: flex; gap: 6px; }
.money input { flex: 1; font-variant-numeric: tabular-nums; }
.money .key { flex: none; width: 46px; min-height: 46px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); font-size: 20px; font-weight: 600; color: var(--ink-2); }
.money.computed input { background: var(--bg); color: var(--ink-2); }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 6px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--card); font-weight: 600; color: var(--ink-2); font-size: 14px;
}
.toggle .ic { width: 16px; height: 16px; }
.toggle.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); }
.toggle.on .ic { fill: currentColor; }
details { border-top: 1px solid var(--line); margin-top: 6px; }
summary {
  display: flex; align-items: center; min-height: 48px; font-weight: 600; color: var(--primary-ink); cursor: pointer; list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid; border-bottom: 2px solid; transform: rotate(45deg); transition: transform .15s ease; }
details[open] summary::after { transform: rotate(-135deg); }
.items { padding: 10px; border-radius: 14px; background: var(--bg); }
.items-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
/* Phone: name on its own line, then qty / price / total / remove. */
.irow { display: grid; grid-template-columns: 56px minmax(0, 1fr) 64px 36px; gap: 6px; align-items: center; margin-bottom: 10px; }
.irow .in-n { grid-column: 1 / -1; }
.irow.ihead { display: none; }
@media (min-width: 560px) {
  .irow { grid-template-columns: minmax(0, 1fr) 52px 84px 60px 36px; margin-bottom: 6px; }
  .irow .in-n { grid-column: auto; }
  .irow.ihead { display: grid; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
}
.items input { min-height: 40px; padding: 8px; border-radius: 10px; }
.items .in-q, .items .in-p { text-align: right; font-variant-numeric: tabular-nums; }
.itot { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.chips.add { margin-top: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--ink-2); }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.sum { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 4px; }
.sum div { display: flex; flex-direction: column; padding: 8px 12px; border-radius: 12px; background: var(--bg); }
.sum span { font-size: 12px; color: var(--muted); }
.sum b { font-variant-numeric: tabular-nums; }
.sum .hl { background: var(--primary-soft); }
.sum .hl b { color: var(--primary-ink); }
@media (min-width: 560px) { .sum { grid-template-columns: repeat(4, 1fr); } }

/* ---------- lock ---------- */
.lock { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 30% 10%, #fde3ee, var(--bg) 60%); }
.lock-card { width: 100%; max-width: 380px; padding: 28px 24px; background: var(--card); border-radius: 24px; box-shadow: var(--shadow); text-align: center; }
.lock-card h1 { font: 700 28px/1.2 var(--serif); margin: 12px 0 2px; }
.lock-card p.muted { margin: 0 0 12px; }
.lock-card .fld { text-align: left; }

/* ---------- toast ---------- */
#toast {
  position: fixed; z-index: 30; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); padding: 8px 8px 8px 16px; border-radius: 14px;
  background: #2a1a24; color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
#toast:empty { padding: 0; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast .btn { background: transparent; color: #ffb3cf; border-color: rgba(255, 255, 255, .25); }
@media (min-width: 900px) { #toast { bottom: 24px; left: calc(50% + 120px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- suggestions under client / item inputs ---------- */
.sheet-body { position: relative; }
.sugg {
  position: absolute; z-index: 3; max-height: 272px; overflow-y: auto; padding: 4px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 8px 24px rgba(42, 26, 36, .16);
}
.sugg[hidden] { display: none; }
.sugg button {
  display: flex; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 0; border-radius: 8px; background: transparent; text-align: left; font-size: 15px;
}
.sugg button:hover, .sugg button.on { background: var(--primary-soft); color: var(--primary-ink); }
.sugg button .muted { flex: none; font-size: 13px; }

/* ---------- user guide ---------- */
.guide-link {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 16px; color: var(--ink); text-decoration: none;
  border: 1px solid transparent; transition: border-color .15s ease;
}
.guide-link:hover { border-color: var(--primary); }
.guide-link > .ic:first-child { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-ink); }
.guide-link > span { flex: 1; display: flex; flex-direction: column; }
.guide-link .muted { font-size: 13px; }
.guide-link > .ic:last-child { color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 600; text-decoration: none; }
.guide-intro { margin: 0 0 12px; font-size: 14px; }
.card.guide { padding: 0 16px; margin: 0 0 10px; border-top: 0; }
.guide summary { gap: 12px; min-height: 56px; color: var(--ink); font-size: 16px; }
.guide .gi { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-ink); }
.guide .gi .ic { width: 17px; height: 17px; }
.guide ul { margin: 0; padding: 0 0 16px 20px; }
.guide li { margin: 6px 0; color: var(--ink-2); line-height: 1.55; }
.guide li b { color: var(--ink); }
