/* Reboot Signage dark design (same palette as rebootsignage.com). */
:root {
  --bg: #101512; --card: #172019; --raised: #1d2820; --hover: #243128; --top: #0c110e;
  --text: #e8efe9; --muted: #a7b5ab; --line: #2a362e; --line-strong: #3d4c42;
  --accent: #4cc472; --accent-ink: #0b1a10; --accent-soft: #1b3323; --accent-text: #6fd890;
  --ok: #4cc472; --bad: #ff8a80;
  --warn-bg: #3a2f12; --warn-line: #6b5520; --warn-text: #f5d27a;
  --info-bg: #15283a; --info-text: #9cc7ff;
  --checker: repeating-conic-gradient(#1d2820 0 25%, #253229 0 50%) 0 0/14px 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
a { color: var(--accent-text); }
:focus-visible { outline: 3px solid #7cb8ff; outline-offset: 2px; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: normal; }
.error { color: var(--bad); min-height: 1em; margin: 4px 0; }
h2 { margin: 0; }
h3 { margin: 0 0 10px; }

input, select, button, .button {
  font: inherit; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--raised); color: inherit;
}
input::placeholder, textarea::placeholder { color: #7d8b82; }
button, .button { cursor: pointer; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.danger { color: var(--bad); }
.link { border: none; background: none; color: var(--accent); padding: 0; }
.link.danger, button.danger { color: var(--bad); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.inline { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label, .auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { margin: 0; font-size: 22px; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--top); color: var(--text); flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.brand-mark { flex: none; }
.brand-name span { color: var(--accent); }
.auth-card .brand { font-size: 22px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.topbar nav a:hover { color: var(--text); background: var(--card); }
.topbar nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.topbar .link { color: var(--accent-text); }
.help-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--muted); text-decoration: none;
            font-weight: 800; font-size: 18px; margin-right: -20px; }
.help-btn:hover { background: var(--card); color: var(--text); }
.help-btn.active { background: var(--accent-soft); color: var(--accent-text); }
.gear { position: relative; margin-right: -12px; }
.gear-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: none; border-radius: 8px; background: transparent; color: var(--muted); }
.gear-btn:hover, .gear-btn[aria-expanded="true"] { background: var(--card); color: var(--text); }
.gear-btn.active { background: var(--accent-soft); color: var(--accent-text); }
.gear-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 250px; background: var(--card); color: var(--text);
             border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.5); padding: 6px; }
.gear-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px 4px; }
.gear-menu a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; font-weight: 600; font-size: 14px; }
.gear-menu a > span:first-child { font-size: 18px; width: 24px; text-align: center; }
.gear-menu a small { display: block; font-weight: normal; font-size: 12px; color: var(--muted); }
.gear-menu a:hover { background: var(--hover); }
.gear-menu a.active { background: var(--accent-soft); color: var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.tab { display: none; }
.tab.active { display: block; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.device .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.device h4 { margin: 0; font-size: 17px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.on { background: var(--ok); }
.device select { width: 100%; }

.list { display: flex; flex-direction: column; gap: 8px; }
.list .item { display: flex; justify-content: space-between; align-items: center; }
.list .item a { font-weight: 600; color: var(--text); text-decoration: none; }

.empty { padding: 32px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: 12px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; position: relative; }
.thumb img, .thumb video { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #000; }
.thumb .cap { padding: 6px 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb .del { position: absolute; top: 6px; right: 6px; padding: 2px 8px; font-size: 12px; }
#picker .thumb { cursor: pointer; }
#picker .thumb:hover { outline: 2px solid var(--accent); }

.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); margin-bottom: 16px; }
.drop.over { border-color: var(--accent); color: var(--accent); }

.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { .editor { grid-template-columns: 1fr; } }
.title-input { font-size: 22px; font-weight: 700; border: none; background: transparent; padding: 4px 0; width: 100%; }
.slides { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.slide { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; cursor: grab; }
.slide.dragging { opacity: .4; }
.slide .pv { width: 96px; aspect-ratio: 16/9; object-fit: cover; background: #000; border-radius: 6px; flex: none; display: grid; place-items: center; color: #fff; font-size: 11px; }
.slide .info { flex: 1; min-width: 0; }
.slide .info .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.slide input[type=number] { width: 70px; padding: 4px 6px; }

.table { width: 100%; border-collapse: collapse; margin-top: 16px; background: var(--card); border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(420px, 92vw); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.code-input { font-size: 24px; letter-spacing: 4px; text-transform: uppercase; text-align: center; font-family: ui-monospace, monospace; }

.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.slide .edit { margin-right: 4px; }
.slide .pv.w-weather { background: linear-gradient(160deg, #0ea5e9, #1e3a8a); }
.slide .pv.w-news { background: #111827; border-bottom: 3px solid #dc2626; }
.slide .pv.w-text { font-weight: 700; }
textarea { font: inherit; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--raised); color: inherit; resize: vertical; width: 100%; }
.extras-head { margin-top: 28px; }
.extras { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .extras { grid-template-columns: 1fr; } }
.extras label { font-size: 14px; }
.extras .stack label { display: flex; flex-direction: column; gap: 4px; }
.extras .inline label { display: flex; align-items: center; gap: 6px; }
.extras hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.switch { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; cursor: pointer; }
.sub-opts { margin: 10px 0 0 26px; }
.sub-opts.off { opacity: .45; pointer-events: none; }
input[type=color] { padding: 2px; width: 44px; height: 34px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.presets button { padding: 3px 8px; font-size: 12px; border-radius: 999px; }
.loc-results { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.loc-results button { border: none; border-radius: 0; text-align: left; border-bottom: 1px solid var(--line); }
.loc-results button:hover { background: var(--accent-soft); }
.loc-current { font-weight: 600; }
.feed-check { font-size: 13px; }
.feed-check.ok { color: var(--ok); }
#slide-dialog { width: min(520px, 94vw); }
#slide-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
#slide-fields .inline label { flex-direction: row; align-items: center; }

/* ---------- schedule ---------- */
.rule { display: flex; align-items: center; gap: 14px; }
.rule.off { opacity: .55; }
.rule .prio { display: flex; flex-direction: column; gap: 2px; }
.rule .prio button { padding: 0 8px; line-height: 1.3; font-size: 12px; }
.rule .swatch { width: 12px; align-self: stretch; border-radius: 4px; flex: none; }
.rule .body { flex: 1; min-width: 0; }
.rule .body b { font-size: 15px; }
.rule .when { font-size: 14px; margin-top: 2px; }
.rule .where { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rule .live { background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.field-label { font-size: 14px; margin-bottom: 6px; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days label { cursor: pointer; }
.days input { display: none; }
.days span { display: inline-block; min-width: 46px; text-align: center; padding: 6px 0; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; user-select: none; }
.days input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.day-presets { margin-top: 6px; }
.times { margin-top: 8px; gap: 12px; }
.times.off { opacity: .4; pointer-events: none; }
.device-checks { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 0 26px; max-height: 160px; overflow: auto; }
.device-checks.off { opacity: .4; pointer-events: none; }
#rule-dialog { width: min(540px, 94vw); }
#rule-dialog details summary { cursor: pointer; font-size: 14px; }
.week-head { margin-top: 28px; }
.week { padding: 12px 16px; overflow-x: auto; }
.week-grid { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; min-width: 640px; align-items: center; }
.week-grid .dl { font-size: 13px; font-weight: 600; }
.week-grid .dl small { display: block; font-weight: 400; color: var(--muted); }
.week-bar { position: relative; height: 30px; border-radius: 6px; overflow: hidden; display: flex; background: var(--raised); }
.week-bar div { height: 100%; font-size: 11px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; line-height: 30px; }
.week-bar .now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); padding: 0; }
.week-hours { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 13px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.device .now-line { font-size: 13px; margin-top: 8px; }
.device .tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.device .tag.sched { background: var(--accent-soft); color: var(--accent-text); }
.device .tag.def { background: var(--raised); color: var(--muted); }
.device .field-label { margin: 10px 0 4px; font-size: 12px; color: var(--muted); }

/* ---------- campaign cards ---------- */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.ccard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column;
         transition: box-shadow .15s, transform .15s; }
.ccard:hover { box-shadow: 0 8px 24px rgba(15,23,42,.10); transform: translateY(-2px); }
.ccard-peek { text-decoration: none; color: inherit; display: grid; grid-template-columns: 3fr 1fr; grid-template-rows: minmax(0, 1fr); gap: 3px; aspect-ratio: 16/8; background: #0f172a; overflow: hidden; }
.peek-main, .peek-side { display: grid; gap: 3px; min-height: 0; grid-template-rows: minmax(0, 1fr); }
.peek-side { grid-template-rows: repeat(3, minmax(0, 1fr)); }
.pk { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; overflow: hidden; min-height: 0; font-size: 22px; color: #fff; }
.peek-side .pk { font-size: 14px; }
.pk-empty { background: #1e293b; color: var(--muted); font-size: 12px; }
.pk-text { font-weight: 800; font-size: 15px; padding: 8px; text-align: center; line-height: 1.15; }
.peek-side .pk-text { font-size: 8px; padding: 3px; }
.pk-weather { background: linear-gradient(160deg, #0ea5e9, #1e3a8a); }
.pk-news { background: #111827; border-bottom: 3px solid #dc2626; }
.pk-url { background: var(--hover); }
.ccard-body { padding: 12px 14px 4px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.ccard-name { font-weight: 700; font-size: 16px; color: var(--text); text-decoration: none; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; min-height: 4px; }
.chip { font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent-text); border-radius: 999px; padding: 2px 8px; }
.ccard-actions { display: flex; gap: 8px; align-items: center; padding: 10px 14px 14px; }
.ccard-actions .delete { margin-left: auto; }
a.button { text-decoration: none; display: inline-block; }

/* ---------- campaign builder ---------- */
main:has(#tab-editor.active), main:has(#tab-widget.active) { max-width: 1680px; }
.ed-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.ed-back { font-size: 22px; text-decoration: none; color: var(--muted); padding: 2px 10px; border-radius: 8px; }
.ed-back:hover { background: var(--hover); color: var(--text); }
.ed-name { flex: 1; font-size: 24px; font-weight: 800; border: 1px solid transparent; background: transparent; padding: 4px 8px; }
.ed-name:hover { border-color: var(--line); } .ed-name:focus { background: var(--raised); border-color: var(--accent); outline: none; }
.ed-status { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.ed-status.unsaved { background: var(--warn-bg); color: var(--warn-text); }
.ed-status.saved { background: var(--accent-soft); color: var(--accent-text); }
#ed-publish:disabled { opacity: .45; cursor: default; }

.ed { display: grid; grid-template-columns: 300px minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
@media (max-width: 1200px) { .ed { grid-template-columns: 260px minmax(0, 1fr); } .ed-inspect { grid-column: 1 / -1; } }
@media (max-width: 760px) { .ed { grid-template-columns: 1fr; } }
.ed-slides, .ed-inspect { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.ed-slides { padding: 12px; position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
.ed-slides.drop-files { outline: 3px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }
.ed-panel-head { padding: 2px 4px 10px; display: flex; justify-content: space-between; align-items: baseline; }
.ed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 60px; }
.ed-empty { color: var(--muted); text-align: center; padding: 24px 8px; font-size: 14px; line-height: 1.5; }
.es { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; position: relative; background: var(--raised); }
.es:hover { background: var(--hover); }
.es.sel { border-color: var(--accent); background: var(--accent-soft); }
.es.now { border-color: var(--ok); background: var(--accent-soft); }
.es.dragging { opacity: .35; }
.es.drop-before { box-shadow: 0 -3px 0 var(--accent); } .es.drop-after { box-shadow: 0 3px 0 var(--accent); }
.es-num { font-size: 11px; color: var(--muted); width: 14px; text-align: right; flex: none; }
.th { width: 72px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; flex: none; background: #0f172a; display: grid; place-items: center; font-size: 18px; color: #fff; overflow: hidden; }
.th-text { font-size: 9px; font-weight: 800; text-align: center; padding: 2px; line-height: 1.1; }
.th-weather { background: linear-gradient(160deg, #0ea5e9, #1e3a8a); }
.th-news { background: #111827; border-bottom: 2px solid #dc2626; }
.th-url { background: var(--hover); }
.es-info { flex: 1; min-width: 0; }
.es-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.es-sub { font-size: 11px; color: var(--muted); }
.es-warn { font-size: 11px; color: var(--warn-text); font-weight: 600; }
.es-act { display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity .1s; }
.es:hover .es-act, .es.sel .es-act { opacity: 1; }
.es-act button { border: none; background: transparent; padding: 2px 5px; font-size: 12px; color: var(--muted); border-radius: 4px; }
.es-act button:hover { background: var(--hover); color: var(--text); }
.es-act .es-del:hover { color: var(--bad); }
.ed-add { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.ed-add-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.add-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.add-tiles button { display: flex; align-items: center; gap: 8px; padding: 9px 10px; font-size: 13px; font-weight: 600; border-radius: 10px; background: var(--raised); text-align: left; }
.add-tiles button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.add-tiles button span { font-size: 18px; }
.add-tiles button:first-child { grid-column: 1 / -1; }

.ed-stage { position: sticky; top: 12px; }
.tv { background: #0b0f19; padding: 10px; border-radius: 16px; box-shadow: 0 20px 40px rgba(15,23,42,.25), inset 0 0 0 1px #1f2937; }
.tv iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 6px; display: block; background: #000; }
.tv-controls { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px 0 4px; }
.tv-controls #pv-play { min-width: 110px; }
.tv-controls #pv-caption { min-width: 240px; }
.center { text-align: center; }

.ed-inspect { overflow: hidden; }
.ed-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--raised); }
.ed-tabs button { flex: 1; border: none; border-radius: 0; background: transparent; padding: 12px 6px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.ed-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); background: var(--card); }
.ed-inspector { padding: 16px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 140px); overflow-y: auto; }
.insp-head { display: flex; gap: 10px; align-items: center; }
.insp-head .th { width: 96px; }
.insp-warn { background: var(--warn-bg); color: var(--warn-text); padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.insp-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > label { font-size: 13px; font-weight: 600; }
.fld input:not([type=checkbox]):not([type=color]):not([type=range]), .fld textarea, .fld select { width: 100%; }
.fld input[type=number] { width: 90px !important; }
.seg { display: flex; flex-wrap: wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: none; background: transparent; padding: 7px 8px; font-size: 13px; border-radius: 8px; white-space: nowrap; }
.seg button.on { background: var(--hover); box-shadow: 0 1px 3px rgba(0,0,0,.4); font-weight: 600; color: var(--accent); }
.bigswitch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.bigswitch input { display: none; }
.bigswitch .knob { width: 40px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative; flex: none; transition: background .15s; }
.bigswitch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.bigswitch input:checked + .knob { background: var(--accent); }
.bigswitch input:checked + .knob::after { transform: translateX(18px); }
.bigswitch small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.sub { display: flex; flex-direction: column; gap: 12px; padding-left: 50px; }
.sub.off { opacity: .4; pointer-events: none; }
.ov { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.ov:last-child { border-bottom: none; }
.range { display: flex; align-items: center; gap: 10px; } .range input { flex: 1; } .rv { font-variant-numeric: tabular-nums; min-width: 42px; font-weight: 600; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets button { padding: 4px 10px; font-size: 12px; border-radius: 999px; }
.presets button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.themes button { height: 44px; border-radius: 10px; font-weight: 800; border: 2px solid transparent; }
.themes button.on { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }
.colors label { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.tcolors { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tcolors button { width: 38px; height: 30px; padding: 0; font-size: 11px; font-weight: 800; border-radius: 8px; border: 2px solid var(--line); }
.tcolors button.on { border-color: var(--text); }
.listed { display: flex; flex-direction: column; gap: 6px; }
.li-row { display: flex; gap: 6px; align-items: center; } .li-row input { flex: 1; }
.listed > .link { align-self: flex-start; font-size: 13px; }
.logo-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.logo-pick button { padding: 4px; height: 52px; border-radius: 8px; background: var(--checker); border: 2px solid var(--line); }
.logo-pick button.on { border-color: var(--accent); }
.logo-pick img { max-width: 100%; max-height: 100%; object-fit: contain; }
.trans { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trans button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px; border-radius: 12px; text-align: left; border: 2px solid var(--line); }
.trans button.on { border-color: var(--accent); background: var(--accent-soft); }
.trans small { color: var(--muted); font-size: 11px; }
.tdemo { width: 100%; height: 38px; border-radius: 6px; background: #0f172a; position: relative; overflow: hidden; margin-bottom: 6px; }
.tdemo i { position: absolute; inset: 4px; border-radius: 4px; }
.tdemo i:first-child { background: #3b82f6; } .tdemo i:last-child { background: #f59e0b; animation: 2.4s infinite; }
.tdemo-fade i:last-child { animation-name: d-fade; } .tdemo-slide i:last-child { animation-name: d-slide; }
.tdemo-zoom i:last-child { animation-name: d-zoom; } .tdemo-none i:last-child { animation-name: d-cut; }
@keyframes d-fade { 0%, 35% { opacity: 0; } 60%, 100% { opacity: 1; } }
@keyframes d-slide { 0%, 35% { transform: translateX(110%); } 65%, 100% { transform: none; } }
@keyframes d-zoom { 0%, 35% { opacity: 0; transform: scale(1.3); } 65%, 100% { opacity: 1; transform: none; } }
@keyframes d-cut { 0%, 49% { opacity: 0; } 50%, 100% { opacity: 1; } }
.feed-check.ok { color: var(--ok); }
dialog.wide { width: min(860px, 94vw); }
.md-grid { max-height: 60vh; overflow-y: auto; }
.md-grid .thumb { cursor: pointer; }
.md-grid .thumb:hover { outline: 3px solid var(--accent); }
.md-grid .thumb.added { outline: 3px solid var(--ok); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--hover); color: var(--text); border: 1px solid var(--line-strong); padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ---------- layouts and zones ---------- */
.ed-tabs button { padding: 12px 2px; font-size: 12.5px; }
.zmap { position: relative; aspect-ratio: 16 / 9; background: #0f172a; border-radius: 6px; overflow: hidden; }
.zmap > * { position: absolute; box-sizing: border-box; border: 1.5px solid #0f172a; background: #64748b; border-radius: 3px; }
.zmap > :first-child { background: #94a3b8; }
.zmap > .inset { border: 2px solid #0f172a; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.ed-zones { margin: 4px 0 10px; display: flex; flex-direction: column; gap: 6px; }
.zmap-pick { border-radius: 10px; }
.zmap-pick > button { padding: 2px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
                      color: #fff; background: #475569; border: 2px solid #0f172a; border-radius: 6px; font-size: 11px; line-height: 1.15; cursor: pointer; }
.zmap-pick > button:first-child { background: #475569; }
.zmap-pick > button small { opacity: .75; font-size: 10px; }
.zmap-pick > button:hover { background: #64748b; }
.zmap-pick > button.on { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.layouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.layouts button { padding: 6px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 600; color: var(--muted); }
.layouts button:hover { border-color: var(--line-strong); }
.layouts button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.layouts button.on .zmap > * { background: #2f7a4a; } .layouts button.on .zmap > :first-child { background: var(--accent); }
.chip-layout { display: inline-flex; align-items: center; gap: 5px; background: var(--info-bg); color: var(--info-text); }
.chip-layout .zmap { width: 22px; border-radius: 2px; } .chip-layout .zmap > * { border-width: 1px; border-radius: 1px; }

/* ---------- backgrounds ---------- */
.bg-folders { margin: 12px 0 8px; }
.bg-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.bg-pick button, .bg-up { position: relative; aspect-ratio: 16 / 9; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid var(--line); background: #0f172a; }
.bg-pick button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bg-pick img, .bg-pick video { width: 100%; height: 100%; object-fit: cover; display: block; }
.bg-pick i { position: absolute; left: 4px; bottom: 2px; font-style: normal; font-size: 12px; }
.bg-up { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--raised); border-style: dashed; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
.bg-up span { font-size: 18px; line-height: 1; }
.bg-up:hover { border-color: var(--accent); color: var(--accent); }
.backdrops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.backdrops button { aspect-ratio: 16 / 10; padding: 0; border-radius: 8px; border: 2px solid transparent; display: flex; align-items: flex-end; overflow: hidden; }
.backdrops button span { width: 100%; font-size: 10px; font-weight: 700; color: #fff; background: rgba(0,0,0,.35); padding: 2px 0; }
.backdrops button.on { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }
#md-folders { margin: 0; }

/* ---------- media library ---------- */
.mlib { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 760px) { .mlib { grid-template-columns: 1fr; } }
.mfolders { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; position: sticky; top: 12px; }
.mf { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; user-select: none; }
.mf:hover { background: var(--hover); }
.mf.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mf.drop { background: var(--accent); color: var(--accent-ink); }
.mfolders.dropping .mf:not([data-folder="all"]) { outline: 1px dashed var(--accent); outline-offset: -2px; }
.mf-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-n { font-size: 12px; color: var(--muted); min-width: 18px; text-align: right; }
.mf.drop .mf-n { color: var(--accent-ink); }
.mf-act { display: none; gap: 6px; }
.mf:hover .mf-act { display: inline-flex; } .mf:hover .mf-n { display: none; }
.mf-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 10px 4px; }
#new-folder { margin-top: 8px; padding: 0 2px; } #new-folder input { flex: 1; min-width: 0; padding: 6px 10px; } #new-folder button { padding: 6px 10px; }
.mf-tip { margin: 8px 6px 2px; }
.mbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mbar h3 { margin: 0; font-size: 18px; }
.mbar #m-summary { margin-right: auto; }
.mbar #m-search { width: 200px; }
.mbar .seg { flex-wrap: nowrap; }
.selbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--accent-soft); color: var(--text); border: 1px solid #2f5a3c; border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; position: sticky; top: 8px; z-index: 5; }
.selbar .link { color: var(--accent-text); } .selbar button.danger { background: var(--card); }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.mt { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.mt:hover { box-shadow: 0 6px 18px rgba(15,23,42,.12); transform: translateY(-1px); }
.mt.picked { outline: 3px solid var(--accent); outline-offset: -1px; }
.mt-pic { position: relative; aspect-ratio: 16 / 10; background: var(--checker); }
.mt-pic img, .mt-pic video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mt-kind { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(0,0,0,.6); padding: 1px 7px; border-radius: 999px; }
.mt-check { position: absolute; top: 6px; left: 6px; opacity: 0; transition: opacity .15s; }
.mt:hover .mt-check, .picking .mt-check, .mt.picked .mt-check { opacity: 1; }
.mt-check input { display: none; }
.mt-check span { display: block; width: 22px; height: 22px; border-radius: 6px; background: rgba(255,255,255,.9); border: 2px solid #94a3b8; box-sizing: border-box; }
.mt-check input:checked + span { background: var(--accent); border-color: var(--accent); }
.mt-check input:checked + span::after { content: "✓"; color: var(--accent-ink); font-size: 14px; font-weight: 800; display: block; text-align: center; line-height: 18px; }
.mt-cap { padding: 8px 10px; }
.mt-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-meta { font-size: 11px; color: var(--muted); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.mt-used { margin-left: auto; padding: 0 6px; border-radius: 999px; background: var(--raised); }
.mt-used.yes { background: var(--accent-soft); color: var(--accent-text); }
.mi { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 700px) { .mi { grid-template-columns: 1fr; } }
.mi-pic { background: var(--checker); border-radius: 10px; overflow: hidden; display: grid; place-items: center; min-height: 200px; }
.mi-pic img, .mi-pic video { max-width: 100%; max-height: 60vh; display: block; }

/* ---------- portrait ---------- */
.zmap.tall { aspect-ratio: 9 / 16; }
.zmap-pick.tall { width: 56%; margin: 0 auto; }
.layouts.tall { grid-template-columns: repeat(4, 1fr); }
.chip-layout .zmap.tall { width: 10px; }
.tv.portrait { width: fit-content; margin: 0 auto; }
.tv.portrait iframe { aspect-ratio: 9 / 16; width: auto; height: min(72vh, 820px); }
.orient { display: flex; gap: 6px; flex-wrap: wrap; }
.orient-warn { margin-top: 6px; font-size: 12px; color: var(--warn-text); background: var(--warn-bg); border-radius: 8px; padding: 6px 8px; }
.add-tiles button:last-child:nth-child(even) { grid-column: 1 / -1; }

/* ---------- widgets ---------- */
.th-widget, .pk-widget { background: linear-gradient(160deg, #1e1b4b, #0f172a); }
.wcard-top { height: 120px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 14px 16px; color: #fff; text-decoration: none; }
.wcard-top.theme-midnight { background: linear-gradient(160deg, #1e1b4b, #0f172a); }
.wcard-top.theme-warm { background: linear-gradient(160deg, #7c2d12, #431407); }
.wcard-top.theme-forest { background: linear-gradient(160deg, #064e3b, #022c22); }
.wcard-top.theme-ocean { background: linear-gradient(160deg, #075985, #082f49); }
.wcard-top.theme-light { background: linear-gradient(180deg, #fffbeb, #fde68a); color: #1c1917; }
.wcard-top.theme-glass { background: linear-gradient(160deg, #334155, #64748b); }
.wcard-icon { font-size: 30px; }
.wcard-title { font-size: 18px; font-weight: 800; }
.wed { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .wed { grid-template-columns: 1fr; } }
.wed-form { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.wed-form .fld { margin: 0; }
.wed-preview { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; }
.wed-preview .seg { align-self: center; }
.wg-tv.portrait iframe { height: min(70vh, 760px); }
.wthemes { display: flex; gap: 6px; flex-wrap: wrap; }
.wthemes button { display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; font-size: 12px; border-radius: 999px; }
.wthemes button i { width: 22px; height: 22px; border-radius: 50%; display: block; border: 1px solid rgba(255,255,255,.18); }
.wthemes button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.wdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 4px; }
.wdays button { padding: 8px 0; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; }
.wdays button small { font-size: 10px; background: var(--accent-soft); color: var(--accent-text); border-radius: 999px; padding: 0 6px; }
.wdays button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.wdays button.on small { background: rgba(0,0,0,.18); color: var(--accent-ink); }
.wday-head { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.wev-list { display: flex; flex-direction: column; gap: 6px; }
.wev { display: grid; grid-template-columns: 132px 132px minmax(0, 1.4fr) minmax(0, 1fr) 24px; gap: 6px; align-items: center; }
.wev input { min-width: 0; width: 100%; box-sizing: border-box; padding: 7px 8px; }
.wev-labels { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.wev-labels i { text-transform: none; font-weight: 400; }
.wsecs { display: flex; flex-direction: column; gap: 10px; }
.wsec { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--raised); display: flex; flex-direction: column; gap: 6px; }
.wsec-head { display: flex; gap: 6px; align-items: center; }
.wsec-name { flex: 1; font-weight: 700; }
.wsec-head button:not(.link) { padding: 4px 9px; }
.witem { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 80px 24px; gap: 6px; align-items: center; }
.witem input { min-width: 0; width: 100%; box-sizing: border-box; padding: 7px 8px; }
.wd-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-height: 60vh; overflow-y: auto; }
.wd-item { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border-radius: 12px; }
.wd-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.wd-item .wd-ic { font-size: 26px; }
.wd-item small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- network page ---------- */
.net-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .net-grid { grid-template-columns: 1fr; } }
.net-grid .card { display: flex; flex-direction: column; gap: 12px; }
.net-grid h3 { margin: 0; }
.net-grid p { margin: 0; }
.net-facts { display: grid; gap: 6px; font-size: 14px; }
.net-facts > div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.net-facts span { color: var(--muted); min-width: 150px; }
.tag { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--raised); color: var(--muted); }
.tag.ok { background: var(--accent-soft); color: var(--accent-text); }
.tag.warn { background: var(--warn-bg); color: var(--warn-text); }
.net-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.net-fields label, .net-server { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.net-fields label small { font-weight: normal; }
.net-fields .inline input { flex: 1; min-width: 0; }
.net-fields label.check { flex-direction: row; align-items: center; font-weight: normal; grid-column: 1 / -1; }
#net-static { display: flex; flex-direction: column; gap: 10px; }
#net-static.hidden { display: none; }
.net-pending { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; padding: 10px 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn-text); }
.kc-cards { display: flex; flex-direction: column; gap: 10px; }
.kc-card { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--raised); }
.kc-card.bad { background: var(--warn-bg); }
.kc-icon { font-size: 30px; }
.kc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.kc-actions { display: flex; flex-direction: column; gap: 6px; }
.kc-wait { display: flex; align-items: center; justify-content: center; gap: 10px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- help ---------- */
.help { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 800px) { .help { grid-template-columns: 1fr; } }
.help-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 32px); }
.help-nav input { width: 100%; }
#help-topics { overflow-y: auto; display: flex; flex-direction: column; padding-right: 4px; }
#help-topics .hn-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 4px; }
#help-topics .hn-cat:first-child { margin-top: 0; }
#help-topics a { color: var(--text); text-decoration: none; font-size: 14px; padding: 5px 8px; border-radius: 6px; }
#help-topics a:hover { background: var(--hover); }
#help-topics a.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.help-article { padding: 24px 28px; line-height: 1.6; font-size: 15px; max-width: 820px; }
.help-article h2 { margin: 2px 0 14px; }
.help-article h4 { margin: 18px 0 6px; }
.help-article p { margin: 0 0 12px; }
.help-article ul, .help-article ol { margin: 0 0 12px; padding-left: 22px; }
.help-article li { margin-bottom: 6px; }
.help-article ol.steps { list-style: none; counter-reset: step; padding-left: 0; }
.help-article ol.steps > li { counter-increment: step; position: relative; padding-left: 38px; margin-bottom: 10px; }
.help-article ol.steps > li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.help-article ol.steps ul { margin-top: 6px; }
.help-article code { background: var(--raised); border-radius: 4px; padding: 1px 6px; font-size: 13px; }
.help-article a { color: var(--accent); }
.help-article .tip, .help-article .note { border-radius: 10px; padding: 10px 14px; margin: 12px 0; font-size: 14px; }
.help-article .tip { background: var(--accent-soft); border: 1px solid #2f5a3c; }
.help-article .tip::before { content: "Tip: "; font-weight: 700; }
.help-article .note { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.help-article .note::before { content: "Good to know: "; font-weight: 700; }
.help-article dl.terms dt { font-weight: 700; margin-top: 10px; }
.help-article dl.terms dd { margin: 2px 0 0; color: var(--muted); }
.help-rel { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.help-rel a { background: var(--accent-soft); border-radius: 999px; padding: 3px 12px; text-decoration: none; }

/* ---------- categories ---------- */
.cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.catbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 16px; }
.catbar button { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 12px; font-size: 13px; background: var(--card); }
.catbar button span { font-size: 11px; color: var(--muted); background: var(--raised); border-radius: 999px; padding: 0 6px; }
.catbar button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.catbar button.on span { background: rgba(0,0,0,.18); color: var(--accent-ink); }
.catbar-manage { font-size: 13px; margin-left: 4px; color: var(--accent); }
.catbar-empty { margin: -6px 0 14px; }
.cgroup { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 10px 0 -4px; font-size: 16px; }
.cgroup:first-child { margin-top: 0; }
.cgroup .muted { font-weight: normal; }
.cgroup .cat-dot { width: 12px; height: 12px; }
.wd-list .cgroup { margin: 8px 0 0; font-size: 14px; }
.ccard-cat { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.ccard-cat select { padding: 3px 8px; font-size: 12px; border-radius: 6px; max-width: 100%; }
.ed-cat { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.ed-cat select { padding: 6px 8px; font-size: 13px; max-width: 180px; }
.cats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.cats-grid .card { display: flex; flex-direction: column; gap: 10px; }
.cats-grid h3 { margin: 0; }
.cat-list { display: flex; flex-direction: column; gap: 6px; }
.cat-list .empty { padding: 16px; }
.cat-row { display: flex; align-items: center; gap: 8px; }
.cat-color { width: 26px; height: 26px; border-radius: 50%; flex: none; cursor: pointer; position: relative; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.cat-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }
.cat-name { flex: 1; min-width: 0; padding: 6px 10px; }
.cat-count { white-space: nowrap; min-width: 82px; text-align: right; }
.cat-row button:not(.link) { padding: 4px 8px; font-size: 11px; }
.cat-add input { flex: 1; }

/* ---------- layout designer ---------- */
.lcard-top { display: block; padding: 14px; background: #0f172a; }
.lmap { border-radius: 6px; background: #1e293b; }
.lmap.tall { aspect-ratio: 9 / 16; height: 140px; margin: 0 auto; }
.lmap:not(.tall) { aspect-ratio: 16 / 9; }
.lmap > * { border: 2px solid #0f172a; opacity: .9; }
.my-layouts-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; margin: 4px 0 6px; }
.my-layouts-head a { color: var(--accent); font-size: 12px; }
.ld { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .ld { grid-template-columns: 1fr; } }
.ld-stage { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.ld-canvas { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #0f172a; border-radius: 10px; overflow: hidden; touch-action: none; cursor: crosshair; user-select: none;
  --gx: 4.1667%;
  background-image: linear-gradient(rgba(148,163,184,.13) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,.13) 1px, transparent 1px);
  background-size: var(--gx) var(--gx); box-shadow: 0 10px 30px rgba(15,23,42,.25); }
.ld-canvas.nogrid { background-image: none; }
.ld-canvas.tall { aspect-ratio: 9 / 16; width: auto; height: min(78vh, 900px); }
.ld-canvas:not(.tall) { max-height: 72vh; }
.ld-zone { position: absolute; box-sizing: border-box; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 30%, #0f172a); border-radius: 4px; cursor: move; }
.ld-zone.inset { box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.ld-zone.on { background: color-mix(in srgb, var(--c) 45%, #0f172a); outline: 2px solid #fff; outline-offset: 1px; z-index: 5; }
.ld-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff; pointer-events: none; overflow: hidden; padding: 4px; text-align: center; }
.ld-label b { width: 26px; height: 26px; border-radius: 50%; background: var(--c); display: grid; place-items: center; font-size: 13px; }
.ld-label span { font-weight: 700; font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.ld-label small { font-size: 11px; opacity: .75; }
.ld-h { position: absolute; width: 12px; height: 12px; background: var(--card); border: 2px solid var(--c); border-radius: 3px; z-index: 6; }
.ld-nw { left: -7px; top: -7px; cursor: nwse-resize; } .ld-se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.ld-ne { right: -7px; top: -7px; cursor: nesw-resize; } .ld-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.ld-n { left: calc(50% - 6px); top: -7px; cursor: ns-resize; } .ld-s { left: calc(50% - 6px); bottom: -7px; cursor: ns-resize; }
.ld-e { right: -7px; top: calc(50% - 6px); cursor: ew-resize; } .ld-w { left: -7px; top: calc(50% - 6px); cursor: ew-resize; }
.ld-guides { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.ld-guides .gx { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed #f472b6; }
.ld-guides .gy { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed #f472b6; }
.ld-draw { position: absolute; border: 2px dashed #fff; background: rgba(255,255,255,.12); border-radius: 4px; pointer-events: none; z-index: 7; }
.ld-panel { display: flex; flex-direction: column; gap: 0; padding: 0; }
.ld-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.ld-sec:last-child { border-bottom: none; }
.ld-sec p { margin: 0; }
.ld-lbl { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.ld-head { display: flex; justify-content: space-between; align-items: baseline; }
.ld-zones { display: flex; flex-direction: column; gap: 4px; }
.ld-zrow { display: flex; align-items: center; gap: 6px; padding: 3px; border-radius: 8px; }
.ld-zrow.on { background: var(--accent-soft); }
.ld-swatch { width: 24px; height: 24px; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; cursor: pointer; }
.ld-zname { flex: 1; min-width: 0; padding: 5px 8px; }
.ld-zrow button:not(.link) { padding: 3px 7px; font-size: 10px; }
.ld-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.ld-tools button { font-size: 12px; padding: 6px 9px; }
.ld-xywh { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ld-xywh label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ld-xywh span { display: flex; align-items: center; gap: 4px; color: var(--text); }
.ld-xywh input { width: 100%; padding: 5px 8px; }
.ld-notes:empty { display: none; }
.ld-notes p { color: var(--warn-text); }

/* ---------- demo mode ---------- */
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 24px; background: var(--accent-soft); border-bottom: 1px solid #2f5a3c; font-size: 14px; }
.demo-bar > span { flex: 1; min-width: 260px; }
.demo-bar .button { padding: 6px 12px; font-size: 13px; text-decoration: none; }
.device .watch { display: block; text-align: center; margin: 10px 0 6px; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; text-decoration: none; }

/* License page and banner */
.license-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 8px 24px; background: var(--info-bg); color: var(--info-text); border-bottom: 1px solid var(--line); font-size: 14px; }
.license-bar.warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.license-bar > span { flex: 1; }
.license-bar .button { padding: 5px 12px; font-size: 13px; text-decoration: none; }
#license-page { display: grid; gap: 16px; max-width: 900px; }
.lic-status.ok { border-left: 4px solid var(--ok); }
.lic-status.bad { border-left: 4px solid var(--bad); }
.lic-title { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.lic-title .pill { font-size: 12px; background: var(--accent-soft); color: var(--accent-text); border-radius: 999px; padding: 2px 10px; }
.lic-warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); border-radius: 8px; padding: 8px 12px; }
.lic-rows { display: grid; grid-template-columns: 140px 1fr; gap: 6px 16px; margin: 14px 0; }
.lic-rows dt { color: var(--muted); }
.lic-rows dd { margin: 0; }
.lic-status .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lic-status .actions .button { text-decoration: none; }
.lic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.lic-grid h3 { margin: 0; }
.lic-key-input { font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; letter-spacing: .04em; }
.lic-offline summary { cursor: pointer; }
.lic-offline label { display: grid; gap: 4px; margin-top: 10px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; width: 100%; }
@media (max-width: 560px) { .lic-rows { grid-template-columns: 1fr; gap: 2px; } .lic-rows dd { margin-bottom: 8px; } }
