/* Meridian File Transfer - polished internal tool UI */

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/schibsted-grotesk-latin.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/schibsted-grotesk-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/geist-latin.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/geist-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --ink: #272625;
  --body: #444342;
  --muted: #72716e;
  --subtle: #9c9b97;
  --line: #d6d5d2;
  --line-strong: #c2c0bc;
  --surface: #fcfcfb;
  --surface-soft: #f1f0ee;
  --surface-warm: #f0efed;
  --canvas: #e7e6e4;
  --gold: #b8954b;
  --gold-soft: #ece0c8;
  --blue: #2457d6;
  --blue-soft: #e9edfb;
  --green: #168a4a;
  --green-soft: #e7f1e7;
  --red: #c93434;
  --red-soft: #f7e7e1;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .06);
  --shadow-md: 0 16px 42px rgba(28, 35, 49, .12);
  --radius: 8px;
  --btn-bg: #2a2620;
  --btn-fg: #fefdfb;
  --btn-bg-hover: #1c1813;
  --display: "Geist", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --sans: "Geist", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--body);
  background:
    linear-gradient(rgba(79, 79, 77, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 79, 77, .04) 1px, transparent 1px),
    var(--canvas);
  background-size: 36px 36px, 36px 36px, auto;
  background-attachment: fixed;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

button svg {
  flex: 0 0 auto;
  opacity: .9;
}

button:hover:not(:disabled) {
  background: var(--btn-bg-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  color: var(--subtle);
  background: #e8e4dc;
  border-color: #d6d0c4;
  box-shadow: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
.ra-link:focus-visible {
  outline: 3px solid rgba(36, 87, 214, .38);
  outline-offset: 2px;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* Download-page error / forbidden state */
.forbidden { text-align: center; padding: 22px 4px 10px; }
.fb-code { font-family: var(--display); font-size: 20px; font-weight: 650; color: var(--ink); margin-bottom: 8px; }
.fb-msg { color: var(--muted); font-size: 14px; font-weight: 400; line-height: 1.5; margin-bottom: 16px; }
.fb-link { display: inline-block; color: var(--blue); font-size: 13px; text-decoration: none; }
.fb-link:hover { text-decoration: underline; }

/* Admin: user-management panel */
.user-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
.user-add input { width: auto; flex: 1 1 150px; min-width: 0; }
.user-add select { width: auto; flex: 0 0 auto; }
.pw-reveal { margin: 0 0 16px; padding: 12px 14px; background: var(--blue-soft); border: 1px solid var(--blue); border-radius: 8px; color: var(--ink); font-size: 14px; }
.pw-reveal code { font-family: var(--mono); font-size: 15px; user-select: all; }
.pw-reveal .copy-btn { min-height: 28px; padding: 0 10px; margin-left: 8px; font-size: 12.5px; font-weight: 500; }
.pw-reveal .pw-note { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.u-act { display: flex; gap: 12px; }
.u-act .rm { color: var(--red); }
.col-act { text-align: right; white-space: nowrap; }
.dash-top { display: flex; justify-content: flex-end; margin: 0 0 6px; }
#usersSec { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }

.wrap {
  min-height: 100vh;
  display: flex;
  padding: 36px 20px;
}

.card {
  width: min(100%, 448px);
  margin: auto;
  padding: 34px;
  border: 1px solid rgba(194, 193, 189, .8);
  border-radius: var(--radius);
  background: rgba(252, 252, 251, .96);
  box-shadow: 0 8px 24px rgba(46, 44, 40, .08);
}

.card.wide {
  width: min(100%, 1040px);
}

.logo {
  display: block;
  width: min(210px, 74%);
  height: auto;
  margin: 0 auto 18px;
}

/* Download/login card header — same brand mark as the main app, centered. */
.dl-brand {
  justify-content: center;
  margin: 0 auto 18px;
}
.dl-brand svg { width: 36px; height: 36px; }
.dl-brand .brand-name { font-size: 20px; }

h1 {
  margin-bottom: 22px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
}

.sub {
  margin: -10px 0 22px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

#login {
  max-width: 360px;
  margin: 0 auto;
}

.form-group,
.field {
  margin-bottom: 15px;
}

label,
.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--body);
  font-size: 12px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 1px 1px rgba(17, 24, 39, .03);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input,
select {
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
}

textarea {
  min-height: 70px;
  padding: 10px 12px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(36, 87, 214, .14);
  outline: none;
}

input[readonly] {
  background: var(--surface-soft);
  color: #4b5563;
}

#loginBtn {
  width: 100%;
  margin-top: 8px;
}

.error {
  margin-bottom: 16px;
  padding: 11px 12px;
  border: 1px solid #f2b8b8;
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
  font-size: 14px;
  text-align: center;
}

.request-access {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.ra-link {
  position: relative;
  display: inline-flex;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.ra-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  z-index: 50;
  width: max-content;
  max-width: 260px;
  transform: translateX(-50%);
  padding: 9px 11px;
  border-radius: var(--radius);
  background: #111827;
  color: #fff;
  box-shadow: 0 12px 28px rgba(17, 24, 39, .2);
  font-size: 12px;
  line-height: 1.35;
  transition: opacity .16s ease, visibility .16s ease;
}

.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #111827;
}

.ra-link:hover .tooltip,
.ra-link:focus-within .tooltip {
  visibility: visible;
  opacity: 1;
}

/* App shell */

#app {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 22px 20px 52px;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  padding: 12px 0;
  background: transparent;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand svg {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
}

.brand-name {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(252, 252, 251, .7);
  box-shadow: var(--shadow-sm);
  zoom: 0.99;
}

.seg-btn {
  min-height: 34px;
  padding: 0 24px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  box-shadow: none;
  transform: none;
}

/* Only the active ("pushed") tab is black; hovering an inactive tab is a subtle
   grey. The :not(.active) raises specificity above the global button:hover so the
   toggle doesn't inherit the near-black hover. */
.seg-btn:hover:not(.active) {
  background: #f3f5f8;
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.seg-btn.active {
  background: var(--btn-bg);
  color: var(--btn-fg);
}

.who {
  justify-self: end;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.who .mono {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

#sendView {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.panes {
  display: grid;
  grid-template-columns: minmax(360px, .95fr) minmax(360px, 1.05fr);
  gap: 18px;
  align-items: start;
  width: min(100%, 1000px);
  zoom: 0.99;
}

.pane {
  padding: 15px;
  border: 1px solid rgba(194, 193, 189, .8);
  border-radius: var(--radius);
  background: rgba(252, 252, 251, .92);
  box-shadow: 0 8px 24px rgba(46, 44, 40, .08);
}

.pane-full {
  grid-column: 1 / -1;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
  margin-bottom: 14px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 680;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.files-pane {
  min-height: 0;
}

.dropzone {
  display: grid;
  min-height: 118px;
  place-items: center;
  padding: 16px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: background-color .25s ease, box-shadow .16s ease;
}

.dropzone:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(36, 87, 214, .14);
}

.dropzone.over {
  background: var(--blue-soft);
  box-shadow: 0 0 0 4px rgba(36, 87, 214, .1);
}

@media (prefers-reduced-motion: reduce) {
  .dropzone.swell { animation: none; }
}

.dz-text {
  max-width: 26ch;
  font-size: 13.5px;
  line-height: 1.45;
}

.link-btn {
  min-height: 0;
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--blue);
  box-shadow: none;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  transform: none;
}

/* :not(:disabled) raises specificity above the global button:hover so link
   buttons (Reset password, Remove, Delete) don't get the near-black hover box. */
.link-btn:hover:not(:disabled) {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.sel-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid var(--blue-soft);
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
}

.file-list-detailed {
  max-height: 340px;
  margin-top: 12px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.file-list-detailed:empty {
  display: none;
}

.frow,
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 11px;
  border-bottom: 1px solid #e1d9c9;
}

.frow {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.frow:last-child,
.file-row:last-child {
  border-bottom: 0;
}

.frow:hover {
  background: var(--surface-soft);
}

.frow.selected {
  background: var(--blue-soft);
  box-shadow: inset 3px 0 0 var(--blue);
}

.folder-row .fname {
  font-weight: 600;
}

.file-row.nested {
  min-height: 42px;
  padding-left: 34px;
  background: #f5f0e7;
}

.ficon {
  display: block;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
}

.chev,
.chev-spacer {
  flex: 0 0 18px;
  width: 18px;
}

.chev {
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
  transform: none;
}

.chev:hover {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.frow .fname,
.file-row .fname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frow .fsize,
.file-row .fsize {
  flex: 0 0 auto;
  color: var(--muted);
  white-space: nowrap;
}

.file-row [class^="status-"] {
  margin-left: auto;
}

.frm {
  min-height: 28px;
  width: 28px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 20px;
  line-height: 1;
  transform: none;
}

.frm:hover {
  border-color: #f3c6c6;
  background: var(--red-soft);
  color: var(--red);
  box-shadow: none;
  transform: none;
}

.file-tally {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
}

.file-tally:empty {
  display: none;
}

.send-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

#sendBtn {
  width: 100%;
}

.ghost {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.ghost:hover {
  border-color: var(--line-strong);
  background: #f1ebdf;
  box-shadow: var(--shadow-sm);
}

.icon-btn {
  min-height: 30px;
  width: 32px;
  margin-left: 12px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  transform: none;
  vertical-align: middle;
}

.icon-btn:hover:not(:disabled) {
  background: rgba(17, 24, 39, .05);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  opacity: 1;
}

.icon-sun {
  display: none;
}

.flow-card {
  width: min(100%, 560px);
  margin: 0 auto;
}

.bar {
  height: 9px;
  margin: 12px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ddce;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #2aa876);
  transition: width .22s ease;
}

.ring-wrap {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 10px auto 16px;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 9;
}

.ring-fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 326.726;
  stroke-dashoffset: 326.726;
  transition: stroke-dashoffset .35s ease;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.ring-center #progPct {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 650;
  line-height: 1;
  color: var(--ink);
}

.ring-rate {
  font-size: 12px;
  color: var(--muted);
}

.prog-stats {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

#cancelBtn {
  width: 100%;
}

.fail-text {
  margin: 16px 0 10px;
  color: var(--red);
  font-size: 14px;
  line-height: 1.45;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 13px;
}

.done {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  color: var(--green);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 680;
}

.done::before {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background:
    var(--green)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.4 6.7 11.1 12 5.2' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 12px 12px no-repeat;
}

.link-box {
  margin-top: 12px;
  padding: 12px 13px;
  border: 1px solid var(--blue-soft);
  border-radius: var(--radius);
  background: var(--surface-warm);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

/* Receive inbox */

.inbox-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(140px, 1.4fr) auto auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--body);
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.inbox-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transform: translateY(-1px);
}

.ix-from,
.ix-sub {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ix-from {
  color: var(--ink);
  font-weight: 600;
}

.ix-sub {
  color: var(--muted);
}

.ix-meta {
  color: var(--muted);
  white-space: nowrap;
}

.ix-del {
  min-height: 26px;
  width: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  box-shadow: none;
  transform: none;
}

.ix-del:hover:not(:disabled) {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
  box-shadow: none;
  transform: none;
}

.ix-bar {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ddce;
}

.ix-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width .3s ease;
}

/* Download page and admin table */

#summary {
  margin: -6px 0 16px;
  text-align: center;
}

/* Download-page folder tree — click a row to highlight/select it */
.tree-ico { width: 15px; height: 15px; flex: 0 0 auto; }
.trow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  user-select: none;
}
.trow:hover { background: var(--surface-soft); }
.trow.sel { background: var(--blue-soft); }
.tchev {
  width: 12px;
  flex: 0 0 auto;
  text-align: center;
  color: var(--subtle);
  font-size: 10px;
}
.trow .tname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tdir .tname { color: var(--ink); }
.tfile .tname { color: var(--body); }
.tmeta, .tsize { color: var(--muted); white-space: nowrap; font-size: 12px; }

/* Download area — reflects the current selection (everything, or highlighted) */
.parts { margin: 16px 0 0; text-align: left; }
.parts-hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.dl-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--body);
  margin: 0 0 8px;
}
.dl-clear {
  background: none;
  border: none;
  min-height: 0;
  padding: 0;
  box-shadow: none;
  color: var(--blue);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.dl-btn { width: 100%; margin-bottom: 8px; }
.dl-btn:last-child { margin-bottom: 0; }

.save-bar {
  margin: 0 0 12px;
  text-align: center;
}

button.inline {
  min-height: 34px;
  margin-left: 8px;
  padding: 0 12px;
  font-size: 13px;
}

#tbl {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #f1ebdf;
  color: #566173;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 680;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 12px;
  border-bottom: 1px solid #e1d9c9;
  color: var(--body);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover,
tr:hover td {
  background: #f5f0e7;
}

[class^="status-"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-complete {
  background: var(--green-soft);
  color: var(--green);
}

.status-failed {
  background: var(--red-soft);
  color: var(--red);
}

.status-uploading {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-expired {
  background: #eef0f4;
  color: #667085;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 860px) {
  #app {
    padding: 14px 14px 36px;
  }

  .appbar {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .seg {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .seg-btn {
    padding: 0 12px;
  }

  .who {
    max-width: 44vw;
  }

  .panes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .wrap {
    padding: 22px 12px;
  }

  .card {
    padding: 26px 20px;
  }

  h1 {
    font-size: 21px;
  }

  .appbar {
    position: static;
  }

  .brand-name {
    font-size: 16px;
  }

  .pane {
    padding: 15px;
  }

  .send-actions {
    grid-template-columns: 1fr;
  }

  .prog-stats {
    grid-template-columns: 1fr auto;
  }

  #progRate {
    display: none;
  }

  .inbox-row {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }

  .ix-sub,
  .ix-meta {
    grid-column: 1 / -1;
  }

  .file-row {
    flex-wrap: wrap;
  }

  button.inline {
    width: 100%;
    margin-left: 0;
  }
}

/* ---------- Dark theme ---------- */

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #dddcd7;
  --body: #aba9a4;
  --muted: #84827c;
  --subtle: #6c6963;
  --line: #2e2d2a;
  --line-strong: #3b3935;
  --surface: #201f1d;
  --surface-soft: #252421;
  --surface-warm: #242320;
  --canvas: #171716;
  --gold: #c6ad74;
  --gold-soft: #322c1b;
  --blue: #8ca2e6;
  --blue-soft: #2c2a25;
  --green: #6cbf8f;
  --green-soft: #242a1e;
  --red: #e0938b;
  --red-soft: #322620;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 18px 40px rgba(0, 0, 0, .5);
  --btn-bg: #e7e2d6;
  --btn-fg: #1a1714;
  --btn-bg-hover: #f1ece1;
}

[data-theme="dark"] body {
  background:
    linear-gradient(rgba(255, 254, 252, .02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 254, 252, .02) 1px, transparent 1px),
    var(--canvas);
  background-size: 36px 36px, 36px 36px, auto;
  background-attachment: fixed;
}

[data-theme="dark"] .card {
  background: rgba(32, 31, 29, .92);
  border-color: rgba(60, 59, 55, .7);
}

[data-theme="dark"] .logo {
  filter: brightness(0) invert(1);
  opacity: .92;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--surface);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .25);
}

[data-theme="dark"] input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
}

[data-theme="dark"] label,
[data-theme="dark"] .field label {
  color: var(--body);
}

[data-theme="dark"] .error {
  border-color: rgba(240, 114, 111, .35);
}

[data-theme="dark"] a,
[data-theme="dark"] .link-btn {
  color: var(--blue);
}

[data-theme="dark"] button:disabled {
  background: #2e2a23;
  border-color: #3a3529;
  color: var(--subtle);
}

[data-theme="dark"] .appbar {
  background: transparent;
}

[data-theme="dark"] .brand svg {
  box-shadow: none;
}

[data-theme="dark"] .seg {
  background: rgba(255, 255, 255, .05);
  border-color: var(--line);
}

[data-theme="dark"] .seg-btn:hover {
  background: rgba(255, 255, 255, .07);
}

[data-theme="dark"] .pane {
  background: rgba(32, 31, 29, .85);
  border-color: rgba(60, 59, 55, .6);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .32);
}

[data-theme="dark"] .pane-head {
  color: var(--muted);
}

[data-theme="dark"] .dropzone {
  border-color: var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, .01)),
    repeating-linear-gradient(135deg, rgba(198, 173, 116, .06) 0 1px, transparent 1px 11px);
  color: var(--muted);
}

[data-theme="dark"] .sel-bar {
  background: var(--gold-soft);
  color: var(--gold);
}

[data-theme="dark"] .file-list-detailed {
  background: var(--surface);
  border-color: var(--line);
}

[data-theme="dark"] .frow,
[data-theme="dark"] .file-row {
  border-bottom-color: var(--line);
}

[data-theme="dark"] .frow:hover {
  background: rgba(255, 255, 255, .04);
}

[data-theme="dark"] .frow.selected {
  background: rgba(208, 184, 118, .12);
}

[data-theme="dark"] .file-row.nested {
  background: rgba(255, 255, 255, .02);
}

[data-theme="dark"] .frm:hover {
  border-color: rgba(240, 114, 111, .4);
}

[data-theme="dark"] .ghost {
  background: transparent;
}

[data-theme="dark"] .ghost:hover {
  background: rgba(255, 255, 255, .05);
  border-color: var(--line-strong);
}

[data-theme="dark"] .bar,
[data-theme="dark"] .ix-bar {
  background: #312d27;
}

[data-theme="dark"] .inbox-row {
  background: var(--surface);
}

[data-theme="dark"] .inbox-row:hover {
  border-color: var(--line-strong);
}

[data-theme="dark"] .ix-sub {
  color: var(--muted);
}

[data-theme="dark"] #tbl {
  background: var(--surface);
}

[data-theme="dark"] th {
  background: var(--surface-soft);
  color: var(--muted);
}

[data-theme="dark"] td {
  border-bottom-color: var(--line);
}

[data-theme="dark"] tbody tr:hover,
[data-theme="dark"] tr:hover td {
  background: rgba(255, 255, 255, .03);
}

[data-theme="dark"] .status-expired {
  background: #2e2a23;
  color: var(--muted);
}

[data-theme="dark"] .icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, .07);
}

[data-theme="dark"] .icon-sun {
  display: block;
}

[data-theme="dark"] .icon-moon {
  display: none;
}
