:root {
  --ink: #16191d;
  --muted: #6b7280;
  --line: #e3e6ea;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #1f6feb;
  --bad: #b42318;
  --ok: #157347;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 650; text-decoration: none; color: var(--ink); letter-spacing: -0.01em; }
.bar nav { display: flex; gap: 16px; flex: 1; }
.bar nav a { text-decoration: none; color: var(--muted); }
.bar nav a.on { color: var(--ink); font-weight: 550; }
.who { color: var(--muted); font-size: 13px; }

main { max-width: 900px; margin: 24px auto; padding: 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 8px; color: var(--muted); font-weight: 550; }

.flash {
  background: #fff4ed;
  border: 1px solid #ffd9c2;
  border-radius: 8px;
  padding: 10px 14px;
}

/* upload */
.drop {
  display: block;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #f5f9ff; }
.drop-title { display: block; font-size: 17px; font-weight: 550; }
.drop-sub { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }

.chosen { list-style: none; margin: 14px 0 0; padding: 0; text-align: left; font-size: 13px; }
.chosen li { padding: 3px 0; border-top: 1px solid var(--line); color: var(--muted); }
.chosen li b { color: var(--ink); font-weight: 500; }

/* tools */
.tools { border: 0; padding: 16px 0 0; margin: 0; }
.tools legend { font-size: 13px; color: var(--muted); padding: 0; }
.tool {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 8px;
  cursor: pointer;
}
.tool:has(input:checked) { border-color: var(--accent); background: #f5f9ff; }
.tool input { grid-row: span 2; align-self: center; }
.tool-label { font-weight: 550; }
.tool-blurb { color: var(--muted); font-size: 13px; }
.tool.dimmed { opacity: .45; }

/* settings */
.settings { margin-top: 16px; font-size: 14px; }
.settings summary { cursor: pointer; color: var(--ink); }
.settings-group { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 0 0; }
.settings-group label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.settings-group input { width: 88px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.unit { font-size: 12px; }

button, .button {
  display: inline-block;
  margin-top: 18px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 550;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
button[disabled] { background: #b9c2cd; cursor: default; }

/* one job */
.job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.meta { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 14px 0 0; padding: 0; }
.chips li {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 10px;
}
.chips b { color: var(--ink); font-weight: 600; }

.sheets { list-style: none; margin: 18px 0 0; padding: 0; }
.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.sheet-name { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.sheet-stat {
  margin: 0;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.sheet-files { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }

.file {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}
.file:hover { border-color: var(--accent); background: #f5f9ff; }
.file svg { width: 15px; height: 15px; flex: none; color: var(--accent); }
.file-name { overflow-wrap: anywhere; }
.file-size { color: var(--muted); font-size: 12px; white-space: nowrap; }

.sheet.failed .sheet-name { color: var(--bad); }

.job-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.job-foot .button { margin-top: 0; }
.job-foot .muted { font-size: 12px; font-variant-numeric: tabular-nums; }
.swept { font-size: 13px; margin-top: 10px; }

/* history — every row has to be recognisable without opening it */
.log { list-style: none; margin: 14px 0 0; padding: 0; }
.log li { border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
.log a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 14px;
  padding: 12px 10px;
  margin: 0 -10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
}
.log a:hover { background: #f5f9ff; }
.log-file {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.log-file .more { color: var(--muted); font-weight: 400; margin-left: 6px; }
.log-codes { text-align: right; white-space: nowrap; }
.log-meta { grid-column: 1; color: var(--muted); font-size: 13px; }
.log-id {
  grid-column: 2;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.code {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}
.sheet-name .code { font-weight: 500; margin-left: 8px; }

.pill { font-size: 11px; padding: 2px 7px; border-radius: 20px; background: #eef1f4; color: var(--muted); }
.pill.telegram { background: #e7f1fb; color: #17608f; }
.pill.portal { background: #eef7ee; color: var(--ok); }

.muted { color: var(--muted); }
.bad { color: var(--bad); }

.recent h2 { margin-bottom: 4px; }

/* The page's own footer only — a <footer> inside a card is not this. */
body > footer {
  max-width: 900px;
  margin: 0 auto 40px;
  padding: 0 20px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 620px) {
  main { margin-top: 14px; }
  .card { padding: 16px; }
  /* Stats move under the filename rather than being squeezed beside it. */
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .sheet-stat { text-align: left; }
  /* One column: the explicit grid-column on the meta and id would otherwise
     keep a second one alive and put them back on the right. */
  .log a { grid-template-columns: minmax(0, 1fr); }
  .log-file, .log-codes, .log-meta, .log-id { grid-column: 1; text-align: left; }
  .log-codes { margin: 2px 0; }
  .log-file { white-space: normal; overflow-wrap: anywhere; }
}
