:root {
  color-scheme: dark;
  --bg: #07131c;
  --panel: #0c1d28;
  --panel-2: #102633;
  --panel-3: #142f3e;
  --line: #244251;
  --line-soft: rgba(126, 171, 190, .16);
  --text: #eaf4f8;
  --muted: #88a3af;
  --cyan: #6fe3ff;
  --lime: #eaff66;
  --amber: #ffbd59;
  --orange: #ff785a;
  --green: #54d69b;
  --red: #ff6577;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 82% -10%, rgba(33, 115, 142, .18), transparent 28rem), var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.command-bar { min-height: 78px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: rgba(7, 19, 28, .94); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid #326072; border-radius: 10px; background: #0b202b; position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: var(--cyan); border-radius: 99px; }
.brand-mark::before { width: 25px; height: 2px; }
.brand-mark::after { width: 2px; height: 25px; }
.brand-mark i { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 16px rgba(234, 255, 102, .65); position: relative; z-index: 1; }
.brand strong { display: block; font-size: .95rem; letter-spacing: .12em; }
.brand span { display: block; margin-top: 3px; color: var(--muted); font-size: .73rem; letter-spacing: .055em; }
.clocks { display: flex; gap: 8px; }
.clocks div { min-width: 112px; padding: 8px 13px; border: 1px solid var(--line-soft); border-radius: 8px; background: #0a1922; }
.clocks span { display: block; color: #66818e; font-size: .67rem; font-weight: 800; letter-spacing: .12em; }
.clocks strong { display: block; margin-top: 2px; color: var(--cyan); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.08rem; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.command-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.sim-badge { padding: 7px 9px; border: 1px solid rgba(255, 189, 89, .38); border-radius: 5px; color: var(--amber); background: rgba(255, 189, 89, .08); font-size: .68rem; font-weight: 850; letter-spacing: .08em; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border: 1px solid transparent; border-radius: 7px; color: var(--text); background: transparent; font-weight: 800; }
.button:hover { filter: brightness(1.08); }
.button-primary { color: #07131c; border-color: var(--lime); background: var(--lime); }
.button-ghost { border-color: #2a4a59; color: #bdd0d8; background: #0c1d28; }
.button-ghost.dark { color: #496674; background: white; border-color: #ccd8dd; }
.button-danger { color: var(--red); border-color: rgba(255,101,119,.34); background: rgba(255,101,119,.08); }

main { width: min(1500px, calc(100% - 36px)); margin: 18px auto 0; padding-bottom: 74px; }
.airfield-strip { display: grid; grid-template-columns: 1.05fr repeat(6, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.runway-block { min-height: 115px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; align-items: center; gap: 4px 12px; padding: 16px 18px; color: #07131c; background: var(--lime); }
.runway-block span { font-size: .7rem; font-weight: 900; letter-spacing: .11em; }
.runway-block strong { grid-row: 2; font-size: 3.45rem; line-height: .85; letter-spacing: -.06em; }
.runway-block i { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding: 6px 8px; border: 1px solid rgba(7,19,28,.22); border-radius: 5px; font-size: .67rem; font-style: normal; font-weight: 900; letter-spacing: .08em; writing-mode: vertical-rl; transform: rotate(180deg); }
.info-cell { min-width: 0; min-height: 115px; display: flex; flex-direction: column; justify-content: center; padding: 16px 18px; border-left: 1px solid var(--line-soft); }
.info-cell > span { color: #6f8995; font-size: .68rem; font-weight: 850; letter-spacing: .12em; }
.info-cell strong { margin-top: 7px; color: var(--text); font-size: clamp(1.05rem, 1.55vw, 1.35rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-cell small { margin-top: 5px; color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-cell.wind strong { color: var(--cyan); }

.desk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; margin-top: 18px; }
.traffic-workspace, .rail-card { border: 1px solid var(--line); border-radius: 12px; background: rgba(12, 29, 40, .88); box-shadow: 0 12px 42px rgba(0,0,0,.18); }
.traffic-workspace { min-width: 0; overflow: hidden; }
.section-heading { min-height: 87px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.kicker { color: var(--cyan); font-size: .66rem; font-weight: 900; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
.section-heading h1 { margin: 5px 0 0; font-size: 1.35rem; letter-spacing: -.025em; }
.traffic-summary { display: flex; align-items: baseline; gap: 7px; color: var(--muted); font-size: .78rem; }
.traffic-summary strong { color: var(--lime); font-size: 1.45rem; }
.traffic-board { display: grid; grid-template-columns: repeat(4, minmax(205px, 1fr)); min-height: 545px; overflow-x: auto; }
.traffic-column { min-width: 0; border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.015), transparent 10rem); }
.traffic-column:last-child { border-right: 0; }
.traffic-column > header { min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 13px; border-bottom: 1px solid var(--line-soft); }
.traffic-column > header div { display: flex; align-items: center; gap: 8px; }
.traffic-column h2 { margin: 0; font-size: .82rem; letter-spacing: .02em; }
.status-light { width: 7px; height: 7px; border-radius: 50%; }
.status-light.inbound { background: var(--cyan); box-shadow: 0 0 10px rgba(111,227,255,.55); }
.status-light.circuit { background: var(--amber); box-shadow: 0 0 10px rgba(255,189,89,.48); }
.status-light.ground { background: var(--green); }
.status-light.departing { background: var(--orange); }
.column-count { min-width: 24px; padding: 3px 6px; border-radius: 99px; color: var(--muted); background: rgba(255,255,255,.05); font-size: .68rem; font-weight: 850; text-align: center; }
.strip-list { min-height: 488px; display: grid; align-content: start; gap: 9px; padding: 10px; }
.strip-list.drag-over { background: rgba(111,227,255,.045); box-shadow: inset 0 0 0 1px rgba(111,227,255,.32); }
.flight-strip { padding: 12px; border: 1px solid #2b4b5b; border-left: 3px solid var(--cyan); border-radius: 7px; background: #112733; box-shadow: 0 7px 18px rgba(0,0,0,.2); cursor: grab; transition: transform .12s, border-color .12s; }
.flight-strip:hover { transform: translateY(-1px); border-color: #3d6476; }
.flight-strip.dragging { opacity: .42; }
.flight-strip[data-status="circuit"] { border-left-color: var(--amber); }
.flight-strip[data-status="ground"] { border-left-color: var(--green); }
.flight-strip[data-status="departing"] { border-left-color: var(--orange); }
.strip-top, .strip-grid { display: grid; align-items: center; }
.strip-top { grid-template-columns: 1fr auto; gap: 8px; }
.strip-top strong { color: white; font-size: .98rem; letter-spacing: .04em; }
.strip-top span { padding: 3px 5px; border-radius: 4px; color: #8ca7b2; background: rgba(255,255,255,.055); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .67rem; }
.strip-intentions { margin: 8px 0 9px; color: #c3d4da; font-size: .75rem; line-height: 1.42; }
.strip-grid { grid-template-columns: 1fr auto; gap: 5px 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.07); color: #78939f; font-size: .66rem; }
.strip-grid b { color: #a9c0c9; font-weight: 750; text-align: right; }
.strip-edit { width: 100%; margin-top: 9px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.08); border-radius: 5px; color: #8ea7b1; background: transparent; font-size: .68rem; font-weight: 800; }
.strip-edit:hover { color: white; border-color: #4a7182; }
.column-empty { padding: 24px 8px; color: #4d6874; font-size: .74rem; text-align: center; }

.side-rail { display: grid; align-content: start; gap: 18px; }
.rail-card { overflow: hidden; }
.rail-card > header { min-height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.rail-card h2 { margin: 4px 0 0; font-size: .9rem; }
.icon-button, .text-button, .close-button { border: 0; color: var(--muted); background: transparent; }
.icon-button { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; font-size: 1.15rem; }
.text-button { padding: 5px; font-size: .7rem; font-weight: 800; }
.watch-list, .movement-log { list-style: none; margin: 0; padding: 9px 12px 12px; }
.watch-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 9px; padding: 10px 3px; border-bottom: 1px solid var(--line-soft); color: #c3d2d8; font-size: .76rem; line-height: 1.38; }
.watch-list li:last-child { border-bottom: 0; }
.watch-check { width: 16px; height: 16px; margin-top: 1px; accent-color: var(--lime); }
.watch-list li.done span { color: #607986; text-decoration: line-through; }
.remove-watch { padding: 0 2px; border: 0; color: #5d7782; background: transparent; }
.rail-card textarea { width: calc(100% - 24px); min-height: 156px; margin: 12px; padding: 12px; resize: vertical; border: 1px solid #284756; border-radius: 7px; outline: none; color: #d9e7ec; background: #091a23; font-size: .82rem; line-height: 1.55; }
.rail-card textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(111,227,255,.08); }
.save-state { color: var(--green); font-size: .66rem; font-weight: 800; }
.movement-log { max-height: 275px; overflow: auto; }
.movement-log li { display: grid; grid-template-columns: 43px 1fr; gap: 8px; padding: 9px 2px; border-bottom: 1px solid var(--line-soft); color: #a9bec7; font-size: .72rem; line-height: 1.4; }
.movement-log time { color: var(--cyan); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .66rem; }
.compact-empty { padding: 22px 15px; color: #5d7783; font-size: .74rem; text-align: center; }

.safety-footer { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; min-height: 41px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 18px; border-top: 1px solid rgba(255,189,89,.24); color: #8fa4ad; background: rgba(7,19,28,.96); backdrop-filter: blur(12px); font-size: .7rem; }
.safety-footer strong { color: var(--amber); letter-spacing: .07em; }

.modal { width: min(620px, calc(100% - 28px)); padding: 0; border: 1px solid #ced9dd; border-radius: 12px; color: #122a35; background: #f7fafb; box-shadow: 0 35px 110px rgba(0,0,0,.58); }
.modal::backdrop { background: rgba(1, 10, 15, .78); backdrop-filter: blur(5px); }
.modal form { padding: 24px; }
.modal-small { width: min(460px, calc(100% - 28px)); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.modal-head h2 { margin: 5px 0 0; color: #092231; font-size: 1.45rem; letter-spacing: -.035em; }
.modal .kicker { color: #28708d; }
.close-button { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid #ced9dd; border-radius: 7px; color: #5d747e; background: white; font-size: 1.4rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.span-2 { grid-column: span 2; }
label { display: grid; gap: 7px; color: #47616d; font-size: .76rem; font-weight: 800; }
input, select, .modal textarea { width: 100%; min-height: 43px; padding: 8px 10px; border: 1px solid #b8c9cf; border-radius: 7px; outline: none; color: #122a35; background: white; }
.modal textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, .modal textarea:focus { border-color: #287ea0; box-shadow: 0 0 0 3px rgba(40,126,160,.12); }
.modal-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid #d8e1e4; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: 58px; transform: translateX(-50%); padding: 10px 14px; border: 1px solid #376070; border-radius: 7px; color: white; background: #102a37; box-shadow: var(--shadow); font-size: .76rem; font-weight: 800; }

@media (max-width: 1180px) {
  .command-bar { grid-template-columns: 1fr auto; }
  .clocks { display: none; }
  .airfield-strip { grid-template-columns: repeat(3, 1fr); }
  .runway-block { grid-row: span 2; }
  .info-cell { min-height: 90px; }
  .desk-grid { grid-template-columns: 1fr; }
  .side-rail { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .command-bar { min-height: auto; grid-template-columns: 1fr; gap: 10px; padding: 12px; position: static; }
  .command-actions { justify-content: stretch; }
  .sim-badge { margin-right: auto; }
  .button { min-height: 42px; }
  main { width: min(100% - 20px, 1500px); margin-top: 10px; }
  .airfield-strip { grid-template-columns: 1fr 1fr; }
  .runway-block { grid-row: auto; min-height: 100px; }
  .info-cell { min-height: 100px; }
  .traffic-board { grid-template-columns: repeat(4, 235px); }
  .side-rail { grid-template-columns: 1fr; }
  .safety-footer { position: static; align-items: flex-start; flex-direction: column; gap: 3px; }
  main { padding-bottom: 12px; }
}
@media (max-width: 480px) {
  .sim-badge { display: none; }
  .command-actions .button { flex: 1; padding-inline: 9px; }
  .airfield-strip { grid-template-columns: 1fr 1fr; }
  .runway-block { grid-column: span 2; }
  .section-heading { align-items: flex-start; }
  .traffic-summary { flex-direction: column; align-items: flex-end; gap: 0; }
  .traffic-summary strong { line-height: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .modal-actions { grid-template-columns: 1fr 1fr; }
  .modal-actions span { display: none; }
}
