/* Design tokens lifted from the reference: sharp 2px corners, dense 10-12px UI
   type, wide-tracked uppercase mono labels, navy on near-white. Themes are pure
   variable swaps -- set data-theme="business" on <html> for the blue variant. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-ui: var(--font-mono);
  --font-body: var(--font-sans);

  --bg-primary: #fff;
  --bg-secondary: #f8fafc;
  --text-primary: #0f172a;
  --text-accent: #1a3560;
  --text-muted: #334155;
  --text-body: #334155;
  --border-primary: #e2e8f0;
  --border-secondary: #cbd5e1;
  --hover-bg: #1a356012;
  --active-bg: #1a35601a;
  --active-border: #1a356066;
  --panel-header-bg: #1a35600d;
  --shadow-primary: #1a356033;
  --shadow-secondary: #1a356012;
  --accent: #1a3560;
  --accent-hover: #12274a;
  --accent-border: #1a356040;
  --danger: #dc2626;
  --danger-hover: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --amber: #92660a;

  --radius: 2px;
  --pill: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --quick: 200ms;
  --footer-height: 36px;
}

[data-theme="business"] {
  --font-ui: var(--font-sans);
  --bg-primary: #f8fafc;
  --bg-secondary: #fff;
  --text-accent: #2563eb;
  --text-muted: #475569;
  --border-primary: #cbd5e1;
  --border-secondary: #e2e8f0;
  --hover-bg: #2563eb14;
  --active-bg: #2563eb1a;
  --active-border: #2563eb73;
  --panel-header-bg: #eff6ff;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-border: #2563eb40;
  --amber: #b45309;
  --success: #059669;
}

* { box-sizing: border-box; }

html { background: var(--bg-secondary); }

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: var(--footer-height);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font: 400 14px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text-accent); }

/* ------------------------------------------------------------------ chrome */

header {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 48px;
  padding: 0 1.25rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-secondary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font: 700 13px/1 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
}
.brand .logo {
  display: block;
  width: 18px;
  height: 18px;
  flex: none;
}

.who {
  margin-left: auto;
  font: 500 10px/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

header form { display: flex; }

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.25rem;
  display: grid;
  gap: 1.25rem;
}

.app-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--footer-height);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.25rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-primary);
  font: 400 10px/1 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.app-footer .ok { color: var(--success); }
.app-footer .spacer { margin-left: auto; }

/* ------------------------------------------------------------------ panels */

.card {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  /* Padding here, not margins on the children: a child with width:100% plus a
     margin is a full-width box pushed sideways, and overhangs the card. */
  padding: 0 .9rem .9rem;
}

.card > h1 {
  margin: 0 -.9rem .9rem;
  padding: .6rem .9rem;
  background: var(--panel-header-bg);
  border-bottom: 1px solid var(--border-primary);
  font: 600 10px/1.4 var(--font-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-accent);
}

.narrow {
  max-width: 21rem;
  margin: 4rem auto;
}
.narrow h1 { margin-bottom: 0; }

/* ------------------------------------------------------------------- forms */

label {
  display: grid;
  gap: .3rem;
  font: 500 10px/1.4 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

input {
  width: 100%;
  padding: .45rem .55rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
  color: var(--text-primary);
  font: 400 13px/1.4 var(--font-mono);
  transition: border-color var(--quick) var(--ease), box-shadow var(--quick) var(--ease);
}
input::placeholder { color: #94a3b8; text-transform: none; letter-spacing: 0; }
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-border);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  align-items: end;
}
.row > label { flex: 1 1 9rem; }
.narrow .row { display: grid; }

button, .button {
  display: inline-block;
  padding: .45rem .9rem;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font: 600 10px/1.6 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--quick) var(--ease), border-color var(--quick) var(--ease);
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.ghost {
  background: transparent;
  color: var(--text-accent);
  border-color: var(--border-secondary);
}
button.ghost:hover { background: var(--hover-bg); border-color: var(--accent-border); }

button.link {
  padding: .15rem .3rem;
  background: none;
  border-color: transparent;
  color: var(--text-accent);
  font-size: 10px;
}
button.link:hover { background: var(--hover-bg); border-color: transparent; }
button.link.danger { color: var(--danger); }
button.link.danger:hover { background: #dc26260f; }

/* ---------------------------------------------------------------- dropzone */

.drop {
  position: relative;
  padding: 2rem 1rem;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-secondary);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--quick) var(--ease), background var(--quick) var(--ease);
}
.drop:hover { border-color: var(--accent-border); }
.drop.over { border-color: var(--accent); background: var(--active-bg); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop p {
  margin: 0;
  pointer-events: none;
  font: 500 10px/1.6 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ------------------------------------------------------------------ tables */

table { width: 100%; border-collapse: collapse; }

thead th {
  padding: .35rem .5rem;
  border-bottom: 1px solid var(--border-secondary);
  text-align: left;
  font: 600 9px/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
thead th:last-child, td:last-child { text-align: right; }

tbody tr { transition: background var(--quick) var(--ease); }
tbody tr:hover { background: var(--hover-bg); }

td {
  padding: .45rem .5rem;
  border-bottom: 1px solid var(--border-primary);
  font: 400 12px/1.5 var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td.name {
  width: 100%;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  white-space: normal;
  word-break: break-all;
}
td a { color: var(--text-primary); text-decoration: none; }
td a:hover { color: var(--text-accent); text-decoration: underline; }

.tag {
  display: inline-block;
  margin-left: .4rem;
  padding: .05rem .45rem;
  border: 1px solid var(--border-secondary);
  border-radius: var(--pill);
  font: 600 9px/1.6 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  vertical-align: 1px;
}
.tag.locked { color: var(--amber); border-color: #92660a40; }
.tag.request { color: var(--text-accent); border-color: var(--accent-border); }

/* -------------------------------------------------------------------- text */

.hint {
  margin: 0 0 .8rem;
  font-size: 12px;
  color: var(--text-muted);
}
.error { color: var(--danger); font-size: 12px; }
.result {
  margin: .8rem 0 0;
  font: 400 12px/1.6 var(--font-mono);
  word-break: break-all;
  color: var(--text-muted);
}
.result a { color: var(--text-accent); }

.empty {
  padding: 1.5rem 0;
  text-align: center;
  font: 500 10px/1.6 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #94a3b8;
}

/* --------------------------------------------------------------- file list */

.files { list-style: none; padding: 0; margin: 0 0 .9rem; }
.files li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .45rem .5rem;
  border-bottom: 1px solid var(--border-primary);
}
.files li:last-child { border-bottom: 0; }
.files li:hover { background: var(--hover-bg); }
.files a { color: var(--text-primary); text-decoration: none; word-break: break-all; }
.files a:hover { color: var(--text-accent); text-decoration: underline; }
.files span {
  flex: none;
  font: 400 11px/1.6 var(--font-mono);
  color: var(--text-muted);
}
.files em { font-style: normal; color: var(--amber); }

/* ---------------------------------------------------------------- progress */

.progress { list-style: none; padding: 0; margin: .9rem 0 0; display: grid; gap: .5rem; }
.progress li {
  font: 400 11px/1.5 var(--font-mono);
  color: var(--text-muted);
  word-break: break-all;
}
.progress .bar {
  height: 2px;
  margin-top: .3rem;
  background: var(--border-primary);
  overflow: hidden;
}
.progress .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width var(--quick) var(--ease);
}
.progress .done .bar i { background: var(--success); }
.progress .failed { color: var(--danger); }
.progress .failed .bar i { background: var(--danger); }

/* ---------------------------------------------------------------- previews */

.gallery {
  display: grid;
  gap: .7rem;
  margin-bottom: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}
.gallery.single { grid-template-columns: 1fr; }

figure {
  margin: 0 0 .9rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  overflow: hidden;
}
figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 34rem;
  object-fit: contain;
  background:
    repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 16px 16px;
}
.gallery.single figure img { max-height: 42rem; }

figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: .45rem .6rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-primary);
  font: 400 11px/1.5 var(--font-mono);
  color: var(--text-muted);
}
figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
figcaption a {
  flex: none;
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-accent);
  text-decoration: none;
}
figcaption a:hover { text-decoration: underline; }

.textfile { background: var(--bg-primary); }
.textfile figcaption { border-top: 0; border-bottom: 1px solid var(--border-primary); }
.textfile pre {
  margin: 0;
  padding: .8rem;
  max-height: 32rem;
  overflow: auto;
  background: var(--bg-secondary);
  font: 400 12px/1.6 var(--font-mono);
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 40rem) {
  main { padding: .75rem; gap: .75rem; }
  header { padding: 0 .75rem; }
  td, thead th { padding: .4rem .3rem; }
  .hide-sm { display: none; }
}

/* ------------------------------------------------------------ staged queue */

.queue { list-style: none; padding: 0; margin: .8rem 0 0; }
.queue:empty { margin: 0; }
.queue li {
  padding: .35rem 0;
  border-bottom: 1px solid var(--border-primary);
}
.queue li:last-child { border-bottom: 0; }

.qrow { display: flex; align-items: baseline; gap: .75rem; }
.qname {
  flex: 1;
  min-width: 0;
  font: 400 12px/1.5 var(--font-mono);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.qsize {
  flex: none;
  font: 400 11px/1.5 var(--font-mono);
  color: var(--text-muted);
}
.queue .bar {
  height: 2px;
  margin-top: .3rem;
  background: var(--border-primary);
  overflow: hidden;
}
.queue .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width var(--quick) var(--ease);
}
.queue .done .qname { color: var(--text-muted); }
.queue .done .bar i { background: var(--success); }
.queue .failed .qname, .queue .failed .qsize { color: var(--danger); }
.queue .failed .bar i { background: var(--danger); }

.queue-foot {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .8rem;
}
.qtotal {
  font: 500 10px/1.6 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.queue-foot button { margin-left: auto; }
.queue-foot button:disabled {
  background: var(--bg-secondary);
  border-color: var(--border-primary);
  color: #94a3b8;
  cursor: not-allowed;
}

/* Revoked rows stay visible -- the data is still there, only the link is dead. */
.revoked-row td { opacity: .55; }
.revoked-row td a { text-decoration: line-through; }
.tag.revoked { color: var(--danger); border-color: #dc262640; }
button.link.warn { color: var(--amber); }
button.link.warn:hover { background: #92660a0f; }

.who-cell {
  font-weight: 600;
  color: var(--text-accent);
  text-transform: none;
  letter-spacing: 0;
}

/* Delivery receipt on the drop page: the uploader cannot open the share to
   check anything arrived, so the confirmation has to be explicit. */
.result.ok { color: var(--success); }
.receipt { list-style: none; padding: 0; margin: .6rem 0 0; }
.receipt li {
  padding: .25rem 0 .25rem 1.15rem;
  position: relative;
  font: 400 11px/1.5 var(--font-mono);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.receipt li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

.subhead {
  margin: 1.1rem 0 .5rem;
  padding-top: .8rem;
  border-top: 1px solid var(--border-primary);
  font: 600 10px/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.card > .subhead:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
code {
  font: 400 12px/1 var(--font-mono);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  padding: .05rem .3rem;
}
.secret {
  display: block;
  margin-top: .4rem;
  padding: .5rem .6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  font: 400 12px/1.5 var(--font-mono);
  color: var(--text-primary);
  overflow-wrap: anywhere;
  user-select: all;
}

/* Section grouping */
.sections { display: flex; gap: .1rem; margin-left: 1.25rem; }
.sections a {
  padding: .3rem .6rem;
  border-radius: var(--radius);
  font: 600 10px/1.6 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
}
.sections a:hover { background: var(--hover-bg); color: var(--text-accent); }

main > section { display: grid; gap: 1.25rem; }
main > section + section { margin-top: 2rem; }

h2.section {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding-bottom: .55rem;
  border-bottom: 2px solid var(--accent);
  font: 700 17px/1.2 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-primary);
  scroll-margin-top: 60px;
}
section { scroll-margin-top: 60px; }

@media (max-width: 46rem) {
  .sections { display: none; }
}

.totp-setup { margin-top: .8rem; }
.qr {
  display: inline-block;
  padding: .5rem;
  background: #fff;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius);
}
.qr svg { display: block; width: 180px; height: 180px; }
.hint.ok { color: var(--success); }

/* The share name is the way into its contents, so make that look like a link
   rather than plain text that happens to be clickable. */
td.name a.open {
  color: var(--text-accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-border);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  font-weight: 500;
}
td.name a.open:hover {
  text-decoration-color: var(--accent);
  background: var(--hover-bg);
}
td.name a.open::after {
  content: " \2192";
  opacity: 0;
  transition: opacity var(--quick) var(--ease);
}
tbody tr:hover td.name a.open::after { opacity: .5; }

/* Anything with an exact-time tooltip */
td[title], span[title] { cursor: help; }
td.name a[title] { cursor: pointer; }

.section-note {
  margin: -.4rem 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
