/* ==========================================================================
   CloudVault — interface styles
   Aesthetic: "the sealed vault" — a calm, engineering-grade console. One teal
   accent (keyed to the product mark), cool slate surfaces, disciplined type.
   Monospace is used ONLY for real cryptographic data (fingerprints, sizes).
   Hand-written, framework-free, strict-CSP safe (no external fonts/scripts).
   ========================================================================== */

:root {
  /* Brand + accent (teal from the product mark) */
  --teal: #16b3c9;
  --teal-600: #0e93a8;
  --teal-700: #0b7688;
  --teal-050: #e6f7fa;

  /* Status */
  --ok: #1f9d6b;
  --warn: #c9821a;
  --danger: #d7443e;
  --danger-600: #b5332e;

  /* Light theme (default) */
  --bg: #eef2f6;
  --bg-grain: #e7edf3;
  --panel: #ffffff;
  --panel-2: #f6f9fb;
  --ink: #0f1b2d;
  --ink-2: #425169;
  --ink-3: #6b7a92;
  --line: #d9e1ea;
  --line-2: #e7edf3;
  --field: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15,27,45,.06), 0 1px 1px rgba(15,27,45,.04);
  --shadow-md: 0 6px 24px rgba(15,27,45,.10), 0 2px 6px rgba(15,27,45,.06);
  --shadow-lg: 0 24px 60px rgba(15,27,45,.18);
  --vault-ink: #0b1420;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, "Liberation Mono", monospace;
  --maxw: 1200px;
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --bg-grain: #0e1627;
  --panel: #131c2e;
  --panel-2: #0f1828;
  --ink: #e8eef7;
  --ink-2: #a9b6cb;
  --ink-3: #7486a0;
  --line: #243149;
  --line-2: #1c2740;
  --field: #0f1828;
  --teal-050: #0c2730;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 10px 30px rgba(0,0,0,.45);
  --shadow-lg: 0 30px 70px rgba(0,0,0,.6);
  --vault-ink: #060c16;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --bg-grain: #0e1627; --panel: #131c2e; --panel-2: #0f1828;
    --ink: #e8eef7; --ink-2: #a9b6cb; --ink-3: #7486a0; --line: #243149; --line-2: #1c2740;
    --field: #0f1828; --teal-050: #0c2730;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 10px 30px rgba(0,0,0,.45); --shadow-lg: 0 30px 70px rgba(0,0,0,.6);
    --vault-ink: #060c16;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  background: var(--bg);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 1.7rem; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }
a { color: var(--teal-600); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-feature-settings: "tnum" 1; }
.muted { color: var(--ink-3); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* -------------------------------------------------------------- buttons */
.btn {
  --b: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: inherit; font-weight: 600; font-size: .94rem;
  padding: .62em 1.05em; border-radius: var(--radius-sm);
  border: 1px solid var(--b); background: var(--panel); color: var(--ink);
  cursor: pointer; transition: background .14s, border-color .14s, transform .06s, box-shadow .14s;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.btn-primary { background: var(--teal-600); border-color: var(--teal-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--teal-700); border-color: var(--teal-700); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-600); border-color: var(--danger-600); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-sm { padding: .4em .7em; font-size: .85rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* -------------------------------------------------------------- fields */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: .34rem; }
.input, select.input, textarea.input {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .66em .8em; transition: border-color .14s, box-shadow .14s;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent);
}
.input::placeholder { color: var(--ink-3); }
.input-group { display: flex; gap: .5rem; }
.input-group .input { flex: 1; }
.hint { font-size: .8rem; color: var(--ink-3); margin-top: .34rem; }
.row { display: flex; gap: .75rem; }
.row > * { flex: 1; }

/* -------------------------------------------------------------- badges + chips */
.badge {
  display: inline-flex; align-items: center; gap: .35em; font-size: .74rem; font-weight: 650;
  padding: .2em .6em; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink-2);
}
.badge-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
.badge-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); }
.badge-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: color-mix(in srgb, var(--danger) 10%, var(--panel)); }
.badge-teal { color: var(--teal-700); border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); background: var(--teal-050); }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }

/* -------------------------------------------------------------- toast */
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 90; max-width: 360px; }
.toast {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--teal);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: .7rem .9rem;
  display: flex; gap: .6rem; align-items: flex-start; animation: toastIn .2s ease-out;
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
.toast .t-msg { font-size: .9rem; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ==========================================================================
   AUTH screens — the sealed vault
   ========================================================================== */
#auth {
  min-height: 100%; display: grid; grid-template-columns: 1.05fr 1fr;
}
.auth-brand {
  position: relative; overflow: hidden; color: #dff1f4;
  background:
    radial-gradient(1200px 700px at 15% -10%, #16384a 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 120%, #10505e 0%, transparent 55%),
    linear-gradient(160deg, #0c1a28 0%, var(--vault-ink) 100%);
  padding: clamp(2rem, 5vw, 4.5rem); display: flex; flex-direction: column; justify-content: space-between;
}
/* concentric vault-door motif, drawn once, no animation */
.auth-brand::after {
  content: ""; position: absolute; right: -16%; top: 50%; translate: 0 -50%;
  width: min(42vw, 560px); aspect-ratio: 1; border-radius: 50%;
  background:
    repeating-radial-gradient(circle at center, transparent 0 34px, rgba(120,214,230,.05) 34px 35px);
  mask: radial-gradient(circle at center, #000 62%, transparent 63%);
  pointer-events: none;
}
.auth-brand::before {
  content: ""; position: absolute; right: -16%; top: 50%; translate: 0 -50%;
  width: min(42vw, 560px); aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgba(120,214,230,.18);
  box-shadow: inset 0 0 0 10px rgba(120,214,230,.05), inset 0 0 90px rgba(22,179,201,.14);
  pointer-events: none;
}
.auth-brand .brand-head { display: flex; align-items: center; gap: .7rem; position: relative; z-index: 2; }
.auth-brand .brand-head img { width: 40px; height: 40px; }
.auth-brand .brand-head b { font-size: 1.15rem; letter-spacing: -.01em; font-weight: 700; }
.auth-brand .brand-copy { position: relative; z-index: 2; max-width: 30ch; }
.auth-brand .brand-copy h1 { font-size: clamp(1.8rem, 3.4vw, 2.7rem); line-height: 1.08; color: #eafafc; }
.auth-brand .brand-copy p { color: #a9c9d2; margin-top: 1rem; font-size: 1.02rem; }
.trust { list-style: none; margin: 0; padding: 0; position: relative; z-index: 2; display: grid; gap: .9rem; }
.trust li { display: flex; gap: .7rem; align-items: flex-start; color: #cfe6eb; font-size: .94rem; }
.trust li svg { flex: none; margin-top: 1px; color: var(--teal); }
.trust li b { color: #eafafc; font-weight: 650; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: clamp(1.5rem, 4vw, 3rem); background: var(--bg); }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .form-head { margin-bottom: 1.4rem; }
.auth-card .form-head h2 { font-size: 1.5rem; }
.auth-card .form-head p { color: var(--ink-3); margin-top: .35rem; }
.auth-tabs { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 1.4rem; }
.auth-tabs button { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--ink-2); padding: .4em 1.1em; border-radius: 999px; cursor: pointer; }
.auth-tabs button.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }

.divider { display: flex; align-items: center; gap: .8rem; color: var(--ink-3); font-size: .82rem; margin: 1.1rem 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* password strength meter */
.meter { height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin-top: .5rem; }
.meter > i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .2s, background .2s; }

.checkline { display: flex; gap: .55rem; align-items: flex-start; font-size: .86rem; color: var(--ink-2); margin: .8rem 0; }
.checkline input { margin-top: .2rem; accent-color: var(--teal-600); }

.form-error { background: color-mix(in srgb, var(--danger) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line)); color: var(--danger-600); padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: 1rem; }

/* recovery key display */
.reckey { font-family: var(--mono); font-size: 1.05rem; letter-spacing: .02em; background: var(--vault-ink); color: #a8f0fb; padding: 1rem; border-radius: var(--radius-sm); word-break: break-all; line-height: 1.8; text-align: center; }

/* ==========================================================================
   APP shell
   ========================================================================== */
#appshell { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; padding: 0 1.1rem; height: 60px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar .brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: -.01em; }
.topbar .brand img { width: 28px; height: 28px; }
.topbar .spacer { flex: 1; }
.searchbox { position: relative; flex: 0 1 360px; }
.searchbox input { width: 100%; padding-left: 2.1rem; }
.searchbox svg { position: absolute; left: .62rem; top: 50%; translate: 0 -50%; color: var(--ink-3); }

.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.iconbtn:hover { background: var(--panel-2); color: var(--ink); }

.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--teal-600); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; border: 1px solid var(--line); overflow: hidden; }
.avatar.lg { width: 76px; height: 76px; font-size: 1.6rem; }

/* account menu */
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 230px; padding: .4rem; z-index: 40; }
.menu-pop .who { padding: .6rem .7rem; border-bottom: 1px solid var(--line-2); margin-bottom: .3rem; }
.menu-pop .who b { display: block; }
.menu-pop button { display: flex; width: 100%; align-items: center; gap: .6rem; background: transparent; border: 0; font: inherit; color: var(--ink); padding: .55rem .7rem; border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
.menu-pop button:hover { background: var(--panel-2); }
.menu-pop button svg { color: var(--ink-3); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line-2); margin: .3rem 0; }

/* sidebar */
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .7rem; display: flex; flex-direction: column; gap: .2rem; }
.navitem { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 550; cursor: pointer; border: 1px solid transparent; }
.navitem:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
.navitem.active { background: var(--teal-050); color: var(--teal-700); border-color: color-mix(in srgb, var(--teal) 25%, transparent); }
.navitem.active svg { color: var(--teal-600); }
.navitem svg { color: var(--ink-3); flex: none; }
.nav-sep { font-size: .72rem; text-transform: none; font-weight: 700; color: var(--ink-3); padding: .9rem .75rem .3rem; letter-spacing: .02em; }
.sidebar .grow { flex: 1; }
.storage-meter { margin: .4rem .5rem; padding: .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); font-size: .8rem; }

/* main */
.main { padding: clamp(1rem, 2.5vw, 1.8rem); max-width: var(--maxw); width: 100%; }
.page-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.page-head .grow { flex: 1; }
.page-head p { color: var(--ink-3); margin: .25rem 0 0; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.pad { padding: 1.2rem; }
.grid { display: grid; gap: 1rem; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

/* stat tiles */
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.stat .k { font-size: .82rem; color: var(--ink-3); font-weight: 600; }
.stat .v { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; margin-top: .2rem; font-family: var(--mono); font-feature-settings: "tnum" 1; }
.stat .sub { font-size: .8rem; color: var(--ink-3); margin-top: .2rem; }
.stat .mark { position: absolute; right: .9rem; top: .9rem; color: color-mix(in srgb, var(--teal) 55%, var(--ink-3)); opacity: .5; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 650; color: var(--ink-3); font-size: .78rem; padding: .6rem .7rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.table td { padding: .66rem .7rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:hover td { background: var(--panel-2); }
.table .actions { display: flex; gap: .35rem; justify-content: flex-end; }

/* file list */
.filebar { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: .3rem; font-size: .92rem; color: var(--ink-2); flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); font-weight: 600; cursor: pointer; }
.crumbs a:hover { color: var(--teal-700); }
.crumbs .sep { color: var(--ink-3); }

.dropzone { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 1.1rem; text-align: center; color: var(--ink-3); transition: border-color .14s, background .14s; margin-bottom: 1rem; cursor: pointer; }
.dropzone.drag { border-color: var(--teal); background: var(--teal-050); color: var(--teal-700); }

.filerow { display: grid; grid-template-columns: 1fr 120px 150px 110px; gap: .6rem; align-items: center; padding: .62rem .75rem; border-bottom: 1px solid var(--line-2); }
.filerow:hover { background: var(--panel-2); }
.filerow .name { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.filerow .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.filerow .fsize, .filerow .fdate { font-size: .84rem; color: var(--ink-3); font-family: var(--mono); }
.filerow .fact { display: flex; gap: .3rem; justify-content: flex-end; }
.ficon { width: 34px; height: 34px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; background: var(--panel-2); color: var(--teal-700); flex: none; }
.ficon.folder { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--panel)); }

/* progress list */
.uplist { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.upitem { display: flex; align-items: center; gap: .7rem; font-size: .86rem; padding: .5rem .7rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2); }
.upitem .bar { flex: 1; height: 6px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.upitem .bar > i { display: block; height: 100%; width: 0; background: var(--teal-600); transition: width .15s; }

/* modal */
.scrim { position: fixed; inset: 0; background: rgba(8,14,24,.5); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 60; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; }
.modal.wide { max-width: 640px; }
.modal-head { padding: 1.2rem 1.3rem .4rem; }
.modal-head h3 { font-size: 1.2rem; }
.modal-body { padding: .6rem 1.3rem 1rem; }
.modal-foot { padding: 1rem 1.3rem 1.3rem; display: flex; gap: .6rem; justify-content: flex-end; }

/* empty states */
.empty { text-align: center; padding: 3rem 1rem; color: var(--ink-3); }
.empty svg { color: var(--line); margin-bottom: .8rem; }
.empty h3 { color: var(--ink-2); margin-bottom: .3rem; }

/* segmented tabs (profile/security) */
.segtabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1.3rem; flex-wrap: wrap; }
.segtabs button { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--ink-3); padding: .6rem .3rem; margin-right: .9rem; cursor: pointer; border-bottom: 2px solid transparent; }
.segtabs button.active { color: var(--ink); border-bottom-color: var(--teal-600); }

/* qr (2fa) */
.qr { width: 184px; height: 184px; background: #fff; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.qr svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: .5rem 1rem; font-size: .9rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

/* fullscreen loader */
.splash { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; background: var(--bg); z-index: 80; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--teal-600); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* -------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  #auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  #appshell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 60px auto 0 0; width: 248px; z-index: 50; transform: translateX(-110%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim.nav { z-index: 45; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .filerow { grid-template-columns: 1fr 80px; }
  .filerow .fdate { display: none; }
  .searchbox { flex: 1; }
}
@media (min-width: 901px) { .menu-toggle { display: none; } }
@media (max-width: 560px) {
  .filerow .fsize { display: none; }
  .filerow { grid-template-columns: 1fr auto; }
}

/* ---- transfer tray (chunked uploads/downloads) ---- */
.xfer-tray { position: fixed; right: 1rem; bottom: 1rem; width: min(380px, calc(100vw - 2rem)); max-height: 50vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0,0,0,.18); z-index: 60; }
.xfer-tray.hidden { display: none; }
.xfer-head { display: flex; align-items: center; justify-content: space-between; padding: .5rem .7rem; border-bottom: 1px solid var(--line-2); font-size: .86rem; }
.xfer-list { overflow-y: auto; padding: .4rem; display: flex; flex-direction: column; gap: .4rem; }
.xfer { padding: .45rem .55rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2); font-size: .82rem; }
.xfer-top { display: flex; align-items: center; gap: .45rem; }
.xfer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.xfer .bar { height: 5px; margin: .35rem 0 .25rem; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.xfer .bar > i { display: block; height: 100%; width: 0; background: var(--teal-600); transition: width .2s; }
.xfer.failed .bar > i { background: var(--danger); }
.xfer-status { color: var(--ink-3); font-size: .74rem; }

.xfer.queued .bar > i { width: 0 !important; }
.xfer.queued { opacity: .8; }
.xfer-count { font-weight: 500; font-size: .78rem; margin-left: .3rem; }

/* live-update indicator */
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); opacity: .5; margin-right: .6rem; flex: none; }
.live-dot.on { background: var(--ok, #16a34a); opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok, #16a34a) 25%, transparent); }

/* ---- posts ---- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: .5rem .9rem; display: inline-flex; align-items: center; gap: .4rem; color: var(--ink-2); cursor: pointer; font: inherit; font-size: .9rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--teal-050); color: var(--teal-700); font-weight: 650; }
.post-tools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 1.2rem 0 .8rem; }
.post-tools .searchbox { min-width: 240px; }
.composer { display: flex; flex-direction: column; gap: .6rem; transition: border-color .15s; }
.composer.drag { border-color: var(--teal); background: var(--teal-050); }
.post-input { resize: vertical; min-height: 4.2rem; line-height: 1.5; font-family: inherit; }
.composer-foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.att-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.att-chips:empty { display: none; }
.att-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .25rem .2rem .55rem; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; background: var(--panel-2); max-width: 100%; }
.att-chip.new { border-style: dashed; border-color: var(--teal); }
.post-feed { display: flex; flex-direction: column; gap: .9rem; }
.post-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .7rem; }
.post-who { display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: .95rem; }
.post-text a { color: var(--teal-700); }
.post-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; margin-top: .8rem; }
.post-images.one { grid-template-columns: minmax(0, 420px); }
.post-thumb { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; padding: 0; background: var(--panel-2); cursor: zoom-in; }
.post-images.one .post-thumb { aspect-ratio: auto; max-height: 360px; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-images.one .post-thumb img { object-fit: contain; max-height: 360px; }
.post-thumb.pending img, .post-thumb.failed img { visibility: hidden; }
.post-thumb.pending::after { content: "Decrypting…"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: .8rem; }
.post-thumb.failed::after { content: "Could not decrypt"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--danger); font-size: .8rem; }
.thumb-label { position: absolute; left: 0; right: 0; bottom: 0; padding: .25rem .5rem; font-size: .72rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .15s; }
.post-thumb:hover .thumb-label { opacity: 1; }
.post-files { display: flex; flex-direction: column; gap: .35rem; margin-top: .8rem; }
.att-row { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.post-actions { display: flex; align-items: center; gap: .2rem; margin-top: .8rem; padding-top: .6rem; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.danger-text { color: var(--danger); }
.alert-box { padding: .7rem .9rem; border-radius: 9px; background: color-mix(in srgb, var(--danger) 10%, var(--panel)); color: var(--danger); font-size: .9rem; }
.share-row { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line-2); }
.share-row.found { margin-top: .8rem; padding: .7rem; border: 1px solid var(--teal); border-radius: 10px; background: var(--teal-050); }
.viewer { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.viewer-img { max-width: 100%; max-height: 70vh; border-radius: 8px; background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 0 0 / 20px 20px; }
.viewer-cap { color: var(--ink-3); font-size: .85rem; }
.nav-count { margin-left: auto; font-size: .72rem; font-weight: 700; color: var(--teal-700); background: var(--teal-050); border-radius: 999px; padding: 0 .45rem; }
.nav-count:empty { display: none; }

/* ---- about ---- */
.about { display: flex; flex-direction: column; gap: 1.1rem; }
.brand-plate { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem 1.6rem; display: flex; justify-content: center; }
.brand-plate img { max-width: 100%; height: auto; }
.about-product { display: flex; align-items: center; gap: .8rem; }
.about-name { font-size: 1.25rem; font-weight: 750; }
.about-kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; font-size: .92rem; }
.about-kv dt { color: var(--ink-3); }
.about-kv dd { margin: 0; }
.about-copy { margin: 0; font-weight: 600; }
