:root {
    --bg: #0a0d12;
    --surface: #11161e;
    --surface-2: #171e28;
    --line: #26303d;
    --text: #edf2f7;
    --muted: #8e9aaa;
    --accent: #a8ff3e;
    --accent-dark: #1d2e0d;
    --blue: #6ca8ff;
    --danger: #ff6b70;
    --warning: #ffc857;
    --radius: 14px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% -10%, #1a2a20 0, transparent 28rem), var(--bg); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); line-height: 1.55; }
.compact { margin: 4px 0 0; font-size: 12px; }
.accent { color: var(--accent); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 10px; line-height: 1.2; font-weight: 800; letter-spacing: .18em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 46px); line-height: 1; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border: 1px solid transparent; border-radius: 8px; color: var(--text); background: none; text-decoration: none; font-size: 12px; font-weight: 700; cursor: pointer; transition: .16s ease; }
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button:disabled { opacity: .45; cursor: wait; transform: none; }
.button.primary { color: #11180a; background: var(--accent); }
.button.secondary { background: var(--surface-2); border-color: var(--line); }
.button.ghost { border-color: var(--line); background: #0e131a; }
.button.danger { color: var(--danger); }
.button.wide { width: 100%; min-height: 46px; }
.small-button { min-height: 31px; padding: 6px 10px; font-size: 11px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: transparent; font-size: 25px; line-height: 1; cursor: pointer; }
.icon-button:hover { color: var(--text); border-color: var(--muted); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 400px); padding: 42px; border: 1px solid var(--line); border-radius: 22px; background: rgba(17,22,30,.92); box-shadow: 0 30px 90px #0008; }
.login-card h1 { font-size: 64px; margin-bottom: 8px; }
.brand-mark { width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; gap: 5px; margin-bottom: 28px; border: 1px solid #385321; border-radius: 14px; background: #172211; }
.brand-mark span { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.brand-mark span:nth-child(2) { transform: translateY(-8px); }
.brand-mark.small { width: 38px; height: 38px; margin: 0; border-radius: 10px; gap: 4px; }
.brand-mark.small span { width: 5px; height: 5px; }
.brand-mark.small span:nth-child(2) { transform: translateY(-5px); }
.login-form { display: grid; gap: 12px; margin-top: 30px; }
.login-form label { font-size: 12px; color: var(--muted); }
.login-form input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--text); background: #0a0f15; }
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #a8ff3e18; }
.form-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 34px; border-bottom: 1px solid var(--line); background: #0b0f15dd; backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 21px; letter-spacing: .02em; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: .18em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.live-dot { display: inline-flex; align-items: center; gap: 7px; margin-right: 10px; color: var(--muted); font-size: 11px; }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px #a8ff3e90; }
.content { width: min(100%, 1900px); margin: auto; padding: 36px 34px 46px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.page-heading p:last-child { margin: 0; font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stats article { padding: 18px 20px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(140deg, #151c25, #10151c); }
.stats span { display: block; margin-bottom: 3px; font-size: 25px; font-weight: 750; letter-spacing: -.03em; }
.stats small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.device-section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.table-wrap { overflow-x: auto; }
.devices-table { width: 100%; min-width: 1420px; border-collapse: collapse; table-layout: fixed; }
.devices-table th { padding: 13px 14px; border-bottom: 1px solid var(--line); color: var(--muted); background: #0d1219; text-align: left; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.devices-table th:nth-child(1) { width: 190px; }
.devices-table th:nth-child(2), .devices-table th:nth-child(3) { width: 137px; }
.devices-table th:nth-child(4) { width: 200px; }
.devices-table th:nth-child(5) { width: 180px; }
.devices-table th:nth-child(6) { width: 120px; }
.devices-table th:nth-child(7) { width: 105px; }
.devices-table th:nth-child(8) { width: 310px; }
.devices-table td { padding: 15px 14px; border-bottom: 1px solid #202936; vertical-align: middle; font-size: 12px; }
.devices-table tr:last-child td { border-bottom: 0; }
.devices-table tbody tr:hover { background: #141b24; }
.device-name { display: flex; align-items: center; gap: 10px; }
.device-icon { width: 31px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #445164; border-radius: 7px; color: var(--accent); font-size: 16px; }
.device-title { display: block; overflow: hidden; text-overflow: ellipsis; font-weight: 700; white-space: nowrap; }
.device-id { display: block; margin-top: 5px; overflow: hidden; color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.date-primary { display: block; color: #d6dde5; }
.date-secondary { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.online-state { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; color: var(--accent); font-size: 9px; }
.online-state.offline { color: var(--muted); }
.online-state i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.cell-input { width: 100%; min-height: 36px; padding: 8px 9px; border: 1px solid transparent; border-radius: 7px; outline: none; resize: vertical; color: #dce3eb; background: #0d131a; font-size: 11px; }
.cell-input:hover, .cell-input:focus { border-color: var(--line); }
.cell-input:focus { border-color: #6d8e49; box-shadow: 0 0 0 2px #a8ff3e10; }
.link-view { display: flex; align-items: center; gap: 6px; }
.link-view a { min-width: 0; overflow: hidden; color: var(--blue); text-overflow: ellipsis; white-space: nowrap; }
.link-edit { flex: 0 0 auto; padding: 4px; border: 0; color: var(--muted); background: none; cursor: pointer; }
.mode-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.mode-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mode-badge.active { border-color: #446427; color: var(--accent); background: #182411; }
.mode-badge.active i { box-shadow: 0 0 9px var(--accent); animation: pulse 1.5s infinite; }
.mode-detail { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.report-button { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface-2); font-size: 11px; cursor: pointer; }
.report-button:hover { border-color: #617188; }
.report-button strong { color: var(--accent); }
.command-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.command-grid .button { min-height: 31px; padding: 5px 7px; border-color: var(--line); background: #0e141c; font-size: 10px; }
.command-grid .record-start { color: var(--accent); }
.command-grid .wide-command { grid-column: 1 / -1; }
.empty-cell { padding: 55px !important; color: var(--muted); text-align: center; }
footer { padding: 0 34px 25px; color: #647082; font-size: 10px; text-align: center; }
footer span { margin: 0 5px; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 25px; }
.modal-backdrop { position: absolute; inset: 0; background: #020407dd; backdrop-filter: blur(7px); }
.modal-card { position: relative; width: min(100%, 760px); max-height: calc(100vh - 50px); overflow: auto; border: 1px solid #354151; border-radius: 17px; background: var(--surface); box-shadow: 0 30px 100px #000b; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 23px; border-bottom: 1px solid var(--line); }
.modal-actions { display: flex; align-items: center; gap: 10px; }
.reports-list { padding: 8px 22px 22px; }
.report-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.report-row:last-child { border: 0; }
.report-meta { margin-top: 5px; color: var(--muted); font-size: 11px; }
.empty-state { padding: 50px 15px; color: var(--muted); text-align: center; }
.player-card { width: min(100%, 1140px); overflow: hidden; }
.player-layout { display: grid; grid-template-columns: minmax(420px, 1fr) 360px; min-height: 610px; max-height: calc(100vh - 155px); }
.replay-column { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 22px; background: #090d12; }
.phone-frame { position: relative; height: min(62vh, 630px); max-width: 100%; aspect-ratio: 9 / 19.5; padding: 8px; border: 2px solid #536174; border-radius: 28px; background: #030507; box-shadow: 0 18px 50px #0009; }
.phone-frame::after { content: ""; position: absolute; inset: 8px; border-radius: 19px; pointer-events: none; box-shadow: inset 0 0 0 1px #ffffff0b; }
.phone-speaker { position: absolute; z-index: 2; top: 13px; left: 50%; width: 42px; height: 4px; transform: translateX(-50%); border-radius: 4px; background: #303943; }
#replayCanvas { display: block; width: 100%; height: 100%; border-radius: 19px; background: #111820; }
.empty-replay { position: absolute; inset: 8px; display: grid; place-items: center; padding: 25px; color: var(--muted); font-size: 12px; text-align: center; }
.transport { width: min(100%, 540px); display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.play-button { width: 36px; height: 36px; flex: 0 0 auto; border: 0; border-radius: 50%; color: #132005; background: var(--accent); cursor: pointer; }
.timecode { color: var(--muted); font: 9px ui-monospace, SFMono-Regular, Consolas, monospace; }
#timeline { min-width: 60px; flex: 1; accent-color: var(--accent); }
#playbackSpeed { padding: 5px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--surface-2); font-size: 10px; }
.event-panel { min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); overflow: hidden; }
.event-summary { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.event-summary div { padding: 16px 20px; }
.event-summary div:first-child { border-right: 1px solid var(--line); }
.event-summary strong, .event-summary span { display: block; }
.event-summary strong { font-size: 17px; }
.event-summary span { margin-top: 3px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.event-details { min-height: 155px; max-height: 220px; overflow: auto; padding: 15px 20px; border-bottom: 1px solid var(--line); font-size: 11px; }
.event-details p { margin-bottom: 8px; }
.detail-grid { display: grid; grid-template-columns: 75px 1fr; gap: 7px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.detail-node { margin-top: 12px; padding: 10px; border-radius: 7px; color: #b8c4d1; background: #0c1219; font: 10px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.event-list-heading { padding: 12px 20px 8px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.event-list { flex: 1; overflow: auto; padding: 0 10px 15px; }
.event-row { width: 100%; display: grid; grid-template-columns: 28px 65px 1fr; gap: 7px; align-items: center; padding: 9px 10px; border: 0; border-radius: 7px; color: #cdd5de; background: none; text-align: left; font-size: 10px; cursor: pointer; }
.event-row:hover, .event-row.selected { background: #1a2430; }
.event-row.selected { color: var(--accent); }
.event-number { color: var(--muted); font: 9px ui-monospace, monospace; }
.event-coordinates { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.toast { position: fixed; z-index: 200; right: 24px; bottom: 24px; max-width: 380px; padding: 13px 17px; border: 1px solid #45536a; border-radius: 10px; color: var(--text); background: #19212c; box-shadow: 0 15px 50px #0009; font-size: 12px; }
.toast.error { border-color: #773c42; color: #ffb4b7; }
@keyframes pulse { 50% { opacity: .35; } }
@media (max-width: 950px) {
    .topbar { padding: 0 18px; }
    .content { padding: 25px 18px; }
    .live-dot { display: none; }
    .player-layout { grid-template-columns: 1fr; max-height: calc(100vh - 145px); overflow: auto; }
    .player-card { overflow: auto; }
    .event-panel { border-top: 1px solid var(--line); border-left: 0; }
    .event-list { max-height: 250px; }
}
@media (max-width: 640px) {
    .topbar { height: auto; min-height: 66px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
    .topbar-actions .button:first-of-type { display: none; }
    .page-heading { align-items: flex-start; }
    .page-heading .button { padding: 8px; }
    .stats { grid-template-columns: 1fr 1fr; }
    .login-card { padding: 30px 25px; }
    .modal { padding: 8px; }
    .modal-card { max-height: calc(100vh - 16px); }
    .modal-header { padding: 15px; }
    .replay-column { padding: 14px 8px; }
    .phone-frame { height: 56vh; }
    .timecode { display: none; }
    .report-row { grid-template-columns: 1fr auto; gap: 10px; }
    .report-row .report-size { display: none; }
}
