:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --line: #dedbd3;
  --ink: #1d1c1a;
  --ink-soft: #5d5a54;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --danger: #a3322a;
  --ok: #2f6f3e;
  --radius: 8px;
  --radius-small: 4px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171716;
    --surface: #222220;
    --line: #3a3936;
    --ink: #ecebe7;
    --ink-soft: #a9a69f;
    --accent: #7db4dc;
    --accent-ink: #10202b;
    --danger: #e0786f;
    --ok: #7cc28d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.page { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 32px 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.error { color: var(--danger); }
.hidden { display: none !important; }

button, .button {
  font: inherit;
  border-radius: var(--radius-small);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 14px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
button:hover { border-color: var(--ink-soft); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--danger); }
button.link { border: none; background: none; padding: 0; color: var(--accent); text-decoration: underline; }

label { display: block; font-weight: 600; margin: 14px 0 4px; }
input[type="text"], input[type="password"], textarea, select {
  font: inherit;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-small);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1 1 200px; min-width: 0; width: auto; }
.spaced { margin-top: 16px; }

.drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.drop.over { border-color: var(--accent); background: var(--surface); }

.files { list-style: none; margin: 12px 0 0; padding: 0; }
.files li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.files li:first-child { border-top: none; }
.files .name { flex: 1 1 14em; min-width: 0; overflow-wrap: anywhere; }
.files .size { color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }

.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 12px 0 6px; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 200ms ease; }

.linkbox { display: flex; gap: 8px; margin: 12px 0; }
.linkbox input { flex: 1 1 auto; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

table.list { width: 100%; border-collapse: collapse; }
table.list td { padding: 10px 8px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
table.list .title { overflow-wrap: anywhere; }
table.list .actions { white-space: nowrap; text-align: right; }
table.list .actions > * { margin-left: 6px; }
.state { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.state.ready { color: var(--ok); }

@media (max-width: 560px) {
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border-top: 1px solid var(--line); padding: 8px 0; }
  table.list td { border: none; padding: 2px 0; }
  table.list .actions { text-align: left; white-space: normal; }
  table.list .actions > * { margin: 6px 6px 0 0; }
}
