/* Same vibehuus look as the public pages (web/public/static/app.css):
   blue on off-white by day, off-white on deep blue by night. */

@font-face {
  font-family: "Bebas Neue";
  font-weight: 400;
  font-display: swap;
  src: url(/_/fonts/bebas-neue-latin-400-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Space Mono";
  font-weight: 400;
  font-display: swap;
  src: url(/_/fonts/space-mono-latin-400-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Space Mono";
  font-weight: 700;
  font-display: swap;
  src: url(/_/fonts/space-mono-latin-700-normal.woff2) format("woff2");
}

:root {
  color-scheme: light;
  --blue: #2e72b8;
  --blue-deep: #1f5a99;
  --blue-dim: #8aaed0;
  --offwhite: #f4f6f9;

  --bg: var(--offwhite);
  --fg: var(--blue);
  --dim: #6f93b8;
  --surface: #ffffff;
  --line: color-mix(in srgb, var(--fg) 35%, transparent);
  --sel: color-mix(in srgb, var(--fg) 8%, transparent);
  --ok: var(--blue);
  --bad: #b3261e;
  --tag-bad-bg: var(--bad);
  --tag-bad-fg: #ffffff;
  --display: "Bebas Neue", "Arial Narrow", sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    /* Off-white on vibehuus's deep blue; panels filled in its main blue. */
    --bg: var(--blue-deep);
    --fg: var(--offwhite);
    --dim: #a9c4e0;
    --surface: var(--blue);
    --ok: var(--offwhite);
    --bad: #ffc2b8;
    --tag-bad-bg: var(--bad);
    --tag-bad-fg: var(--blue-deep);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 var(--mono);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; }
code { font: inherit; overflow-wrap: anywhere; }
small, .muted { color: var(--dim); }

.top {
  padding: 10px 16px;
  border-bottom: 2px solid var(--fg);
  background: var(--surface);
}
/* Name left, title centred, NAS status right, lined up with main's
   edges. Equal side columns keep the title exactly centred. */
.top-inner {
  max-width: 1168px; /* main's 1200px minus its padding */
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px 16px;
}
.top .hello { justify-self: start; }
.top .nas { justify-self: end; text-align: right; }
@media (max-width: 640px) {
  .top-inner { grid-template-columns: 1fr 1fr; }
  .top h1 { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
}
.top h1 {
  margin: 0;
  font: 400 34px/1 var(--display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.nas {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  border: 1.5px solid currentColor;
}
.nas.ok { color: var(--ok); }
.nas.bad { color: var(--bad); font-weight: 700; }

main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.hello {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
}
section { margin: 28px 0; }
h2 {
  margin: 0 0 10px;
  font: 400 26px/1 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h2 .clear { font: 11px var(--mono); letter-spacing: 0.12em; margin-left: 8px; text-transform: uppercase; }

.banner { padding: 10px 14px; margin: 0 0 16px; border: 2px solid; background: var(--surface); }
.banner p { margin: 0; }
.banner.error { color: var(--bad); }
.url-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px !important; font-weight: 700; }

/* New-link form: six columns on desktop. Row 1 is where files go and the
   limits, row 2 the link itself, then the message. Every field is title /
   control / hint, so controls on one row line up. */
form.new-link {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px 18px;
  align-items: start;
  background: var(--surface);
  border: 2px solid var(--fg);
  padding: 18px;
}
.f-dest, .f-expires, .f-max, .f-label { grid-column: span 2; }
.f-name { grid-column: span 4; }
.f-message, .f-submit { grid-column: 1 / -1; }
.f-submit { text-align: center; }
/* Create button: "Create link" → after creating, "Link copied ✓", which
   reads "Create new link" on hover. Fixed width so it doesn't jump. */
button.create { min-width: 210px; }
button.create .when-done, button.create .when-hover { display: none; }
form.done button.create .when-ready { display: none; }
form.done button.create .when-done { display: inline; }
form.done button.create:hover .when-done,
form.done button.create:focus-visible .when-done { display: none; }
form.done button.create:hover .when-hover,
form.done button.create:focus-visible .when-hover { display: inline; }
button.create:disabled { opacity: 0.6; cursor: progress; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hint { margin: 0; font-size: 11px; line-height: 1.45; color: var(--dim); }
.field.invalid input, .field.invalid select, .field.invalid textarea {
  border-color: var(--bad);
  box-shadow: inset 0 0 0 1px var(--bad);
}
/* A solid tag, so it stands out on blue as much as on off-white. */
.field-error {
  align-self: flex-start;
  margin: 0;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tag-bad-fg);
  background: var(--tag-bad-bg);
}
@media (max-width: 900px) {
  form.new-link { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .f-dest, .f-expires, .f-max, .f-label { grid-column: span 1; }
  .f-name { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  form.new-link { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .f-dest, .f-expires, .f-max, .f-label, .f-name { grid-column: 1 / -1; }
}

input, select, textarea {
  font: 13px/1.4 var(--mono);
  letter-spacing: 0;
  color: inherit;
  background: var(--bg);
  border: 1.5px solid var(--fg);
  border-radius: 0;
  padding: 8px 10px;
  width: 100%;
  min-height: 38px;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
textarea { resize: vertical; }

/* Custom URL: the full domain, never truncated. Side by side when there's
   room, the domain on its own line above the input when there isn't. */
.prefixed { display: flex; flex-wrap: wrap; align-items: stretch; }
.prefixed > span {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1.5px solid var(--fg);
  border-right: none;
  color: var(--dim);
  white-space: nowrap;
}
.prefixed input { flex: 1 1 12em; min-width: 0; }
.prefixed .reroll {
  flex: none;
  border-left: none;
  padding: 0 12px;
  font-size: 15px;
  letter-spacing: 0;
}
@media (max-width: 560px) {
  .prefixed > span { flex-basis: 100%; border-right: 1.5px solid var(--fg); border-bottom: none; padding: 6px 10px; }
}

button {
  font: 700 10px/1.2 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg);
  background: transparent;
  border: 1.5px solid var(--fg);
  border-radius: 0;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover { background: var(--sel); }
/* A link that looks like a button (Download). */
a.button {
  display: inline-block;
  font: 700 10px/1.2 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg);
  border: 1.5px solid var(--fg);
  padding: 6px 12px;
  text-align: center;
}
a.button:hover { background: var(--sel); }
button.primary { background: var(--fg); color: var(--surface); padding: 10px 20px; font-size: 11px; }
button.primary:hover { background: var(--dim); border-color: var(--dim); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger.solid { background: var(--bad); color: var(--surface); padding: 10px 20px; font-size: 11px; }
button.danger.solid:hover { opacity: 0.85; }
button.small { padding: 2px 8px; }

.scroll { overflow-x: auto; background: var(--surface); border: 2px solid var(--fg); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1.5px solid var(--fg);
}
tbody tr:last-child td { border-bottom: none; }
tr.selected { background: var(--sel); }
tr.revoked, tr.expired { opacity: 0.55; }

/* Links: the label (bold) sits above the URL in one wide column. */
td.link-cell { min-width: 280px; width: 40%; }
table.log td[data-label="Link"] { min-width: 190px; }
table.log td.state { min-width: 170px; }
.link-label { font-weight: 700; overflow-wrap: anywhere; margin-bottom: 2px; }
.link-url { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.link-url code { overflow-wrap: anywhere; }
td.file { overflow-wrap: anywhere; min-width: 180px; font-weight: 700; }
td.actions { white-space: nowrap; text-align: right; width: 1%; }
td.actions > form { display: inline; }
/* Actions stacked, one per line, so the column stays narrow. */
td.actions > button, td.actions > form, td.actions > a.button { display: block; margin: 0 0 6px auto; }
td.actions > form button, td.actions > button, td.actions > a.button { width: 100%; }
td.actions > :last-child { margin-bottom: 0; }
/* Dialogs live in this cell too; keep them centred whatever the rules
   above say about the cell's children. */
td.actions > dialog.modal { margin: auto; }

/* Size cap, changed straight from the table. */
/* "Saved" sits just under the dropdown, out of the layout, so showing it
   never resizes the table. The cell's bottom padding leaves it room. */
.cap-form { display: inline-block; position: relative; }
.cap-form select { width: auto; min-height: 0; padding: 3px 6px; font-size: 12px; }
td[data-label="Cap"] { padding-bottom: 16px; }
.saved {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 2px;
  font-size: 9px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Message dialog. The form fills the dialog, so a click that lands on the
   dialog element itself can only be on the backdrop. */
dialog.modal {
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  border: 2px solid var(--fg);
  border-radius: 0;
  background: var(--surface);
  color: var(--fg);
  white-space: normal;
  text-align: left;
}
dialog.modal::backdrop { background: color-mix(in srgb, var(--blue-deep) 55%, transparent); }
dialog.modal > form, dialog.modal > .modal-body { display: flex; flex-direction: column; gap: 10px; padding: 20px; margin: 0; }
.message-readonly {
  margin: 0;
  padding: 10px 12px;
  border: 1.5px dashed var(--fg);
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.5;
}
.confirm-text { margin: 0; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.modal-actions button { padding: 10px 20px; font-size: 11px; }
dialog.modal h3 {
  margin: 0;
  font: 400 28px/1 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.stack small { display: block; }
/* Dates come as "dd/mm/yy\nhh:mm": keep that line break, and no other. */
td[data-label="Created"], td[data-label="Expires"], td[data-label="Started"],
td[data-label="Completed"], td[data-label="Pulled to NAS"], td[data-label="Kept until"],
td[data-label="Added"], td[data-label="Last used"] { white-space: pre; }
td[data-label="Delivery"] { white-space: pre-line; }
/* Keeps "3 files" and "51 MB" whole; the cell may break between them. */
.nw { white-space: nowrap; }
.pill {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 1px 8px;
  border: 1.5px solid currentColor;
  white-space: nowrap;
}
.pill.revoked, .pill.expired { color: var(--dim); }
.ok { color: var(--ok); font-weight: 700; }
.bad { color: var(--bad); font-weight: 700; }
tr.state-failed td.state, tr.state-abandoned td.state { color: var(--bad); }

/* Phones and tablets: each row becomes a card, every value labelled. */
@media (max-width: 1100px) {
  .scroll { overflow: visible; background: none; border: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards thead { display: none; }
  table.cards tr {
    background: var(--surface);
    border: 2px solid var(--fg);
    margin-bottom: 10px;
    padding: 6px 0;
  }
  table.cards tr.selected { background: color-mix(in srgb, var(--fg) 8%, var(--surface)); }
  table.cards td { border: none; padding: 4px 12px; min-width: 0; }
  table.cards td[data-label] { display: flex; gap: 12px; align-items: baseline; }
  table.cards td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 8.5em;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--dim);
  }
  table.cards td.link-cell, table.cards td.file { padding-top: 8px; padding-bottom: 8px; }
  table.cards td.actions { text-align: left; white-space: normal; padding-top: 8px; width: auto; }
  table.cards td.actions > button, table.cards td.actions > form, table.cards td.actions > a.button { display: inline-block; margin: 0 6px 0 0; }
  table.cards td.actions > form button, table.cards td.actions > button, table.cards td.actions > a.button { width: auto; }
  table.cards td[data-label="Cap"] { padding-bottom: 16px; }
}

/* Short values stay on one line in the wide table layout. */
@media (min-width: 1101px) {
  td[data-label="Cap"], td[data-label="Size"] { white-space: nowrap; }
}

/* Sign-in and passkey-creation pages: one framed box, centred, with the
   TRANSFER wordmark on top. */
body.auth { min-height: 100vh; }
.auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-panel {
  width: 100%;
  max-width: 440px;
  border: 2px solid var(--fg);
  background: var(--surface);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: center;
}
.auth-logo {
  margin: 0;
  font: 400 clamp(48px, 10vw, 75px)/0.9 var(--display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.auth-panel h2 { margin: 0; }
.auth-panel p { margin: 0; line-height: 1.6; }
.auth-panel button.primary { align-self: center; min-width: 240px; }
.auth-error { color: var(--bad); font-weight: 700; }

/* Header, right side: NAS status (NAS mode) and Sign out. */
.top-right { justify-self: end; display: flex; align-items: center; gap: 12px; }
.top-right form { margin: 0; }

/* People & passkeys */
.person { margin-bottom: 18px; }
.person-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.person-head h3 { margin: 0; font: 400 22px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.person-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.person-actions form { margin: 0; }
