/* GlobeBurst Files - one stylesheet for the owner panel and the friends' pages. */
:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #f0f4f3;
  --surface-3: #e6eeeb;
  --border: #dbe4e1;
  --border-strong: #c3d1cc;
  --text: #0f1f1c;
  --text-2: #31443f;
  --muted: #5d716c;
  --accent: #0f766e;
  --accent-hover: #0b5f58;
  --accent-soft: #dcf1ed;
  --accent-text: #0b5f58;
  --on-accent: #ffffff;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --warn: #9a5b00;
  --warn-soft: #fdf0d5;
  --ok: #08744a;
  --ok-soft: #dcf3e7;
  --shadow: 0 1px 2px rgba(16, 32, 29, .05), 0 4px 16px rgba(16, 32, 29, .06);
  --shadow-lg: 0 10px 40px rgba(16, 32, 29, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1412;
    --surface: #121d1a;
    --surface-2: #17241f;
    --surface-3: #1e2e29;
    --border: #253632;
    --border-strong: #344a44;
    --text: #e5eeeb;
    --text-2: #c2d1cc;
    --muted: #8fa39d;
    --accent: #2bb3a3;
    --accent-hover: #44c7b7;
    --accent-soft: #123a35;
    --accent-text: #5fd6c7;
    --on-accent: #04201c;
    --danger: #f2766b;
    --danger-soft: #3a1714;
    --warn: #f0b75a;
    --warn-soft: #382709;
    --ok: #4fd18f;
    --ok-soft: #10331f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .link-btn:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, .dropzone:focus-visible, .nav a:focus-visible, .switch input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.big { min-height: 50px; padding: 12px 22px; font-size: 1.05rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.small { min-height: 32px; padding: 4px 11px; font-size: .88rem; gap: 6px; }
.btn.small .ic { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading .ic { opacity: 0; }
.btn.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--on-accent) var(--on-accent) transparent transparent;
  animation: spin .7s linear infinite;
}
.btn:not(.primary).loading::after { border-color: var(--text) var(--text) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none;
  border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.link-btn { border: 0; background: none; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }

/* ── forms ───────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.label { font-weight: 600; font-size: .92rem; color: var(--text-2); }
.label .opt { font-weight: 400; color: var(--muted); }
.hint { font-size: .83rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 80px; resize: vertical; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 .field + .field { margin-top: 0; }
.grid2 + .field, .field + .grid2 { margin-top: 14px; }
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; font-family: var(--mono); }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; padding: 4px 0; }
.switch { position: relative; }
.switch input { position: absolute; left: 0; top: 50%; width: 1px; height: 1px; margin: 0; opacity: 0; }
.switch span.track { position: relative; width: 42px; height: 24px; border-radius: 99px; background: var(--border-strong); flex: none; transition: background .15s; }
.switch span.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span.track { background: var(--accent); }
.switch input:checked + span.track::after { transform: translateX(18px); }
.switch .sw-text { display: flex; flex-direction: column; }
.switch .sw-text small { color: var(--muted); }
.chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 42px; padding: 5px 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: text;
}
.chips input { border: 0 !important; outline: 0 !important; min-height: 30px !important; padding: 2px 4px !important; flex: 1; min-width: 160px; background: transparent !important; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); font-size: .88rem; font-weight: 600; max-width: 100%; }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; display: inline-flex; padding: 2px; border-radius: 50%; }
.chip button .ic { width: 14px; height: 14px; }
.chip button:hover { background: color-mix(in srgb, currentColor 18%, transparent); }
.error-box { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-weight: 500; }
.note-box { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); }
.warn-box { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); }
.error-box .ic, .note-box .ic, .warn-box .ic { margin-top: 2px; }

/* ── cards & layout ──────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title h2, .card-title h3 { margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 22px 16px 60px; }
.narrow { max-width: 640px; margin: 0 auto; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.split > .card + .card { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.section-head h1 { margin: 0; font-size: 1.45rem; }

/* header */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.topbar-in { max-width: 1080px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 14px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.02rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; position: relative; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.on { color: var(--accent-text); background: var(--accent-soft); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .74rem; font-weight: 700; }
.top-right { display: flex; align-items: center; gap: 8px; }
.storage-pill { display: flex; flex-direction: column; gap: 3px; font-size: .76rem; color: var(--muted); min-width: 120px; }
.storage-pill .bar { height: 5px; }

/* progress */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .25s; }
.bar.warn > i { background: var(--warn); }
.bar.big { height: 12px; }

/* status chips */
.st { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st.active, .st.open { background: var(--ok-soft); color: var(--ok); }
.st.used, .st.expired, .st.closed { background: var(--surface-3); color: var(--muted); }
.st.stopped { background: var(--warn-soft); color: var(--warn); }
.st.new { background: var(--danger); color: #fff; }
.st.new::before { display: none; }
.st.uploading { background: var(--accent-soft); color: var(--accent-text); }
.st.suspended { background: var(--warn-soft); color: var(--warn); }
.st.unverified { background: var(--surface-3); color: var(--muted); }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; opacity: 0; }
a.link-btn { text-decoration: none; display: inline-block; }
a.link-btn:hover { text-decoration: underline; }
.warn-box.small, .note-box.small, .error-box.small { font-size: .86rem; }

/* ── drop zone & file list ───────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 34px 18px; text-align: center;
  background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-files { padding: 18px; }
.dropzone.has-files .dz-icon, .dropzone.has-files .dz-or { display: none; }
.dropzone.has-files .dz-title { font-size: .95rem; margin-bottom: 10px; }
.dz-icon { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.dz-icon .ic { width: 28px; height: 28px; }
.dz-title { font-weight: 700; font-size: 1.1rem; }
.dz-or { color: var(--muted); margin: 6px 0 12px; font-size: .9rem; }
.dz-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.flist-head { display: flex; align-items: center; gap: 6px; padding: 12px 2px 4px; }
.flist-head .link-btn { margin-left: auto; }
.flist { list-style: none; margin: 0; padding: 0; }
.flist li { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.flist li:last-child { border-bottom: 0; }
.flist li.more { color: var(--muted); justify-content: center; }
.fl-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fl-name .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.fl-name .p { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-size { color: var(--muted); font-size: .88rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fl-actions { display: flex; gap: 4px; }
.ficon { width: 36px; height: 36px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.ficon .ic { width: 19px; height: 19px; }
.ficon.k-image { background: #e5effd; color: #2f6fd6; }
.ficon.k-video { background: #f3e8fd; color: #8a3fd1; }
.ficon.k-audio { background: #fde8f1; color: #c2387a; }
.ficon.k-archive { background: #fdf0d5; color: #a26200; }
.ficon.k-doc { background: #e3f4ec; color: #138a52; }
@media (prefers-color-scheme: dark) {
  .ficon.k-image { background: #172a46; color: #83b0f5; }
  .ficon.k-video { background: #2c1a40; color: #c49af0; }
  .ficon.k-audio { background: #3a1a2a; color: #f08cbb; }
  .ficon.k-archive { background: #382709; color: #f0b75a; }
  .ficon.k-doc { background: #10331f; color: #6fd8a0; }
}
.flist .fprog { width: 90px; }
.flist .fstate { width: 22px; display: grid; place-items: center; color: var(--muted); }
.flist .fstate.done { color: var(--ok); }
.flist .fstate.err { color: var(--danger); }
.ferr { font-size: .8rem; color: var(--danger); }

/* ── upload progress ─────────────────────────────────────────────────── */
.progress-card .pct { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.progress-card .meta { color: var(--muted); font-variant-numeric: tabular-nums; margin: 6px 0 14px; }
.progress-card .flist { max-height: 300px; overflow: auto; margin-top: 14px; }

/* ── link box / result ───────────────────────────────────────────────── */
.linkbox { display: flex; gap: 8px; align-items: stretch; }
.linkbox input { font-family: var(--mono); font-size: .88rem; background: var(--surface-2); }
.result-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.okmark { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); flex: none; }
.okmark .ic { width: 24px; height: 24px; stroke-width: 2.5; }
.qr { display: flex; gap: 16px; align-items: center; margin-top: 16px; }
.qr img { width: 150px; height: 150px; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.mail-results { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; }
.mail-results li { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.mail-results li.ok { color: var(--ok); }
.mail-results li.bad { color: var(--danger); }
.pwnote { margin-top: 14px; }

/* ── lists of shares / requests / inbox ──────────────────────────────── */
.items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.item { min-width: 0;
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s;
}
.item:hover { border-color: var(--border-strong); }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: .86rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .84rem; color: var(--muted); white-space: nowrap; }
.item.dim { opacity: .72; }
.filters { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.filters button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.filters button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big-ic { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: var(--surface-3); display: grid; place-items: center; }
.empty .big-ic .ic { width: 30px; height: 30px; }
.empty h3 { color: var(--text); }

/* detail pages */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 600; margin-bottom: 10px; }
.back:hover { color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 11px 13px; }
.stat .k { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-weight: 700; margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.tl-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); }
.tl-ic .ic { width: 16px; height: 16px; }
.tl-ic.download { background: var(--ok-soft); color: var(--ok); }
.tl-ic.wrong_password, .tl-ic.email_failed { background: var(--danger-soft); color: var(--danger); }
.tl-ic.email { background: var(--accent-soft); color: var(--accent-text); }
.tl-body { flex: 1; min-width: 0; }
.tl-body .w { font-weight: 600; }
.tl-body .d { font-size: .85rem; color: var(--muted); word-break: break-word; }

/* inbox */
.batch { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.batch + .batch { margin-top: 14px; }
.batch.unseen { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.batch-head { display: flex; gap: 12px; align-items: center; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; color: var(--on-accent); background: var(--accent); }
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; margin: 0 auto 14px; }
.msg { margin: 12px 0 4px; padding: 10px 14px; background: var(--surface-2); border-radius: 4px 14px 14px 14px; white-space: pre-wrap; word-break: break-word; }

/* ── modal, toasts, preview ──────────────────────────────────────────── */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(6, 14, 12, .55); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal-back.out { opacity: 0; transition: opacity .15s; }
.modal { position: relative; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 16px; padding: 24px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(980px, 100%); padding: 16px; background: var(--surface); }
.modal-x { position: absolute; top: 10px; right: 10px; z-index: 2; background: var(--surface); }
.modal h3 { padding-right: 34px; }
.modal .row.end { margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }
.preview { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.preview-media { max-width: 100%; max-height: calc(100vh - 140px); border-radius: 10px; background: #000; }
.preview-audio { width: min(520px, 100%); margin: 40px 0 10px; }
.preview-name { color: var(--muted); font-size: .9rem; word-break: break-all; text-align: center; padding: 0 30px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-weight: 600; animation: rise .2s; }
.toast.t-bad { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ── public pages (friends) ──────────────────────────────────────────── */
.pub { min-height: 100vh; display: flex; flex-direction: column; }
.pub-top { max-width: 640px; width: 100%; margin: 0 auto; padding: 22px 16px 0; display: flex; align-items: center; gap: 9px; color: var(--muted); font-weight: 700; font-size: .92rem; }
.pub-top img { width: 26px; height: 26px; }
.pub-main { max-width: 640px; width: 100%; margin: 0 auto; padding: 18px 16px 50px; flex: 1; }
.pub-hero { text-align: center; padding: 6px 0 4px; }
.pub-hero h1 { font-size: 1.55rem; margin-bottom: 4px; }
.pub-hero .sub { color: var(--text-2); font-weight: 600; font-size: 1.08rem; }
.pub-hero .msg { text-align: left; margin: 16px 0 0; }
.pub-sum { display: flex; justify-content: center; gap: 8px 16px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin: 16px 0 18px; }
.pub-sum span { display: inline-flex; align-items: center; gap: 6px; }
.pub-sum .ic { width: 16px; height: 16px; }
.pub-foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 0 16px 28px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.pub-foot .ic { width: 15px; height: 15px; }
.state-card { text-align: center; padding: 40px 24px; }
.state-card .big-ic { width: 70px; height: 70px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.state-card .big-ic .ic { width: 32px; height: 32px; }
.state-card .big-ic.ok { background: var(--ok-soft); color: var(--ok); }
.state-card .big-ic.lock { background: var(--accent-soft); color: var(--accent-text); }
.skeleton { height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton + .skeleton { margin-top: 10px; }
.skeleton.w60 { width: 60%; margin: 10px auto 18px; }
.skeleton.w40 { width: 160px; }

/* ── login / setup ───────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: min(430px, 100%); padding: 30px; }
.auth-logo { width: 56px; height: 56px; margin: 0 auto 14px; display: block; }
.auth h1 { text-align: center; font-size: 1.4rem; }
.auth .lead { text-align: center; color: var(--muted); margin-bottom: 22px; }
.code-box { font-family: var(--mono); font-size: 1.08rem; font-weight: 700; letter-spacing: .04em; text-align: center; padding: 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); word-spacing: .3em; line-height: 1.9; user-select: all; }

/* ── responsive ──────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .storage-pill { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .topbar-in { height: auto; flex-wrap: wrap; padding: 10px 12px 0; gap: 8px; }
  .brand span { display: none; }
  .nav { order: 3; flex-basis: 100%; padding-bottom: 8px; }
  .top-right { margin-left: auto; }
  .card { padding: 16px; }
  .wrap { padding: 16px 12px 50px; }
  .grid2 { grid-template-columns: 1fr; }
  .item { padding: 12px; gap: 10px; }
  .item .side { display: none; }
  .item .side-sm { display: flex !important; }
  .qr { flex-direction: column; align-items: flex-start; }
  .linkbox { flex-wrap: wrap; }
  .linkbox input { flex-basis: 100%; }
  .linkbox .btn { flex: 1; }
  .dropzone { padding: 26px 14px; }
  .pub-hero h1 { font-size: 1.32rem; }
  .flist .fprog { width: 54px; }
  .section-head h1 { font-size: 1.25rem; }
}
.side-sm { display: none !important; }

/* ── v2: landing ─────────────────────────────────────────────────────── */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.land-top { max-width: 1080px; width: 100%; margin: 0 auto; padding: 20px 16px 0; display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; }
.land-top img { width: 34px; height: 34px; }
.land-main { max-width: 1080px; width: 100%; margin: 0 auto; padding: 28px 16px 60px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: start; flex: 1; }
.land-hero h1 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); line-height: 1.15; letter-spacing: -.02em; margin: 10px 0 22px; }
.land-points { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 16px; }
.land-points li { display: flex; gap: 14px; align-items: flex-start; color: var(--text-2); }
.land-points .ic { width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }
.land-card { padding: 24px; }
.land-tabs { display: flex; width: 100%; margin-bottom: 18px; }
.land-tabs button { flex: 1; }
.at-input { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.at-input span { padding: 0 2px 0 12px; color: var(--muted); font-weight: 700; }
.at-input input { border: 0 !important; background: transparent !important; padding-left: 4px; min-width: 0; }
.at-input:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.at-input input:focus-visible { outline: none; }
@media (max-width: 860px) { .land-main { grid-template-columns: 1fr; gap: 20px; padding-top: 10px; } }

/* ── v2: chats ──────────────────────────────────────────────────────── */
.wrap.wide-view { max-width: 1240px; padding-top: 14px; padding-bottom: 14px; }
.chats { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; height: calc(100vh - 62px - 28px); min-height: 460px; }
.chat-side, .chat-main { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.chat-side-head h2 { margin: 0; font-size: 1.15rem; }
.chat-list { overflow-y: auto; flex: 1; padding: 6px; }
.chat-row { display: flex; gap: 11px; align-items: center; padding: 10px; border-radius: 12px; color: inherit; text-decoration: none; }
.chat-row:hover { background: var(--surface-2); }
.chat-row.on { background: var(--accent-soft); }
.chat-row .main { flex: 1; min-width: 0; }
.chat-row .t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .s { font-size: .86rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.chat-row .time { font-size: .75rem; color: var(--muted); white-space: nowrap; margin-left: 8px; }
.chat-row.unread .t, .chat-row.unread .s { color: var(--text); font-weight: 700; }
.chat-row .row { flex-wrap: nowrap; gap: 6px; }
.empty-mini { text-align: center; color: var(--muted); padding: 30px 16px; }
.empty-mini .ic { width: 28px; height: 28px; }
.empty-thread { margin: auto; text-align: center; padding: 30px; max-width: 380px; }
.empty-thread .big-ic { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; }
.empty-thread .big-ic .ic { width: 30px; height: 30px; }
.thread { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.thread.drop::after { content: "Drop files to send them"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--accent-soft) 85%, transparent); display: grid; place-items: center; font-weight: 700; color: var(--accent-text); pointer-events: none; }
.thread-head { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.thread-head .t { font-weight: 700; }
.thread-head .s { font-size: .82rem; color: var(--muted); }
.back-btn { display: none; }
.thread-banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--warn-soft); color: var(--warn); font-size: .88rem; }
.thread-list { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; font-size: .75rem; color: var(--muted); background: var(--surface-2); padding: 3px 10px; border-radius: 99px; margin: 8px 0; }
.bubble-row { display: flex; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { max-width: min(560px, 82%); background: var(--surface-2); border-radius: 4px 16px 16px 16px; padding: 8px 12px 6px; position: relative; }
.bubble-row.mine .bubble { background: var(--accent-soft); border-radius: 16px 4px 16px 16px; }
.bubble.pending { opacity: .9; min-width: 220px; }
.b-text { white-space: pre-wrap; word-break: break-word; }
.b-meta { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: .72rem; color: var(--muted); margin-top: 3px; }
.b-more { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; display: inline-flex; opacity: 0; transition: opacity .15s; }
.bubble:hover .b-more, .b-more:focus-visible { opacity: 1; }
@media (hover: none) { .b-more { opacity: .7; } }
.b-more .ic { width: 14px; height: 14px; }
.b-warn { display: flex; gap: 6px; align-items: center; font-size: .8rem; color: var(--warn); margin-top: 4px; }
.b-warn .ic { width: 15px; height: 15px; }
.atts { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 2px; }
.media-grid { display: grid; gap: 4px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 420px; }
.media-grid.n1 { grid-template-columns: 1fr; }
.media { position: relative; border: 0; padding: 0; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface-3); aspect-ratio: 4 / 3; }
.media-grid.n1 .media { aspect-ratio: auto; max-height: 360px; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media:disabled { cursor: default; filter: grayscale(.8); opacity: .6; }
.media .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, .18); }
.media .play .ic { width: 42px; height: 42px; fill: rgba(0, 0, 0, .45); stroke: #fff; }
.pub-media { margin: 14px auto 4px; max-width: 520px; }
.att-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 10px; padding: 6px 8px; min-width: 0; }
.bubble-row.mine .att-row { background: color-mix(in srgb, var(--surface) 75%, transparent); }
.att-row .fl-name { flex: 1; min-width: 0; }
.dl-all { align-self: flex-start; }
.composer { border-top: 1px solid var(--border); padding: 10px 12px 8px; background: var(--surface); }
.comp-row { display: flex; align-items: flex-end; gap: 8px; }
.comp-text { flex: 1; min-height: 42px !important; max-height: 180px; resize: none; border-radius: 21px !important; padding: 10px 16px !important; line-height: 1.4; }
.attach { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--text-2); }
.send-btn { width: 42px; height: 42px; min-height: 42px; padding: 0; border-radius: 50%; flex: none; }
.comp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.comp-foot .muted { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.comp-foot .ic { width: 13px; height: 13px; }
.comp-keep { width: auto; min-height: 30px; padding: 2px 30px 2px 10px; font-size: .8rem; background-position: calc(100% - 15px) 12px, calc(100% - 10px) 12px; }
.comp-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; max-height: 120px; overflow-y: auto; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; border-radius: 10px; background: var(--surface-2); font-size: .84rem; max-width: 100%; }
.fchip .ficon { width: 26px; height: 26px; border-radius: 7px; }
.fchip .ficon .ic { width: 15px; height: 15px; }
.fchip .n { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip button { border: 0; background: none; color: var(--muted); cursor: pointer; display: inline-flex; padding: 2px; }
.fchip button .ic { width: 14px; height: 14px; }
.code-box.safety { font-size: 1.15rem; letter-spacing: .08em; }
.code-box.safety.small { font-size: .95rem; }
@media (max-width: 899px) {
  .chats { grid-template-columns: 1fr; height: calc(100vh - 110px); height: calc(100dvh - 110px); }
  .chat-side.hide, .chat-main.hide { display: none; }
  .back-btn { display: inline-flex; }
  .wrap.wide-view { padding: 8px; }
}

/* ── v2: share menu ─────────────────────────────────────────────────── */
.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.qr-img { width: 168px; height: 168px; image-rendering: pixelated; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.pub-top a { color: inherit; text-decoration: none; }
