/* ============================================================================
   Hermes Portal

   The board is the idea: each workspace is a row on a dispatch board — a lamp,
   a destination, a gate number. It comes from what this thing actually is, a
   messenger routing people to the right place, and from the industrial floor
   these teams work on. Everything else stays quiet so the board carries it.

   Brass is the one indulgence: the metal of the caduceus, used for the mark,
   the active rule, and nothing else.
   ========================================================================= */

@font-face {
  font-family: 'Vazirmatn';
  src: local('Vazirmatn'), local('Vazir');
  font-display: swap;
}

:root {
  --ink:    #0D1014;
  --panel:  #151A21;
  --raise:  #1B212A;
  --line:   #232B36;
  --text:   #E6EAF0;
  --dim:    #8792A3;
  --faint:  #5C6673;

  --brass:  #C8A44D;
  --live:   #4FA88B;
  --halt:   #B4626A;

  --fa: Vazirmatn, "Segoe UI", Tahoma, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--fa);
  font-size: 15px;
  line-height: 1.7;
}

button, input { font-family: inherit; font-size: inherit; }

button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────── sign in ── */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  width: 100%;
  max-width: 370px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--brass);
  border-radius: 3px;
  padding: 40px 34px 34px;
}

.mark {
  width: 42px;
  height: 42px;
  margin-bottom: 22px;
  color: var(--brass);
}
.mark svg { width: 100%; height: 100%; }

.gate-card h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sub {
  margin: 6px 0 28px;
  color: var(--dim);
  font-size: 13.5px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--dim);
}

input[type=text], input[type=password], input:not([type]) {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 18px;
  color: var(--text);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
}

input::placeholder { color: var(--faint); }

button {
  padding: 10px 18px;
  color: var(--ink);
  background: var(--brass);
  border: none;
  border-radius: 3px;
  font-weight: 700;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: default; }

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

button.ghost {
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  font-weight: 400;
}
button.ghost:hover { color: var(--text); border-color: var(--faint); filter: none; }

button.link {
  padding: 2px 6px;
  color: var(--dim);
  background: none;
  border: none;
  font-weight: 400;
  font-size: 13px;
}
button.link:hover { color: var(--brass); filter: none; }

.err {
  margin: 0 0 14px;
  padding: 9px 12px;
  color: #E8A0A6;
  background: rgba(180, 98, 106, .12);
  border-right: 2px solid var(--halt);
  border-radius: 2px;
  font-size: 13px;
}

/* ───────────────────────────────────────────────────────────── shell ── */

.top {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 26px;
  height: 58px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brass);
}

.tabs { display: flex; gap: 2px; margin-inline-start: auto; }

.tabs button {
  padding: 7px 15px;
  color: var(--dim);
  background: transparent;
  border: none;
  border-radius: 3px;
  font-weight: 400;
  font-size: 13.5px;
}
.tabs button:hover { color: var(--text); filter: none; }
.tabs button.on { color: var(--ink); background: var(--brass); font-weight: 700; }

.who {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: auto;
  font-size: 13px;
  color: var(--dim);
}
.tabs:not([hidden]) ~ .who { margin-inline-start: 0; }

main { max-width: 940px; margin: 0 auto; padding: 34px 26px 70px; }

.tab { display: none; }
.tab.on { display: block; }

.head { margin-bottom: 18px; }
.head h2 { margin: 0; font-size: 19px; font-weight: 700; }
.note { margin: 4px 0 0; color: var(--dim); font-size: 13px; }

.empty {
  padding: 30px;
  color: var(--dim);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 3px;
  text-align: center;
  font-size: 13.5px;
}

/* ───────────────────────────────────────────────────── dispatch board ── */

.board { border-top: 1px solid var(--line); }

.berth {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

/* The brass rule appears under the row you are about to enter — the only
   moving part on the page, so the eye goes where the click goes. */
.berth::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  height: 1px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .22s ease;
}
.berth:hover::after { transform: scaleX(1); }

.lamp {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}
.lamp.live { background: var(--live); box-shadow: 0 0 0 3px rgba(79, 168, 139, .16); }
.lamp.halt { background: var(--halt); }

.berth .name { font-weight: 700; }
.berth .label { color: var(--dim); font-size: 13px; }

.gate-no {
  direction: ltr;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--faint);
  letter-spacing: .04em;
}

.enter {
  padding: 7px 16px;
  font-size: 13.5px;
  text-decoration: none;
  display: inline-block;
}
.enter.off {
  color: var(--faint);
  background: transparent;
  border: 1px solid var(--line);
  pointer-events: none;
}

.ctl { display: flex; gap: 4px; }
.ctl button {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 400;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
}
.ctl button:hover { color: var(--text); border-color: var(--faint); filter: none; }

/* ─────────────────────────────────────────────────────────── forms ── */

.row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-bottom: 16px;
}
.row-form input { flex: 1; min-width: 150px; margin-bottom: 0; }
.row-form input:not([type]) { max-width: 260px; }

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--dim);
  font-size: 13px;
  white-space: nowrap;
}
.check input { width: auto; margin: 0; }

/* ──────────────────────────────────────────────────────────── lists ── */

.list { border-top: 1px solid var(--line); }

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.item .grow { flex: 1; min-width: 0; }
.item .sub2 { color: var(--dim); font-size: 12.5px; }
.item.off { opacity: .5; }

.tag {
  padding: 1px 8px;
  border-radius: 9px;
  font-size: 11px;
  border: 1px solid var(--line);
  color: var(--dim);
}
.tag.admin { color: var(--brass); border-color: rgba(200, 164, 77, .4); }

.stamp {
  direction: ltr;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────── matrix ── */

.matrix-wrap { overflow-x: auto; }

.matrix { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.matrix th, .matrix td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.matrix th:first-child, .matrix td:first-child { text-align: right; }
.matrix thead th { color: var(--dim); font-weight: 400; font-size: 12.5px; }
.matrix input { width: auto; margin: 0; cursor: pointer; }
.matrix td.all { color: var(--brass); font-size: 12px; }

/* ─────────────────────────────────────────────────────────── dialog ── */

.veil {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 11, .74);
  padding: 24px;
}

.dialog {
  width: 100%;
  max-width: 350px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--brass);
  border-radius: 3px;
  padding: 26px;
}
.dialog h3 { margin: 0 0 18px; font-size: 17px; }
.dialog .note { margin-bottom: 14px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-start; }

/* ──────────────────────────────────────────────────────────── toast ── */

.toast {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-start: 22px;
  padding: 11px 17px;
  background: var(--raise);
  border: 1px solid var(--line);
  border-inline-start: 2px solid var(--brass);
  border-radius: 3px;
  font-size: 13.5px;
  max-width: 380px;
}

@media (max-width: 720px) {
  .top { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 12px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; margin: 0; }
  .who { margin-inline-start: auto; }
  main { padding: 22px 16px 60px; }
  .berth { grid-template-columns: auto 1fr; row-gap: 10px; }
  .berth .gate-no, .berth .ctl { grid-column: 2; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .berth::after { transition: none; }
}
