/* Layout: one centered column; summary tiles, then attention cards, then folder groups. */
:root {
  --bg: #f6f6f3;
  --panel: #ffffff;
  --fg: #1d1f1c;
  --muted: #676b63;
  --line: #e2e3dc;
  --accent: #b5532f;
  --warn: #a4570c;
  --warn-bg: #f8ebdc;
  --ok: #2f7a4b;
  --ok-bg: #e2f1e6;
  --focus: #1d1f1c;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: ui-rounded, -apple-system, "SF Pro Rounded", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161715;
    --panel: #1f201e;
    --fg: #ecece7;
    --muted: #9da196;
    --line: #33352f;
    --accent: #e08a62;
    --warn: #f0a85c;
    --warn-bg: #3a2c1c;
    --ok: #7fcb97;
    --ok-bg: #1e3326;
    --focus: #ecece7;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 var(--font);
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; }

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding-top: max(28px, env(safe-area-inset-top));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.head { display: flex; flex-direction: column; gap: 6px; }
.head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 1.75rem; font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.lede { margin: 0; max-width: 62ch; color: var(--muted); }
.lede b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { font-size: 0.8rem; color: var(--muted); }
.tile-num { font-family: var(--font-num); font-size: 2rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-warn .tile-num { color: var(--warn); }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 0.85rem; color: var(--muted); }
.bar select { min-width: 12rem; max-width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }

.section { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); gap: 12px; }

.card, .row { position: relative; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.card:hover, .row:hover { border-color: var(--muted); }
.card:focus-within, .row:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.main { text-decoration: none; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.main::after { content: ""; position: absolute; inset: 0; }
.main:focus-visible { outline: none; }
.dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); align-self: center; }
.ask, .sum { margin: 0; font-size: 0.86rem; line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.sum { color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 0 12px; margin-top: auto; font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.alt { position: relative; z-index: 1; color: var(--muted); text-underline-offset: 2px; white-space: nowrap; }
.alt:hover { color: var(--fg); }

.chip { flex: none; font-size: 0.74rem; line-height: 1; padding: 4px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.chip-warn { color: var(--warn); background: var(--warn-bg); }
.chip-ok { color: var(--ok); background: var(--ok-bg); }
.chip-info { color: var(--fg); border-color: var(--line); }
.chip-muted { color: var(--muted); border-color: var(--line); }

.groups { display: flex; flex-direction: column; gap: 16px; }
.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ghead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.gname { font-weight: 600; overflow-wrap: anywhere; }
.gmachine, .gcount { font-size: 0.8rem; color: var(--muted); }
.gcount { margin-left: auto; font-variant-numeric: tabular-nums; }
.rows { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: baseline;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.rows > .row:last-child { border-bottom: 0; }
.row .body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .ask, .row .sum { -webkit-line-clamp: 1; }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 0.78rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row .chip { grid-column: 1 / -1; justify-self: start; }
}

.more { border-top: 1px solid var(--line); padding-top: 16px; }
.more > summary { cursor: pointer; font-weight: 600; }
.more .rows { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.empty { margin: 0; color: var(--muted); font-size: 0.86rem; }

.link-button { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: 0.85rem; }

/* Login */
.login-shell { min-height: 100vh; justify-content: center; align-items: center; }
.login-card { width: min(100%, 380px); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 1.4rem; }
.login-card p { margin: 0; }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.04em; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.field input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 16px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 0.88rem; }
.error { color: var(--warn); font-size: 0.88rem; }
.primary { padding: 10px 14px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
