/* Tokens, type and controls shared by every screen. Ported from the old app's
   styles.css so the crews see the look they know. */

/* Geist (variable weight), self-hosted so it works offline. */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/geist-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --label: #475569;
  --border: #cbd5e1;
  --header: #d8e4c1;
  --accent: #0f172a;
  --danger: #b91c1c;
  --switch: #3b2d8a;
  --warning-bg: #fffbeb;
  --warning-border: #f59e0b;
  --warning-text: #92400e;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Geist', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Author rules like `display: flex` otherwise beat the browser's own
   [hidden] rule, whatever their specificity, and the element stays on screen.
   The old stylesheet patched that one component at a time; this is the whole
   fix. */
[hidden] { display: none !important; }

h1 { margin: 0.15rem 0; font-size: clamp(1.35rem, 3vw, 2rem); }
h2 { margin: 0; font-size: 1.1rem; }
h3 { margin: 0 0 .3rem; font-size: 1rem; }
h4 { margin: 0 0 .3rem; font-size: .9rem; }

.container { max-width: 2200px; margin: 0 auto; padding: 1rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.small-note { margin: .5rem 0 0; color: var(--muted); font-size: .88rem; }
.muted { color: var(--muted); font-size: .9rem; }
.form-error { margin: .5rem 0 0; color: var(--danger); font-size: .9rem; }

.grid { display: grid; gap: .85rem; margin-bottom: .85rem; }
.grid.one { grid-template-columns: 1fr; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

label, legend {
  display: block;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .035em;
  font-weight: 700;
  color: var(--label);
}
input, select, textarea {
  width: 100%;
  margin-top: .25rem;
  border: 1px solid var(--border);
  border-radius: .7rem;
  padding: .7rem .75rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: white;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 23, 42, .12); }
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0; }
textarea { resize: vertical; min-height: 5rem; }

button, .button-like {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: .8rem;
  padding: .75rem .95rem;
  min-height: 44px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
button.secondary, .button-like.secondary { background: #e2e8f0; color: var(--text); }
button.danger, .button-like.danger { background: var(--danger); }
button.switch { background: var(--switch); }
button:active, .button-like:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: default; transform: none; }
:focus-visible { outline: 3px solid rgba(59, 45, 138, .45); outline-offset: 2px; }
/* Fields show focus with their own border and shadow. */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

.compact-btn {
  min-height: 36px;
  padding: .5rem .75rem;
  border-radius: .65rem;
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
}

/* A tick box with a sentence beside it. */
.toggle-setting {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin-top: .65rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: .98rem;
  color: var(--text);
}
.toggle-setting input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  margin-top: .08rem;
  flex: 0 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: .75rem;
  font-weight: 700;
}
.badge-warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }

.icon { width: 1.4rem; height: 1.4rem; fill: currentColor; flex: none; }

/* Three dots that brighten in turn: the busy overlay and the gate's wait. */
.busy-dots { display: flex; gap: .55rem; justify-content: center; }
.busy-dots span {
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: .25;
  animation: busy-dot-pulse 1.2s ease-in-out infinite both;
}
.busy-dots span:nth-child(2) { animation-delay: .2s; }
.busy-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes busy-dot-pulse {
  0%, 80%, 100% { opacity: .25; }
  40% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .busy-dots span { animation-duration: 2.4s; }
}
