/* The back office, in Panzuko's own clothes: a white page, Nunito, orange
   buttons with ink labels and a darker edge underneath, one idea to a card.
   Tokens are the app's (theme/palette.ts) and the site's (website/src/index.html).

   ⚠️ THE PHONE COMES FIRST. Every rule below is written for 390 wide and then
   widened. Check a change there before anything else. */
:root {
  --orange: #FF8A00; --orange-edge: #D96E00; --orange-ink: #A35200; --orange-soft: #FFE3C2; --orange-wash: #FFF5EB;
  --ink: #2B2B2B; --ink-soft: #6B645B; --muted: #6F6860; --paper: #FFFFFF; --cream: #FFFDF5; --line: #EFEAE3; --cloud: #F4F1E8;
  --good: #4BC63E; --good-edge: #3A9D30; --good-soft: #E4F7E1; --good-ink: #2F7D27;
  --bad: #FF5C5C; --bad-edge: #D33B3B; --bad-soft: #FFE5E5; --bad-ink: #B84242;
  --info: #1CB0F6; --info-ink: #1274A2; --info-soft: #E3F5FE;
  --lemon: #FFD400; --lilac: #A77BE0; --lilac-soft: #F1E8FB; --lilac-ink: #6A41A3;
  --fire-bg: #1B0D26; --fire-card: #311B3D; --fire-text: #FFF6EA; --fire-gold: #FFC400;
  --r: 16px; --r-lg: 24px; --ease: cubic-bezier(.3, .975, .4, .975);
  --shadow: 0 4px 10px rgba(0, 0, 0, .07);
  --gut: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 600 16px/1.5 Nunito, ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-weight: 900; letter-spacing: -.02em; line-height: 1.15; margin: 0; }
h1 { font-size: 28px; } h2 { font-size: 20px; text-transform: lowercase; } h3 { font-size: 16px; }
p { margin: 0; } a { color: var(--orange-ink); } img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 50; background: var(--paper); padding: 8px 12px; }
.noscript { padding: 40px var(--gut); text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; }
.cap { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--orange-ink); }

/* ---- top */
/* The name bar and the tabs stick as one block, so the tabs sit under the bar
   whatever height the bar turns out to be (a notch makes it taller). */
#chrome { position: sticky; top: 0; z-index: 20; background: var(--paper); }
#top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px var(--gut); padding-top: max(10px, env(safe-area-inset-top)); background: var(--paper); border-bottom: 2px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 900; font-size: 18px; letter-spacing: -.02em; min-width: 0; }
.brand b { color: var(--orange-ink); font-weight: 900; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { margin-right: auto; }
/* the dot that says the figures are current */
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--good-ink); flex: none; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(75, 198, 62, .5); animation: pulse 2.4s ease-out infinite; }
.live.off { color: var(--bad-ink); } .live.off i { background: var(--bad); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(75, 198, 62, .5); } 70%, 100% { box-shadow: 0 0 0 8px rgba(75, 198, 62, 0); } }
@media (max-width: 420px) { .live b { display: none; } }
@media (prefers-reduced-motion: reduce) { .live i { animation: none; } }
.who { border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 14px; cursor: pointer; max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { position: absolute; right: var(--gut); top: calc(100% + 6px); background: var(--paper); border: 2px solid var(--line); border-radius: var(--r); box-shadow: 0 8px 18px rgba(0, 0, 0, .14); padding: 6px; min-width: 200px; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 10px; font-weight: 800; cursor: pointer; }
.menu button:hover { background: var(--cloud); }
.menu .me { padding: 8px 12px 10px; border-bottom: 2px solid var(--line); margin-bottom: 6px; font-size: 13px; color: var(--muted); word-break: break-all; }

/* ---- tabs: a strip that scrolls sideways on a phone, a rail on a wide screen */
#tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px var(--gut); background: var(--paper); border-bottom: 2px solid var(--line); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
#tabs::-webkit-scrollbar { display: none; }
#tabs a { flex: none; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-soft); font-weight: 800; font-size: 15px; text-transform: lowercase; border: 2px solid transparent; white-space: nowrap; }
#tabs a[aria-current="page"] { background: var(--orange-wash); color: var(--orange-ink); border-color: var(--orange-soft); }
#tabs a .dot { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }

main { padding: 20px var(--gut) 80px; max-width: 1180px; margin: 0 auto; }
main:focus { outline: none; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.head p { color: var(--muted); font-size: 15px; margin-top: 4px; max-width: 60ch; }
.grid { display: grid; gap: 12px; }
.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two { grid-template-columns: minmax(0, 1fr); }
.section { margin-top: 28px; }
.section > h2 { margin-bottom: 12px; }

/* ---- cards and tiles */
.card { background: var(--paper); border: 2px solid var(--line); border-radius: var(--r-lg); padding: 16px; min-width: 0; }
.card > h3 { margin-bottom: 10px; }
.card.wash { background: var(--orange-wash); border-color: var(--orange-soft); }
.card.fire { background: var(--fire-bg); border-color: var(--fire-card); color: var(--fire-text); }
.tile { background: var(--paper); border: 2px solid var(--line); border-radius: 20px; padding: 14px; min-width: 0; }
.tile .n { font-size: 30px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; margin-top: 2px; overflow-wrap: anywhere; }
.tile .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tile.big .n { font-size: 38px; }
.tile.good .n { color: var(--good-ink); } .tile.bad .n { color: var(--bad-ink); }
a.tile { display: block; text-decoration: none; color: inherit; }
a.tile:hover { border-color: var(--orange-soft); }

/* ---- buttons: orange face, ink label, a darker edge that it presses into */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border: 0; border-radius: var(--r); background: var(--orange); color: var(--ink); font-weight: 900; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 4px 0 var(--orange-edge); cursor: pointer; text-decoration: none; transition: transform .08s var(--ease), box-shadow .08s var(--ease); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--orange-edge); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.plain { background: var(--paper); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn.plain:active { box-shadow: 0 0 0 var(--line); }
.btn.danger { background: var(--bad); box-shadow: 0 4px 0 var(--bad-edge); color: #fff; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 12px; box-shadow: 0 3px 0 var(--orange-edge); }
.btn.small.plain { box-shadow: 0 3px 0 var(--line); }
.btn.wide { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--orange-ink); font-weight: 800; text-decoration: underline; cursor: pointer; }

/* ---- forms */
label.f { display: block; font-weight: 800; font-size: 14px; margin-bottom: 12px; }
label.f span { display: block; margin-bottom: 4px; }
label.f small { display: block; font-weight: 600; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea { width: 100%; min-height: 46px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--paper); font-weight: 700; font-size: 16px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); outline: none; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--orange); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters > * { flex: 1 1 140px; min-width: 0; }
.filters input[type=search] { flex: 2 1 220px; }
.err { background: var(--bad-soft); color: var(--bad-ink); border-radius: 14px; padding: 10px 14px; font-weight: 800; font-size: 14px; margin-bottom: 12px; }
.note { background: var(--info-soft); color: var(--info-ink); border-radius: 14px; padding: 10px 14px; font-weight: 700; font-size: 14px; }
.note.warn { background: #FFF6CC; color: #6B5600; }
.note + .note { margin-top: 8px; }
.code-in { text-align: center; font-size: 28px !important; font-weight: 900 !important; letter-spacing: .3em; }

/* ---- chips and badges */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 14px; cursor: pointer; text-transform: lowercase; }
.chip[aria-pressed="true"] { background: var(--orange-wash); border-color: var(--orange); color: var(--orange-ink); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; background: var(--cloud); color: var(--ink-soft); white-space: nowrap; }
.badge.free { background: var(--cloud); color: var(--ink-soft); }
.badge.lite { background: var(--info-soft); color: var(--info-ink); }
.badge.fire { background: var(--fire-bg); color: var(--fire-gold); }
.badge.family { background: var(--lilac-soft); color: var(--lilac-ink); }
.badge.good { background: var(--good-soft); color: var(--good-ink); }
.badge.bad { background: var(--bad-soft); color: var(--bad-ink); }
.badge.warn { background: #FFF6CC; color: #6B5600; }
.badge.ios { background: #EEF0F3; color: #2B2B2B; } .badge.android { background: var(--good-soft); color: var(--good-ink); } .badge.web { background: var(--info-soft); color: var(--info-ink); }

/* ---- lists. On a phone a row is a small card; on a wide screen, a table row. */
.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 14px; border: 2px solid var(--line); border-radius: 18px; background: var(--paper); text-align: left; width: 100%; }
button.item { cursor: pointer; }
button.item:hover { border-color: var(--orange-soft); }
.item .t { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 13px; color: var(--muted); grid-column: 1 / -1; overflow-wrap: anywhere; }
.item .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; border: 2px solid var(--line); border-radius: 18px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 2px solid var(--line); white-space: nowrap; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 800; background: var(--cream); }
tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; min-width: 180px; }
th.sort { cursor: pointer; } th.sort[aria-sort] { color: var(--orange-ink); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }

/* ---- charts (plain SVG and plain boxes: nothing to load, nothing to break) */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar { fill: var(--orange); } .chart .bar.alt { fill: var(--info); } .chart .bar.neg { fill: var(--bad); } .chart .bar.pos { fill: var(--good); }
.chart .axis { stroke: var(--line); stroke-width: 2; } .chart text { font: 700 11px Nunito, sans-serif; fill: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--orange); }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; margin-bottom: 10px; }
.hbar .lab { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .val { font-weight: 900; font-variant-numeric: tabular-nums; }
.hbar .track { grid-column: 1 / -1; height: 14px; background: var(--cloud); border-radius: 999px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--orange); border-radius: 999px; min-width: 2px; }
.hbar .fill.alt { background: var(--info); } .hbar .fill.good { background: var(--good); } .hbar .fill.bad { background: var(--bad); } .hbar .fill.lilac { background: var(--lilac); }
.hbar .drop { grid-column: 1 / -1; font-size: 12px; color: var(--bad-ink); font-weight: 800; }
.split { display: flex; height: 22px; border-radius: 999px; overflow: hidden; background: var(--cloud); }
.split span { display: block; height: 100%; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.heat th, .heat td { border: 0; padding: 6px 4px; text-align: center; border-radius: 8px; background: none; min-width: 38px; }
.heat td.c { font-weight: 800; color: var(--ink); }

/* the sum that ends in profit */
.sum { display: grid; gap: 0; }
.sum .l { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 9px 0; border-bottom: 2px dashed var(--line); align-items: baseline; }
.sum .l .k small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.sum .l .v { font-weight: 900; font-variant-numeric: tabular-nums; }
.sum .l.minus .v { color: var(--bad-ink); }
.sum .l.zero .v { color: var(--muted); }
.sum .l.sub { border-bottom: 2px solid var(--ink); } .sum .l.sub .k, .sum .l.sub .v { font-weight: 900; }
.sum .l.total { border: 0; padding-top: 14px; } .sum .l.total .k { font-size: 20px; font-weight: 900; } .sum .l.total .v { font-size: 28px; }
.sum .l.total.good .v { color: var(--good-ink); } .sum .l.total.bad .v { color: var(--bad-ink); }

/* ---- empty and loading */
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 28px 16px; color: var(--muted); }
.empty img { width: 96px; height: auto; }
.empty b { color: var(--ink); font-size: 17px; font-weight: 900; }
.empty p { max-width: 46ch; font-size: 15px; }
.skel { border-radius: 18px; background: linear-gradient(90deg, var(--cloud) 25%, #FAF8F2 37%, var(--cloud) 63%); background-size: 400% 100%; animation: sk 1.2s ease infinite; min-height: 84px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } .btn { transition: none; } }

/* ---- the sheet: one person, one bug, one form. Full height on a phone. */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(43, 43, 43, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet .panel { background: var(--paper); width: 100%; max-width: 720px; max-height: 94dvh; overflow-y: auto; border-radius: 28px 28px 0 0; padding: 18px var(--gut) calc(24px + env(safe-area-inset-bottom)); }
.sheet .bar { display: flex; align-items: start; justify-content: space-between; gap: 12px; position: sticky; top: -18px; background: var(--paper); padding: 18px 0 12px; margin-top: -18px; z-index: 2; }
.sheet .bar h2 { text-transform: none; overflow-wrap: anywhere; }
.sheet .x { flex: none; width: 40px; height: 40px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); font-weight: 900; font-size: 18px; cursor: pointer; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 800; overflow-wrap: anywhere; }
pre.log { background: var(--fire-bg); color: var(--fire-text); border-radius: 14px; padding: 12px; font: 500 12px/1.5 ui-monospace, Menlo, monospace; overflow: auto; max-height: 280px; white-space: pre-wrap; overflow-wrap: anywhere; }
.shot { max-height: 420px; border-radius: 14px; border: 2px solid var(--line); }
.steps { display: flex; flex-wrap: wrap; gap: 6px; } .steps .badge { text-transform: none; letter-spacing: 0; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 800; font-size: 14px; box-shadow: 0 8px 18px rgba(0, 0, 0, .24); max-width: calc(100vw - 32px); text-align: center; }
.toast.bad { background: var(--bad-ink); }

/* ---- signing in */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gut); background: var(--cream); }
.gate .box { width: 100%; max-width: 420px; background: var(--paper); border: 2px solid var(--line); border-radius: 28px; padding: 28px 22px; box-shadow: var(--shadow); }
.gate .hello { display: flex; align-items: end; gap: 14px; margin-bottom: 18px; }
.gate .hello img { width: 78px; height: auto; flex: none; }
.gate h1 { font-size: 26px; text-transform: lowercase; }
.gate .sub { color: var(--muted); font-size: 15px; margin: 6px 0 18px; }
.gate .alt { margin-top: 16px; text-align: center; font-size: 14px; }

/* ---- wider screens */
@media (min-width: 720px) {
  :root { --gut: 24px; }
  h1 { font-size: 34px; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet { align-items: center; } .sheet .panel { border-radius: 28px; max-height: 88dvh; }
  main { padding-top: 28px; }
}
@media (min-width: 1100px) {
  body { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  #chrome { display: contents; }
  #top { grid-column: 1 / -1; position: sticky; top: 0; z-index: 20; }
  #tabs { position: sticky; top: 60px; align-self: start; flex-direction: column; overflow: visible; border-bottom: 0; border-right: 2px solid var(--line); height: calc(100dvh - 60px); padding: 16px 12px; }
  #tabs a { border-radius: 14px; }
  .gate { grid-column: 1 / -1; }
}
@media print { #top, #tabs, .btn, .filters { display: none !important; } main { padding: 0; } }
