/* Phone-first single column; office tables widen on PC */
:root {
  --navy: #14365A; --navy-2: #1f4a75; --orange: #F28C28; --orange-ink: #9a4d05;
  --bg: #f3f5f8; --panel: #ffffff; --line: #d9e0e8; --ink: #15212e; --muted: #5b6b7c;
  --ok: #1f7a4a; --ok-bg: #e3f4ea; --warn-bg: #fff1e2; --bad: #a3302a; --bad-bg: #fbe7e5; --chip: #e9eef4;
  --f-display: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1620; --panel: #152230; --line: #2a3a4c; --ink: #e6edf4; --muted: #9aabbd;
    --ok: #7fd4a4; --ok-bg: #173527; --warn-bg: #3a2a17; --bad: #f2a29c; --bad-bg: #3d1e1c; --chip: #1f3044;
    --orange-ink: #f6b06a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1620; --panel: #152230; --line: #2a3a4c; --ink: #e6edf4; --muted: #9aabbd;
  --ok: #7fd4a4; --ok-bg: #173527; --warn-bg: #3a2a17; --bad: #f2a29c; --bad-bg: #3d1e1c; --chip: #1f3044;
  --orange-ink: #f6b06a; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--f-body); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; margin: 0; }
h2 { font-size: 20px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.top { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px; position: sticky; top: 0; z-index: 5; }
.top img { width: 32px; height: 32px; }
.top h1 { font-size: 22px; white-space: nowrap; }
@media (max-width: 420px) { .top h1 { font-size: 19px; } .top .me { font-size: 13px; } }
.top h1 span { color: var(--orange); }
.top .me { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 14px; min-width: 0; }
.top .me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost { background: transparent; border: 1px solid #ffffff55; color: #fff; border-radius: 8px; padding: 4px 10px; cursor: pointer; white-space: nowrap; }

.tabs { display: flex; gap: 4px; overflow-x: auto; background: var(--navy-2); padding: 0 12px; position: sticky; top: 52px; z-index: 4; }
.tabs button { background: none; border: 0; color: #fff; opacity: .75; padding: 10px 12px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { opacity: 1; border-bottom-color: var(--orange); }

main { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
main.wide { max-width: 1200px; }
.pad { padding: 24px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.card h2 { margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: 14px; margin-bottom: 12px; }

label { display: block; font-weight: 500; font-size: 14px; margin: 12px 0 4px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); min-height: 46px; }
input[type="file"] { padding: 8px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 12px 18px;
  background: var(--orange); color: #1b1006; font-weight: 600; cursor: pointer; min-height: 46px; text-decoration: none; }
.btn.full { width: 100%; margin-top: 16px; }
.btn.sec { background: var(--chip); color: var(--ink); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 14px; font-weight: 500; }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }

.status { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-weight: 500; }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.warn { background: var(--warn-bg); color: var(--orange-ink); }
.status.bad { background: var(--bad-bg); color: var(--bad); }
.summary { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 500; }
.list { list-style: none; padding: 0; margin: 8px 0 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.pin { letter-spacing: .4em; font-size: 22px; text-align: center; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 12px; }
.filters > div { flex: 1 1 160px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--chip); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.mute { background: var(--chip); color: var(--muted); }
.link { color: var(--navy-2); text-decoration: underline; cursor: pointer; background: none; border: 0; padding: 0; }
:root[data-theme="dark"] .link { color: #9cc3ea; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .link { color: #9cc3ea; } }
.copy { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 15px; z-index: 20; max-width: calc(100% - 32px); }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); width: min(520px, calc(100% - 32px)); padding: 16px; }
dialog::backdrop { background: #0008; }
dialog img { max-width: 100%; border-radius: 8px; }
