/* Uppy — paper and ink. One accent, generous space, type doing the work. */

@font-face {
  font-family: 'Inter var';
  src: url('/assets/fonts/inter.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

:root {
  --paper: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --ink: #0e0e10;
  --ink-2: #44444b;
  --muted: #86868f;
  --line: rgba(16, 16, 20, 0.09);
  --line-2: rgba(16, 16, 20, 0.16);
  --accent: #2f6bed;
  --accent-soft: rgba(47, 107, 237, 0.09);
  --good: #12855a;
  --warn: #9a6b00;
  --bad: #c22a2a;
  --btn-ink: #101014;
  --btn-ink-text: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 16, 20, 0.05);
  --shadow: 0 12px 34px -18px rgba(16, 16, 20, 0.22);
  --radius: 14px;
  --radius-lg: 20px;
  --sans: 'Inter var', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --paper: #0b0b0d;
  --surface: #141417;
  --surface-2: #1b1b1f;
  --ink: #f3f3f5;
  --ink-2: #b6b6bd;
  --muted: #82828c;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.17);
  --accent: #6f9bff;
  --accent-soft: rgba(111, 155, 255, 0.14);
  --good: #4ade80;
  --warn: #f0b429;
  --bad: #ff6b6b;
  --btn-ink: #f3f3f5;
  --btn-ink-text: #101014;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 560; letter-spacing: -0.025em; line-height: 1.1; }
p { margin: 0; }

::selection { background: var(--accent-soft); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ───────── layout ───────── */

.shell { display: flex; flex-direction: column; min-height: 100vh; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 760px; }
.wrap.wide { max-width: 1280px; }

.nav {
  position: sticky; top: 0; z-index: 40; border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  transition: border-color .2s;
}
.nav.scrolled { border-color: var(--line); }
.nav-inner { display: flex; align-items: center; gap: 16px; height: 68px; }

.logo { font-size: 20px; font-weight: 620; letter-spacing: -0.045em; }
.logo span { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 6px; margin-left: auto; }

main { flex: 1; }

footer.foot { border-top: 1px solid var(--line); margin-top: 96px; padding: 34px 0; }
.foot-inner { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.foot-inner a:hover { color: var(--ink); }
.foot-links { display: flex; gap: 18px; margin-left: auto; }

/* ───────── type ───────── */

.display { font-size: clamp(38px, 7vw, 68px); letter-spacing: -0.04em; line-height: 1.02; font-weight: 600; }
.title { font-size: clamp(26px, 3.6vw, 34px); letter-spacing: -0.03em; }
.section-title { font-size: 22px; letter-spacing: -0.025em; }
.lead { font-size: clamp(16px, 2vw, 18.5px); color: var(--ink-2); line-height: 1.55; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───────── buttons ───────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 520;
  cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--btn-ink); color: var(--btn-ink-text); border-color: transparent; font-weight: 560; }
.btn.primary:hover { opacity: .9; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.quiet { background: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 8%, transparent); }
.btn.lg { height: 52px; padding: 0 26px; font-size: 15.5px; border-radius: 12px; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ───────── forms ───────── */

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 520; color: var(--ink-2); }
.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 92px; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.input:hover { border-color: var(--ink-2); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }
.error-text { color: var(--bad); font-size: 13.5px; }
.ok-text { color: var(--good); font-size: 13.5px; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2);
  display: grid; place-items: center; background: var(--surface); flex: none; transition: .15s;
}
.check .box svg { width: 12px; height: 12px; opacity: 0; color: var(--btn-ink-text); }
.check input:checked + .box { background: var(--btn-ink); border-color: var(--btn-ink); }
.check input:checked + .box svg { opacity: 1; }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; }
.seg button {
  border: none; background: none; height: 30px; padding: 0 12px; border-radius: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer; font-weight: 510;
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: .18s; pointer-events: none; }
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ───────── dropzone ───────── */

.drop {
  position: relative; border: 1.5px dashed var(--line-2); border-radius: var(--radius-lg);
  background: var(--surface); padding: 68px 28px; text-align: center; cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
}
.drop:hover { border-color: var(--ink-2); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.004); }
.drop-title { font-size: 21px; font-weight: 540; letter-spacing: -0.02em; }
.drop-sub { margin-top: 8px; color: var(--muted); font-size: 14.5px; }
.drop-limit { margin-top: 26px; font-size: 13px; color: var(--muted); }
.drop-icon { width: 34px; height: 34px; margin: 0 auto 20px; color: var(--muted); display: block; }

.panel {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.panel-head { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.panel-body { padding: 22px; }
.panel-foot { padding: 18px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }

/* ───────── file rows ───────── */

.file-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line);
}
.file-row:last-child { border-bottom: none; }
.file-icon {
  width: 38px; height: 38px; border-radius: 9px; background: var(--surface-2); flex: none;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 640; letter-spacing: .03em;
  color: var(--ink-2); text-transform: uppercase;
}
.file-name { font-weight: 500; }
.file-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.progress { height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .2s ease; }
.progress.thin { height: 3px; }

/* ───────── cards, stats, tables ───────── */

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.stat { padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat .value { font-size: 30px; font-weight: 580; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.stat .label { font-size: 13px; color: var(--muted); margin-top: 4px; }

.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 560; padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.clickable { cursor: pointer; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 520; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.tag.good { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); }
.tag.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.tag.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }

.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.divider { height: 1px; background: var(--line); margin: 28px 0; }

/* ───────── menus, dialogs, toasts ───────── */

.pop {
  position: fixed; z-index: 70; min-width: 190px; padding: 6px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow);
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.pop-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px;
  font-size: 14px; cursor: pointer; color: var(--ink-2);
}
.pop-item:hover { background: var(--surface-2); color: var(--ink); }
.pop-item.danger { color: var(--bad); }
.pop-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.pop-label { font-size: 12px; color: var(--muted); padding: 8px 10px 4px; }

.backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(12, 12, 16, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .15s ease-out; backdrop-filter: blur(2px);
}
@keyframes fade { from { opacity: 0; } }
.dialog {
  width: min(460px, 100%); background: var(--surface); border-radius: 18px; border: 1px solid var(--line);
  box-shadow: var(--shadow); padding: 26px; animation: pop .16s ease-out;
}
.dialog h3 { font-size: 19px; margin-bottom: 10px; }
.dialog p { color: var(--ink-2); font-size: 14.5px; margin-bottom: 22px; }
.dialog .row { justify-content: flex-end; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--btn-ink); color: var(--btn-ink-text); padding: 11px 18px; border-radius: 99px;
  font-size: 14px; box-shadow: var(--shadow); animation: rise .2s ease-out; display: flex; gap: 9px; align-items: center;
}
.toast.bad { background: var(--bad); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ───────── states ───────── */

.empty { text-align: center; padding: 64px 24px; color: var(--muted); }
.empty h3 { font-size: 19px; color: var(--ink); margin-bottom: 8px; }
.skeleton {
  border-radius: 8px; height: 14px;
  background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2));
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───────── home ───────── */

.hero { padding: clamp(48px, 9vw, 96px) 0 clamp(28px, 4vw, 44px); text-align: center; }
.hero .lead { margin: 20px auto 0; max-width: 520px; }
.upload-area { margin-top: clamp(32px, 5vw, 48px); scroll-margin-top: 92px; }

.benefits { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; margin-top: 30px; font-size: 13.5px; color: var(--muted); }
.benefits span { display: inline-flex; align-items: center; gap: 7px; }
.benefits svg { width: 15px; height: 15px; color: var(--ink-2); }

.features { margin-top: clamp(80px, 12vw, 130px); }
.feature h3 { font-size: 17px; margin-bottom: 8px; letter-spacing: -0.02em; }
.feature p { color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.feature { padding-top: 22px; border-top: 1px solid var(--line); }
.features-grid { grid-template-columns: 1fr; gap: 26px 44px; }
@media (min-width: 760px) { .features-grid { grid-template-columns: 1fr 1fr; } }

.faq { margin-top: clamp(72px, 10vw, 110px); }
.faq-item { border-top: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 20px 0; font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 16px; color: var(--ink);
}
.faq-q svg { width: 16px; height: 16px; margin-left: auto; color: var(--muted); transition: transform .2s; flex: none; }
.faq-item.open .faq-q svg { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .25s ease; color: var(--ink-2); font-size: 14.5px; line-height: 1.65; }
.faq-item.open .faq-a { max-height: 260px; }
.faq-a p { padding-bottom: 22px; max-width: 62ch; }

/* ───────── share page ───────── */

.share-head { text-align: center; padding: clamp(40px, 7vw, 72px) 0 32px; }
.share-meta { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin-top: 14px; }
.share-message {
  margin: 26px auto 0; max-width: 560px; padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink-2); font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}

.success-mark { width: 46px; height: 46px; margin: 0 auto 22px; color: var(--good); }
.link-box {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border: 1px solid var(--line-2);
  border-radius: 12px; background: var(--surface); font-family: var(--mono); font-size: 13.5px;
}
.link-box .value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

.qr { background: #fff; padding: 14px; border-radius: 12px; display: inline-block; border: 1px solid var(--line); }

/* ───────── dashboard and admin ───────── */

.side-layout { display: grid; grid-template-columns: 216px 1fr; gap: 40px; align-items: start; padding-top: 36px; }
.side-nav { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 9px;
  font-size: 14px; color: var(--ink-2); font-weight: 480;
}
.side-nav a:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a.active { background: var(--surface-2); color: var(--ink); font-weight: 560; }
.side-nav svg { width: 16px; height: 16px; opacity: .75; }
.side-nav .group { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 20px 12px 8px; }

.page-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head .title { margin: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input { height: 38px; width: auto; min-width: 200px; }

.chart { width: 100%; display: block; }

/* ───────── mobile ───────── */

@media (max-width: 860px) {
  .side-layout { grid-template-columns: 1fr; gap: 20px; }
  .side-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .side-nav .group { display: none; }
  .side-nav a { white-space: nowrap; }
  .foot-links { margin-left: 0; width: 100%; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav-inner { height: 60px; }
  .drop { padding: 48px 20px; }
  .hero { padding-top: 34px; }
  table.data th, table.data td { padding: 11px 12px; }
  .hide-sm { display: none !important; }
  .dialog { padding: 22px; }
  .btn.lg { height: 48px; }
}
