:root {
  --bg: #f4f5f2; --card: #ffffff; --ink: #1d2320; --muted: #66706a; --line: #dfe3dd;
  --accent: #1f7a4d; --accent-ink: #ffffff; --warn: #b5560b; --bad: #b3261e; --good: #1f7a4d;
  --radius: 12px; color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121614; --card: #1b201d; --ink: #e8ece9; --muted: #9aa49e; --line: #2c332f; --accent: #3fae75; --accent-ink: #08130d; --warn: #e39a4f; --bad: #ef7a72; --good: #4cc286; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
header.top { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; }
header.top h1 { font-size: 18px; margin: 0; flex: 1; }
header.top .logo { width: 28px; height: 28px; }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 16px; margin: 0 0 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }
input, select, button { font: inherit; }
input[type=text], input[type=password], input[type=email], input[type=number], select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); min-width: 0; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; font-weight: 500; min-height: 44px; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
.muted { color: var(--muted); font-size: 14px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--bg); border: 1px solid var(--line); }
.pill.done { color: var(--good); } .pill.failed { color: var(--bad); } .pill.processing, .pill.queued, .pill.submitting, .pill.downloading { color: var(--warn); }
.bar { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 8px 0; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .4s; }
.qr { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.qr figure { margin: 0; text-align: center; font-size: 13px; word-break: break-all; }
.qr img { width: 100%; max-width: 170px; background: #fff; border-radius: 8px; padding: 6px; }
pre.log { background: #0d100e; color: #cfe7d6; font-size: 12px; padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto; white-space: pre-wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: calc(100% - 32px); opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
[hidden] { display: none !important; }
/* v0.4: floating action buttons + bottom sheets + tiles */
.fabs { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.fab { width: 60px; height: 60px; min-height: 0; padding: 0; border-radius: 50%; border: none; background: var(--accent); color: var(--accent-ink); font-size: 30px; line-height: 1; box-shadow: 0 6px 18px #0005; }
.fab.small { width: 48px; height: 48px; font-size: 20px; background: var(--card); color: var(--accent); border: 1px solid var(--line); }
.fab svg { width: 26px; height: 26px; fill: currentColor; }
.fab.small svg { width: 20px; height: 20px; }
.scrim { position: fixed; inset: 0; background: #0007; z-index: 30; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 88vh; overflow: auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 8px 16px max(18px, env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px #0006; }
@media (min-width: 700px) { .sheet { left: 50%; transform: translateX(-50%); width: 640px; bottom: 24px; border-radius: 18px; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 10px; }
.sheet h2 { font-size: 18px; margin: 4px 0 12px; display: flex; align-items: center; gap: 8px; }
.sheet h2 span { flex: 1; }
.menu { display: grid; gap: 2px; }
.menu > a, .menu > button { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 500; min-height: 44px; justify-content: flex-start; border: none; background: none; border-radius: 10px; padding: 12px 10px; font-size: 16px; color: var(--ink); width: 100%; text-align: left; }
.menu > a:hover, .menu > button:hover { background: var(--bg); }
.menu .ic { width: 28px; text-align: center; font-size: 20px; }
.menu small { display: block; color: var(--muted); font-weight: 400; }
.menu .danger { color: var(--bad); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.tile { display: block; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.tile .img { aspect-ratio: 4 / 3; background: var(--bg) center / cover no-repeat; display: grid; place-items: center; font-size: 34px; color: var(--muted); position: relative; }
.tile .name { padding: 8px 10px 10px; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .badge { position: absolute; left: 8px; top: 8px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #000a; color: #fff; }
.tile .badge.failed { background: var(--bad); }
.tile .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #0005; }
.tile .prog i { display: block; height: 100%; background: var(--accent); }
