:root {
  --bg: #F6F7F9; --panel: #FFFFFF; --panel2: #F0F2F5; --line: #DADDE3; --ink: #0F1218; --ink2: #3E4554; --ink3: #5F6776;
  --accent: #4F46E5; --accentInk: #FFFFFF; --accentSoft: #ECEBFF; --focus: #4F46E5;
  --warnBg: #FFF4D6; --warnInk: #6B4A00; --warnLine: #E9CF86;
  --okBg: #E3F4EA; --okInk: #145C33; --badBg: #FDE8E6; --badInk: #9B1C12;
  --p0: #B42318; --p1: #B5470D; --p2: #8A6A00; --p3: #4D5B6B; --p4: #5B4BB0;
  --radius: 12px; --tap: 48px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D0F14; --panel: #151821; --panel2: #1B1F2A; --line: #2A3040; --ink: #ECEEF3; --ink2: #C2C8D4; --ink3: #9AA3B3;
    --accent: #7C75FF; --accentInk: #0D0F14; --accentSoft: #24224A; --focus: #A5A0FF;
    --warnBg: #2B2410; --warnInk: #F4D27A; --warnLine: #5A4815;
    --okBg: #12301E; --okInk: #8FE3B0; --badBg: #3A1614; --badInk: #FFA39B;
    --p0: #FF8A80; --p1: #FFB078; --p2: #F2CC5C; --p3: #A7B3C4; --p4: #B9AEF5;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 17px; line-height: 1.45; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--ink3); } .center { text-align: center; } .pad { padding: 24px 16px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 750; color: var(--ink); text-decoration: none; font-size: 17px; }
#nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
#nav a { color: var(--ink2); text-decoration: none; padding: 10px 12px; border-radius: 9px; font-weight: 600; font-size: 15px; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
#nav a.on { background: var(--panel2); color: var(--ink); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }
main.wide { max-width: 1080px; }
h1 { font-size: 26px; line-height: 1.15; margin: 8px 0 14px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 22px 0 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 14px; }

button, .btn { font: inherit; min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accentInk); }
button.block, .btn.block { width: 100%; }
button.ghost { background: transparent; }
button.small { min-height: 40px; padding: 0 12px; font-size: 15px; }
button.danger { color: var(--badInk); border-color: var(--badInk); background: transparent; }
button:disabled { opacity: .55; cursor: default; }

label.f { display: block; font-weight: 650; font-size: 15px; margin-bottom: 6px; }
.hint { font-size: 14px; color: var(--ink3); margin-top: 4px; }
input[type=text], input[type=email], textarea, select { font: inherit; font-size: 17px; width: 100%; min-height: var(--tap); padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
textarea { min-height: 104px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink3); }

.notice { background: var(--warnBg); color: var(--warnInk); border: 1px solid var(--warnLine); border-radius: 12px; padding: 11px 13px; font-size: 14.5px; line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: var(--tap); padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 600; }
.chip[aria-pressed=true] { background: var(--accentSoft); border-color: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }

.pick { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; border: 2px dashed var(--line); border-radius: 14px; background: var(--panel); color: var(--ink2); font-weight: 650; cursor: pointer; position: relative; }
.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.files { list-style: none; padding: 0; margin: 10px 0 0; }
.file { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin-bottom: 8px; }
.thumb { width: 52px; height: 52px; border-radius: 9px; background: var(--panel2); object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; }
.fname { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmeta { font-size: 13.5px; color: var(--ink3); }
.bar { height: 6px; border-radius: 3px; background: var(--panel2); overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.state-ok { color: var(--okInk); font-weight: 650; } .state-bad { color: var(--badInk); font-weight: 650; }

.details summary { cursor: pointer; font-weight: 650; min-height: var(--tap); display: flex; align-items: center; color: var(--ink2); }
.sticky-send { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }

.done { text-align: center; padding: 28px 16px; }
.done .big { font-size: 44px; line-height: 1; }
.done .key { font-size: 30px; font-weight: 800; letter-spacing: .01em; margin: 10px 0 4px; }

.list { list-style: none; padding: 0; margin: 0; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 13px 14px; border-bottom: 1px solid var(--line); background: var(--panel); text-decoration: none; color: var(--ink); min-height: 60px; }
.list .item:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.list .item:last-child { border-bottom: 0; border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.listwrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.k { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13.5px; color: var(--ink3); }
.t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sub { font-size: 13.5px; color: var(--ink3); }
.pri { font-size: 12.5px; font-weight: 800; padding: 2px 7px; border-radius: 6px; border: 1px solid currentColor; }
.pri.P0 { color: var(--p0); } .pri.P1 { color: var(--p1); } .pri.P2 { color: var(--p2); } .pri.P3 { color: var(--p3); } .pri.P4 { color: var(--p4); }
.blk { font-size: 12px; font-weight: 800; color: var(--badInk); background: var(--badBg); padding: 2px 7px; border-radius: 6px; }
.status { font-size: 13.5px; font-weight: 650; color: var(--ink2); white-space: nowrap; }

.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.meta div { background: var(--panel2); border-radius: 10px; padding: 9px 11px; }
.meta b { display: block; font-size: 12.5px; color: var(--ink3); font-weight: 650; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.gallery img, .gallery video { display: block; width: 100%; max-height: 360px; object-fit: contain; background: #000; }
.gallery figcaption { padding: 7px 9px; font-size: 13px; color: var(--ink3); display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.activity { list-style: none; padding: 0; margin: 0; font-size: 15px; }
.activity li { padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--ink2); }
.err { background: var(--badBg); color: var(--badInk); border-radius: 12px; padding: 11px 13px; font-weight: 600; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar select { width: auto; min-width: 180px; }
table.users { width: 100%; border-collapse: collapse; font-size: 15px; }
table.users td, table.users th { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }

.hero { text-align: center; padding: 56px 8px 24px; }
.hero img { width: 64px; height: 64px; }
.hero h1 { margin-top: 16px; }

/* Narrow phones: keep all tabs and Sign out on one line */
#signout { white-space: nowrap; flex-shrink: 0; }
.brand { flex-shrink: 0; }
@media (max-width: 520px) {
  .top { gap: 6px; padding: 8px 10px; }
  .brand span { display: none; }
  #nav { gap: 2px; }
  #nav a { padding: 10px 9px; font-size: 15px; }
  #signout { padding-left: 10px; padding-right: 10px; }
}
.f { display: block; font-weight: 650; font-size: 15px; margin-bottom: 6px; }
.details summary::before { content: "›"; display: inline-block; margin-right: 8px; transition: transform .15s; font-size: 20px; }
.details[open] summary::before { transform: rotate(90deg); }
.details summary { list-style: none; } .details summary::-webkit-details-marker { display: none; }
