/* ================= Shell ================= */
.app-body { background: var(--bg); }
.demo-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  padding: 8px 16px;
}
.demo-banner a { color: #fff; font-weight: 600; text-decoration: none; background: var(--accent); padding: 3px 10px; border-radius: 999px; }
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  overflow-y: auto;
}
body.is-demo .sidebar { top: 37px; height: calc(100vh - 37px); }
.side-brand { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 4px; }
.new-wrap { position: relative; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .subnav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.nav a .i, .subnav a .i { color: var(--ink-3); }
.nav a:hover, .subnav a:hover { background: rgba(18, 18, 16, 0.045); color: var(--ink); }
.nav a.on, .subnav a.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow-1); }
.nav a.on .i, .subnav a.on .i { color: var(--ink); }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 650; display: grid; place-items: center; }
.nav .count.soft { background: var(--surface-3); color: var(--ink-2); }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4); padding: 12px 10px 4px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.plan-widget { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px; box-shadow: var(--shadow-1); font-size: 13px; }
.plan-widget strong { font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.plan-widget p { color: var(--ink-3); margin-top: 2px; }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 10px 0 12px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.4s var(--ease); }
.meter.ok > i { background: var(--ok); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 6px; border-radius: 12px; min-width: 0; }
.me .who { min-width: 0; flex: 1; line-height: 1.3; }
.me .who strong { display: block; font-size: 13.5px; font-weight: 600; }
.me .who span { font-size: 12px; color: var(--ink-3); }
.avatar { width: 32px; height: 32px; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 650; flex: none; letter-spacing: 0.02em; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.avatar.lg { width: 44px; height: 44px; border-radius: 13px; font-size: 14px; }
.main { min-width: 0; padding: 28px 36px 100px; max-width: 1320px; width: 100%; outline: none; }
.mtop, .tabbar { display: none; }

/* ================= Page scaffolding ================= */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; letter-spacing: -0.032em; }
.page-head h1 .serif-i { font-size: 1.12em; }
.page-head p { color: var(--ink-3); margin-top: 4px; font-size: 14px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); text-decoration: none; margin-bottom: 10px; }
.crumb:hover { color: var(--ink); }
.crumb .i { width: 15px; height: 15px; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-1); min-width: 0; }
.section-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 0; }
.section-h h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; letter-spacing: -0.012em; }
.section-h h3 .i { color: var(--ink-3); }
.section-h .hint { margin: 0; }
.section-b { padding: 14px 20px 20px; }
.section-b.flush { padding: 8px 0 6px; }
.fields-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fields-3 { display: grid; grid-template-columns: 1fr 120px minmax(0, 1fr); gap: 12px; }
.fields-2 .field + .field, .fields-3 .field + .field { margin-top: 0; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.stack-12 > .field + .field { margin-top: 0; }

/* ================= Home ================= */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 15px 17px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 3px; min-width: 0; text-decoration: none; color: inherit; transition: border-color 0.15s, transform 0.15s; }
a.kpi:hover { border-color: var(--line-2); transform: translateY(-1px); }
.kpi .k { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi .k .i { width: 15px; height: 15px; }
.kpi .v { font-size: 24px; font-weight: 650; letter-spacing: -0.035em; font-feature-settings: "tnum"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v small { font-size: 13px; color: var(--ink-3); font-weight: 500; margin-right: 4px; letter-spacing: 0; }
.kpi .s { font-size: 12.5px; color: var(--ink-3); }
.kpi.alert { border-color: #f4c9c4; background: linear-gradient(180deg, #fff6f5, #fff); }
.kpi.alert .v { color: var(--accent-ink); }
.kpi.good .v { color: var(--ok); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.home-side { display: flex; flex-direction: column; gap: 16px; }
.greet { font-size: 30px; letter-spacing: -0.035em; }
.tasks { display: flex; flex-direction: column; container-type: inline-size; }
/* Narrow task column (desktop with side panel): put the buttons on their own line instead of squeezing the text. */
@container (max-width: 640px) {
  .task { flex-wrap: wrap; }
  .task .acts { width: 100%; padding-left: 50px; }
}
.task { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); animation: fade-in 0.3s var(--ease); }
.task:first-child { border-top: 0; }
.task .body { flex: 1; min-width: 0; }
.task .t { font-weight: 560; font-size: 14.5px; letter-spacing: -0.01em; }
.task .t a { text-decoration: none; }
.task .t a:hover { text-decoration: underline; text-underline-offset: 3px; }
.task .d { font-size: 13px; color: var(--ink-3); margin-top: 1px; }
.task .amt { font-family: var(--mono); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.task .acts { display: flex; gap: 6px; flex: none; }
.feed { display: flex; flex-direction: column; padding: 4px 0 8px; }
.feed-item { display: flex; gap: 12px; padding: 9px 18px; position: relative; text-decoration: none; color: inherit; }
a.feed-item:hover { background: var(--surface-2); }
.feed-item .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--ink-2); position: relative; z-index: 1; }
.feed-item .dot .i { width: 13px; height: 13px; }
.feed-item .dot.green { background: var(--ok-soft); color: var(--ok); }
.feed-item .dot.violet { background: var(--violet-soft); color: var(--violet); }
.feed-item .dot.red { background: var(--accent-soft); color: var(--accent); }
.feed-item .dot.blue { background: var(--info-soft); color: var(--info); }
.feed-item .dot.amber { background: var(--warn-soft); color: var(--warn); }
.feed-item .t { font-size: 13.5px; line-height: 1.4; }
.feed-item .w { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.feed-item:not(:last-child)::before { content: ""; position: absolute; left: 30px; top: 36px; bottom: -8px; width: 1px; background: var(--line); }
.checklist { display: grid; gap: 2px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 9px 4px; text-decoration: none; color: inherit; border-radius: 10px; }
a.check-item:hover { background: var(--surface-2); }
.check-item .cb { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; color: transparent; }
.check-item.done .cb { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-item.done .lbl { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-4); }
.check-item .cb .i { width: 13px; height: 13px; stroke-width: 3; }
.check-item .lbl { font-size: 14px; flex: 1; }
.promo { position: relative; overflow: hidden; background: var(--ink); color: #fff; border-radius: 18px; padding: 20px; }
.promo h3 { font-size: 17px; letter-spacing: -0.02em; }
.promo p { color: rgba(255, 255, 255, 0.72); font-size: 13.5px; margin: 6px 0 14px; }
.promo .btn-secondary { background: #fff; border-color: #fff; }
.promo::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(215, 38, 27, 0.55), transparent 70%); }

/* ================= Lists ================= */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-4); width: 16px; height: 16px; pointer-events: none; }
.search .input { padding-left: 34px; height: 38px; width: 260px; font-size: 14px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }
.filter:hover { border-color: var(--ink-4); color: var(--ink); }
.filter.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter .n { font-size: 11.5px; opacity: 0.6; font-feature-settings: "tnum"; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-1); overflow: hidden; }
.list-row { display: grid; grid-template-columns: 116px minmax(0, 1.4fr) 128px 104px 124px; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 60px; }
.list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--surface-2); }
.list-head { font-size: 12px; color: var(--ink-3); font-weight: 550; min-height: 0; padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); }
.list-row .no { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.list-row .who { min-width: 0; }
.list-row .who strong { display: block; font-weight: 560; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .who span { display: block; color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .when { font-size: 13px; color: var(--ink-3); }
.list-row .amt { text-align: right; font-family: var(--mono); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.list-foot { display: flex; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 13px; color: var(--ink-3); }
.list-foot strong { color: var(--ink); font-family: var(--mono); font-weight: 550; }
.client-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) 80px 120px 120px; }
.client-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.empty { text-align: center; padding: 52px 24px; }
.empty .ic { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 14px; }
.empty h3 { font-size: 17px; letter-spacing: -0.015em; }
.empty p { color: var(--ink-3); margin: 6px auto 18px; max-width: 42ch; font-size: 14px; }

/* ================= Composer ================= */
.composer { max-width: 780px; margin: 8px auto 0; }
.composer-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-2); padding: 28px; }
.composer h1 { font-size: 32px; letter-spacing: -0.04em; margin: 8px 0 6px; }
.composer .lead { color: var(--ink-2); margin-bottom: 18px; }
.composer .textarea { min-height: 210px; font-size: 16px; border-radius: 14px; padding: 16px; background: var(--surface-2); line-height: 1.6; }
.composer .textarea:focus { background: var(--surface); }
.composer-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.examples { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.examples .chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; color: var(--ink-2); }
.examples .chip:hover { border-color: var(--ink-3); color: var(--ink); }
.mic-on { background: var(--accent-soft) !important; color: var(--accent-ink) !important; border-color: #f4b9b4 !important; }
.mic-on .i { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.gen { display: flex; flex-direction: column; gap: 14px; padding: 6px 0; }
.gen-step { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: var(--ink-3); transition: color 0.3s; }
.gen-step .dot { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; }
.gen-step.on { color: var(--ink); }
.gen-step.on .dot { border-color: var(--accent); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.gen-step.done { color: var(--ink-2); }
.gen-step.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; animation: none; }
.gen-step.done .dot .i { width: 12px; height: 12px; stroke-width: 3; }
.gen-skel { display: grid; gap: 8px; margin-top: 8px; }
.gen-skel .skel { height: 44px; border-radius: 12px; }
.composer-foot { display: flex; justify-content: center; gap: 18px; margin-top: 18px; font-size: 13.5px; color: var(--ink-3); flex-wrap: wrap; }
.composer-foot button { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 550; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-4); }

/* ================= Editor ================= */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: 24px; align-items: start; }
.editor-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.preview-col { position: sticky; top: 20px; min-width: 0; }
body.is-demo .preview-col { top: 56px; }
.preview-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.preview-frame { max-height: calc(100vh - 110px); overflow: auto; border-radius: 16px; scrollbar-width: thin; }
.preview-frame .paper { font-size: 11.5px; }
.ai-hint { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 14px; background: var(--violet-soft); color: #3b2a85; font-size: 13.5px; border: 1px solid #ddd4fa; }
.ai-hint .i { color: var(--violet); margin-top: 1px; }
.ai-hint ul { margin: 4px 0 0 16px; }
.client-pick { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-3); padding: 6px; max-height: 260px; overflow: auto; }
.suggest button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.suggest button:hover, .suggest button.on { background: var(--surface-3); }
.suggest small { color: var(--ink-3); display: block; font-size: 12px; }
.lines-ed { display: flex; flex-direction: column; gap: 8px; }
.line-ed { display: grid; grid-template-columns: minmax(0, 1fr) 70px 98px 104px 104px 34px; gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); position: relative; }
.line-ed.opt { border-color: #d9d0f8; background: #faf8ff; }
.line-ed .input, .line-ed .select { height: 38px; font-size: 14px; background: var(--surface); }
.line-ed .select { padding-right: 26px; background-position: right 7px center; }
.line-ed .detail { margin-top: 6px; height: 32px; font-size: 13px; color: var(--ink-2); }
.line-ed .num-in { text-align: right; font-family: var(--mono); font-size: 13.5px; }
.line-ed .sum { height: 38px; display: flex; align-items: center; justify-content: flex-end; font-family: var(--mono); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.line-ed .opt-flag { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--violet); }
.line-ed .lbl-mobile { display: none; }
.lines-head { display: grid; grid-template-columns: minmax(0, 1fr) 70px 98px 104px 104px 34px; gap: 8px; padding: 0 11px 2px; font-size: 11.5px; color: var(--ink-3); font-weight: 550; }
.lines-head span:nth-child(n + 2) { text-align: right; }
.lines-head span:nth-child(3) { text-align: left; }
.lines-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.lines-wrap { container-type: inline-size; }
.line-ed > .c-title { grid-area: title; }
.line-ed > .c-qty { grid-area: qty; }
.line-ed > .c-unit { grid-area: unit; }
.line-ed > .c-price { grid-area: price; }
.line-ed > .c-sum { grid-area: sum; }
.line-ed > .c-menu { grid-area: menu; }
.line-ed { grid-template-areas: "title qty unit price sum menu"; }
@container (max-width: 680px) {
  .lines-head { display: none; }
  .line-ed { grid-template-columns: 72px 112px minmax(0, 1fr) minmax(0, 1fr) 34px; grid-template-areas: "title title title title menu" "qty unit price sum sum"; row-gap: 8px; }
  .line-ed .lbl-mobile { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 3px; font-weight: 550; }
  .line-ed .c-title .lbl-mobile { display: none; }
  .line-ed .c-sum .lbl-mobile { text-align: right; }
}
@container (max-width: 420px) {
  .line-ed { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; grid-template-areas: "title title menu" "qty unit unit" "price sum sum"; }
}
.totals-mini { display: grid; gap: 5px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); font-size: 14px; }
.totals-mini div { display: flex; justify-content: space-between; gap: 12px; }
.totals-mini span:last-child { font-family: var(--mono); }
.totals-mini .grand { font-weight: 650; font-size: 16px; }
.totals-mini .dep { color: var(--accent-ink); font-size: 13px; }
.editor-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 14px 0 10px; background: linear-gradient(to top, var(--bg) 72%, rgba(246, 245, 241, 0)); }
.editor-bar .sum { margin-right: auto; font-size: 13px; color: var(--ink-3); }
.editor-bar .sum strong { color: var(--ink); font-size: 17px; font-family: var(--mono); font-weight: 600; margin-left: 6px; }
.lock { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; background: var(--ink); padding: 2px 7px; border-radius: 999px; }
.lock .i { width: 11px; height: 11px; }
.pct-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.pct-seg button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 7px 12px; font-size: 13.5px; font-weight: 550; color: var(--ink-2); }
.pct-seg button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pct-seg button:disabled { opacity: 0.5; }
.more-toggle { background: none; border: 0; padding: 0; color: var(--ink-2); font-size: 13.5px; font-weight: 550; display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; }
.more-toggle:hover { color: var(--ink); }

/* ================= Detail ================= */
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.detail-head h1 { font-size: 26px; letter-spacing: -0.03em; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-head .sub { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.detail-head .acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: relative; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 24px; align-items: start; }
.detail-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 20px; }
body.is-demo .detail-side { top: 56px; }
.state-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); margin-bottom: 18px; box-shadow: var(--shadow-1); flex-wrap: wrap; }
.state-banner .body { flex: 1; min-width: 220px; }
.state-banner .t { font-weight: 600; font-size: 14.5px; }
.state-banner .d { font-size: 13.5px; color: var(--ink-2); margin-top: 1px; }
.state-banner .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.state-banner.ok { background: linear-gradient(180deg, #f2fbf6, #fff); border-color: #c9ead8; }
.state-banner.red { background: linear-gradient(180deg, #fff5f4, #fff); border-color: #f4c9c4; }
.state-banner.amber { background: linear-gradient(180deg, #fff8ee, #fff); border-color: #f1dcb9; }
.state-banner.violet { background: linear-gradient(180deg, #f8f6ff, #fff); border-color: #ddd4fa; }
.kv { display: grid; gap: 9px; font-size: 13.5px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; }
.kv > div > span:first-child { color: var(--ink-3); }
.kv > div > span:last-child { text-align: right; font-weight: 500; }
.big-amt { font-size: 30px; font-weight: 650; letter-spacing: -0.035em; font-feature-settings: "tnum"; line-height: 1.1; margin: 4px 0 2px; }
.big-amt small { font-size: 14px; color: var(--ink-3); font-weight: 500; margin-right: 4px; letter-spacing: 0; }
.share-row { display: flex; gap: 8px; }
.share-row .input { font-family: var(--mono); font-size: 12px; height: 38px; }
.share-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.views-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--violet); font-weight: 550; }

/* Menu */
.menu { position: absolute; z-index: 80; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow-3); padding: 6px; animation: pop-in 0.14s var(--ease); }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; font-size: 14px; color: var(--ink); text-decoration: none; text-align: left; white-space: nowrap; }
.menu button .i, .menu a .i { color: var(--ink-3); }
.menu button:hover, .menu a:hover { background: var(--surface-3); }
.menu .danger { color: var(--accent-ink); }
.menu .danger .i { color: var(--accent); }
.menu hr { margin: 6px 4px; }
.menu small { color: var(--ink-3); font-size: 12px; display: block; }

/* Send modal */
.send-tabs { margin-bottom: 16px; display: flex; }
.send-tabs .seg { width: 100%; }
.send-tabs .seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.share-qr { display: flex; gap: 16px; align-items: center; margin-top: 14px; }
.share-qr .qr { width: 120px; height: 120px; border: 1px solid var(--line); border-radius: 12px; flex: none; }

/* ================= Settings ================= */
.settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; }
.subnav { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.settings-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 760px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.setting-row:first-child { border-top: 0; padding-top: 4px; }
.setting-row .lbl { font-weight: 550; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.setting-row .hint { margin-top: 2px; }
.logo-drop { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-prev { width: 140px; height: 72px; border: 1px dashed var(--line-2); border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-4); overflow: hidden; }
.logo-prev img { max-width: 90%; max-height: 56px; object-fit: contain; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.iban-ok { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ok); font-weight: 550; }
.iban-bad { color: var(--accent-ink); }
.save-bar { display: flex; justify-content: flex-end; gap: 8px; }

/* ================= Plan ================= */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; position: relative; }
.plan-card.pro { border: 1.5px solid var(--ink); box-shadow: var(--shadow-2); }
.plan-card .tag { position: absolute; top: -11px; right: 20px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 650; letter-spacing: 0.04em; padding: 3px 10px; border-radius: 999px; }
.plan-card h3 { font-size: 18px; }
.plan-card .price { font-size: 40px; font-weight: 650; letter-spacing: -0.045em; margin: 10px 0 2px; font-feature-settings: "tnum"; }
.plan-card .price small { font-size: 15px; color: var(--ink-3); font-weight: 500; letter-spacing: 0; }
.plan-card .per { font-size: 13px; color: var(--ink-3); min-height: 20px; }
.plan-card .btn { margin-top: auto; }
.value-box { background: var(--ink); color: #fff; border-radius: 20px; padding: 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; position: relative; overflow: hidden; }
.value-box .k { font-size: 12.5px; color: rgba(255, 255, 255, 0.6); }
.value-box .v { font-size: 26px; font-weight: 650; letter-spacing: -0.035em; margin-top: 2px; font-feature-settings: "tnum"; }
.value-box .v small { font-size: 13px; color: rgba(255, 255, 255, 0.6); font-weight: 500; margin-right: 4px; letter-spacing: 0; }
.value-box .note { grid-column: 1 / -1; font-size: 14px; color: rgba(255, 255, 255, 0.8); border-top: 1px solid rgba(255, 255, 255, 0.14); padding-top: 14px; }
.ref-card { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.ref-card .body { flex: 1; min-width: 240px; }

/* ================= Receipts ================= */
.month-nav { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; box-shadow: var(--shadow-1); }
.month-nav strong { min-width: 130px; text-align: center; font-size: 14px; font-weight: 600; }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: 18px; padding: 30px 20px; text-align: center; background: var(--surface); cursor: pointer; transition: border-color 0.15s, background 0.15s; display: block; }
.dropzone:hover { border-color: var(--ink-4); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .ic { margin: 0 auto 10px; }
.dropzone strong { display: block; font-size: 15px; }
.dropzone span { font-size: 13px; color: var(--ink-3); }
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.rc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-1); position: relative; }
.rc img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--surface-3); }
.rc .meta { padding: 10px 12px; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.rc .meta span { min-width: 0; }
.rc .del { position: absolute; top: 8px; right: 8px; background: rgba(255, 255, 255, 0.92); }

/* ================= Print (receipt pack, lists) ================= */
@media print {
  .sidebar, .tabbar, .mtop, .demo-banner, .dropzone, .rc .del, .page-head .row, .editor-bar, .toolbar { display: none !important; }
  .shell { display: block; }
  .main { padding: 12mm !important; max-width: none; }
  .rc-grid { grid-template-columns: repeat(3, 1fr); }
  .rc, .section, .list, .kpi { box-shadow: none !important; break-inside: avoid; }
}

/* ================= Mobile ================= */
@media (max-width: 1180px) {
  .editor { grid-template-columns: 1fr; }
  .preview-col { display: none; position: static; }
  .preview-col.show { display: block; }
  .preview-frame { max-height: none; }
  .home-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { position: static; }
}
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 14px 14px 116px; }
  .mtop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 45;
    height: 56px;
    padding: 0 14px;
    background: rgba(246, 245, 241, 0.9);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line);
  }
  body.is-demo .mtop { top: 0; }
  .tabbar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: flex-end;
  }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--ink-3); text-decoration: none; padding: 5px 8px; border-radius: 10px; min-width: 62px; font-weight: 560; }
  .tabbar a .i { width: 21px; height: 21px; }
  .tabbar a.on { color: var(--ink); }
  .tabbar a .count { position: absolute; top: 0; right: 12px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; display: grid; place-items: center; font-weight: 700; }
  .tabbar .plus { width: 50px; height: 50px; border-radius: 17px; background: var(--accent); color: #fff; display: grid; place-items: center; margin-top: -20px; box-shadow: 0 10px 22px -10px rgba(215, 38, 27, 0.9); }
  .tabbar .plus .i { width: 24px; height: 24px; stroke-width: 2.4; }
  .page-head { margin-bottom: 16px; }
  .page-head h1, .greet { font-size: 24px; }
  .kpi { padding: 13px 14px; }
  .kpi .v { font-size: 19px; }
  .task { flex-wrap: wrap; padding: 14px; }
  .task .acts { width: 100%; padding-left: 50px; }
  .task .amt { order: 0; }
  .search .input { width: 100%; }
  .search { flex: 1; min-width: 180px; }
  .list-head { display: none; }
  .list-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who amt" "meta badge"; gap: 4px 12px; padding: 12px 14px; }
  .list-row .who { grid-area: who; }
  .list-row .amt { grid-area: amt; }
  .list-row .no { grid-area: meta; font-size: 12px; }
  .list-row .st { grid-area: badge; justify-self: end; }
  .list-row .when { display: none; }
  .client-row { grid-template-areas: "who amt" "meta badge"; }
  .client-row .hide-m { display: none; }
  .composer-card { padding: 18px; border-radius: 18px; }
  .composer h1 { font-size: 25px; }
  .composer .textarea { min-height: 170px; }
  .fields-2, .fields-3 { grid-template-columns: 1fr; }
  .section-h { padding: 14px 16px 0; }
  .section-b { padding: 12px 16px 16px; }
  .editor-bar { position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 14px; background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
  .editor-bar .sum strong { font-size: 15px; }
  .editor-bar .btn-ghost { display: none; }
  .detail-head h1 { font-size: 22px; }
  .settings { grid-template-columns: 1fr; gap: 14px; }
  .subnav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; scrollbar-width: none; }
  .subnav a { white-space: nowrap; }
  .plan-grid { grid-template-columns: 1fr; }
  .value-box { grid-template-columns: 1fr; }
  .hide-m { display: none !important; }
}
@media (min-width: 861px) {
  .only-m { display: none !important; }
}
