:root {
    color-scheme: dark;
    --bg: #0b1016;
    --panel: #121922;
    --panel-2: #17212c;
    --line: #263240;
    --text: #edf3f7;
    --muted: #8d9caa;
    --accent: #65e6b4;
    --accent-dark: #173f35;
    --blue: #6fa8ff;
    --warning: #f2c46d;
    --danger: #ff8f8f;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 30px clamp(20px, 4vw, 64px);
    border-bottom: 1px solid var(--line);
    background: linear-gradient(120deg, #111a23, #0b1016 65%);
}
.eyebrow { color: var(--accent); font: 600 11px/1.4 Consolas, monospace; letter-spacing: 2px; margin-bottom: 8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(26px, 3vw, 38px); margin-bottom: 6px; letter-spacing: -1px; }
.topbar p { color: var(--muted); margin-bottom: 0; }
.simulation-badge { border: 1px solid #2b5146; background: #11271f; color: var(--accent); padding: 10px 14px; border-radius: 30px; font-size: 13px; white-space: nowrap; }
.simulation-badge span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; box-shadow: 0 0 10px var(--accent); }
main { max-width: 1600px; margin: auto; padding: 28px clamp(20px, 4vw, 64px) 40px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 28px; }
.stats article { background: var(--panel); border: 1px solid var(--line); padding: 16px 20px; border-radius: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stats span { color: var(--muted); font-size: 13px; }
.stats strong { font: 500 27px/1 Consolas, monospace; }
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.call-panel, .rides-section { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.call-panel { padding: 22px; position: sticky; top: 16px; }
.section-heading { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 24px; }
.section-heading h2, .section-title-row h2 { font-size: 17px; margin: 0; }
.section-heading p { font-size: 12px; color: var(--muted); margin: 5px 0 0; }
.step { color: var(--accent); font: 500 11px/1 Consolas, monospace; border: 1px solid var(--line); border-radius: 4px; padding: 5px; display: inline-block; }
label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 7px; }
input { width: 100%; color: var(--text); background: #0c131b; border: 1px solid var(--line); border-radius: 7px; padding: 11px 12px; outline: none; transition: border-color .2s; }
input:focus { border-color: var(--accent); }
#robot-id { margin-bottom: 16px; }
.floor-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary-button { width: 100%; display: flex; justify-content: space-between; align-items: center; border: 0; border-radius: 7px; padding: 12px 14px; margin-top: 20px; background: var(--accent); color: #082219; font-weight: 700; }
.primary-button:hover { background: #87f2c9; }
.primary-button:disabled, .action-button:disabled { opacity: .5; cursor: wait; }
.message { min-height: 18px; font-size: 12px; line-height: 1.5; margin-top: 12px; color: var(--accent); overflow-wrap: anywhere; }
.message.error { color: var(--danger); }
.timing-info { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.timing-info h3 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
dl { margin: 0; }
dl div { display: flex; justify-content: space-between; font-size: 12px; margin: 9px 0; }
dt { color: var(--muted); } dd { margin: 0; font-family: Consolas, monospace; }
.elevators-section { min-width: 0; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-title-row > div { display: flex; align-items: center; gap: 10px; }
.updated-at, .hint { font-size: 11px; color: var(--muted); }
.elevators-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.elevator-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 15px; min-width: 0; transition: border-color .2s; }
.elevator-card.busy { border-color: #365573; }
.elevator-card.waiting { border-color: #3d8069; }
.elevator-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.elevator-number { color: var(--muted); font: 600 11px/1 Consolas, monospace; letter-spacing: 1px; }
.floor-number { font: 500 32px/1 Consolas, monospace; }
.floor-number small { font-size: 11px; color: var(--muted); margin-left: 4px; }
.destination-floor { color: var(--accent); font-size: 18px; margin-left: 8px; white-space: nowrap; }
.direction { color: var(--blue); font-size: 20px; width: 22px; text-align: center; }
.doors-visual { display: flex; height: 45px; background: #080d12; border: 1px solid #34404b; border-bottom: 3px solid #34404b; overflow: hidden; margin-bottom: 14px; transition: border-color .3s; }
.door-panel { flex: 0 0 50%; height: 100%; background: linear-gradient(90deg, #25313b, #354550); transition: transform var(--door-duration, 5s) cubic-bezier(.4, 0, .2, 1); will-change: transform; }
.door-panel.left { border-right: 1px solid #10171d; }
.door-panel.right { border-left: 1px solid #10171d; }
.doors-visual.open .left, .doors-visual.opening .left { transform: translateX(-85%); }
.doors-visual.open .right, .doors-visual.opening .right { transform: translateX(85%); }
.doors-visual.opening, .doors-visual.closing { border-bottom-color: var(--warning); }
.doors-visual.open { border-bottom-color: var(--accent); }
.elevator-state { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; margin-bottom: 8px; }
.elevator-state span:last-child { color: var(--muted); }
.robot-label { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 16px; }
.robot-label strong { color: var(--text); font-weight: 500; }
.rides-section { margin-top: 28px; padding: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: var(--muted); font-weight: 500; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 12px; border-bottom: 1px solid #202b36; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.robot-cell { font-weight: 600; }
.route-cell { font-family: Consolas, monospace; white-space: nowrap; }
.lift-pill { color: var(--blue); background: #172538; padding: 4px 7px; border-radius: 4px; font: 500 11px/1 Consolas, monospace; }
.status-pill { display: inline-block; border: 1px solid var(--line); border-radius: 20px; padding: 5px 8px; white-space: nowrap; }
.status-pill.waiting_entry, .status-pill.waiting_exit { color: var(--accent); border-color: #3d8069; background: #11271f; }
.status-pill.completed { color: var(--muted); }
.secondary-state { color: var(--muted); white-space: nowrap; }
.action-button { color: #082219; background: var(--accent); border: 0; border-radius: 5px; padding: 7px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.action-placeholder { color: #566573; }
.empty-state { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 12px; }
footer { color: #62717e; border-top: 1px solid var(--line); padding: 20px; text-align: center; font-size: 11px; }

@media (max-width: 1100px) {
    .elevators-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}
@media (max-width: 760px) {
    .topbar { align-items: flex-start; flex-direction: column; padding-top: 22px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stats article { padding: 13px; }
    .stats span { font-size: 11px; }
    .workspace { grid-template-columns: 1fr; }
    .call-panel { position: static; }
    .rides-section { padding: 14px; }
    .hint { display: none; }
}
@media (max-width: 420px) {
    .elevators-grid { grid-template-columns: 1fr; }
}
