:root {
  --bg: #f4f1ea; --card: #ffffff; --ink: #1d2b2b; --muted: #5d6b6b; --line: #ddd7ca;
  --brand: #0f3d3e; --brand-ink: #ffffff; --accent: #e0a458;
  --good: #1f9d5b; --mid: #c98a1b; --low: #b3261e; --soft: #ebe6da;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101a1a; --card: #182424; --ink: #eef2ef; --muted: #9fb0ae; --line: #2a3b3b;
    --brand: #4fb3a6; --brand-ink: #0b1717; --soft: #213030;
    --good: #4cd08a; --mid: #f0b24a; --low: #ff8a80;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
button, .btn { font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; cursor: pointer; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); text-decoration: none; display: inline-block; }
button.secondary, .btn.secondary { background: transparent; color: var(--brand); }
button.danger { background: var(--low); border-color: var(--low); color: #fff; }
button.link { background: none; border: none; padding: 0; color: var(--brand); text-decoration: underline; font-weight: 500; }
button.small, .btn.small { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
input, select, textarea { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); max-width: 100%; }
textarea { width: 100%; min-height: 70px; }
label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 17px; padding: 0 8px 14px; display: flex; align-items: center; gap: 8px; }
.mark { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 14px; }
.side a.nav { padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
.side a.nav:hover { background: var(--soft); }
.side a.nav[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
.side .who { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
main { padding: 24px; max-width: 1150px; width: 100%; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side .who { margin-top: 0; border: 0; padding: 0; }
  main { padding: 14px; }
}

/* tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--soft); }

/* bits */
.bar { width: 90px; height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; display: inline-block; vertical-align: middle; }
.bar span { display: block; height: 100%; border-radius: 99px; background: currentColor; }
.bar.good { color: var(--good); } .bar.mid { color: var(--mid); } .bar.low { color: var(--low); }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); display: inline-block; }
.pill.tracking { color: var(--good); border-color: var(--good); }
.pill.online { color: var(--mid); border-color: var(--mid); }
.pill.offline { color: var(--muted); }
.pill.warn { color: var(--low); border-color: var(--low); }
.pill.pending { color: var(--mid); border-color: var(--mid); }
.pill.approved { color: var(--good); border-color: var(--good); }
.pill.rejected { color: var(--low); border-color: var(--low); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }
.toasts, #toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; max-width: 360px; }
.toast.error { background: var(--low); color: #fff; }

/* timeline */
.iv { border: 1px solid var(--line); border-left-width: 5px; border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--card); }
.iv .top { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: baseline; }
.iv .apps { margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.shots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
img.shot { width: 160px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--soft); cursor: zoom-in; }
img.shot.failed { cursor: default; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; }
.gallery img.shot { width: 100%; height: 130px; }
.gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* dialogs and forms */
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); padding: 18px; max-width: min(92vw, 560px); width: 100%; }
dialog.wide { max-width: min(96vw, 1100px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog img.full { max-width: 100%; max-height: 74vh; display: block; margin: 0 auto 10px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.secret { font: 600 16px ui-monospace, Consolas, monospace; background: var(--soft); padding: 10px 12px; border-radius: 8px; user-select: all; word-break: break-all; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 400px; padding: 28px; }
.error-text { color: var(--low); font-weight: 600; }
