@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations"), url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations"), url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- tokens ---------- */
:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f2f2f5;
  --line: #e6e6ea;
  --ink: #1b1b1f;
  --ink-2: #5d5d66;
  --ink-3: #8b8b94;
  --accent: #5550d9;
  --accent-hover: #4741c9;
  --accent-ink: #4a45cc;
  --on-accent: #ffffff;
  --danger: #d4334a;
  --danger-soft: #fceef0;
  --radius: 14px;
  --radius-sm: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --surface: #1b1b1f;
    --surface-2: #26262b;
    --line: #2d2d33;
    --ink: #ededf0;
    --ink-2: #a9a9b2;
    --ink-3: #7d7d87;
    --accent-ink: #a5a2ff;
    --danger: #ff6b7d;
    --danger-soft: rgba(255, 107, 125, .12);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2 { margin: 0; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent-ink); }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; }
.i {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.subtle { color: var(--ink-3); }
.small { font-size: 13px; }
.lede { color: var(--ink-2); margin-top: 6px; }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 480px; margin: 0 auto; padding: 28px 16px 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--ink); text-decoration: none; font-weight: 650; font-size: 16px; letter-spacing: -.01em;
}
.brand-mark {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: #fff;
}
.brand-mark .i { width: 16px; height: 16px; stroke-width: 2.2; }
.column {
  max-width: 480px; margin: 0 auto; padding: 0 16px 48px;
  display: flex; flex-direction: column; gap: 16px;
}

/* ---------- card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.card-pad { padding: 24px; }
.card-foot { padding: 16px 20px 20px; }
.footnote { font-size: 13px; color: var(--ink-3); text-align: center; }
.form-error { color: var(--danger); font-size: 14px; }
#upload-error { margin: 12px 20px 0; padding: 9px 12px; border-radius: 8px; background: var(--danger-soft); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border: 0; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, color .15s, opacity .15s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn-lg { height: 46px; }
.btn-block { width: 100%; }
.btn-meta { font-weight: 500; opacity: .75; }
.text-link {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent-ink); font-weight: 550; font-size: 14px; text-decoration: none;
}
.text-link:hover { text-decoration: underline; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .i { width: 17px; height: 17px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn.armed, .icon-btn.armed:hover {
  width: auto; padding: 0 10px; display: inline-flex; gap: 6px; align-items: center;
  background: var(--danger); color: #fff; font-size: 13px; font-weight: 600;
}
.icon-btn.done { color: var(--accent-ink); }

/* ---------- inputs ---------- */
.login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.pw-field { position: relative; }
.pw-field input, .message-field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.pw-field input { height: 44px; padding: 0 46px 0 12px; font-size: 16px; }
.pw-field input::placeholder, .message-field textarea::placeholder { color: var(--ink-3); }
.pw-field input:focus, .message-field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.pw-field .icon-btn { position: absolute; right: 5px; top: 5px; }
.pw-field.invalid input { border-color: var(--danger); }

/* ---------- uploader ---------- */
.dropzone {
  margin: 20px 20px 0; padding: 28px 16px; border: 1.5px dashed var(--line); border-radius: var(--radius-sm);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px;
  transition: border-color .15s, background-color .15s;
}
body.dragging .dropzone { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.add-main, .add-folder {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer;
  padding: 6px 10px; border-radius: 8px; font-weight: 600;
}
.add-main { color: var(--accent-ink); font-size: 15px; }
.add-folder { color: var(--ink-2); font-size: 14px; }
.add-main:hover, .add-folder:hover { background: var(--surface-2); }
.add-folder .i { width: 16px; height: 16px; }
.drop-hint { color: var(--ink-3); font-size: 14px; }
.if-files, [data-state="files"] .if-empty { display: none; }
[data-state="files"] .if-files { display: inline; }
[data-state="files"] .dropzone { padding: 6px; justify-content: space-between; border-style: solid; border-width: 1px; }

.selection { display: none; margin-top: 8px; }
[data-state="files"] .selection { display: block; }

.file-list { list-style: none; margin: 0; padding: 0 12px; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.file-list.more-below { -webkit-mask-image: linear-gradient(#000 calc(100% - 32px), transparent); mask-image: linear-gradient(#000 calc(100% - 32px), transparent); }
.file-list li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; }
.file-list li + li { border-top: 1px solid var(--line); }
.file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name {
  font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.file-dir { color: var(--ink-3); }
.file-size { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.chip {
  display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px;
  font-size: 10px; font-weight: 650; letter-spacing: .02em; text-transform: uppercase;
  color: var(--ink-2); background: var(--surface-2);
}

.capacity { display: flex; align-items: center; gap: 12px; padding: 8px 20px 0; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.meter { flex: 1; height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); }
.capacity.over { color: var(--danger); }
.capacity.over .meter i { background: var(--danger); }

.options { padding: 20px 20px 0; display: flex; flex-direction: column; gap: 16px; }
.segmented { border: 0; margin: 0; padding: 0; min-width: 0; }
.segmented legend, .field-label { display: block; padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-label em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.seg-row { display: flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--surface-2); }
.seg-row label { flex: 1; position: relative; }
.seg-row input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-row span {
  display: block; text-align: center; padding: 6px 0; border-radius: 7px;
  font-size: 14px; font-weight: 550; color: var(--ink-2);
}
.seg-row input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg-row input:focus-visible + span { outline: 2px solid var(--accent); }
.message-field { display: block; }
.message-field textarea { display: block; min-height: 60px; resize: vertical; padding: 10px 12px; font-size: 14.5px; }

/* progress + done */
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pct { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.bar { height: 6px; margin: 16px 0 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s linear; }
.bar.finishing i { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
#progress-sub { font-size: 14px; font-variant-numeric: tabular-nums; margin-bottom: 14px; }
#cancel { margin-left: -12px; }

.copy-field { display: flex; gap: 8px; margin-top: 16px; }
.copy-field input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; font-size: 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.copy-field input:focus { outline: none; border-color: var(--accent); }
.share-actions { display: flex; gap: 18px; margin-top: 16px; }
.share-actions .push { margin-left: auto; }

/* ---------- transfers ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.count { color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.tx-list { list-style: none; margin: 0; padding: 0; }
.tx { display: flex; align-items: center; gap: 12px; padding: 10px 0; transition: opacity .25s; }
.tx + .tx { border-top: 1px solid var(--line); }
.tx.removing { opacity: 0; }
.tx-main { flex: 1; min-width: 0; }
.tx-name { color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; max-width: calc(100% - 44px); vertical-align: bottom; }
.tx-name:hover { color: var(--accent-ink); }
.tx-more { margin-left: 6px; font-size: 13px; color: var(--ink-3); }
.tx-meta { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tx-meta span { white-space: nowrap; }
.tx-actions { display: flex; gap: 2px; }
.empty { color: var(--ink-3); font-size: 14px; padding-top: 4px; }

/* ---------- download page ---------- */
.dl-head { padding-bottom: 16px; }
.dim { color: var(--ink-3); font-weight: 500; }
.expiry { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.expiry.soon { color: var(--danger); }
.note {
  margin: 16px 0 0; padding: 10px 14px; border-left: 3px solid var(--line); color: var(--ink-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.file-list-static { border-top: 1px solid var(--line); padding-top: 6px; max-height: 380px; }

/* ---------- overlays ---------- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 50; padding: 12px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
body.dragging .drop-overlay { opacity: 1; }
.drop-overlay-inner {
  height: 100%; display: grid; place-items: center; border-radius: var(--radius);
  border: 2px dashed var(--accent); color: var(--accent-ink); font-size: 18px; font-weight: 600;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%);
  padding: 9px 14px; border-radius: 8px; background: var(--ink); color: var(--bg);
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

@media (max-width: 520px) {
  .topbar { padding-top: 18px; }
  .card-pad { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
