/* Graviti file transfer portal.
   Substrate: cool neutral, the colour of a reading room.
   State: one saturated colour per status, carried by a rail on each row. */

:root {
  --bg: #FBFCFD;
  --surface: #FFFFFF;
  --sunken: #F1F4F7;
  --line: #DDE3E9;
  --ink: #161D24;
  --ink-soft: #5A6672;
  --accent: #2F7D6F;
  --accent-ink: #FFFFFF;
  --waiting: #B4791C;
  --progress: #2B6CB0;
  --done: #2F7D6F;
  --expired: #96566A;
  --empty: #94A3AE;

  --waiting-wash: #FBF2E2;
  --progress-wash: #E8F0FA;
  --done-wash: #E4F1EE;
  --expired-wash: #F8EAEE;

  --radius: 8px;
  --row: 56px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1418;
    --surface: #161E24;
    --sunken: #111920;
    --line: #26313A;
    --ink: #E7ECF0;
    --ink-soft: #93A1AD;
    --accent: #5FBFAC;
    --accent-ink: #0B1114;
    --waiting: #E0A94A;
    --progress: #6BA6E8;
    --done: #5FBFAC;
    --expired: #C98BA0;
    --empty: #5C6B77;

    --waiting-wash: #2A2113;
    --progress-wash: #14212F;
    --done-wash: #13261F;
    --expired-wash: #2B181D;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }

:where(a, button, input, select, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ------------------------------------------------------------- header */

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner {
  display: flex; align-items: center; gap: 1.75rem;
  min-height: 60px; flex-wrap: wrap;
}
.brand {
  font-weight: 640; font-size: 0.95rem; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand .mark {
  display: inline-block; width: 3px; height: 0.85em; margin-right: 0.55rem;
  background: var(--accent); border-radius: 2px; vertical-align: -0.05em;
}
.nav { display: flex; gap: 1.25rem; margin-right: auto; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 0.9rem;
  padding: 0.35rem 0; border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.whoami { display: flex; align-items: center; gap: 0.7rem; font-size: 0.85rem; }
.whoami .name { font-weight: 550; }
.whoami .role {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 99px; padding: 0.12rem 0.5rem;
}

main.wrap { padding: 2.25rem 0 4rem; }

/* --------------------------------------------------------------- type */

h1 { font-size: 1.55rem; font-weight: 640; letter-spacing: -0.02em; margin: 0 0 0.4rem; }
h2 { font-size: 1.05rem; font-weight: 620; letter-spacing: -0.01em; margin: 2.25rem 0 0.85rem; }
h3 { font-size: 0.95rem; font-weight: 620; margin: 0 0 0.3rem; }
.lede { color: var(--ink-soft); margin: 0 0 1.5rem; max-width: 62ch; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: var(--mono); font-size: 0.85em; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- cards */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.4rem;
}
.empty { text-align: center; color: var(--ink-soft); padding: 2.75rem 1.4rem; }
.empty p { margin: 0.3rem 0; }
.empty p:first-child { color: var(--ink); font-weight: 550; }

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

.progress { margin-bottom: 2rem; }
.progress-bar {
  display: flex; height: 8px; border-radius: 99px; overflow: hidden;
  background: var(--sunken); margin-bottom: 0.85rem;
}
.progress-bar span { display: block; height: 100%; }
.seg-waiting { background: var(--waiting); }
.seg-progress { background: var(--progress); }
.seg-done { background: var(--done); }
.seg-empty { background: var(--empty); }
.seg-expired { background: var(--expired); }

@media (prefers-reduced-motion: no-preference) {
  .progress-bar span { animation: grow 240ms ease-out both; }
  @keyframes grow { from { transform: scaleX(0); transform-origin: left; } }
}

.legend {
  display: flex; flex-wrap: wrap; gap: 1.4rem;
  font-size: 0.85rem; color: var(--ink-soft); margin: 0; padding: 0; list-style: none;
}
.legend li { display: flex; align-items: center; gap: 0.45rem; }
.legend a {
  display: flex; align-items: center; gap: 0.45rem;
  color: inherit; text-decoration: none;
}
.legend a:hover { color: var(--ink); }
.legend .dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.legend .count {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  color: var(--ink); font-weight: 600;
}
.dot-waiting { background: var(--waiting); }
.dot-progress { background: var(--progress); }
.dot-done { background: var(--done); }
.dot-empty { background: var(--empty); }
.dot-expired { background: var(--expired); }

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

.form { display: flex; flex-direction: column; gap: 0.4rem; }
.form label { font-size: 0.85rem; font-weight: 550; margin-top: 0.7rem; }
.hint { font-size: 0.82rem; color: var(--ink-soft); font-weight: 400; display: block; }
.row { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.col { flex: 1 1 240px; display: flex; flex-direction: column; gap: 0.4rem; }

input[type="text"], input[type="password"], input[type="search"],
input[type="file"], select {
  font: inherit; width: 100%; color: var(--ink); background: var(--sunken);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.6rem 0.75rem;
}
input[type="file"] { padding: 0.5rem; font-size: 0.9rem; }
input::placeholder { color: var(--ink-soft); opacity: 0.75; }
input.mini { width: 150px; padding: 0.35rem 0.5rem; font-size: 0.85rem; }

.checkline {
  display: flex; align-items: flex-start; gap: 0.55rem;
  margin-top: 1rem; font-size: 0.9rem; font-weight: 400; flex-wrap: wrap;
}
.checkline input { width: auto; margin-top: 0.25rem; }
.checkline .hint { flex-basis: 100%; margin-left: 1.5rem; }

button, .button {
  font: inherit; cursor: pointer; display: inline-block; text-decoration: none;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.9rem;
}
button:hover, .button:hover { border-color: var(--accent); color: var(--accent); }
button[disabled] { opacity: 0.55; cursor: progress; }

.primary {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font-weight: 560; align-self: flex-start; margin-top: 1.15rem;
}
.primary:hover { color: var(--accent-ink); filter: brightness(1.07); }
.primary-outline { border-color: var(--accent); color: var(--accent); font-weight: 550; }

.linkish {
  background: none; border: none; padding: 0.25rem 0.35rem;
  color: var(--ink-soft); text-decoration: underline; font-size: 0.85rem;
}
.linkish:hover { color: var(--accent); }
.linkish.danger:hover { color: var(--expired); }
.inline { display: inline; }

.controls {
  display: flex; gap: 0.75rem; align-items: center;
  flex-wrap: wrap; margin-bottom: 1.25rem;
}
.searchbar { display: flex; gap: 0.5rem; align-items: center; margin: 0; }
.searchbar input { max-width: 260px; }
.toggle { display: flex; gap: 0.25rem; margin-left: auto; }
.toggle a {
  font-size: 0.85rem; text-decoration: none; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.75rem;
}
.toggle a[aria-current="true"] {
  color: var(--ink); background: var(--sunken); border-color: var(--ink-soft);
}

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

.tablewrap {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
table { border-collapse: collapse; width: 100%; min-width: 640px; }
thead th {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft);
  text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 0.8rem 1rem; border-bottom: 1px solid var(--line);
  vertical-align: middle; height: var(--row);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--sunken); }
tbody tr.is-dim { opacity: 0.5; }

/* The signature: a status rail on the leading edge of each case row. */
tbody tr.railed td:first-child {
  border-left: 3px solid var(--empty);
  padding-left: calc(1rem - 3px);
}
tbody tr.rail-sent     td:first-child { border-left-color: var(--waiting); }
tbody tr.rail-opened   td:first-child { border-left-color: var(--progress); }
tbody tr.rail-returned td:first-child { border-left-color: var(--done); }
tbody tr.rail-expired  td:first-child { border-left-color: var(--expired); }

.case-name { font-weight: 550; color: var(--ink); text-decoration: none; }
a.case-name:hover { color: var(--accent); }
.case-note {
  display: block; margin-top: 0.2rem; font-size: 0.84rem; color: var(--ink-soft);
}

.state { font-size: 0.85rem; font-weight: 550; white-space: nowrap; }
.state-sent { color: var(--waiting); }
.state-opened { color: var(--progress); }
.state-returned { color: var(--done); }
.state-expired { color: var(--expired); }
.state-empty { color: var(--ink-soft); }

/* ------------------------------------------------- two-panel workspace */

.workspace-head { margin-bottom: 1.75rem; }

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}

.panel-head {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: var(--sunken);
}
.panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 640;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
/* A colour marker per side, so which panel you are in is obvious at a glance. */
.panel-head h2::before {
  content: "";
  width: 3px;
  height: 1em;
  border-radius: 2px;
  flex: none;
}
.panel-own .panel-head h2::before { background: var(--progress); }
.panel-vendor .panel-head h2::before { background: var(--done); }

.panel-meta {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.panel .upload {
  margin: 0;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.panel .upload .primary { margin-top: 0.9rem; }

.panel-empty {
  padding: 2.5rem 1.2rem;
  text-align: center;
  color: var(--ink-soft);
}
.panel-empty p { margin: 0.25rem 0; }
.panel-empty p:first-child { color: var(--ink); font-weight: 550; }

.filelist { list-style: none; margin: 0; padding: 0; }
.filelist li {
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
}
.filelist li:last-child { border-bottom: none; }
.filelist li:hover { background: var(--sunken); }
.filelist li.is-fresh { border-left-color: var(--waiting); }
.filelist li.is-collected { border-left-color: var(--done); }

.fileline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.filename {
  font-weight: 550;
  overflow-wrap: anywhere;
  min-width: 0;
}
.small-button { padding: 0.3rem 0.7rem; font-size: 0.85rem; flex: none; }

.filemeta {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.filestate {
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8rem;
}
.filestate .tick { color: var(--done); font-weight: 550; }
.filestate .waiting { color: var(--waiting); font-weight: 550; }
.filestate .collector { color: var(--ink-soft); }
.filestate .collector::before { content: "\2014\00a0"; }

@media (max-width: 900px) {
  .panels { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ uploads */

.upload { margin: 1.25rem 0 0; }
.progress-list {
  list-style: none; margin: 1rem 0 0; padding: 0;
  font-family: var(--mono); font-size: 0.82rem; color: var(--ink-soft);
}
.progress-list li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.28rem 0; border-bottom: 1px solid var(--line);
}
.progress-list li:last-child { border-bottom: none; }
.progress-list .st-sent { color: var(--done); }
.progress-list .st-failed { color: var(--expired); }
.progress-list .st-busy { color: var(--progress); }

/* ------------------------------------------------------------- alerts */

.alert {
  padding: 0.8rem 1rem; border-radius: 6px; font-size: 0.92rem;
  margin-bottom: 1.4rem; border: 1px solid var(--line);
  background: var(--sunken); color: var(--ink);
}
.alert.note { background: var(--sunken); color: var(--ink); }
.alert.bad { background: var(--expired-wash); color: var(--expired); border-color: transparent; }
.alert.good { background: var(--done-wash); color: var(--done); border-color: transparent; }

/* ------------------------------------------------------------- signin */

.signin { max-width: 380px; margin: 4.5rem auto; }
.signin h1 { text-align: center; font-size: 1.35rem; }
.signin .lede { text-align: center; }
.signin .primary { align-self: stretch; text-align: center; margin-top: 1.4rem; }
.signin .footnote { text-align: center; margin-top: 1.5rem; }

/* --------------------------------------------------------------- misc */

.back { color: var(--ink-soft); text-decoration: none; font-size: 0.88rem; }
.back:hover { color: var(--accent); }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1.1rem; }
.danger-zone { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.danger-zone summary { cursor: pointer; color: var(--ink-soft); font-size: 0.9rem; }
.danger-zone summary:hover { color: var(--expired); }
.danger-zone .form { max-width: 380px; }
.foot {
  color: var(--ink-soft); font-size: 0.8rem;
  border-top: 1px solid var(--line); padding: 1.1rem 0 2rem; margin-top: 3rem;
}

@media (max-width: 620px) {
  .topbar-inner { gap: 1rem; padding: 0.6rem 0; }
  .nav { order: 3; width: 100%; margin-right: 0; }
  main.wrap { padding-top: 1.5rem; }
  .legend { gap: 0.9rem; }
  .toggle { margin-left: 0; }
  .searchbar input { max-width: none; }
}
