/* votport UI. AGPL-3.0-only.
 *
 * Enterprise application chrome: a fixed identity bar, a grey work surface,
 * white bordered panels, square corners, dense uppercase field labels. One
 * navy for actions, one yellow as the identity mark (matching the favicon),
 * one green reserved for a verified result. No gradients, no shadows, no
 * padlock iconography — the product is the security claim, not the decoration.
 *
 * Every id and class here is load-bearing: admin.js and upload.js bind them.
 * Rename nothing without grepping web/assets/*.js first.
 */

:root {
  --bg: #e9ebee;
  --panel: #ffffff;
  --panel-2: #f4f5f7;
  --head: #f7f8f9;
  --text: #11151a;
  --muted: #59626d;
  --accent: #14395c;
  --accent-wash: #eef2f6;
  --brand: #f2c230;
  --ok: #15604a;
  --danger: #94272a;
  --border: #d2d7dd;
  --border-strong: #b3bac2;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --panel: #171c22;
    --panel-2: #1e242b;
    --head: #1b2128;
    --text: #e3e7eb;
    --muted: #97a1ac;
    --accent: #4f8ec2;
    --accent-wash: #182430;
    --brand: #f2c230;
    --ok: #5fb494;
    --danger: #dd8b86;
    --border: #29313a;
    --border-strong: #3a444f;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- identity bar ------------------------------------------------------ */

.appbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1.25rem;
  height: 46px;
  background: var(--panel);
  border-bottom: 1px solid var(--border-strong);
}
/* The mark is the favicon: one solid square, no glyph inside it. */
.mark { width: 13px; height: 13px; background: var(--brand); flex: none; }
.wordmark {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.appbar-tag {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 0.6rem;
  margin-left: 0.1rem;
  border-left: 1px solid var(--border);
}

/* ---- work surface ------------------------------------------------------ */

.wrap { max-width: 860px; margin: 0 auto; padding: 2.25rem 1.25rem 5rem; }
.wrap.narrow { max-width: 560px; }

.masthead { margin-bottom: 1.5rem; }
.eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.masthead h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.25;
}
.masthead .sub { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.8rem; }
.masthead a { color: var(--muted); }

/* Panel titles read as record headers, not headlines. */
h2 {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}
section > h2 { margin: 2rem 0 0.7rem; }

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

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 1.15rem 1.25rem;
  margin-bottom: 0.85rem;
}
.card > p { margin: 0 0 0.85rem; }
.card > p:last-child { margin-bottom: 0; }
/* .card.ok carries no separate treatment: the panel title already says the
   transfer completed, and a coloured edge only competes with it. */

/* ---- form controls ----------------------------------------------------- */

label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.95rem;
}
label .muted {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 0.7rem;
  opacity: 0.85;
}
label .muted::before { content: "("; }
label .muted::after { content: ")"; }

input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}
input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--panel);
}
input::placeholder { color: var(--muted); opacity: 0.7; }

button {
  padding: 0.45rem 1rem;
  border-radius: 0;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.25); }
button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
button:disabled { opacity: 0.35; cursor: default; }

button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border-strong);
}
button.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--text); filter: none; }
button.tiny { padding: 0.22rem 0.6rem; font-size: 0.65rem; }
button.danger { background: transparent; border-color: var(--border-strong); color: var(--danger); }
button.danger:hover:not(:disabled) { border-color: var(--danger); filter: none; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}
.muted { color: var(--muted); font-size: 0.78rem; }
.error { color: var(--danger); font-size: 0.8rem; margin: 0.7rem 0 0; }

/* Addresses to copy sit in a field-shaped well, not as running text. */
.card > p.mono {
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 0.5rem 0.6rem;
}

/* ---- request records --------------------------------------------------- */

.link-item { margin-bottom: 0.5rem; padding: 0; }
.link-item .head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding: 0.65rem 1.25rem;
  background: var(--head);
  border-bottom: 1px solid var(--border);
}
.link-item .head h3 { margin: 0; font-size: 0.9rem; font-weight: 600; }
.link-item > :not(.head) { margin-left: 1.25rem; margin-right: 1.25rem; }
.link-item > p { margin-top: 0.85rem; margin-bottom: 0.85rem; }
.link-item > details { margin-bottom: 1rem; }

.badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  white-space: nowrap;
}
.badge.on { border-color: var(--ok); color: var(--ok); }
.badge.off { border-color: var(--border-strong); color: var(--muted); background: var(--panel-2); }

.link-item .actions { display: flex; gap: 0.4rem; margin-bottom: 1.1rem; flex-wrap: wrap; }

.uploads { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.uploads li { padding: 0.5rem 0; border-top: 1px solid var(--border); font-size: 0.78rem; }

/* ---- uploader ---------------------------------------------------------- */

.drop {
  border: 1px dashed var(--border-strong);
  background: var(--panel-2);
  text-align: center;
  padding: 1.75rem 1rem;
  margin-bottom: 1.1rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.drop p { margin: 0 0 0.7rem; }
.drop p:last-child { margin-bottom: 0; }
.drop strong { color: var(--text); font-weight: 600; font-size: 0.875rem; }
.drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop.hover { border-color: var(--accent); border-style: solid; background: var(--accent-wash); color: var(--text); }

.files { list-style: none; margin: 0 0 1.1rem; padding: 0; }
.files li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
/* A flex item will not shrink below its content width by default, so a long
   unbreakable file name pushed the nowrap status column outside the panel.
   min-width:0 lets the name wrap; flex:none keeps the status column intact. */
.files li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.files li .status {
  flex: none;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
}
.files li.done .status { color: var(--ok); }

.meter { height: 4px; background: var(--panel-2); border: 1px solid var(--border); overflow: hidden; }
#meter-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.15s linear; }
#phase {
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}
#progress-note { margin-top: 0.6rem; }

.progress-actions { margin-top: 1rem; }

/* ---- modal ------------------------------------------------------------- */

.modal {
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  background: var(--panel);
  color: var(--text);
  max-width: 420px;
  width: calc(100% - 2rem);
}
.modal::backdrop { background: rgb(0 0 0 / 45%); }
.modal form { padding: 1.25rem 1.35rem; }
.modal h2 { margin-bottom: 0.6rem; }
.modal p { margin: 0 0 1.25rem; font-size: 0.85rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }

details summary { cursor: pointer; color: var(--muted); font-size: 0.76rem; }
details summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
