:root {
  --bg: #070d14;
  --panel: #0d1724;
  --panel2: #0f1c2b;
  --line: #1b2c3f;
  --text: #f1f5f9;
  --muted: #8497aa;
  --accent: #eab308;
  --good: #168053;
  --good-hover: #1ca36a;
  --danger: #991b1b;
  --shadow: 0 16px 36px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.ttx-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 22px 40px;
}
.ttx-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #091421, #0c1a2b);
  padding: 24px 28px;
  margin-bottom: 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.kicker {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
}
.ttx-header h1 {
  margin: 4px 0 4px;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffffff;
}
.header-line {
  width: 44px;
  height: 3px;
  background: var(--accent);
  margin: 4px 0 8px 0;
  border-radius: 2px;
}
.ttx-header p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar button {
  border: 1px solid var(--line);
  background: #0f1e2f;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 20px;
}
.steps button {
  padding: 12px;
  border: 1px solid var(--line);
  background: #0a1420;
  color: var(--muted);
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
}
.steps button.active {
  color: var(--text);
  border-color: #3b82f6;
  background: #112236;
}

.view.hidden { display: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.panel > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.panel h2, .panel h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #f8fafc;
}
.panel > header > span {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid #1a2b3c;
  background: #08111b;
  color: #f1f5f9;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: #38bdf8;
}
textarea { resize: vertical; }

.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 6px 0;
  color: var(--text);
  font-size: 13px;
}
.check input { width: auto; accent-color: var(--accent); }

.checks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 18px;
}
.intro {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.intro .signal {
  width: 6px;
  height: 42px;
  background: var(--accent);
  border-radius: 2px;
}
.intro h2 { margin: 3px 0 4px; font-size: 18px; }
.intro p { margin: 0; color: var(--muted); font-size: 13px; }

.person, .vehicle {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  border: 1px solid #1b2d40;
  background: #09131f;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 9px;
}
.person label, .vehicle label { margin: 0; }
.person .danger, .vehicle .danger { height: 40px; }

.secondary {
  background: #111d2d;
  border: 1px solid #23364c;
  color: #e2e8f0;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 11px;
  padding: 10px 16px;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.secondary:hover {
  background: #19293d;
  border-color: #354f6e;
}
.danger {
  background: #2d1315;
  border: 1px solid #632225;
  color: #fca5a5;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: 12px;
}
.primary {
  background: var(--good);
  border: none;
  color: #ffffff;
  width: 100%;
  padding: 14px 20px;
  font-weight: 800;
  letter-spacing: 1.5px;
  font-size: 14px;
  text-transform: uppercase;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(22, 128, 83, 0.3);
}
.primary:hover {
  background: var(--good-hover);
  box-shadow: 0 6px 16px rgba(28, 163, 106, 0.4);
}

.actions { display: flex; gap: 10px; margin-top: 10px; }
.actions .primary { flex: 1; }
.actions button:not(.primary) { width: auto; }

.muted { color: var(--muted); font-size: 13px; }
.resource-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: #08131e;
  border-radius: 8px;
}
.resource-card b { font-size: 17px; }

.exercise-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}
.exercise-head h2 { margin: 5px 0; }
.turnbox {
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 9px;
  background: var(--panel);
  white-space: nowrap;
}
.incident {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 13px;
  padding: 18px;
  margin-bottom: 16px;
}
.timeline {
  padding: 9px;
  border-left: 2px solid #1f3344;
  color: var(--muted);
  font-size: 12px;
}
.timeline.active {
  color: var(--text);
  border-left-color: var(--accent);
}
.timeline b {
  display: inline-block;
  min-width: 24px;
  color: var(--accent);
}

.briefgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0;
}
.brief {
  border: 1px solid #1a2b3c;
  background: #09131e;
  border-radius: 8px;
  padding: 11px;
}
.brief b {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
}
.brief p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.decisions { display: grid; gap: 9px; }
.decision {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  background: #0a1522;
  color: var(--text);
  padding: 13px;
  border-radius: 8px;
}
.decision:hover { border-color: #38bdf8; }
.decision span { color: var(--muted); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  border: 1px solid var(--line);
  background: #08121d;
  border-radius: 8px;
  padding: 10px;
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.stat b {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.log { margin: 0; padding-left: 22px; }
.log li { padding: 7px 0; color: #dbe4e9; }
.routebox {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #08121d;
}
footer { color: #64748b; font-size: 12px; text-align: center; margin-top: 18px; }
.notice {
  border: 1px solid #455227;
  background: #141b0f;
  color: #dce7bd;
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 16px;
}

@media(max-width:900px) {
  .grid4 { grid-template-columns: repeat(2, 1fr); }
  .person, .vehicle { grid-template-columns: 1fr 1fr; }
  .incident { grid-template-columns: 1fr; }
  .ttx-header { flex-direction: column; }
}
@media(max-width:620px) {
  .grid2, .grid3, .grid4, .checks, .briefgrid, .stats { grid-template-columns: 1fr; }
  .ttx-shell { padding: 14px; }
  .ttx-header { padding: 20px; }
  .steps { grid-template-columns: 1fr; }
  .toolbar { width: 100%; }
  .toolbar > * { flex: 1; }
}
@media print {
  body { background: white; color: #111; }
  .ttx-shell { max-width: none; }
  .toolbar, .steps, .actions, footer { display: none; }
  .panel, .incident { break-inside: avoid; background: white; color: #111; border-color: #aaa; }
  .muted, .brief p { color: #444; }
}
