:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --ink: #16202a;
    --muted: #64717e;
    --line: #dde3e9;
    --accent: #0f766e;
    --accent-ink: #ffffff;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --radius: 12px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f151b;
        --surface: #182028;
        --ink: #e8edf2;
        --muted: #93a1ae;
        --line: #2a3541;
        --accent: #2dd4bf;
        --accent-ink: #062b27;
        --danger: #f97066;
        --danger-soft: #3a1d1b;
    }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 0; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 8px 0 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.narrow { max-width: 380px; margin: 12vh auto 0; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .92rem; }
label .muted { font-weight: 400; }
input[type=text], input[type=password], input[type=number], select {
    width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
    background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
input:focus-visible, select:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 14px; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
    color: var(--ink); background: var(--surface); border: 1px solid var(--line);
    border-radius: 8px; text-decoration: none; min-height: 40px;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .8rem; }
.alert { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }

.folder-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.qr-thumb { flex: none; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; line-height: 0; }
.linkrow { display: flex; gap: 8px; margin: 12px 0; }
.linkrow input { flex: 1; min-width: 0; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.renew { flex-basis: 100%; }
.renew summary { list-style: none; display: inline-flex; }
.renew summary::-webkit-details-marker { display: none; }
.renew form { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-align: center; padding: 20px; max-width: 92vw; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog img { display: block; margin: 0 auto 8px; max-width: 100%; height: auto; background: #fff; padding: 8px; border-radius: 8px; }

.drop {
    display: grid; gap: 4px; justify-items: center; text-align: center; cursor: pointer;
    padding: 28px 16px; border: 2px dashed var(--line); border-radius: var(--radius);
    font-weight: 400;
}
.drop strong { color: var(--accent); font-size: 1.05rem; }
.drop.over { border-color: var(--accent); background: var(--bg); }
.queue, .files { list-style: none; margin: 0; padding: 0; }
.queue li { margin-top: 10px; font-size: .9rem; }
.queue .bar { height: 6px; margin-top: 4px; background: var(--line); border-radius: 3px; overflow: hidden; }
.queue .bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.queue .err { color: var(--danger); }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.list-head h2 { margin: 0; }
.files li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.files li:first-child { border-top: 0; }
.fname { color: var(--ink); font-weight: 600; word-break: break-all; text-decoration: none; }
.fname:hover { color: var(--accent); text-decoration: underline; }
.files li form { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
