:root {
  --bg: #f3f2ee;
  --ink: #17201d;
  --muted: #6c746f;
  --panel: #fff;
  --line: #dddeda;
  --accent: #156b4d;
  --accent-2: #ccff75;
  --deep: #102b22;
  --danger: #b43a2d;
  --warning: #d99427;
  --ok: #16845c;
  --uk: #7259a8;
  --shadow: 0 18px 50px rgba(24, 39, 33, .08);
  --radius: 18px;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.45 "Segoe UI Variable", "Segoe UI", system-ui, sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button, input, textarea, select { outline: none; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); padding: 11px 12px; transition: .18s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(21, 107, 77, .1); }
label { display: grid; gap: 7px; color: #4e5853; font-size: 13px; font-weight: 600; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.035em; }
h1 { font-size: clamp(28px, 4vw, 46px); line-height: 1.02; }
h2 { font-size: 30px; margin-bottom: 8px; }
h3 { font-size: 19px; margin-bottom: 6px; }
a { color: inherit; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12px; }
.overline { margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.err { color: var(--danger); margin: 0; }

.gate { min-height: 100vh; display: grid; grid-template-columns: 1.25fr .75fr; background: var(--deep); color: #f7fff9; }
.gate-art { position: relative; overflow: hidden; padding: max(9vw, 64px); display: flex; flex-direction: column; justify-content: center; }
.gate-art h1 { font-size: clamp(50px, 7vw, 100px); max-width: 900px; margin-bottom: 24px; }
.gate-art > p:last-child { max-width: 500px; color: rgba(255,255,255,.62); font-size: 20px; }
.gate-orbit { position: absolute; width: 620px; height: 620px; right: -180px; top: -230px; border: 1px solid rgba(204,255,117,.25); border-radius: 50%; box-shadow: 0 0 0 80px rgba(204,255,117,.04), 0 0 0 160px rgba(204,255,117,.025); }
.gate-card { align-self: center; margin: 32px; padding: 42px; display: grid; gap: 18px; border-radius: 26px; color: var(--ink); background: rgba(255,255,255,.97); box-shadow: 0 30px 100px rgba(0,0,0,.3); }
.mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; background: var(--accent-2); color: var(--deep); font-weight: 900; font-size: 22px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px 16px; display: flex; flex-direction: column; color: #e8f0eb; background: var(--deep); }
.wordmark { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; font-size: 20px; }
.wordmark span:last-child { display: grid; }
.wordmark small { color: rgba(255,255,255,.4); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.side-nav { display: grid; gap: 4px; }
.side-nav button { position: relative; width: 100%; padding: 11px 12px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 11px; color: rgba(255,255,255,.58); background: transparent; text-align: left; transition: .16s; }
.side-nav button:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-nav button.on { color: #fff; background: rgba(204,255,117,.13); }
.side-nav button.on::before { content: ""; position: absolute; left: -16px; width: 3px; height: 22px; border-radius: 3px; background: var(--accent-2); }
.nav-icon { width: 22px; text-align: center; font-size: 17px; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 16px 8px 4px; border-top: 1px solid rgba(255,255,255,.1); }
.profile { display: flex; align-items: center; gap: 10px; min-width: 0; }
.profile > span:last-child { min-width: 0; display: grid; }
.profile b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile small { color: rgba(255,255,255,.45); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--deep); background: var(--accent-2); font-weight: 800; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 10px; color: #fff; background: rgba(255,255,255,.08); }

.workspace { min-width: 0; padding: 0 38px 56px; }
.topbar { height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar h1 { margin: 0; font-size: 26px; }
.crumb { margin: 0 0 2px; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.sync { color: var(--ok); font-size: 12px; }
.view { animation: enter .25s ease; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }

.button { min-height: 42px; padding: 10px 16px; border: 0; border-radius: 11px; font-weight: 700; transition: .16s; }
.button:hover { transform: translateY(-1px); }
.primary { color: #fff; background: var(--accent); box-shadow: 0 8px 22px rgba(21,107,77,.18); }
.secondary { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.light { color: var(--deep); background: var(--accent-2); }
.danger { color: #fff; background: var(--danger); }
.danger-soft { color: var(--danger); background: #f8e8e5; }
.wide { width: 100%; }
.text-button { padding: 6px; border: 0; color: var(--accent); background: transparent; font-weight: 700; }

.hero { min-height: 220px; padding: 36px 40px; display: flex; align-items: flex-end; justify-content: space-between; overflow: hidden; border-radius: 24px; color: #fff; background: radial-gradient(circle at 85% 0, #318465 0, transparent 35%), var(--deep); box-shadow: var(--shadow); }
.hero h2 { max-width: 620px; font-size: clamp(32px, 4vw, 54px); }
.hero p:not(.overline) { max-width: 600px; color: rgba(255,255,255,.62); }
.metrics { margin: 18px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric { padding: 18px 20px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.72); }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { margin-top: 5px; display: block; font-size: 27px; letter-spacing: -.04em; }
.metric small { color: var(--ok); }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span-2 { grid-column: span 2; }
.panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 8px 30px rgba(24,39,33,.035); }
.panel-head, .section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel-head { margin-bottom: 15px; }
.section-head { margin-bottom: 24px; }
.section-head p { margin-bottom: 0; color: var(--muted); }
.device-row, .list-row, .incident-row { padding: 12px 0; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #eeeeeb; }
.device-row:last-child, .list-row:last-child, .incident-row:last-child { border: 0; }
.grow { min-width: 0; flex: 1; }
.grow b, .grow small { display: block; }
.grow small { color: var(--muted); }
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #aaa; }
.status-dot.online { background: var(--ok); box-shadow: 0 0 0 4px rgba(22,132,92,.1); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 0 4px rgba(180,58,45,.1); }
.badge { padding: 4px 8px; border-radius: 999px; color: var(--muted); background: #f0f1ee; font-size: 11px; font-weight: 700; }
.badge.new, .badge.critical { color: var(--danger); background: #faeae7; }
.badge.in_progress, .badge.warning { color: #986110; background: #fff3db; }
.badge.done, .badge.resolved { color: var(--ok); background: #e4f5ee; }
.mini-chart { height: 160px; display: flex; align-items: end; gap: 8px; }
.mini-chart i { flex: 1; min-height: 5px; border-radius: 5px 5px 0 0; background: linear-gradient(var(--accent-2), var(--accent)); }

.filters, .content-toolbar, .segmented, .toolbar-actions, .device-switch { display: flex; gap: 8px; align-items: center; }
.section-head { flex-wrap: wrap; align-items: flex-end; }
.section-head .filters { flex: none; }
.filters input { width: 250px; flex: none; }
.filters .button { flex: none; width: auto; padding-inline: 18px; white-space: nowrap; }
.segmented { padding: 4px; border-radius: 11px; background: #e8e8e3; }
.segmented button, .device-switch button, .rail-tabs button { padding: 7px 11px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.segmented button.active, .device-switch button.active, .rail-tabs button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.screen-grid, .asset-grid, .slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.screen-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.accounts-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 18px; align-items: start; }
.account-card { display: grid; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.account-card header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.account-card .row-actions { display: flex; gap: 8px; }
.uk-assign { width: 100%; margin-top: 6px; }
@media (max-width: 900px) { .accounts-layout { grid-template-columns: 1fr; } }
.screen-shot { height: 160px; padding: 16px; display: grid; place-items: center; background: #e2e4df; }
.screen-mini { width: 70px; height: 124px; padding: 5px; display: grid; gap: 2px; border-radius: 5px; background: #fff; box-shadow: 0 10px 25px rgba(0,0,0,.14); }
.screen-mini.landscape { width: 124px; height: 70px; }
.screen-mini i { display: block; border-radius: 2px; background: #dcebe4; }
.screen-mini i:nth-child(2) { background: var(--accent); }
.screen-body { padding: 17px; }
.screen-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.screen-actions button, .screen-actions a { flex: 1; padding: 9px; border-radius: 9px; text-decoration: none; text-align: center; background: #f1f2ef; font-weight: 700; font-size: 12px; }
.screen-actions .edit-screen { color: #fff; background: var(--deep); }
.screen-actions .delete-screen { flex: 1 1 100%; color: var(--danger); background: #f8e8e5; }

.studio-view { margin: 0 -38px -56px; }
.studio-toolbar { min-height: 80px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border: 1px solid var(--line); border-left: 0; border-right: 0; background: #fff; }
.studio-toolbar h2 { margin: 0; font-size: 20px; }
.display-bar { padding: 10px 24px; display: flex; align-items: end; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: #f7faf8; }
.display-bar label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.display-bar input, .display-bar select { width: 180px; min-height: 38px; padding: 8px 10px; }
.display-bar .hint { max-width: 360px; margin: 0 0 8px; }
.studio { height: calc(100vh - 248px); display: grid; grid-template-columns: 280px minmax(420px, 1fr) 320px; background: #e8e8e3; }
.studio-rail, .inspector { overflow-y: auto; padding: 18px; background: #fff; }
.studio-rail { border-right: 1px solid var(--line); }
.inspector { border-left: 1px solid var(--line); }
.rail-tabs { margin-bottom: 14px; display: flex; }
.page-tree { margin: -4px 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.tree-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tree-head .overline { margin: 0; }
.tree-add { width: 28px; height: 28px; border: 0; border-radius: 8px; color: #fff; background: var(--deep); font-size: 18px; line-height: 1; }
.tree-page { margin-top: 8px; }
.tree-page.on > .tree-row { background: #e7f3ec; }
.tree-row { display: flex; align-items: center; gap: 2px; border-radius: 10px; }
.tree-name, .tree-widget { min-width: 0; border: 0; background: transparent; text-align: left; }
.tree-name { flex: 1; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 10px; font-weight: 750; }
.tree-name i { width: 16px; color: var(--accent); font-style: normal; }
.tree-name span, .tree-widget b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-tool { width: 26px; height: 26px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.tree-tool:hover { color: var(--danger); background: #f8e8e5; }
.tree-tool.copy:hover { color: var(--deep); background: #e7f3ec; }
.tree-page ul { margin: 2px 0 0; padding: 0 0 0 16px; list-style: none; border-left: 1px solid #d7e0da; }
.tree-widget { width: 100%; padding: 5px 8px; display: flex; align-items: center; gap: 6px; border-radius: 8px; color: var(--muted); font-size: 12px; }
.tree-widget.on, .tree-widget:hover { color: var(--ink); background: #f4f7f5; }
.tree-widget em { margin-left: auto; max-width: 88px; overflow: hidden; text-overflow: ellipsis; color: var(--accent); font-style: normal; font-size: 10px; }
.tree-empty { padding: 4px 8px; color: var(--muted); font-size: 12px; }
.tree-rename { width: 100%; padding: 6px 8px; }
.zone-link { position: absolute; top: 6px; right: 6px; z-index: 2; max-width: 70%; padding: 2px 6px; overflow: hidden; border-radius: 99px; color: #fff; background: rgba(17,43,34,.82); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.hint { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.popup-fields { padding: 10px; display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: #f7f9f7; }
.popup-fields textarea { min-height: 100px; }
.popup-preview { display: grid; gap: 12px; }
.popup-preview h3, .popup-preview p { margin: 0; }
.popup-preview p { color: var(--muted); white-space: pre-wrap; }
.popup-preview-media { width: 100%; max-height: 320px; object-fit: contain; border-radius: 14px; background: var(--deep); }
.palette { margin-top: 14px; display: grid; grid-template-columns: 1fr; gap: 8px; }
.media-tray { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.media-import { width: 100%; min-height: 78px; padding: 12px; border: 1px dashed #b7c4bc; border-radius: 14px; color: var(--ink); background: #f7faf8; line-height: 1.35; }
.media-import.over, .stage.over { border-color: var(--accent); background: #edf8f2; }
.media-import small { color: var(--muted); }
.studio-asset { width: 100%; margin-top: 8px; padding: 7px; display: grid; grid-template-columns: 42px 1fr; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; cursor: grab; }
.studio-asset img, .studio-asset video, .asset-fallback { width: 42px; height: 32px; object-fit: cover; border-radius: 6px; background: #e7eeea; }
.studio-asset span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.chip { min-width: 0; min-height: 48px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fafaf8; text-align: left; font-size: 14px; line-height: 1.2; cursor: grab; }
.chip:hover { border-color: var(--accent); background: #f1f8f4; }
.chip small { margin-left: auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.canvas-area { min-width: 0; overflow: auto; padding: 18px 28px 50px; }
.canvas-tools { margin-bottom: 12px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.autosave { color: var(--ok); }
.stage-wrap { min-height: 100%; display: flex; justify-content: center; align-items: flex-start; }
.stage { position: relative; width: min(430px, 80%); aspect-ratio: 1080 / 1920; overflow: hidden; border-radius: 3px; background: #f5f7f5; box-shadow: 0 24px 70px rgba(22,37,31,.2); }
.stage.landscape { width: min(760px, 94%); }
.zone { position: absolute; padding: 8px; overflow: hidden; border: 1px solid rgba(23,32,29,.12); color: #20312b; font-size: 11px; line-height: 1.25; cursor: move; user-select: none; }
.preview-well { border: 1px solid var(--line); border-radius: 14px; background: repeating-conic-gradient(#e7e7e4 0% 25%, #fff 0% 50%) 50% / 14px 14px; }
.style-preview { min-height: 78px; padding: 16px; display: grid; align-content: end; gap: 4px; border-radius: 14px; }
.style-preview .zone-kicker { font-size: 11px; }
.style-preview .zone-title { font-size: 18px; font-weight: 700; }
.tone { display: grid; grid-template-columns: 88px 1fr; gap: 8px; align-items: end; }
.tone output { color: var(--muted); font-size: 12px; font-weight: 700; }
.page-switch, .device-switch select, #monitorSelect, #slotMonitor { max-width: 320px; min-width: 180px; }
.monitor-url { margin: 10px 0; padding: 8px 10px; overflow: hidden; border-radius: 8px; background: #f3f6f4; font-family: "Courier New", monospace; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.zone .media-fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.zone-kicker, .zone-title, .zone-body, .media-error { position: relative; z-index: 1; display: block; }
.zone-kicker { font-size: .72em; font-weight: 800; letter-spacing: .12em; line-height: 1.2; text-transform: uppercase; }
.zone-title { font-weight: 700; }
.zone-body { font-weight: 560; font-size: .82em; line-height: 1.25; white-space: pre-wrap; }
.media-error { margin-top: 6px; padding: 4px 6px; background: rgba(0,0,0,.72); color: #fff; font-size: 11px; }
.zone.on { z-index: 3; box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px rgba(21,107,77,.14); }
.zone .handle { position: absolute; right: -1px; bottom: -1px; z-index: 2; width: 16px; height: 16px; border-radius: 7px 0 0; background: var(--accent); cursor: nwse-resize; }
.owner { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.owner.uk { color: var(--uk); }
.owner.provider { color: var(--accent); }
.theme-box, #zoneCard { margin-top: 20px; padding-top: 18px; display: grid; gap: 12px; border-top: 1px solid var(--line); }
.geometry { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.content-toolbar { margin-bottom: 18px; justify-content: space-between; }
.content-toolbar input { max-width: 340px; }
.asset-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.asset-preview { height: 150px; display: grid; place-items: center; color: var(--accent); background: linear-gradient(135deg,#e8f4ee,#f6f8f5); font-size: 42px; }
.asset-body { padding: 15px; }
.asset-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.empty { padding: 48px 22px; grid-column: 1/-1; border: 1px dashed #cfd1cc; border-radius: 16px; color: var(--muted); text-align: center; }

.timeline { display: grid; gap: 12px; }
.schedule-card { padding: 18px; display: grid; grid-template-columns: 70px 1fr auto; gap: 18px; align-items: center; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.date-tile { padding: 9px; border-radius: 11px; color: #fff; background: var(--deep); text-align: center; }
.date-tile strong { display: block; font-size: 23px; }
.request-board { display: grid; gap: 10px; }
.request-card { padding: 17px; display: grid; grid-template-columns: 110px 1fr 190px; gap: 20px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.request-actions { display: flex; gap: 6px; }
.request-actions select { padding: 8px; font-size: 12px; }
.bars { min-height: 230px; display: flex; align-items: end; gap: 16px; }
.bar { flex: 1; display: grid; gap: 8px; justify-items: center; color: var(--muted); font-size: 11px; }
.bar i { width: 100%; min-height: 4px; border-radius: 8px 8px 2px 2px; background: linear-gradient(180deg,var(--accent-2),var(--accent)); }
.donut { width: 160px; height: 160px; margin: 24px auto; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--accent) 0 55%, var(--accent-2) 55% 78%, #ddd 78%); }
.donut::after { content: attr(data-total); width: 105px; height: 105px; display: grid; place-items: center; border-radius: 50%; background: #fff; font-size: 27px; font-weight: 800; }
.slot-card { padding: 18px; display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.slot-card textarea { min-height: 90px; }

.emergency-layout { min-height: calc(100vh - 150px); display: grid; grid-template-columns: 1.2fr .8fr; gap: 30px; align-items: center; }
.emergency-copy h2 { font-size: clamp(42px,6vw,76px); }
.emergency-copy > p:not(.overline) { max-width: 620px; color: var(--muted); font-size: 18px; }
.emergency-preview { min-height: 260px; padding: 38px; display: grid; place-content: center; gap: 18px; border-radius: 22px; color: #fff; background: var(--danger); text-align: center; box-shadow: 0 24px 70px rgba(180,58,45,.2); }
.emergency-preview span { font-size: 12px; letter-spacing: .18em; }
.emergency-preview strong { max-width: 550px; font-size: 35px; }
.emergency-form { display: grid; gap: 14px; }
.settings-grid { max-width: 780px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 30px 100px rgba(0,0,0,.3); }
.modal-shell { position: relative; }
dialog::backdrop { background: rgba(10,25,20,.58); backdrop-filter: blur(5px); }
.modal-card { position: relative; padding: 28px; display: grid; gap: 14px; }
.check-list { display: grid; gap: 6px; max-height: 180px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.check-list .check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check-list .check input { width: auto; }
.modal-close { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #eee; font-size: 22px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 13px 18px; border-radius: 12px; color: #fff; background: var(--deep); box-shadow: var(--shadow); }
.context-menu { position: fixed; z-index: 30; width: 230px; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.98); box-shadow: 0 22px 65px rgba(18,35,28,.22); backdrop-filter: blur(16px); }
.context-menu button { width: 100%; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 9px; color: var(--ink); background: transparent; text-align: left; }
.context-menu button:hover { background: #edf5f0; }
.context-menu button.danger { color: var(--danger); }
.context-menu hr { margin: 5px 4px; border: 0; border-top: 1px solid var(--line); }
.context-menu kbd { color: var(--muted); background: transparent; font: 11px inherit; }

@media (max-width: 1050px) {
  .gate { grid-template-columns: 1fr; }
  .gate-art { display: none; }
  .shell { grid-template-columns: 78px 1fr; }
  .wordmark span:last-child, .profile span:last-child, .side-nav button span:last-child { display: none; }
  .studio { grid-template-columns: 260px minmax(360px,1fr); }
  .inspector { position: fixed; right: 0; top: 96px; width: 300px; height: calc(100vh - 96px); z-index: 5; box-shadow: var(--shadow); }
  .screen-grid, .asset-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 10; bottom: 0; top: auto; width: 100%; height: 64px; padding: 7px; }
  .wordmark, .profile { display: none; }
  .sidebar-foot { position: fixed; right: 7px; bottom: 7px; z-index: 12; display: flex; padding: 0; border: 0; }
  .side-nav { padding-right: 54px; display: flex; overflow-x: auto; }
  .side-nav button { width: auto; white-space: nowrap; }
  .workspace { padding: 0 16px 90px; }
  .topbar { height: 78px; }
  .emergency-layout { min-height: auto; padding-bottom: 84px; }
  .sync { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .dashboard-grid, .screen-grid, .asset-grid, .slot-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .studio-view { margin: 0 -16px -90px; }
  .studio { grid-template-columns: 1fr; height: auto; }
  .studio-rail, .inspector { position: static; width: auto; height: auto; }
  .emergency-layout { grid-template-columns: 1fr; }
  .request-card, .schedule-card { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* Единая визуальная система: спокойная премиальная основа и живые состояния. */
:root {
  --bg: #f3f5f1;
  --ink: #13231d;
  --muted: #68756f;
  --panel: rgba(255,255,255,.92);
  --line: #dce3de;
  --accent: #197253;
  --accent-2: #d5ff7d;
  --deep: #0d2a21;
  --danger: #b84637;
  --shadow: 0 18px 55px rgba(18,43,33,.08);
  --shadow-hover: 0 24px 70px rgba(18,43,33,.13);
}

html { scrollbar-gutter: stable; }
body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 82% 7%, rgba(213,255,125,.16), transparent 25rem),
    radial-gradient(circle at 18% 92%, rgba(25,114,83,.08), transparent 32rem),
    var(--bg);
}
::selection { color: #fff; background: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: #aebcb5 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 99px; background: #aebcb5; background-clip: padding-box; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(25,114,83,.25);
  outline-offset: 2px;
}

.sidebar {
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 0, rgba(67,151,116,.2), transparent 28%),
    linear-gradient(180deg, #0e3025 0%, #0a231c 100%);
  box-shadow: 12px 0 40px rgba(9,35,27,.08);
}
.sidebar::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  right: -150px;
  bottom: 8%;
  border: 1px solid rgba(213,255,125,.11);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(213,255,125,.025), 0 0 0 76px rgba(213,255,125,.015);
  pointer-events: none;
}
.wordmark, .side-nav, .sidebar-foot { position: relative; z-index: 1; }
.mark, .avatar {
  background: linear-gradient(145deg, #e4ffa9, var(--accent-2));
  box-shadow: 0 8px 24px rgba(213,255,125,.18);
}
.side-nav button { min-height: 44px; }
.side-nav button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.08), transparent);
  opacity: 0;
  transform: translateX(-35%);
  transition: .3s ease;
}
.side-nav button:hover::after { opacity: 1; transform: translateX(35%); }
.side-nav button.on {
  background: linear-gradient(90deg, rgba(213,255,125,.16), rgba(213,255,125,.07));
  box-shadow: inset 0 0 0 1px rgba(213,255,125,.08);
}

.workspace { position: relative; }
.workspace::before {
  content: "";
  position: fixed;
  z-index: -1;
  width: 500px;
  height: 500px;
  right: -180px;
  top: -230px;
  border-radius: 50%;
  background: rgba(213,255,125,.12);
  filter: blur(80px);
  pointer-events: none;
}
.topbar { position: relative; z-index: 6; }
.sync {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(25,114,83,.12);
  border-radius: 99px;
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(12px);
}
.sync::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(22,132,92,.3);
  animation: statusPulse 2.8s ease-out infinite;
}

.button, .icon-button, .text-button, .screen-actions button, .screen-actions a {
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.button:hover, .screen-actions button:hover, .screen-actions a:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(18,43,33,.1); }
.button:active, .screen-actions button:active, .screen-actions a:active { transform: translateY(0) scale(.985); }
.primary { background: linear-gradient(145deg, #218561, #146448); box-shadow: 0 10px 26px rgba(25,114,83,.22); }
.light { background: linear-gradient(145deg, #ddff96, #c9f86d); box-shadow: 0 10px 25px rgba(154,205,73,.18); }
.secondary:hover { border-color: #bccac2; background: #fbfdfb; }

.hero {
  position: relative;
  isolation: isolate;
  border: 1px solid rgba(255,255,255,.08);
  background:
    radial-gradient(circle at 86% 8%, rgba(87,177,139,.58), transparent 32%),
    radial-gradient(circle at 8% 100%, rgba(213,255,125,.09), transparent 34%),
    linear-gradient(135deg, #0a271e, #143a2d);
  box-shadow: 0 24px 70px rgba(10,39,30,.16);
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 280px;
  height: 280px;
  right: -90px;
  top: -150px;
  border: 1px solid rgba(213,255,125,.18);
  border-radius: 50%;
  box-shadow: 0 0 0 45px rgba(213,255,125,.025), 0 0 0 90px rgba(213,255,125,.015);
  animation: orbitFloat 9s ease-in-out infinite alternate;
}
.hero h2 { text-wrap: balance; }

.metric, .panel, .screen-card, .asset-card, .slot-card, .schedule-card, .request-card {
  border-color: rgba(207,218,211,.88);
  background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(250,252,249,.88));
  box-shadow: 0 8px 32px rgba(18,43,33,.045);
  backdrop-filter: blur(15px);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.metric:hover, .panel:hover, .screen-card:hover, .asset-card:hover, .slot-card:hover, .schedule-card:hover, .request-card:hover {
  transform: translateY(-3px);
  border-color: #c5d3cb;
  box-shadow: var(--shadow-hover);
}
.metric strong { color: #10281f; }
.status-dot.online { animation: statusPulse 2.8s ease-out infinite; }
.badge { border: 1px solid rgba(0,0,0,.035); }

.screen-shot {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 75% 18%, rgba(213,255,125,.3), transparent 25%),
    linear-gradient(145deg, #e7eee9, #dbe5df);
}
.screen-shot::after {
  content: "";
  position: absolute;
  inset: -50% auto -50% -45%;
  width: 30%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: screenShine 7s ease-in-out infinite;
}
.screen-mini { border: 1px solid rgba(18,43,33,.08); box-shadow: 0 14px 35px rgba(18,43,33,.18); }

.studio-toolbar {
  position: relative;
  z-index: 4;
  border-color: #dfe5e1;
  background: rgba(255,255,255,.88);
  box-shadow: 0 8px 28px rgba(18,43,33,.05);
  backdrop-filter: blur(18px);
}
.studio { background: linear-gradient(145deg, #e9ede9, #e2e8e4); }
.studio-rail, .inspector { background: rgba(255,255,255,.94); }
.tree-page.on > .tree-row { background: linear-gradient(90deg, #e3f4ea, #f1f8f4); }
.tree-widget.on { box-shadow: inset 3px 0 var(--accent); }
.chip, .studio-asset, .media-import, .popup-fields { transition: .18s ease; }
.chip:hover, .studio-asset:hover {
  transform: translateX(2px);
  border-color: #b8ccc0;
  box-shadow: 0 8px 22px rgba(18,43,33,.07);
}
.media-import:hover { border-color: var(--accent); background: #edf8f2; }
.canvas-area {
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.92), transparent 26rem),
    linear-gradient(145deg, #e8ece8, #dfe5e1);
}
.stage {
  border: 1px solid rgba(16,43,34,.12);
  border-radius: 12px;
  box-shadow: 0 28px 80px rgba(16,43,34,.22), 0 0 0 8px rgba(255,255,255,.55);
}
.zone { transition: box-shadow .16s ease, filter .16s ease; }
.zone:hover { filter: brightness(1.015); }
.zone.on { box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px rgba(25,114,83,.16), 0 14px 28px rgba(16,43,34,.18); }
.autosave {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 99px;
  background: rgba(255,255,255,.7);
}
.preview-well { overflow: hidden; }
.style-preview { box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }

dialog { overflow: hidden; border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.97); box-shadow: 0 35px 120px rgba(7,30,22,.32); }
dialog[open] { animation: modalIn .2s ease-out; }
.toast { border: 1px solid rgba(255,255,255,.12); background: rgba(9,39,29,.94); backdrop-filter: blur(16px); animation: toastIn .22s ease-out; }

@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
@keyframes statusPulse { 65% { box-shadow: 0 0 0 0 rgba(22,132,92,.24); } 100% { box-shadow: 0 0 0 8px rgba(22,132,92,0); } }
@keyframes orbitFloat { to { transform: translate(-18px, 16px) scale(1.04); } }
@keyframes screenShine { 0%, 68% { transform: translateX(-20%) rotate(18deg); opacity: 0; } 76% { opacity: .75; } 90%, 100% { transform: translateX(560%) rotate(18deg); opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 760px) {
  .workspace { padding-bottom: 96px; }
  .sidebar { height: 78px; overflow: visible; box-shadow: 0 -12px 35px rgba(8,34,26,.18); }
  .sidebar::after { display: none; }
  .side-nav { flex: 1 0 64px; min-height: 64px; height: 64px; padding: 0 58px 0 0; align-items: stretch; gap: 2px; overflow-y: hidden; overscroll-behavior-inline: contain; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav button { min-width: 68px; min-height: 60px; height: 60px; padding: 6px 8px 4px; flex-direction: column; justify-content: center; gap: 2px; border-radius: 10px; font-size: 10px; }
  .side-nav button span:last-child { display: block; max-width: 74px; overflow: hidden; text-overflow: ellipsis; }
  .nav-icon { height: 22px; line-height: 22px; font-size: 18px; }
  .side-nav button.on::before { left: 50%; top: -7px; width: 24px; height: 3px; transform: translateX(-50%); }
  .sidebar-foot { right: 8px; bottom: 14px; }
  .top-actions { gap: 7px; }
  .top-actions .button { padding-inline: 12px; }
  .hero { min-height: 250px; padding: 30px; }
  .hero h2 { font-size: clamp(34px, 10vw, 48px); }
  .panel, .metric { border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
