/* Webmail styles: Gmail-like layout, Roboto, Material icons, organisation colours via --brand / --accent. */
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/roboto-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/roboto-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/roboto-latin-700-normal.woff2") format("woff2"); }

:root {
  --brand: #1F4D3A; --accent: #F2A93B; --on-brand: #fff;
  --bg: #F6F8FC; --panel: #FFFFFF; --ink: #1F1F1F; --ink-2: #444746; --muted: #5E5E5E; --line: #E3E5E8;
  --hover: #F2F6FC; --row-unread: #FFFFFF; --row-read: #F2F6FC; --sel: #C2DBFF; --chip: #E8EAED;
  --danger: #B3261E; --ok: #146C2E; --focus: #0B57D0;
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --row-h: 40px; --radius: 16px;
  --tint: color-mix(in srgb, var(--accent) 22%, var(--panel));
  --tint-strong: color-mix(in srgb, var(--accent) 34%, var(--panel));
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111317; --panel: #1C1E22; --ink: #E3E3E3; --ink-2: #C4C7C5; --muted: #9AA0A6; --line: #2F3237;
  --hover: #262A30; --row-unread: #1C1E22; --row-read: #16181B; --sel: #24365A; --chip: #2F3237;
  --danger: #F2B8B5; --ok: #6DD58C; --focus: #A8C7FA; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #111317; --panel: #1C1E22; --ink: #E3E3E3; --ink-2: #C4C7C5; --muted: #9AA0A6; --line: #2F3237;
    --hover: #262A30; --row-unread: #1C1E22; --row-read: #16181B; --sel: #24365A; --chip: #2F3237;
    --danger: #F2B8B5; --ok: #6DD58C; --focus: #A8C7FA; color-scheme: dark;
  }
}
body.density-comfortable { --row-h: 48px; }
body.density-compact { --row-h: 32px; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.43 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.3em; font-size: .9rem; margin: .4rem 0 0; }

.ic { width: 20px; height: 20px; fill: currentColor; flex: none; vertical-align: middle; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; }
.iconbtn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.iconbtn[disabled] { opacity: .38; cursor: default; background: none; }
.iconbtn.small { width: 32px; height: 32px; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 18px; padding: .5rem 1.1rem; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; color: var(--ink-2); }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .6; cursor: progress; }
label.f { display: block; font-size: .85rem; color: var(--muted); margin: .9rem 0 .3rem; }
input.f, select.f, textarea.f { width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
textarea.f { resize: vertical; min-height: 6rem; }

/* ---------- sign-in ---------- */
.signin { min-height: 100%; display: grid; place-items: center; padding: 1.5rem; background: var(--bg); }
.signin-card { width: min(440px, 100%); background: var(--panel); border-radius: 28px; padding: 2.5rem 2rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.signin-card.wide { width: min(560px, 100%); }
.secret.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem 1.5rem; font-size: 1.05rem; }
.signin-card .logo { width: 72px; height: 72px; border-radius: 16px; }
.signin-card h1 { font-size: 1.75rem; font-weight: 400; margin: 1.25rem 0 .25rem; }
.signin-card .btn.primary { margin-top: 1.5rem; width: 100%; justify-content: center; padding: .7rem; }
.lang-switch { margin-top: 1.25rem; text-align: center; }
.linkbtn { background: none; border: 0; color: var(--focus); cursor: pointer; padding: .2rem .4rem; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 256px 1fr; grid-template-rows: 64px 1fr; height: 100dvh; }
.shell.collapsed { grid-template-columns: 72px 1fr; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: .5rem; padding: 0 .75rem 0 .5rem; background: var(--brand); color: var(--on-brand); }
.top .iconbtn { color: var(--on-brand); }
.top .iconbtn:hover { background: rgba(255,255,255,.14); }
.brand { display: flex; align-items: center; gap: .6rem; min-width: 190px; font-size: 1.2rem; font-weight: 500; white-space: nowrap; }
.brand img { height: 34px; width: auto; max-width: 150px; object-fit: contain; }
.search { flex: 1; max-width: 720px; display: flex; align-items: center; gap: .25rem; background: rgba(255,255,255,.92); color: #1F1F1F; border-radius: 24px; height: 46px; padding: 0 .5rem; }
.search .iconbtn { color: #444746; }
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 1rem; color: #1F1F1F; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 500; font-size: .95rem; flex: none; user-select: none; }
.avatar.lg { width: 40px; height: 40px; font-size: 1.1rem; }
.avatar-btn { border: 2px solid rgba(255,255,255,.6); padding: 0; background: none; border-radius: 50%; cursor: pointer; }

.menu { position: fixed; z-index: 50; background: var(--panel); border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,.2); padding: .5rem 0; min-width: 260px; }
.menu .head { padding: .75rem 1rem; border-bottom: 1px solid var(--line); margin-bottom: .25rem; }
.menu button { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .6rem 1rem; border: 0; background: none; cursor: pointer; text-align: left; color: var(--ink); }
.menu button:hover { background: var(--hover); }

.side { overflow-y: auto; padding: .5rem .5rem 1rem 0; }
.compose-btn { display: inline-flex; align-items: center; gap: .9rem; margin: .5rem 0 1rem .5rem; padding: 1.1rem 1.4rem 1.1rem 1.1rem; border-radius: 16px; border: 0; background: var(--tint); color: var(--ink); font-weight: 500; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.compose-btn:hover { box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.collapsed .compose-btn span, .collapsed .nav-item .lbl, .collapsed .nav-item .count, .collapsed .side-h, .collapsed .quota { display: none; }
.collapsed .compose-btn { padding: 1rem; }
.nav { list-style: none; margin: 0; padding: 0; }
.nav-item { display: flex; align-items: center; gap: 1.1rem; width: 100%; height: 32px; padding: 0 .75rem 0 1.6rem; border: 0; background: none; border-radius: 0 16px 16px 0; cursor: pointer; color: var(--ink-2); text-align: left; }
.nav-item:hover { background: var(--hover); }
.nav-item[aria-current="true"] { background: var(--tint-strong); color: var(--ink); font-weight: 700; }
.nav-item .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: .8rem; font-weight: 700; }
.side-h { margin: 1rem 0 .25rem 1.6rem; font-size: .9rem; font-weight: 500; color: var(--ink-2); }
.dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.quota { margin: 1.5rem 0 0 1.6rem; font-size: .75rem; color: var(--muted); }
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: .3rem; overflow: hidden; width: 160px; }
.bar i { display: block; height: 100%; background: var(--brand); }

.main { background: var(--panel); border-radius: var(--radius); margin: 0 1rem 1rem 0; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: .1rem; padding: .35rem .5rem .35rem 1rem; min-height: 48px; border-bottom: 1px solid var(--line); }
.toolbar .sp { flex: 1; }
.pager { display: flex; align-items: center; gap: .25rem; font-size: .8rem; color: var(--muted); }
.chk { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; margin: 0 .6rem; }
.scroll { flex: 1; overflow-y: auto; }
.banner { margin: .5rem 1rem; padding: .6rem 1rem; border-radius: 8px; background: var(--hover); color: var(--ink-2); font-size: .9rem; display: flex; align-items: center; gap: .75rem; }

/* message rows */
.row { display: grid; grid-template-columns: 36px 32px minmax(120px, 200px) 1fr auto; align-items: center; height: var(--row-h); padding: 0 1rem 0 .5rem; border-bottom: 1px solid var(--line); cursor: pointer; background: var(--row-read); position: relative; }
.row.unread { background: var(--row-unread); font-weight: 700; }
.row:hover { box-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px rgba(60,64,67,.3); z-index: 1; }
.row.selected { background: var(--sel); }
.row .who, .row .what { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 1rem; }
.row .what .snip { color: var(--muted); font-weight: 400; }
.row .meta { display: flex; align-items: center; gap: .4rem; font-size: .8rem; white-space: nowrap; }
.row .hover-actions { display: none; }
.row:hover .hover-actions { display: flex; }
.row:hover .date { display: none; }
.star { color: var(--muted); }
.star.on { color: #F4B400; }
.tag { display: inline-block; font-size: .72rem; padding: 0 .4rem; border-radius: 4px; background: var(--chip); color: var(--ink-2); margin-right: .4rem; font-weight: 500; vertical-align: 1px; }
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); }

/* reading view */
.reader { padding: 1.25rem 1.5rem 2rem 4.5rem; }
.reader h2 { font-size: 1.375rem; font-weight: 400; margin: 0 0 1rem -3rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; overflow-wrap: anywhere; }
.msg-head { display: grid; grid-template-columns: 40px 1fr auto; gap: .75rem; margin-left: -3rem; align-items: start; }
.msg-head .name { font-weight: 700; }
.msg-head .addr, .msg-head .to { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.msg-head .when { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: .25rem; white-space: nowrap; }
.badges { display: flex; gap: .3rem; margin: .5rem 0 0; flex-wrap: wrap; }
.badge { font-size: .7rem; padding: 0 .45rem; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.badge.pass { color: var(--ok); border-color: currentColor; }
.badge.fail { color: var(--danger); border-color: currentColor; }
.notice { margin: .75rem 0 0; padding: .6rem .9rem; border-radius: 8px; background: var(--hover); font-size: .875rem; }
.notice.bad { background: color-mix(in srgb, var(--danger) 12%, var(--panel)); color: var(--danger); }
.atts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.att { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 8px; padding: .45rem .7rem; color: var(--ink); text-decoration: none; font-size: .85rem; }
.att:hover { background: var(--hover); }
.frame { width: 100%; height: 320px; border: 0; margin-top: .75rem; background: #fff; border-radius: 8px; display: block; }
.thread { margin-left: -3rem; }
.mcard { border-bottom: 1px solid var(--line); padding: .9rem 0; }
.mcard.open .msg-head { margin-left: 0; cursor: pointer; }
.mcard-collapsed { display: grid; grid-template-columns: 32px auto 1fr auto; gap: .75rem; align-items: center; cursor: pointer; padding: .2rem 0; }
.mcard-collapsed .name { font-weight: 700; white-space: nowrap; }
.mcard-collapsed .snip { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mcard-collapsed .when { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.more-msgs { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: var(--hover); color: var(--ink-2); padding: .6rem; cursor: pointer; font-weight: 500; }
.row .cnt { color: var(--muted); font-weight: 400; font-size: .8rem; }
.editor { flex: 1; min-height: 12rem; outline: none; padding: .75rem 0; line-height: 1.5; overflow-wrap: anywhere; }
.editor blockquote { color: var(--muted); }
.editor .sig { color: var(--muted); }
.fmtbar { display: flex; gap: .1rem; padding: .15rem .75rem; border-top: 1px solid var(--line); flex: none; overflow-x: auto; }
.reply-row { display: flex; gap: .75rem; margin-top: 1.25rem; }

/* compose window */
.compose { position: fixed; right: 24px; bottom: 0; width: 540px; max-width: calc(100vw - 16px); height: min(620px, calc(100dvh - 80px)); background: var(--panel); border-radius: 12px 12px 0 0; box-shadow: 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12); display: flex; flex-direction: column; z-index: 40; }
.compose.min { height: 40px; width: 280px; }
.compose.min .cbody, .compose.min .cfoot { display: none; }
.compose.max { right: 50%; bottom: 50%; transform: translate(50%, 50%); width: min(1000px, 92vw); height: 86dvh; border-radius: 12px; }
.chead { display: flex; align-items: center; height: 40px; padding: 0 .25rem 0 1rem; background: color-mix(in srgb, var(--brand) 12%, var(--panel)); border-radius: 12px 12px 0 0; font-weight: 500; cursor: pointer; flex: none; }
.chead .t { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cbody { flex: 1; display: flex; flex-direction: column; overflow: auto; padding: 0 1rem; }
.cfield { display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid var(--line); min-height: 40px; }
.cfield .k { color: var(--muted); min-width: 44px; }
.cfield input, .cfield select { flex: 1; border: 0; background: none; outline: none; padding: .5rem 0; min-width: 0; }
.cfield .linkbtn { color: var(--muted); font-size: .85rem; }
.cbody textarea { flex: 1; border: 0; outline: none; resize: none; padding: .75rem 0; background: none; min-height: 12rem; line-height: 1.5; }
.cfiles { display: flex; flex-wrap: wrap; gap: .4rem; padding: .25rem 0; }
.cfoot .sp { flex: 1; }
.cfoot { display: flex; align-items: center; gap: .25rem; padding: .6rem 1rem; flex: none; }
.send-btn { background: var(--focus); color: #fff; border: 0; border-radius: 18px; padding: .55rem 1.5rem; font-weight: 500; cursor: pointer; }
:root[data-theme="dark"] .send-btn { color: #062E6F; }
.send-btn[disabled] { opacity: .6; }

/* settings & admin pages */
.page { padding: 0 1.5rem 2rem; }
.page h1 { font-size: 1.375rem; font-weight: 400; margin: 1.25rem 0 0; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 1rem 0 0; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: .75rem 1rem; cursor: pointer; border-bottom: 3px solid transparent; color: var(--ink-2); white-space: nowrap; font-weight: 500; }
.tabs button[aria-selected="true"] { color: var(--brand); border-color: var(--brand); }
:root[data-theme="dark"] .tabs button[aria-selected="true"] { color: var(--accent); border-color: var(--accent); }
.setrow { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.setrow > .k { font-weight: 500; }
.setrow > .k small { display: block; font-weight: 400; color: var(--muted); margin-top: .25rem; }
.setrow .opt { display: flex; align-items: center; gap: .5rem; margin: .25rem 0; }
.setrow input[type="radio"], .setrow input[type="checkbox"] { accent-color: var(--brand); width: 16px; height: 16px; }
.actions { display: flex; gap: .75rem; padding: 1.25rem 0; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.scroll-x { overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; padding: .7rem; background: var(--hover); border-radius: 8px; word-break: break-all; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: .35rem .7rem; cursor: pointer; font-size: .85rem; }

#toast { position: fixed; left: 24px; bottom: calc(24px + env(safe-area-inset-bottom)); background: #303030; color: #F2F2F2; padding: .8rem 1.1rem; border-radius: 4px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 30; }

/* ---------- phones & small tablets ---------- */
@media (max-width: 900px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; grid-template-rows: 64px 1fr; }
  .brand { min-width: 0; font-size: 1rem; }
  .brand .title { display: none; }
  .side { position: fixed; top: 0; bottom: 0; left: 0; width: 280px; background: var(--panel); z-index: 35; transform: translateX(-100%); transition: transform .2s; padding-top: 1rem; }
  .shell.drawer .side { transform: none; }
  .collapsed .compose-btn span, .collapsed .nav-item .lbl, .collapsed .nav-item .count, .collapsed .side-h, .collapsed .quota { display: revert; }
  .main { margin: 0; border-radius: 0; }
  .row { grid-template-columns: 32px 1fr auto; grid-template-rows: auto auto; height: auto; padding: .6rem .75rem .6rem .25rem; row-gap: .1rem; }
  .row .chk { grid-row: 1 / span 2; }
  .row .starbtn { display: none; }
  .row .who { grid-column: 2; }
  .row .meta { grid-column: 3; grid-row: 1; }
  .row .what { grid-column: 2 / span 2; grid-row: 2; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .row:hover .hover-actions { display: none; }
  .row:hover .date { display: inline; }
  .reader { padding: 1rem; }
  .reader h2, .msg-head, .thread { margin-left: 0; }
  .setrow { grid-template-columns: 1fr; gap: .5rem; }
  .compose, .compose.max { inset: 0; width: auto; height: auto; transform: none; border-radius: 0; max-width: none; }
  .compose.min { inset: auto 8px 0 auto; width: 240px; height: 40px; border-radius: 12px 12px 0 0; }
  .grid2 { grid-template-columns: 1fr; }
  .pager .range { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- v6: Mail / Drive switch ---------- */
.appswitch { display: flex; gap: 4px; margin: .5rem .5rem .25rem .5rem; padding: 4px; background: var(--chip); border-radius: 14px; }
.appswitch .seg { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; background: none; padding: .45rem .5rem; border-radius: 10px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.appswitch .seg.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.appswitch .seg.on .ic { color: var(--brand); }
:root[data-theme="dark"] .appswitch .seg.on .ic { color: var(--accent); }
.shell.collapsed .appswitch { flex-direction: column; }
.shell.collapsed .appswitch span { display: none; }
.quota > div:last-child:not(.bar) { margin-top: .35rem; }

/* ---------- v6: Drive ---------- */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .15rem; min-width: 0; font-size: 1.1rem; }
.crumb { border: 0; background: none; padding: .35rem .6rem; border-radius: 8px; cursor: pointer; color: var(--ink); font-size: inherit; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb:hover { background: var(--hover); }
.crumb.static { cursor: default; }
.crumb.static:hover { background: none; }
.crumbs .sep { color: var(--muted); }
.dlist { overflow-y: auto; flex: 1; }
.drow { display: grid; grid-template-columns: 36px 40px minmax(0, 1fr) 150px 100px 84px; align-items: center; min-height: 48px; padding: 0 .5rem 0 .75rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.drow:hover { background: var(--hover); }
.drow.dhead { min-height: 40px; font-weight: 500; color: var(--ink-2); cursor: default; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.drow.dhead:hover { background: var(--panel); }
.dname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; padding-right: 1rem; }
.dic { display: inline-grid; place-items: center; color: var(--muted); }
.dic.fold { color: var(--brand); }
:root[data-theme="dark"] .dic.fold { color: var(--accent); }
.dact { display: flex; justify-content: flex-end; }
.c-size, .c-mod { font-size: .85rem; }
.main { position: relative; }
.dropzone { display: none; position: absolute; inset: 8px; border: 2px dashed var(--brand); border-radius: 16px; background: color-mix(in srgb, var(--panel) 88%, transparent);
  align-items: center; justify-content: center; gap: .6rem; font-size: 1.1rem; color: var(--ink); z-index: 5; pointer-events: none; }
.main.dragging .dropzone { display: flex; }
.uploads { position: fixed; right: 16px; bottom: 16px; width: min(360px, calc(100vw - 32px)); background: var(--panel); border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,.25); z-index: 40; overflow: hidden; }
.uploads .uhead { display: flex; align-items: center; justify-content: space-between; padding: .5rem .5rem .5rem 1rem; background: color-mix(in srgb, var(--brand) 12%, var(--panel)); font-weight: 500; }
.uploads ul { list-style: none; margin: 0; padding: .25rem 0; max-height: 40vh; overflow-y: auto; }
.uploads li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: .25rem .5rem; padding: .45rem 1rem; }
.uploads li .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads li .st { font-size: .8rem; color: var(--muted); }
.uploads li .st.bad { color: var(--danger); }
.uploads li .bar { grid-column: 2 / -1; height: 4px; background: var(--chip); border-radius: 2px; overflow: hidden; }
.uploads li .bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.dialog { position: fixed; z-index: 45; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--panel); border-radius: 24px; padding: 1rem 1.25rem 1.25rem; box-shadow: 0 8px 40px rgba(0,0,0,.3); }
.dialog .dhead2 { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog h2 { font-size: 1.15rem; font-weight: 500; margin: .25rem 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.picker { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: .5rem; }
.pick { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: .5rem; padding: .6rem .8rem; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; text-align: left; color: var(--ink); }
.pick:hover { background: var(--hover); }
.preview-wrap { display: grid; place-items: center; background: var(--chip); border-radius: 12px; padding: .5rem; margin-top: .5rem; }
.preview { max-width: 100%; max-height: 65vh; border-radius: 8px; }
.att-wrap { display: inline-flex; align-items: center; gap: 2px; }
@media (max-width: 700px) {
  .drow { grid-template-columns: 32px 34px minmax(0, 1fr) 70px 72px; }
  .drow .c-mod { display: none; }
}

/* ---------- v6.1: selection, offline, storage ---------- */
.drow.selected, .drow.selected:hover { background: var(--sel); }
.drow .chk { margin: 0; }
.selbar { background: color-mix(in srgb, var(--brand) 10%, var(--panel)); }
.selcount { font-weight: 500; margin-left: .25rem; }
.offtag { display: inline-flex; vertical-align: middle; margin-left: .4rem; color: var(--ok); }
.offtag .ic { width: 16px; height: 16px; }
.quota.nearfull { color: var(--danger); }
.quota .qnote { margin-top: .4rem; color: var(--muted); line-height: 1.35; padding-right: .5rem; }
.small-btn { margin-top: .5rem; padding: .3rem .8rem; font-size: .8rem; }
.small-btn .ic { width: 16px; height: 16px; }
.bar.mini { width: 120px; height: 4px; margin: .3rem 0; }
.bar.hot i { background: var(--danger); }
