/* Lumora — CMS UI */
:root {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f1f3f9; --border: #e4e7ef; --text: #1b2033; --muted: #6b7286;
  --primary: #5b4bff; --primary-2: #7466ff; --primary-soft: #efedff; --on-primary: #fff;
  --good: #0f9f6e; --good-soft: #e6f7f0; --warn: #d97706; --warn-soft: #fff4e0; --bad: #dc2626; --bad-soft: #fdecec; --info: #2563eb; --info-soft: #e8f0ff;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06); --shadow-lg: 0 12px 32px rgba(16,24,40,.12);
  --sidebar: 260px; --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1220; --surface: #171b2e; --surface-2: #1f2440; --border: #2a3050; --text: #e7e9f3; --muted: #9aa1bb;
    --primary: #818cf8; --primary-2: #a5b4fc; --primary-soft: #252a52; --on-primary: #0f1220;
    --good: #34d399; --good-soft: #10302a; --warn: #fbbf24; --warn-soft: #33290f; --bad: #f87171; --bad-soft: #3a1a1f; --info: #60a5fa; --info-soft: #172a4a;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 32px rgba(0,0,0,.45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1220; --surface: #171b2e; --surface-2: #1f2440; --border: #2a3050; --text: #e7e9f3; --muted: #9aa1bb;
  --primary: #818cf8; --primary-2: #a5b4fc; --primary-soft: #252a52; --on-primary: #0f1220;
  --good: #34d399; --good-soft: #10302a; --warn: #fbbf24; --warn-soft: #33290f; --bad: #f87171; --bad-soft: #3a1a1f; --info: #60a5fa; --info-soft: #172a4a;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 32px rgba(0,0,0,.45); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .8em; }
code, pre { font-family: var(--mono); font-size: .88em; }
pre { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
small, .muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .2s; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), #f5a524); display: grid; place-items: center; color: #fff; font-weight: 900; }
.sidebar nav { overflow-y: auto; padding: 4px 12px 20px; flex: 1; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; font-weight: 700; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; margin: 1px 0; }
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-link .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: .7rem; padding: 1px 7px; font-weight: 700; }
.site-switch { margin: 6px 4px 4px; }
.site-switch select { width: 100%; }
.main { margin-left: var(--sidebar); flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 30; }
.topbar .title { font-weight: 700; font-size: 1.05rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; background: none; border: 0; color: var(--text); padding: 4px; cursor: pointer; }
.menu-btn svg { width: 24px; height: 24px; display: block; }
.content { padding: 26px 28px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.stat .label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.7rem; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stat .delta { font-size: .82rem; font-weight: 600; }
.up { color: var(--good); } .down { color: var(--bad); }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty h3 { color: var(--text); }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-2); }
.btn-danger { color: var(--bad); border-color: var(--bad-soft); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .85rem; border-radius: 7px; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 3px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 6px; margin: 0 0 18px; }
legend { font-weight: 700; padding: 0 6px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
.url-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Badges & pills */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.b-critical, .b-bad, .b-high { background: var(--bad-soft); color: var(--bad); }
.b-medium, .b-warn { background: var(--warn-soft); color: var(--warn); }
.b-low, .b-info { background: var(--info-soft); color: var(--info); }
.b-good, .b-done { background: var(--good-soft); color: var(--good); }
.b-primary { background: var(--primary-soft); color: var(--primary); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.alert-error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.banner { padding: 10px 28px; font-size: .9rem; font-weight: 600; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.banner.trial { background: var(--primary-soft); color: var(--primary); }
.banner.imp { background: var(--warn-soft); color: var(--warn); }

/* Score ring */
.score-ring { --size: 132px; --val: 0; --col: var(--muted); width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%), conic-gradient(var(--col) calc(var(--val) * 1%), var(--surface-2) 0); }
.score-ring b { font-size: calc(var(--size) * .3); font-weight: 800; letter-spacing: -.03em; }
.score-ring small { display: block; text-align: center; font-size: .72rem; margin-top: -6px; }
.score-ring.good { --col: var(--good); } .score-ring.warn { --col: var(--warn); } .score-ring.bad { --col: var(--bad); }
.score-ring.sm { --size: 64px; } .score-ring.xs { --size: 44px; }
.score-text.good { color: var(--good); } .score-text.warn { color: var(--warn); } .score-text.bad { color: var(--bad); }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s; }
.bar.good > span { background: var(--good); } .bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); }
.cat-row { display: grid; grid-template-columns: 150px 1fr 36px; gap: 10px; align-items: center; margin: 9px 0; font-size: .9rem; }
.cat-row b { text-align: right; }

/* Issue list */
.issue { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; background: var(--surface); }
.issue + .issue { margin-top: 8px; }
.issue:hover { border-color: var(--primary); }
.issue .t { font-weight: 600; }
.issue .meta { color: var(--muted); font-size: .84rem; }
.issue .n { margin-left: auto; font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active, .tab:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border); color: var(--text); font-size: .84rem; font-weight: 600; background: var(--surface); }
.chip.active, .chip:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); text-decoration: none; }

/* Modal / drawer */
.modal-bg { position: fixed; inset: 0; background: rgba(10,12,25,.5); z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 860px; box-shadow: var(--shadow-lg); padding: 24px; position: relative; }
.modal .close { position: absolute; right: 14px; top: 12px; background: none; border: 0; font-size: 1.6rem; color: var(--muted); cursor: pointer; }

/* Progress */
.progress-box { display: flex; gap: 18px; align-items: center; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* AI chat */
.chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; height: calc(100vh - 140px); }
.chat-list { overflow-y: auto; padding: 12px; }
.chat-list a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list a.active, .chat-list a:hover { background: var(--primary-soft); text-decoration: none; }
.chat-main { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 22px; }
.msg { max-width: 860px; margin: 0 auto 18px; display: flex; gap: 12px; }
.msg .av { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.msg.user .av { background: var(--surface-2); color: var(--muted); }

.msg .body { min-width: 0; flex: 1; padding-top: 4px; overflow-wrap: anywhere; }
.msg.user .body { background: var(--surface-2); padding: 10px 14px; border-radius: 12px; }
.msg .tools { font-size: .78rem; color: var(--muted); margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; font-size: 1.05rem; }
.md ul, .md ol { padding-left: 22px; margin: 6px 0 10px; }
.md li { margin: 3px 0; }
.md table { margin: 10px 0; font-size: .9rem; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 9px; }
.md p:last-child { margin-bottom: 0; }
.chat-input { border-top: 1px solid var(--border); padding: 14px 18px; background: var(--surface); }
.chat-input form { display: flex; gap: 10px; max-width: 900px; margin: 0 auto; align-items: flex-end; }
.chat-input textarea { min-height: 46px; max-height: 220px; flex: 1; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.suggestions button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 8px 14px; cursor: pointer; font: inherit; font-size: .88rem; }
.suggestions button:hover { border-color: var(--primary); color: var(--primary); }
.action-card { border: 1px solid var(--primary); background: var(--primary-soft); border-radius: 12px; padding: 14px; margin: 10px 0; }
.action-card pre { background: var(--surface); max-height: 260px; }
.action-card .status { font-weight: 700; }

/* Posts */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.post { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.post img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); display: block; }
.post .pb { padding: 10px 12px; font-size: .84rem; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.post .stats { display: flex; gap: 10px; color: var(--muted); font-size: .8rem; flex-wrap: wrap; margin-top: auto; }
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.heat div { border-radius: 8px; padding: 10px 4px; text-align: center; font-size: .8rem; font-weight: 700; }

/* Public pages */
.public-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; max-width: 1180px; margin: 0 auto; }
.public-nav .brand { display: flex; gap: 10px; align-items: center; font-weight: 800; font-size: 1.2rem; color: var(--text); }
.hero { text-align: center; padding: 70px 20px 40px; max-width: 900px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.03em; line-height: 1.1; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 680px; margin: 16px auto 28px; }
.section { max-width: 1180px; margin: 0 auto; padding: 40px 24px; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.feature .ico { width: 42px; height: 42px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 10px; }
.pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.price-card { position: relative; }
.price-card.featured { border: 2px solid var(--primary); }
.price { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; }
.price-card ul { padding-left: 0; list-style: none; margin: 14px 0 20px; }
.price-card li { padding: 4px 0 4px 24px; position: relative; }
.price-card li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 800; }
.price-card li.no::before { content: "–"; color: var(--muted); }
.auth-box { max-width: 420px; margin: 40px auto; }
.footer { text-align: center; color: var(--muted); padding: 30px 20px 40px; font-size: .88rem; }

/* Toast */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 380px; font-weight: 500; animation: fadein .2s; }
.toast.error { background: var(--bad); color: #fff; }
.toast.success { background: var(--good); color: #fff; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

.kpi-inline { display: flex; gap: 22px; flex-wrap: wrap; }
.kpi-inline div b { display: block; font-size: 1.2rem; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 180px; }
.spark { width: 110px; height: 32px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }
.list-plain li:last-child { border-bottom: 0; }
.help { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; font-size: .9rem; }
.help ol { margin: 6px 0 0; padding-left: 20px; }
.copy-box { display: flex; gap: 6px; }
.copy-box input { font-family: var(--mono); font-size: .85rem; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; display: none; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .overlay { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 12px 16px; }
  .g2, .g3, .features, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 12px 14px; }
  .stat .value { font-size: 1.35rem; }
  .topbar .btn span { display: none; }
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: auto; }
  .chat-list { display: none; }
  .chat-main { height: calc(100vh - 120px); }
  .cat-row { grid-template-columns: 110px 1fr 32px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .banner { padding: 10px 16px; }
}
@media print {
  .sidebar, .topbar, .no-print, .banner { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Lumora ---------- */
.brand img.brand-img { height: 30px; max-width: 150px; object-fit: contain; }
.org-switch { margin: 0 12px 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: .82rem; }
.org-switch .crumbs { color: var(--muted); margin-bottom: 6px; line-height: 1.35; }
.org-switch .crumbs b { color: var(--text); }
.org-switch select { padding: 6px 8px; font-size: .84rem; }
.banner.support { background: var(--warn-soft); color: var(--warn); }
.banner.emergency { background: var(--bad); color: #fff; }
.nav-link.danger { color: var(--bad); }
.nav-link.danger.active { background: var(--bad-soft); color: var(--bad); }
.content.wide { max-width: none; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.media-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; min-width: 0; }
.media-thumb { aspect-ratio: 16/10; background: var(--surface-2) center/cover no-repeat; position: relative; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; pointer-events: none; }
.media-thumb .kind { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; }
.media-thumb svg { width: 34px; height: 34px; }
.media-card .mb { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: .85rem; }
.media-card .mb .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-card .mb .meta { color: var(--muted); font-size: .78rem; }
.media-card .mb .row { display: flex; gap: 6px; align-items: center; margin-top: 4px; }

.dropzone { border: 2px dashed var(--border); border-radius: 14px; padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; background: var(--surface); }
.dropzone:hover, .dropzone.over { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.dropzone svg { width: 34px; height: 34px; }
.upload-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.upload-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px 60px; gap: 10px; align-items: center; font-size: .86rem; }
.upload-row .bar { height: 6px; }

.display-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.display-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); color: var(--text); display: flex; flex-direction: column; gap: 6px; }
.display-card:hover { border-color: var(--primary); text-decoration: none; }
.display-card .top { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.display-card .meta { color: var(--muted); font-size: .82rem; }
.shot { width: 100%; border-radius: 10px; border: 1px solid var(--border); background: #000; display: block; aspect-ratio: 16/9; object-fit: contain; }

.pl-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.pl-items { display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.pl-item { display: grid; grid-template-columns: 22px 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--surface); }
.pl-item.dragging { opacity: .4; }
.pl-item .handle { cursor: grab; color: var(--muted); }
.pl-item .handle svg { width: 18px; }
.pl-item .th { width: 72px; height: 44px; border-radius: 6px; background: var(--surface-2) center/cover; display: grid; place-items: center; color: var(--muted); font-size: .7rem; font-weight: 700; overflow: hidden; }
.pl-item .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-item .sub { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.pl-item .ctl { display: flex; gap: 6px; align-items: center; }
.pl-item .ctl input { width: 64px; padding: 5px 7px; }
.picker { max-height: 60vh; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.picker button { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 6px; text-align: left; cursor: pointer; font: inherit; color: var(--text); display: flex; flex-direction: column; gap: 4px; font-size: .8rem; }
.picker button:hover { border-color: var(--primary); }
.picker .th { aspect-ratio: 16/10; border-radius: 6px; background: var(--surface-2) center/cover; display: grid; place-items: center; color: var(--muted); font-weight: 700; font-size: .7rem; }
.picker .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days label { margin: 0; }
.days input { display: none; }
.days span { display: inline-block; padding: 5px 10px; border-radius: 7px; border: 1px solid var(--border); font-size: .82rem; font-weight: 600; cursor: pointer; user-select: none; }
.days input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.cond-tags { display: flex; gap: 4px; flex-wrap: wrap; }

.preview-frame { width: 100%; aspect-ratio: 16/9; border: 1px solid var(--border); border-radius: 12px; background: #000; overflow: hidden; position: relative; }
.preview-frame.portrait { aspect-ratio: 9/16; max-width: 360px; margin: 0 auto; }
.preview-frame iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; }

/* Kiosk builder */
.kb { display: grid; grid-template-columns: 230px minmax(0, 1fr) 320px; gap: 14px; height: calc(100vh - 150px); min-height: 560px; }
.kb-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow-y: auto; padding: 12px; min-width: 0; }
.kb-panel h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 2px 8px; }
.kb-screens a { display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 8px; color: var(--text); font-size: .88rem; cursor: pointer; }
.kb-screens a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.kb-screens a .start { margin-left: auto; font-size: .7rem; color: var(--muted); }
.kb-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.kb-blocks button { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 9px 6px; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.kb-blocks button:hover { border-color: var(--primary); color: var(--primary); }
.kb-blocks button span { font-size: 1.1rem; }
.kb-stage { display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; position: relative; }
.kb-canvas { position: relative; box-shadow: 0 10px 40px rgba(0,0,0,.25); border-radius: 14px; overflow: hidden; }
.kb-canvas .k-block { outline: 1px dashed transparent; cursor: move; }
.kb-canvas .k-block:hover { outline-color: rgba(255,255,255,.5); }
.kb-canvas .k-block.sel { outline: 2px solid #f5a524; outline-offset: 1px; z-index: 50; }
.kb-canvas .k-block .rz { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; background: #f5a524; border-radius: 3px; cursor: nwse-resize; display: none; }
.kb-canvas .k-block.sel .rz { display: block; }
.kb-canvas .k-block * { pointer-events: none; }
.kb-canvas .k-block .rz { pointer-events: auto; }
.kb-props .field { margin-bottom: 10px; }
.kb-props label { font-size: .8rem; }
.kb-props input, .kb-props select, .kb-props textarea { padding: 6px 9px; font-size: .86rem; }
.kb-props .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kb-props .four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.kb-props .rowlist { display: flex; flex-direction: column; gap: 6px; }
.kb-props .rowlist .r { display: grid; grid-template-columns: minmax(0, 1fr) 90px 26px; gap: 4px; }
.kb-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.kb-toolbar input[type=text] { max-width: 260px; }

.qr-box { background: #fff; padding: 10px; border-radius: 10px; display: inline-block; }
.legend-dots { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.hbar { display: grid; grid-template-columns: 120px minmax(0, 1fr) 60px; gap: 10px; align-items: center; font-size: .85rem; margin: 6px 0; }
.hbar .bar { height: 10px; }
.sparkline { color: var(--primary); display: block; }
.sparkline.warn { color: var(--warn); }
.ai-preview { width: 100%; background: #000; border-radius: 12px; overflow: hidden; position: relative; border: 1px solid var(--border); }
.ai-preview iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; }
.print-only { display: none; }

@media (max-width: 1100px) {
  .pl-layout { grid-template-columns: minmax(0, 1fr); }
  .kb { grid-template-columns: 200px minmax(0, 1fr); height: auto; }
  .kb-props-wrap { grid-column: 1 / -1; }
  .kb-stage { min-height: 520px; }
}
@media (max-width: 860px) {
  .kb { grid-template-columns: minmax(0, 1fr); }
  .upload-row { grid-template-columns: minmax(0, 1fr) 80px 44px; }
  .pl-item { grid-template-columns: 18px 56px minmax(0, 1fr); }
  .pl-item .ctl { grid-column: 2 / -1; }
  .hbar { grid-template-columns: 90px minmax(0, 1fr) 50px; }
}
@media print { .print-only { display: block; } }

[hidden] { display: none !important; }
