/* Coattail Storage. Plain, quiet, black and white, like the main site. */
:root {
  --bg: #ffffff;
  --panel: #f6f6f4;
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #e3e3e0;
  --line-strong: #c9c9c5;
  --hover: #f0f0ed;
  --select: #ebeef7;
  --accent: #111111;
  --accent-ink: #ffffff;
  --ok: #217a3c;
  --warn: #9a6a00;
  --warn-bg: #fff6dc;
  --danger: #b3261e;
  --danger-bg: #fdeceb;
  --backup: #5b4bb7;
  --backup-bg: #efedfb;
  --radius: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .12);
  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --panel: #171717;
    --ink: #f2f2f0;
    --muted: #9a9a96;
    --line: #262626;
    --line-strong: #3a3a3a;
    --hover: #1d1d1d;
    --select: #1d2233;
    --accent: #f2f2f0;
    --accent-ink: #111111;
    --ok: #5cc37a;
    --warn: #e7b84a;
    --warn-bg: #2b2412;
    --danger: #f2827a;
    --danger-bg: #2e1615;
    --backup: #a99cf4;
    --backup-bg: #221e38;
    --shadow: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
  .logo--light { display: none !important; }
  .logo--dark { display: block !important; }
}
.logo--dark { display: none; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 6px; font-weight: 750; }
h2 { font-size: 18px; letter-spacing: -.01em; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 700; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }
.ok { color: var(--ok); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--bg); cursor: pointer;
  font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .45; cursor: default; }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--primary:hover { background: var(--accent); opacity: .88; }
.btn--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn--danger:hover { background: var(--danger-bg); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn--block { width: 100%; }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex !important; align-items: center; gap: 8px; grid-template-columns: none; color: var(--ink) !important; font-weight: 500 !important; font-size: 14px !important; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 42px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--bg); font-size: 15px; color: var(--ink);
}
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.code-input { font-size: 26px !important; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- sign-in and public link pages ---------- */
.public, .gate { display: grid; place-items: center; padding: 24px 16px; min-height: 100vh; }
.public__card, .gate__card {
  width: 100%; max-width: 420px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow);
}
.public__logo, .gate__logo { height: 26px; width: auto; display: block; margin-bottom: 28px; }
.public__from { color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.public__name { word-break: break-word; }
.public__list { list-style: none; padding: 0; margin: 16px 0; border-top: 1px solid var(--line); }
.public__list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); word-break: break-word; }
.public__list a { text-decoration: none; font-weight: 600; }
.public .btn { margin-top: 8px; }
.qr { width: 200px; height: 200px; margin: 8px auto 4px; background: #fff; padding: 8px; border-radius: 8px; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; background: var(--panel); padding: 8px 10px; border-radius: 6px; user-select: all; }

/* ---------- the app frame ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 60px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.top__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.top__brand img { height: 22px; width: auto; }
.top__name { font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.top__right { display: flex; align-items: center; gap: 8px; }
.top__menu-btn { display: none; }

.banner { padding: 10px 20px; font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--line); }
.banner--emergency { background: var(--warn-bg); color: var(--warn); }
.banner--warn { background: var(--warn-bg); color: var(--warn); }
.banner--danger { background: var(--danger-bg); color: var(--danger); }

.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.side {
  border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; background: var(--bg);
}
.side__label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 14px 10px 4px; }
.side a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  text-decoration: none; font-weight: 550; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side a:hover { background: var(--hover); }
.side a.is-active { background: var(--select); }
.side__icon { width: 18px; text-align: center; flex: none; }
.side__quota { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--line); }

.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 8px 0 6px; display: flex; }
.meter__fill { height: 100%; background: var(--ink); }
.meter__fill--backup { background: var(--backup); }
.meter--warn .meter__fill { background: var(--warn); }
.meter--danger .meter__fill { background: var(--danger); }

.main { padding: 22px 28px 120px; min-width: 0; }

/* ---------- file browser ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 22px; font-weight: 750; letter-spacing: -.02em; margin-bottom: 14px; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs span.sep { color: var(--line-strong); margin: 0 2px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar__spacer { flex: 1; }
.selection-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; margin-bottom: 12px;
  border-radius: var(--radius); background: var(--select);
}
.selection-bar strong { margin-right: 6px; font-size: 14px; }

.files { width: 100%; border-collapse: collapse; }
.files th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.files td { padding: 0 10px; height: 48px; border-bottom: 1px solid var(--line); font-size: 14px; }
.files tr.is-selected td { background: var(--select); }
.files tbody tr:hover td { background: var(--hover); }
.files tbody tr.is-selected:hover td { background: var(--select); }
.files .c-check { width: 36px; }
.files .c-size, .files .c-date { width: 130px; color: var(--muted); white-space: nowrap; }
.files .c-act { width: 44px; text-align: right; }
.files .name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.files .name a, .files .name button.link { text-decoration: none; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.files .name a:hover, .files .name button.link:hover { text-decoration: underline; }
.icon { width: 22px; flex: none; text-align: center; font-size: 17px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.tag--backup { background: var(--backup-bg); color: var(--backup); }
.tag--warn { background: var(--warn-bg); color: var(--warn); }
.tag--danger { background: var(--danger-bg); color: var(--danger); }
.tag--ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.tag--muted { background: var(--panel); color: var(--muted); }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

.dropzone {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(2px);
  border: 3px dashed var(--ink); font-size: 22px; font-weight: 750; pointer-events: none;
}

/* ---------- uploads tray ---------- */
.tray {
  position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 380px; max-width: calc(100vw - 32px);
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.tray__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.tray__list { max-height: 320px; overflow-y: auto; }
.tray.is-collapsed .tray__list { display: none; }
.up { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.up:last-child { border-bottom: 0; }
.up__row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.up__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.up__bar { height: 4px; background: var(--line); border-radius: 99px; margin: 6px 0 4px; overflow: hidden; }
.up__bar div { height: 100%; background: var(--ink); width: 0; transition: width .3s; }
.up.is-error .up__bar div { background: var(--danger); }
.up.is-done .up__bar div { background: var(--ok); }
.up__meta { color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.up__btns { display: flex; gap: 4px; flex: none; }
.icon-btn { width: 30px; height: 30px; border-radius: 99px; border: 0; background: transparent; cursor: pointer; display: inline-grid; place-items: center; font-size: 15px; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }

/* ---------- dialogs and menus ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .45); }
.modal__panel { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--bg); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.modal__panel--wide { max-width: 920px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.preview { display: grid; place-items: center; background: #000; border-radius: 10px; overflow: hidden; }
.preview img, .preview video { max-width: 100%; max-height: 70vh; display: block; }
.preview iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.preview audio { width: 100%; margin: 30px; }

.menu { position: fixed; z-index: 70; min-width: 190px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; font-size: 14px; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.picker { border: 1px solid var(--line); border-radius: 8px; max-height: 300px; overflow-y: auto; margin-top: 8px; }
.picker button { display: flex; gap: 8px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; text-align: left; font-size: 14px; }
.picker button:hover { background: var(--hover); }
.picker__path { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.picker__path button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); text-decoration: underline; }

.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-size: 13px; }
.copy-row select { width: auto; flex: none; }
.copy-row input[type=number] { font-size: 15px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* ---------- admin and lists ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; background: var(--bg); }
.card__big { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.card--emergency { border-color: var(--warn); background: var(--warn-bg); }
.section { margin: 28px 0; }
.section__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section__head h2 { margin: 0; }
.alerts { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 8px; }
.alerts li { padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.alerts .warn { background: var(--warn-bg); color: var(--warn); }
.alerts .danger { background: var(--danger-bg); color: var(--danger); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .mini-meter { width: 170px; white-space: nowrap; }
.table .wrap { word-break: break-word; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters > * { flex: 1 1 160px; max-width: 240px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- phones ---------- */
@media (max-width: 820px) {
  .top { padding: 0 16px; }
  .top__menu-btn { display: inline-flex; }
  .top__name { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; top: 60px; left: 0; bottom: 0; width: 280px; z-index: 30; height: auto;
    transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow);
  }
  .side.is-open { transform: none; }
  .main { padding: 18px 16px 140px; }
  .banner { padding: 10px 16px; }
  .files .c-date, .files thead .c-date { display: none; }
  .files .c-size { width: 84px; }
  .crumbs { font-size: 19px; }
  .form .row { grid-template-columns: 1fr; }
  .tray { right: 16px; bottom: 16px; left: 16px; width: auto; max-width: none; }
  .hide-phone { display: none !important; }
}
.loading { padding: 24px; }

/* ---------- upload-link page ---------- */
.public__card:has(.drop) { max-width: 560px; }
.drop { display: grid; gap: 14px; margin: 18px 0 14px; }
.drop__note { background: var(--panel); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; }
.drop__name { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.drop__zone {
  display: grid; justify-items: center; gap: 8px; text-align: center; padding: 28px 16px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
}
.drop__zone.is-over { border-color: var(--ink); background: var(--hover); }
.drop__buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.drop__list { list-style: none; margin: 0; padding: 0; }
.drop__item { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.drop__item.is-done .up__bar div { background: var(--ok); }
.drop__item.is-error .up__bar div { background: var(--danger); }

textarea { padding: 10px 12px; min-height: 0; resize: vertical; font: inherit; }
