/* Site Forms client panel. Layout: fixed sidebar (projects + sections), content area with KPI tiles, charts and tables.
   Single dark theme matching the Site Forms website (carbon, wine, midnight navy). */
:root {
  color-scheme: dark;
  --bg: #0b0b10;
  --bg-2: #101119;
  --surface: #161722;
  --surface-2: #1c1d2b;
  --surface-3: #242536;
  --line: rgba(244, 237, 240, .08);
  --line-2: rgba(244, 237, 240, .15);
  --fg: #f4edf0;
  --fg-2: #cfc4ca;
  --muted: #9a8f9c;
  --garnet: #f0577e;
  --garnet-2: #ff8fab;
  --garnet-ink: #1c0710;
  --champagne: #ebcba3;
  --wine: #561330;
  --navy: #15214d;
  /* chart series (validated for colour-blind separation on the dark surface) */
  --s1: #f0577e;
  --s2: #3987e5;
  --s3: #199e70;
  --s4: #c98500;
  /* status */
  --good: #4fcf96;
  --warn: #f3c46e;
  --bad: #ff6b81;
  --f-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --f-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 14px;
  --side: 256px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(50vw 40vw at 100% 0%, rgba(21, 33, 77, .45), transparent 60%), radial-gradient(45vw 35vw at 0% 100%, rgba(86, 19, 48, .35), transparent 60%), var(--bg);
}
a { color: var(--garnet-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--champagne); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px; background: rgba(12, 12, 18, .82); border-right: 1px solid var(--line); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); padding: 4px 6px; }
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand b { font-family: var(--f-display); font-size: 17px; }
.brand small { display: block; font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.switcher select { width: 100%; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group .label { padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--fg-2); font-size: 14px; font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, .05); color: var(--fg); text-decoration: none; }
.nav a[aria-current="page"] { background: linear-gradient(90deg, rgba(240, 87, 126, .2), rgba(240, 87, 126, .04)); color: var(--fg); box-shadow: inset 2px 0 0 var(--garnet); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 6px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 12px; color: var(--garnet-ink); background: linear-gradient(135deg, var(--champagne), var(--garnet)); }
.who span { min-width: 0; }
.langs { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 6px; }
.langs a { font-family: var(--f-mono); font-size: 11px; padding: 3px 6px; border-radius: 6px; color: var(--muted); border: 1px solid var(--line); }
.langs a[aria-current="true"] { color: var(--fg); border-color: var(--garnet); }

.main { min-width: 0; padding: 22px clamp(16px, 3vw, 36px) 48px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.topbar h1 { font-family: var(--f-display); font-size: clamp(20px, 2.4vw, 26px); }
.topbar .sub { color: var(--muted); font-size: 14px; margin-top: 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.imp-banner { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 16px; background: linear-gradient(90deg, var(--wine), var(--navy)); font-size: 14px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- range */
.range { display: inline-flex; padding: 3px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.range a { padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--fg-2); white-space: nowrap; flex: none; }
@media (max-width: 420px) { .range a { padding: 6px 9px; font-size: 12.5px; } }
.range a:hover { text-decoration: none; color: var(--fg); }
.range a[aria-current="true"] { background: var(--garnet); color: var(--garnet-ink); }

/* ---------------------------------------------------------------- cards */
.card { background: linear-gradient(170deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: 18px; padding: 18px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h h2 { font-size: 15px; font-weight: 600; }
.card-h .small a { color: var(--muted); }
.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, 2fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .g3, .g2 { grid-template-columns: minmax(0, 1fr); } }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpis.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1280px) { .kpis.c6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .kpis.c4, .kpis.c6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: linear-gradient(170deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi .label { display: flex; align-items: center; gap: 6px; }
.kpi .v { font-family: var(--f-display); font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.kpi.live { border-color: rgba(79, 207, 150, .35); background: linear-gradient(170deg, rgba(79, 207, 150, .1), var(--surface)); }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; }
.delta.up { color: var(--good); background: rgba(79, 207, 150, .12); }
.delta.down { color: var(--bad); background: rgba(255, 107, 129, .12); }
.delta.flat { color: var(--muted); background: rgba(255, 255, 255, .06); }
.delta.inverse.up { color: var(--bad); background: rgba(255, 107, 129, .12); }
.delta.inverse.down { color: var(--good); background: rgba(79, 207, 150, .12); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(79, 207, 150, .6); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(79, 207, 150, 0); } 100% { box-shadow: 0 0 0 0 rgba(79, 207, 150, 0); } }

/* charts */
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 200px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--fg-2); }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend .s1 { background: var(--s1); } .legend .s2 { background: var(--s2); } .legend .s3 { background: var(--s3); } .legend .s4 { background: var(--s4); }
.legend .dash { background: repeating-linear-gradient(90deg, var(--s2) 0 4px, transparent 4px 7px); }

/* bar lists */
.bars { display: flex; flex-direction: column; gap: 4px; }
.bar { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 8px; font-size: 14px; overflow: hidden; }
.bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); background: rgba(240, 87, 126, .14); border-radius: 8px; z-index: 0; transition: width .6s var(--ease); }
.bar.b2::before { background: rgba(57, 135, 229, .16); }
.bar.b3::before { background: rgba(25, 158, 112, .16); }
.bar.b4::before { background: rgba(201, 133, 0, .16); }
.bar > * { position: relative; z-index: 1; }
.bar .k { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .n { font-family: var(--f-mono); font-size: 13px; color: var(--fg); }
.bar .p { font-family: var(--f-mono); font-size: 12px; color: var(--muted); min-width: 46px; text-align: right; }
.bars-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; padding: 0 10px 6px; }

/* heatmap (sequential blue) */
.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 3px; font-size: 11px; }
.heat .h-lab { color: var(--muted); font-family: var(--f-mono); text-align: center; }
.heat .d-lab { color: var(--muted); font-family: var(--f-mono); align-self: center; }
.heat .c { aspect-ratio: 1; border-radius: 4px; background: rgba(57, 135, 229, var(--a, .04)); min-height: 10px; }
.heat .c:hover { outline: 1px solid var(--fg); }
.heat-wrap { overflow-x: auto; }
.heat-wrap .heat { min-width: 560px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-family: var(--f-mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good); background: rgba(79, 207, 150, .1); border-color: rgba(79, 207, 150, .25); }
.pill.warn { color: var(--warn); background: rgba(243, 196, 110, .1); border-color: rgba(243, 196, 110, .25); }
.pill.bad { color: var(--bad); background: rgba(255, 107, 129, .1); border-color: rgba(255, 107, 129, .25); }
.pill.info { color: #8fb5ff; background: rgba(57, 135, 229, .12); border-color: rgba(57, 135, 229, .3); }
.pill.neutral { color: var(--fg-2); background: rgba(255, 255, 255, .05); border-color: var(--line-2); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--garnet); color: var(--garnet-ink); }
.badge.good { background: var(--good); color: #062014; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04); color: var(--fg); font: 600 14px/1.2 var(--f-body); cursor: pointer; white-space: nowrap; }
.btn.menu-btn { display: none; }
.btn:hover { border-color: var(--garnet); text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, var(--garnet-2), var(--garnet)); color: var(--garnet-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); border-color: rgba(255, 107, 129, .35); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--garnet-2); font: inherit; cursor: pointer; }
form.inline { display: inline; }
.form { display: flex; flex-direction: column; gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fields .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .fields { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .lab { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04); color: var(--fg); font: 15px/1.4 var(--f-body);
}
textarea { min-height: 110px; resize: vertical; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23cfc4ca' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; }
select option { background: #16172a; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--garnet); box-shadow: 0 0 0 3px rgba(240, 87, 126, .2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--fg-2); }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--garnet); flex: none; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }

/* flash */
.flash { padding: 12px 16px; border-radius: 12px; border: 1px solid; font-size: 14px; }
.flash.ok { border-color: rgba(79, 207, 150, .35); background: rgba(79, 207, 150, .08); }
.flash.err { border-color: rgba(255, 107, 129, .4); background: rgba(255, 107, 129, .08); }
.error-text { color: var(--bad); font-size: 13px; }

/* misc components */
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 14px; font-size: 14px; }
.meter { height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; background: var(--s2); width: var(--w); }
.meter.over i { background: var(--warn); }
.steps { display: flex; flex-direction: column; gap: 0; }
.steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding-bottom: 16px; position: relative; }
.steps li::before { content: ""; position: absolute; left: 12px; top: 22px; bottom: 0; width: 2px; background: var(--line-2); }
.steps li:last-child::before { display: none; }
.steps .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-2); background: var(--surface); position: relative; z-index: 1; font-size: 12px; }
.steps .done .ic { background: var(--good); border-color: var(--good); color: #062014; }
.steps .doing .ic { border-color: var(--garnet); box-shadow: 0 0 0 4px rgba(240, 87, 126, .2); }
.steps .doing .ic::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--garnet); }
.feed { display: flex; flex-direction: column; }
.feed li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed li:last-child { border-bottom: 0; }
.feed li.new { animation: flashIn 1.2s var(--ease); }
@keyframes flashIn { from { background: rgba(240, 87, 126, .18); } }
.big-live { display: flex; align-items: center; gap: 18px; }
.big-live .v { font-family: var(--f-display); font-size: 64px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.uptime-bars { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; height: 34px; }
.uptime-bars i { border-radius: 3px; background: var(--good); opacity: .85; }
.uptime-bars i.part { background: var(--warn); }
.uptime-bars i.bad { background: var(--bad); }
.uptime-bars i.none { background: rgba(255, 255, 255, .08); }
.code { position: relative; font-family: var(--f-mono); font-size: 13px; background: #0a0a10; border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg-2); }
.code:has(> .copy) { padding-right: 104px; }
.copy { position: absolute; top: 8px; right: 8px; }
.secret-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 18px; border-radius: 14px; border: 1px solid rgba(235, 203, 163, .4); background: rgba(235, 203, 163, .07); }
.secret-box .pw { font-family: var(--f-mono); font-size: 22px; letter-spacing: .04em; color: var(--champagne); }
.comment { padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.comment.mine { background: rgba(240, 87, 126, .06); border-color: rgba(240, 87, 126, .2); }
.comment.internal { border-style: dashed; border-color: rgba(243, 196, 110, .4); }
.comment .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.comment .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; color: var(--fg-2); font-size: 14px; font-weight: 600; box-shadow: inset 0 -2px 0 transparent; }
.tabs a:hover { text-decoration: none; color: var(--fg); }
.tabs a[aria-current="true"] { color: var(--fg); box-shadow: inset 0 -2px 0 var(--garnet); }
details.box { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
details.box summary { cursor: pointer; font-weight: 600; }
.tooltip-note { font-size: 12px; color: var(--muted); }
.notif { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.notif.unread .t { font-weight: 700; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 18px; padding: 30px; border-radius: 22px; background: linear-gradient(170deg, var(--surface-2), var(--surface)); border: 1px solid var(--line-2); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .9); }
.auth-card h1 { font-family: var(--f-display); font-size: 24px; }
.auth-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

/* mobile */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: min(86vw, 300px); transform: translateX(-105%); transition: transform .3s var(--ease); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5); }
  .btn.menu-btn { display: inline-flex; }
  .main { padding-top: 14px; }
  .big-live .v { font-size: 48px; }
}
@media print {
  .side, .topbar .range, .menu-btn, .no-print { display: none !important; }
  .shell { display: block; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.cf-steps { list-style: decimal; margin: 0; padding-left: 20px; display: grid; gap: 10px; color: var(--fg-2); }
.cf-steps li::marker { color: var(--garnet); font-weight: 700; }

/* ---------------------------------------------------------------- invoice editor + preview */
.inv-editor .inv-side { position: sticky; top: 16px; align-self: start; }
.inv-edit-lines { min-width: 640px; }
.inv-edit-lines td { padding: 6px 4px; vertical-align: middle; }
.inv-edit-lines input { width: 100%; }
.inv-edit-lines td:nth-child(1) { width: 44%; }
.inv-edit-lines td:nth-child(2) { width: 9%; } .inv-edit-lines td:nth-child(3) { width: 9%; }
.inv-edit-lines td:nth-child(4) { width: 14%; } .inv-edit-lines td:nth-child(5) { width: 10%; }
.inv-edit-lines td:nth-child(6) { width: 12%; white-space: nowrap; }
.inv-edit-lines input[name="line_qty"], .inv-edit-lines input[name="line_price"], .inv-edit-lines input[name="line_discount"] { text-align: right; }
.inv-presets { gap: 6px; }
.inv-vatmode { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.inv-vatmode.reverse, .inv-vatmode.export { border-color: rgba(99, 217, 166, .4); }
.inv-vatmode.custom { border-color: rgba(243, 196, 110, .5); }
.inv-live { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 4px 0 6px; }
.inv-live dt { color: var(--muted); } .inv-live dd { margin: 0; text-align: right; }
.inv-live .grand { font-size: 18px; font-weight: 700; color: var(--fg); padding-top: 6px; border-top: 1px solid var(--line); }
.inv-preview .inv-sheet { box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .8); }

/* Phone app (added to the home screen): keep content clear of the notch, status bar and home indicator */
@supports (padding: env(safe-area-inset-top)) {
  .main { padding-top: max(22px, calc(env(safe-area-inset-top) + 10px)); padding-bottom: max(48px, calc(env(safe-area-inset-bottom) + 24px)); padding-left: max(clamp(16px, 3vw, 36px), env(safe-area-inset-left)); padding-right: max(clamp(16px, 3vw, 36px), env(safe-area-inset-right)); }
  .side { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .auth { padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  @media (max-width: 960px) { .main { padding-top: max(14px, calc(env(safe-area-inset-top) + 8px)); } }
}
@media (display-mode: standalone) { body { overscroll-behavior-y: none; } }
