:root {
  --bg: #f3f5f8; --card: #ffffff; --ink: #1c2430; --muted: #66717f; --line: #dde3ea;
  --accent: #1f6feb; --accent-ink: #ffffff; --side: #111827; --side-ink: #d1d5db; --side-active: #1f2937;
  --ok: #1a7f37; --warn: #9a6700; --bad: #cf222e;
  --page-x: 24px; --page-y: 20px; --chip: #eef1f5; --chip-ink: #2b3646; --chip-active: #dbe7fb; --media: #0f172a;
  --hover: #f7f9fb; --focus: #bcd3fb; --shadow: 0 8px 24px rgba(17, 24, 39, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 system-ui, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 14px 0; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; font-weight: 700; font-size: 18px; padding: 4px 18px 14px; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
nav a { display: block; color: var(--side-ink); padding: 9px 18px; border-left: 3px solid transparent; }
nav a:hover { background: var(--side-active); text-decoration: none; }
nav a.active { background: var(--side-active); color: #fff; border-left-color: var(--accent); }
nav a.external { margin-top: 10px; font-size: 13px; opacity: .85; }
.sidebar-foot { margin-top: auto; padding: 12px 18px 0; border-top: 1px solid #1f2937; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.user-name { color: #fff; font-weight: 600; }
.link-button { background: none; border: 0; color: var(--side-ink); padding: 0; font: inherit; cursor: pointer; text-align: left; }
.link-button:hover { color: #fff; text-decoration: underline; }

.content { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.topbar h1 { margin: 0; font-size: 20px; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page { padding: var(--page-y) var(--page-x); flex: 1; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 8px; font-size: 16px; }
.stage { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #eef1f5; color: var(--muted); margin-left: 8px; vertical-align: middle; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid .card { margin: 0; }
ul.plain { margin: 6px 0 0; padding-left: 18px; }
button.primary { font: inherit; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; }
button.primary:hover { filter: brightness(1.08); }
code { font: 12.5px ui-monospace, Consolas, monospace; background: #eef1f5; padding: 1px 5px; border-radius: 4px; }

/* login / setup */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px 26px; box-shadow: 0 10px 30px rgba(17, 24, 39, .08); }
.auth-card h1 { margin: 0 0 4px; font-size: 20px; }
.auth-card p.lead { margin: 0 0 16px; color: var(--muted); }
.field { display: block; margin-top: 12px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.field input:focus { outline: 2px solid #bcd3fb; border-color: var(--accent); }
.auth-card button.primary { width: 100%; margin-top: 18px; padding: 9px 14px; }
.error { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { display: flex; flex-wrap: wrap; }
  nav a { border-left: 0; border-bottom: 3px solid transparent; }
  nav a.active { border-bottom-color: var(--accent); }
  .sidebar-foot { flex-direction: row; flex-wrap: wrap; gap: 12px; align-items: center; }
}

/* ---- shared controls (buttons, segments, chips, badges) ---- */
.btn { font: inherit; font-size: 13px; line-height: 1.3; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b8c2cf; background: var(--hover); }
.btn:focus-visible, .primary:focus-visible, .chip:focus-visible, .tag:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.btn.small { padding: 2px 8px; font-size: 12px; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: #fff5f5; }
.btn.active, .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); position: relative; z-index: 1; }
.btn:disabled, .primary:disabled { opacity: .55; cursor: default; }
.seg { display: inline-flex; flex: none; }
.seg .btn { border-radius: 0; margin-left: -1px; }
.seg .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg .btn:last-child { border-radius: 0 6px 6px 0; }
.badge { display: inline-block; font-size: 12px; line-height: 1.45; padding: 1px 6px; border-radius: 4px; background: var(--chip); color: var(--chip-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge.kind-video { background: #e8def8; color: #4a2b8a; }
.badge.kind-image { background: #dcf3e6; color: #135c2b; }
.badge.override { box-shadow: inset 0 0 0 1px var(--warn); }
.badge.deleted { background: #fde8e8; color: var(--bad); }
.chip-group { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 3px; padding: 2px 4px 2px 2px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.chip-key { font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: var(--chip); color: var(--muted); }
.chip-group.auto .chip-key { background: var(--side); color: #fff; }
.chip { font: inherit; font-size: 12.5px; line-height: 1.3; padding: 2px 8px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.chip em { font-style: normal; font-size: 11px; color: var(--muted); background: var(--chip); border-radius: 8px; padding: 0 5px; font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--chip); }
.chip.active, .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.chip.active em { background: rgba(255, 255, 255, .25); color: #fff; }
.tag { font: inherit; font-size: 12px; line-height: 1.4; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; white-space: nowrap; }
.tag.auto { color: var(--chip-ink); background: var(--chip); border-color: transparent; }
.tag.override { box-shadow: inset 0 0 0 1px var(--warn); }
.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag.active { background: var(--chip-active); border-color: var(--accent); color: var(--accent); }
.tag-none { font-size: 11.5px; }
.mono { font: 12px ui-monospace, Consolas, monospace; }

/* ---- Content page (rezervor) ---- */
.ct-toolbar { position: sticky; top: var(--topbar-h, 59px); z-index: 1; background: var(--bg); margin: calc(-1 * var(--page-y)) calc(-1 * var(--page-x)) 12px; padding: 10px var(--page-x) 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ct-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ct-row-b { align-items: flex-start; gap: 8px 16px; }
.ct-search { flex: 1 1 200px; min-width: 160px; max-width: 320px; }
.ct-search-input, .ct-sort, .ct-upload-tags { font: inherit; font-size: 13px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); width: 100%; }
.ct-search-input:focus, .ct-sort:focus, .ct-upload-tags:focus { outline: 2px solid var(--focus); border-color: var(--accent); }
.ct-sort { width: auto; flex: none; }
.ct-counter { font-size: 13px; color: var(--muted); white-space: nowrap; margin-right: 6px; }
.ct-counter b { color: var(--ink); font-size: 15px; }
.ct-chips { flex: 1 1 320px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; min-height: 30px; }
.ct-chips-empty { font-size: 12.5px; }
.ct-upload { display: flex; align-items: center; gap: 6px; flex: 0 1 auto; flex-wrap: wrap; }
.ct-upload-tags { width: 280px; }
.ct-upload .primary { padding: 6px 14px; font-size: 13px; white-space: nowrap; }
.ct-notice { background: #fde8e8; color: var(--bad); border: 1px solid #f5c2c2; border-radius: 6px; padding: 6px 10px; display: flex; gap: 8px; align-items: center; font-size: 13px; }
.ct-notice .btn { margin-left: auto; color: var(--ink); }
.asset-name-wrap { min-width: 0; }
.asset-inline-error { color: var(--bad); font-size: 12px; margin-top: 4px; line-height: 1.35; }
.page.has-uploads { padding-bottom: 300px; }
.page.has-uploads-collapsed { padding-bottom: 72px; }
.ct-list[aria-busy="true"] { opacity: .6; pointer-events: none; }
.ct-more { text-align: center; padding: 14px 0 4px; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.asset-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; transition: box-shadow .15s, outline-color .2s; }
.asset-card:hover { box-shadow: var(--shadow); }
.asset-card.highlight { outline: 3px solid var(--accent); outline-offset: -1px; }
.asset-row.highlight td { background: var(--chip-active); }
.asset-card.deleted { opacity: .8; }
.asset-media { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: var(--media) radial-gradient(ellipse at 30% 20%, #243042, #0f172a 70%); display: grid; place-items: center; overflow: hidden; }
.asset-media.clickable { cursor: zoom-in; }
.asset-media img { width: 100%; height: 100%; display: block; }
.asset-media img.contain { object-fit: contain; }
.asset-media img.cover { object-fit: cover; }
.asset-play { font-size: 26px; color: #fff; width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, .14); display: grid; place-items: center; padding-left: 3px; }
.asset-duration { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 11.5px; line-height: 1.4; padding: 1px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.asset-media.small { width: 64px; height: 36px; aspect-ratio: auto; border-radius: 4px; }
.asset-media.small .asset-play { width: 22px; height: 22px; font-size: 11px; padding-left: 2px; }
.asset-media.small .asset-duration { display: none; }
.asset-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.asset-name { display: inline-block; max-width: 100%; font-weight: 600; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; cursor: text; border-radius: 4px; padding: 2px 4px; margin: -2px -4px; border: 1px dashed transparent; }
.asset-name[role="button"]:hover { background: var(--chip); border-color: var(--line); }
.asset-name-input { font: inherit; font-weight: 600; font-size: 13.5px; width: 100%; padding: 1px 4px; margin: -2px -4px; border: 1px solid var(--accent); border-radius: 4px; outline: 2px solid var(--focus); color: var(--ink); }
.asset-badges, .asset-tags { display: flex; flex-wrap: wrap; gap: 3px 4px; }
.asset-actions { display: flex; gap: 4px; margin-top: auto; padding-top: 6px; border-top: 1px dashed var(--line); }
.asset-actions .btn { flex: 1 1 0; padding: 4px 4px; font-size: 12px; }

.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; max-width: 100%; }
.asset-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 13px; }
.asset-table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 8px; border-bottom: 1px solid var(--line); background: var(--hover); white-space: nowrap; }
.asset-table th.num, .asset-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.asset-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.asset-table tr:last-child td { border-bottom: 0; }
.asset-table tbody tr:hover td { background: var(--hover); }
.asset-table .cell-thumb { width: 64px; padding-right: 0; }
.asset-table .cell-name { min-width: 170px; max-width: 300px; }
.asset-table .cell-name .asset-name-input { margin: 0; }
.asset-table .cell-tags { min-width: 170px; max-width: 320px; }
.asset-table .cell-tags .asset-tags { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.asset-table .override-cell { text-decoration: underline dotted var(--warn); }
.asset-table .cell-date { white-space: nowrap; color: var(--muted); }
.asset-table .cell-actions { white-space: nowrap; }
.asset-table .asset-actions { margin: 0; padding: 0; border: 0; }
.asset-table .asset-actions .btn { flex: none; padding: 3px 7px; }
.asset-table .small-note { font-size: 11.5px; }
.asset-table tr.deleted td { opacity: .8; }

.ct-empty { border: 2px dashed #b8c2cf; border-radius: 12px; background: var(--card); padding: 40px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 42vh; justify-content: center; }
.ct-empty h2 { margin: 0; color: var(--ink); font-size: 18px; }
.ct-empty p { margin: 0; max-width: 560px; }
.ct-empty .glyph { font-size: 40px; line-height: 1; color: var(--accent); }
.ct-empty-filter { min-height: 28vh; border-style: solid; border-color: var(--line); }

.ct-drop-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(31, 111, 235, .12); display: grid; place-items: center; pointer-events: none; }
.ct-drop-overlay > div { border: 3px dashed var(--accent); border-radius: 16px; background: rgba(255, 255, 255, .94); padding: 32px 40px; font-size: 18px; font-weight: 600; color: var(--accent); text-align: center; line-height: 1.5; }
.ct-drop-overlay small { font-size: 13px; font-weight: 400; color: var(--muted); }

.ct-uploads { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: min(400px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; }
.ct-uploads header { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
.ct-uploads header > span { color: var(--muted); font-weight: 400; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-uploads ul { list-style: none; margin: 0; padding: 4px 0; max-height: 40vh; overflow: auto; }
.ct-uploads.collapsed ul { display: none; }
.ct-uploads.collapsed header { border-bottom: 0; }
.upload-item { padding: 6px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { color: var(--muted); display: inline-flex; gap: 6px; align-items: center; max-width: 60vw; min-width: 0; }
.upload-status .upload-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status .btn { flex: none; }
.upload-duration { width: 74px; font: inherit; font-size: 12px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; }
.upload-item[data-state="ok"] .upload-status { color: var(--ok); }
.upload-item[data-state="existing"] .upload-status, .upload-item[data-state="duplicate"] .upload-status { color: var(--warn); }
.upload-item[data-state="error"] .upload-status { color: var(--bad); flex-wrap: wrap; }
.upload-item[data-state="error"] .upload-status .upload-text { white-space: normal; }
.upload-bar { grid-column: 1 / -1; height: 4px; background: var(--chip); border-radius: 2px; overflow: hidden; }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upload-item[data-state="ok"] .upload-bar i { background: var(--ok); }
.upload-item[data-state="existing"] .upload-bar i, .upload-item[data-state="duplicate"] .upload-bar i { background: var(--warn); }
.upload-item[data-state="error"] .upload-bar i { background: var(--bad); }

dialog.ct-dialog { border: 0; border-radius: 10px; padding: 0; width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 24px 60px rgba(17, 24, 39, .3); color: var(--ink); background: var(--card); }
dialog.ct-dialog::backdrop { background: rgba(17, 24, 39, .45); }
.ct-dialog-body { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.ct-dialog header { padding: 12px 18px 10px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.ct-dialog h2 { margin: 0; font-size: 16px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ct-dialog h3 { margin: 14px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ct-dialog-main { padding: 12px 18px 14px; overflow: auto; }
.ct-dialog footer { padding: 10px 18px 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ct-dialog .spacer { flex: 1; }
.ct-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.ct-form-grid .span2 { grid-column: 1 / -1; }
.ct-form-grid .field { margin-top: 10px; }
.field textarea, .field select, .field input[type="file"] { width: 100%; font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
.field textarea { resize: vertical; font: 13px/1.5 ui-monospace, Consolas, monospace; }
.field textarea:focus, .field select:focus { outline: 2px solid var(--focus); border-color: var(--accent); }
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4; }
.field .upload-bar { margin-top: 6px; }
.ct-replace { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.ct-edit-media { display: flex; gap: 12px; align-items: center; background: var(--chip); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.ct-edit-media .asset-media { width: 144px; flex: none; border-radius: 6px; }
.ct-edit-facts { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ct-error { color: var(--bad); font-size: 13px; margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ct-error:empty { display: none; }
.ct-error .ok { color: var(--ok); }
.ct-preview-media { background: var(--media); border-radius: 8px; display: grid; place-items: center; min-height: 160px; max-height: 44vh; overflow: hidden; }
.ct-preview-media video, .ct-preview-media img { max-width: 100%; max-height: 44vh; display: block; }
.ct-preview-media .asset-play { width: 72px; height: 72px; font-size: 32px; }
.ct-meta { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 12px 0 0; font-size: 13px; }
.ct-meta dt { color: var(--muted); white-space: nowrap; }
.ct-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ct-versions li { margin: 2px 0; }

@media (max-width: 600px) {
  :root { --page-x: 12px; --page-y: 12px; }
  .topbar { padding: 10px 12px; }
  .ct-toolbar { position: static; }
  .ct-search { max-width: none; flex-basis: 100%; }
  .ct-toolbar, .ct-row { gap: 6px; }
  .ct-uploads ul { max-height: 24vh; }
  .page-actions { width: 100%; margin-left: 0; }
  .ct-upload { width: 100%; }
  .ct-upload-tags { width: auto; flex: 1 1 140px; }
  .badge, .tag { font-size: 12.5px; }
  .page.has-uploads { padding-bottom: 40vh; }
  .ct-form-grid { grid-template-columns: 1fr; }
  .ct-edit-media { flex-wrap: wrap; }
  .ct-uploads { right: 8px; left: 8px; bottom: 8px; width: auto; }
  .ct-meta { grid-template-columns: 1fr; gap: 0; }
  .ct-meta dt { margin-top: 6px; }
}

/* ---- Locations page (rețeaua de ecrane) ---- */
.lc-actions-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lc-badge-count { font-style: normal; font-size: 11px; font-weight: 700; line-height: 1.4; margin-left: 6px; padding: 0 6px; border-radius: 9px; background: var(--chip); color: var(--muted); font-variant-numeric: tabular-nums; }
.lc-badge-count.warn { background: var(--warn); color: #fff; }
.lc-devices-button { display: inline-flex; align-items: center; }
.lc-toolbar .seg { flex: none; }

.lc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; background: #94a3b8; vertical-align: middle; margin-right: 5px; }
.lc-dot-online { background: #16a34a; }
.lc-dot-offline { background: #f59e0b; }
.lc-dot-none { background: #94a3b8; }
.lc-state { font-weight: 600; }
.lc-state-online { color: var(--ok); }
.lc-state-offline { color: var(--warn); }
.lc-state-none { color: var(--muted); }

.lc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.lc-grid.small { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.lc-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; cursor: pointer; transition: box-shadow .15s, outline-color .2s; }
.lc-card:hover { box-shadow: var(--shadow); }
.lc-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.lc-card.highlight { outline: 3px solid var(--accent); outline-offset: -1px; }
.lc-row.highlight td { background: var(--chip-active); }
.lc-card.deleted { opacity: .85; }
.lc-shot { position: relative; height: 150px; background: linear-gradient(180deg, #eef2f7, #dde5ee); display: grid; place-items: center; overflow: hidden; }
.lc-grid.small .lc-shot { height: 100px; }
.lc-screen { height: calc(100% - 16px); max-width: calc(100% - 24px); background: var(--media) radial-gradient(ellipse at 30% 20%, #243042, #0f172a 70%); overflow: hidden; display: grid; place-items: center; box-shadow: 0 0 0 3px #2a3546, 0 5px 12px rgba(15, 23, 42, .35); border-radius: 3px; }
.lc-screen.portrait { aspect-ratio: 9 / 16; }
.lc-screen.landscape { aspect-ratio: 16 / 9; }
.lc-screen img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lc-initials { color: #93a8c2; font-weight: 700; font-size: 18px; letter-spacing: .08em; }
.lc-grid.small .lc-initials { font-size: 14px; }
.lc-shot > .lc-dot { position: absolute; top: 6px; left: 6px; width: 11px; height: 11px; margin: 0; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(15, 23, 42, .18); }
.lc-orient-badge { position: absolute; right: 5px; bottom: 5px; background: rgba(255, 255, 255, .88); color: var(--muted); font-size: 10.5px; line-height: 1.6; padding: 0 6px; border-radius: 4px; letter-spacing: .03em; }
.lc-body { padding: 7px 10px 9px; display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.lc-name-wrap { min-width: 0; }
.lc-name { display: inline-block; max-width: 100%; font-weight: 600; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; cursor: text; border-radius: 4px; padding: 2px 4px; margin: -2px -4px; border: 1px dashed transparent; }
.lc-name[role="button"]:hover { background: var(--chip); border-color: var(--line); }
.lc-name-input { font: inherit; font-weight: 600; font-size: 13.5px; width: 100%; padding: 1px 4px; margin: -2px -4px; border: 1px solid var(--accent); border-radius: 4px; outline: 2px solid var(--focus); color: var(--ink); }
.lc-inline-error { color: var(--bad); font-size: 12px; margin-top: 4px; line-height: 1.35; }
.lc-orar { font-size: 12.5px; line-height: 1.35; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lc-clock { color: var(--muted); margin-right: 4px; }
.lc-tags { display: flex; flex-wrap: wrap; gap: 3px 4px; }
.lc-player { font-size: 12.5px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; }
.lc-player-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lc-stale { background: #fdf1d4; color: var(--warn); }
.lc-actions { display: flex; gap: 4px; margin-top: auto; padding-top: 6px; border-top: 1px dashed var(--line); }
.lc-actions .btn { flex: 1 1 0; padding: 4px 4px; font-size: 12px; }

.lc-table { min-width: 980px; }
.lc-table .cell-dot { width: 22px; padding-right: 0; }
.lc-table .cell-dot .lc-dot { margin: 0; }
.lc-table .cell-name { min-width: 160px; max-width: 260px; }
.lc-table .cell-name .lc-name-input { margin: 0; }
.lc-table .cell-orar { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lc-table .cell-zone { white-space: nowrap; font-size: 12.5px; }
.lc-table .cell-player { min-width: 150px; }
.lc-table .cell-tags { min-width: 150px; max-width: 260px; }
.lc-table .cell-tags .lc-tags { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.lc-table .cell-date { white-space: nowrap; color: var(--muted); }
.lc-table .cell-actions { white-space: nowrap; }
.lc-table .lc-actions { margin: 0; padding: 0; border: 0; }
.lc-table .lc-actions .btn { flex: none; padding: 3px 7px; }
.lc-table .lc-player { flex-wrap: nowrap; }
.lc-empty-first .glyph { font-size: 34px; }

/* dialogs */
dialog.lc-dialog { width: min(760px, calc(100vw - 32px)); }
.lc-fact-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; padding: 0 0 10px; margin-bottom: 2px; }
.lc-fact-strip .lc-dot { margin-right: 0; }
.lc-fact-player { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.lc-fact-config { margin-left: auto; }
.lc-fact-sep { opacity: .5; }
.lc-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 4px; }
.lc-panel-body { padding-top: 6px; }
.lc-hint { font-size: 12.5px; margin: 2px 0 10px; }
.lc-facts { background: var(--chip); border-radius: 8px; padding: 8px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.lc-panel-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lc-panel-actions .primary { font-size: 13px; padding: 5px 12px; }

.lc-orar-editor { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--card); }
.lc-orar-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.lc-orar-grid { display: flex; flex-direction: column; gap: 3px; }
.lc-orar-grid.disabled { opacity: .45; }
.lc-orar-row { display: grid; grid-template-columns: 106px max-content 10px max-content 1fr; align-items: center; gap: 0 6px; }
.lc-orar-editor.compact .lc-orar-row { grid-template-columns: 62px max-content 10px max-content 1fr; }
.lc-day { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; margin: 0; }
.lc-day input { margin: 0; }
.lc-day span { display: inline; font-size: 13px; color: var(--ink); margin: 0; }
.lc-hour { font: inherit; font-size: 12.5px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 5px; background: var(--card); color: var(--ink); font-variant-numeric: tabular-nums; }
.lc-hour:disabled { color: var(--muted); background: var(--hover); }
.lc-dash { font-size: 12px; text-align: center; }
.lc-closed { font-size: 12px; visibility: hidden; padding-left: 6px; }
.lc-orar-row.closed .lc-closed { visibility: visible; }
.lc-orar-summary { margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lc-orar-summary b { color: var(--ink); }

.lc-identity-current { display: flex; gap: 12px; align-items: center; background: var(--chip); border-radius: 8px; padding: 8px 10px; }
.lc-identity-shot { height: 90px; width: 156px; flex: none; border-radius: 6px; border: 1px solid var(--line); }
.lc-identity-facts { min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.lc-identity-facts .btn { align-self: flex-start; margin-top: 3px; }
.lc-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; max-height: 230px; overflow: auto; padding: 2px; }
.lc-picker-item { font: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 4px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0; text-align: left; }
.lc-picker-item:hover { border-color: var(--accent); }
.lc-picker-item.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--chip-active); }
.lc-picker-shot { height: 62px; background: var(--media); border-radius: 4px; display: grid; place-items: center; overflow: hidden; }
.lc-picker-shot img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.lc-picker-shot .lc-initials { font-size: 13px; }
.lc-picker-name { font-size: 11.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-picker-note { font-size: 12px; margin-top: 6px; }
.lc-new-picker .lc-picker { max-height: 170px; }

.lc-token { border: 1px solid #f0d48a; background: #fdf6e3; border-radius: 8px; padding: 8px 10px; margin-top: 10px; }
.lc-token-warn { color: var(--warn); font-size: 12.5px; margin-bottom: 6px; font-weight: 600; }
.lc-token-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lc-token-input { flex: 1 1 260px; min-width: 0; font-size: 12px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
.lc-copied { font-size: 12px; }

.lc-device-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lc-device-list li { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; background: var(--card); }
.lc-device-main { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lc-device-main .muted { flex-basis: 100%; font-size: 12px; }
.lc-code-big { font: 700 20px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .12em; background: var(--side); color: #fff; padding: 6px 10px; border-radius: 6px; flex: none; }
.lc-code { font: 12px ui-monospace, Consolas, monospace; background: var(--chip); padding: 1px 6px; border-radius: 4px; }
.lc-inline-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lc-location-select, .lc-newplayer-name { font: inherit; font-size: 12.5px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); max-width: 240px; }
.lc-devices-section { margin-top: 12px; }
.lc-devices-section:first-of-type { margin-top: 0; }
.lc-status-pending { background: #fdf1d4; color: var(--warn); }
.lc-status-revoked { background: #fde8e8; color: var(--bad); }
.lc-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.lc-history li { padding: 5px 8px; border-left: 3px solid var(--line); background: var(--hover); border-radius: 0 6px 6px 0; }
.lc-config-versions { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lc-config-doc { margin-top: 6px; }

@media (max-width: 600px) {
  .lc-actions-bar { width: 100%; }
  .lc-actions-bar .lc-counter { flex: 1 1 100%; }
  .lc-grid, .lc-grid.small { grid-template-columns: 1fr; }
  .lc-shot, .lc-grid.small .lc-shot { height: 132px; }
  .lc-tabs .btn { flex: 1 1 auto; }
  .lc-orar-row { grid-template-columns: 96px max-content 10px max-content 1fr; }
  .lc-identity-current { flex-wrap: wrap; }
  .lc-picker { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .lc-device-list li { flex-direction: column; align-items: stretch; }
  .lc-location-select, .lc-newplayer-name { max-width: none; flex: 1 1 auto; }
}

.lc-one-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---- sub-page tabs under the title -------------------------------------- */
.page-tabs { display: flex; gap: 2px; margin-left: 4px; }
.page-tabs a { font-size: 13px; padding: 4px 12px; border-radius: 14px; color: var(--muted); }
.page-tabs a:hover { background: var(--chip); text-decoration: none; }
.page-tabs a.active { background: var(--chip-active); color: var(--accent); font-weight: 600; }

/* ---- content groups: the tree table ------------------------------------- */
.gr-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff7e0; border: 1px solid #f0dda6; color: var(--warn); border-radius: 6px; padding: 7px 12px; font-size: 13px; margin-bottom: 12px; }
.gr-list { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.gr-empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.gr-empty h3 { margin: 0 0 6px; font-size: 16px; color: var(--ink); }
.gr-empty p { margin: 0 auto 14px; max-width: 60ch; }

.tree-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tree-table th { position: sticky; top: 0; z-index: 1; background: var(--hover); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tree-table td { padding: 5px 8px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.tree-table .col-name { width: auto; min-width: 260px; }
.tree-table .col-num { width: 92px; }
.tree-table .col-type { width: 120px; }
.tree-table .col-window { width: 138px; }
.tree-table .col-where { width: 190px; }
.tree-table .col-toggle { width: 58px; text-align: center; }
.tree-table .col-actions { width: 96px; text-align: right; white-space: nowrap; }
.tree-row.is-parent > td { background: var(--card); }
.tree-row.is-parent.is-open > td { background: var(--hover); border-bottom-color: var(--line); }
.tree-row.is-child > td { background: #fbfcfe; }
.tree-row.is-add > td { background: #fbfcfe; padding: 2px 8px 8px 44px; }
.tree-row.is-disabled .tree-input, .tree-row.is-disabled .tree-meta, .tree-row.is-disabled .tree-range, .tree-row.is-disabled .tree-glyph, .tree-row.is-disabled .tree-thumb { opacity: .55; }

.tree-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tree-name.is-child { padding-left: 12px; }
.tree-name-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tree-branch { flex: none; width: 12px; height: 16px; border-left: 1px solid #ccd5e0; border-bottom: 1px solid #ccd5e0; border-bottom-left-radius: 5px; margin: -10px 0 5px 2px; }
.tree-glyph { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 13px; }
.tree-glyph.daily { color: #9a6700; background: #fff4d6; }
.tree-glyph.evergreen { color: #6b4fbb; background: #efeafb; }
.tree-thumb { flex: none; width: 44px; height: 26px; border-radius: 4px; object-fit: cover; background: var(--media); }
.tree-thumb.is-blank { display: grid; place-items: center; color: #94a3b8; font-size: 12px; }
.tree-meta { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }
.tree-name + .tree-meta { padding-left: 55px; margin-top: -3px; }
.tree-meta.warn { color: var(--warn); }
.tree-range { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tree-seconds { display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; }

.tree-input { font: inherit; font-size: 13px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 5px 7px; color: var(--ink); min-height: 30px; }
.tree-input:hover:not(:disabled) { border-color: var(--line); background: var(--card); }
.tree-input:focus { outline: 2px solid var(--focus); border-color: var(--accent); background: var(--card); }
.tree-input:disabled { color: var(--muted); }
.tree-input.text { flex: 1; min-width: 0; font-weight: 600; text-overflow: ellipsis; }
.tree-row.is-child .tree-input.text { font-weight: 500; }
.tree-input.num { width: 62px; text-align: right; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.tree-input.num::-webkit-outer-spin-button, .tree-input.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tree-input.select, .tree-input.date { width: 100%; font-size: 12.5px; }

.tree-icon { font: inherit; font-size: 13px; line-height: 1; width: 26px; height: 26px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.tree-icon:hover:not(:disabled) { background: var(--chip); color: var(--ink); }
.tree-icon:disabled { opacity: .3; cursor: default; }
.tree-icon.danger:hover { background: #fde8e8; color: var(--bad); }
.tree-icon:focus-visible, .tree-where:focus-visible, .tree-add:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.tree-chevron { color: var(--ink); }
.tree-where { font: inherit; text-align: left; width: 100%; border: 1px solid transparent; border-radius: 6px; background: transparent; padding: 4px 7px; cursor: pointer; color: var(--ink); }
.tree-where:hover:not(:disabled) { border-color: var(--line); background: var(--card); }
.tree-where-main { display: block; font-size: 12.5px; overflow-wrap: anywhere; }
.tree-add { font: inherit; font-size: 12.5px; border: 1px dashed var(--line); background: var(--card); color: var(--muted); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.tree-add:hover { border-color: var(--accent); color: var(--accent); }

.tree-switch { display: inline-flex; align-items: center; cursor: pointer; }
.tree-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.tree-track { width: 34px; height: 19px; border-radius: 10px; background: #cbd5e1; position: relative; transition: background .15s; }
.tree-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .15s; }
.tree-switch input:checked + .tree-track { background: var(--ok); }
.tree-switch input:checked + .tree-track::after { transform: translateX(15px); }
.tree-switch input:focus-visible + .tree-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.tree-switch input:disabled + .tree-track { opacity: .45; }

.pill { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 9px; background: var(--chip); color: var(--muted); margin-left: 6px; }
.pill.warn { background: #fff4d6; color: var(--warn); }

/* ---- group dialogs ------------------------------------------------------- */
.ct-field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; font-size: 13px; }
.ct-field > span { color: var(--muted); }
.ct-input { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); width: 100%; }
.ct-input:focus { outline: 2px solid var(--focus); border-color: var(--accent); }
.ct-input.small { width: auto; min-width: 160px; padding: 4px 8px; font-size: 12.5px; }
.ct-check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.ct-check .tree-meta { margin-left: auto; text-align: right; }
.ct-hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; }
.chip-x { font: inherit; font-size: 11px; line-height: 1; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 0 0 2px; }
.gr-block { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 12px; margin: 0 0 12px; }
.gr-block legend { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 4px; }
.gr-block:disabled { opacity: .5; }
.gr-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gr-tags .chip { background: var(--chip); }
.gr-locations { max-height: 210px; overflow: auto; }
.gr-preview { font-size: 13px; color: var(--muted); background: var(--hover); border-radius: 6px; padding: 8px 10px; margin: 0 0 10px; }
.gr-preview.warn { background: #fff7e0; color: var(--warn); }
.gr-picker-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.gr-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.gr-pick { font: inherit; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.gr-pick img, .gr-pick-blank { width: 100%; height: 72px; border-radius: 5px; object-fit: cover; background: var(--media); display: grid; place-items: center; color: #94a3b8; }
.gr-pick-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-pick:hover:not(:disabled) { border-color: var(--accent); }
.gr-pick.is-chosen { border-color: var(--accent); box-shadow: 0 0 0 2px var(--chip-active); }
.gr-pick.is-in { opacity: .5; cursor: default; }

@media (max-width: 800px) {
  .tree-table .col-where, .tree-table .col-window, .tree-table .col-type { display: none; }
  .page-tabs { order: 3; flex-basis: 100%; margin-left: 0; }
}

/* ---- media campaigns (stage 5): the tree table and its dialog ------------ */
.cp-table .col-window { width: 132px; }
.cp-table .col-hours { width: 96px; }
.cp-table .col-num { width: 88px; }
.cp-table .col-where { width: 132px; }
.cp-table .col-state { width: 128px; text-align: left; }
.cp-table .col-actions { width: 44px; }
.cp-table .col-window .tree-meta { padding-left: 7px; }
.cp-table .tree-input.date { font-size: 12px; }
.cp-glyph { color: #1f6feb; background: #e4edfd; }
.cp-open { color: var(--muted); flex: none; }
.cp-state { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.cp-acts { display: flex; flex-wrap: wrap; gap: 4px; }
.cp-acts .btn { padding: 2px 8px; }
.cp-act-go { border-color: var(--accent); color: var(--accent); }
.cp-act-go:hover { background: var(--chip-active); }
.cp-variant-window { white-space: nowrap; }
.pill.ok { background: #dcf3e6; color: var(--ok); }
.pill.off { background: #e7e9ee; color: var(--muted); }

/* dialog: campaign details, variants, screens, allocated time */
dialog.cp-dialog { width: min(820px, calc(100vw - 32px)); }
.cp-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--muted); padding-bottom: 10px; }
.cp-facts .pill { margin-left: 0; }
.cp-fact { white-space: nowrap; }
.cp-fact + .cp-fact::before { content: "·"; margin-right: 8px; opacity: .6; }
.cp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.cp-form-grid .cp-span2 { grid-column: 1 / -1; }
.cp-form-grid .ct-field.is-locked > span { opacity: .6; }
.cp-dialog .ct-input:disabled { background: var(--hover); color: var(--muted); cursor: not-allowed; }
.cp-form-grid .ct-hint { margin: 3px 0 0; }
.cp-lock { font-size: 12.5px; background: #fff7e0; border: 1px solid #f0dda6; color: var(--warn); border-radius: 6px; padding: 6px 10px; margin: 0 0 10px; }

.cp-variants { display: flex; flex-direction: column; gap: 8px; }
.cp-variant { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--card); }
.cp-variant.is-off { background: var(--hover); }
.cp-variant.is-off .cp-variant-name, .cp-variant.is-off .cp-variant-title { color: var(--muted); }
.cp-variant-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cp-variant-head .tree-thumb { width: 52px; height: 30px; }
.cp-variant-name { flex: 1; min-width: 0; }
.cp-variant-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-variant-order { display: flex; align-items: center; gap: 4px; flex: none; }
.cp-variant-order .ct-input.small { width: 74px; min-width: 0; }
.cp-variant-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 0 12px; align-items: end; margin-top: 6px; }
.cp-variant-grid .ct-field { margin-bottom: 4px; }
.cp-variant > .tree-meta { padding-left: 60px; }
.cp-variant-switch { align-self: center; }
.cp-new-variants { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.cp-new-variant .cp-variant-order .tree-meta { display: inline; }

.cp-screen-picker { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.cp-screen-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cp-screen-head .ct-input.small { flex: 1 1 180px; }
.cp-screen-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.cp-screens { max-height: 240px; overflow: auto; }
.cp-screen { border-radius: 6px; padding: 3px 6px; }
.cp-screen:hover { background: var(--hover); }
.cp-screen.is-unfit { background: #fff7e0; }
.cp-screen > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cp-screen-summary { margin: 8px 0 0; }
.cp-unfit { white-space: nowrap; }

.cp-fit { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; background: var(--hover); margin-top: 10px; }
.cp-fit.is-ok { background: #eefaf1; border-color: #bfe6cb; }
.cp-fit.is-warn { background: #fff7e0; border-color: #f0dda6; }
.cp-fit-list { margin: 6px 0; padding-left: 18px; }
.cp-fit-list li { margin: 2px 0; }
.cp-fit-list li.warn { color: var(--warn); }

.cp-total { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.cp-total > div { background: var(--chip); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; }
.cp-total > div.is-warn { background: #fff4d6; }
.cp-total b { font-size: 19px; font-variant-numeric: tabular-nums; }
.cp-plan-block { margin-top: 12px; }
.cp-plan-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cp-plan-table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 5px 8px; border-bottom: 1px solid var(--line); }
.cp-plan-table td { padding: 4px 8px; border-bottom: 1px solid #eef1f5; }
.cp-plan-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cp-plan-table td.is-warn { color: var(--warn); font-weight: 600; }
.cp-plan-empty { margin-top: 0; }

@media (max-width: 900px) {
  .cp-table .col-hours { display: none; }
}
@media (max-width: 600px) {
  .cp-form-grid { grid-template-columns: 1fr; }
  .cp-facts { gap: 3px 6px; }
  .cp-screens { max-height: 200px; }
  .cp-total { grid-template-columns: 1fr 1fr; }
  .cp-variant-order .ct-input.small { width: 64px; }
}

/* ---- planning (stage 6): the occupancy map and „mai încape?” ------------- */
.pl-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.pl-field .ct-input.small { min-width: 132px; }
.pl-field-wide .ct-input.small { min-width: 190px; max-width: 260px; }
.pl-chips { min-height: 24px; }
.pl-ask { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 12px; margin-bottom: 14px; }
.pl-ask-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.pl-ask-head h2 { margin: 0; font-size: 15px; }
.pl-ask-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 0 12px; align-items: end; }
.pl-ask-grid .ct-field { margin-bottom: 6px; }
.pl-ask-go > span { visibility: hidden; }
.pl-ask-go .primary { width: 100%; padding: 7px 10px; }
.pl-fit-answer { margin-top: 6px; }

.pl-days { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 10px; }
.pl-days-label { margin-right: 2px; }
.pl-day { font-variant-numeric: tabular-nums; }
.pl-day b { font-weight: 600; }
.pl-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.pl-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.pl-swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid rgba(17, 24, 39, .1); }

.pl-grid-wrap { margin-bottom: 16px; }
.pl-grid { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 12px; }
.pl-grid thead th { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 4px 2px; }
.pl-grid tbody th { font-weight: 400; color: var(--ink); padding: 4px 2px; }
.pl-grid td { padding: 0; }
.pl-col-name { text-align: left; min-width: 168px; position: sticky; left: 0; background: var(--card); z-index: 1; padding-right: 8px; }
.pl-col-hour { width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.pl-col-total { width: 94px; padding-left: 6px; }
.pl-name { display: flex; flex-direction: column; min-width: 0; }
.pl-name-text { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.pl-cell-wrap { padding: 0; }
.pl-cell { display: block; width: 100%; min-width: 30px; height: 26px; border: 1px solid transparent; border-radius: 4px; font: inherit; font-size: 10.5px; font-variant-numeric: tabular-nums; cursor: pointer; padding: 0; }
.pl-cell:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.pl-lvl-0 { background: #f2f5f9; border-color: #e3e8ef; color: #97a2b0; }
.pl-lvl-1 { background: #dbe7fb; color: #1c2430; }
.pl-lvl-2 { background: #a9c8f6; color: #10243f; }
.pl-lvl-3 { background: #6ea3f0; color: #0b1c33; }
.pl-lvl-4 { background: #1f6feb; color: #fff; }
.pl-closed { background: repeating-linear-gradient(45deg, #e7e9ee, #e7e9ee 4px, #dfe3e9 4px, #dfe3e9 8px); color: #98a1ad; }
.pl-outside { background: transparent; color: #cdd5e0; cursor: default; line-height: 26px; text-align: center; }
.pl-has-shed { box-shadow: inset 0 0 0 2px var(--warn); }
.pl-total-bar { position: relative; display: block; height: 20px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.pl-total-bar i { position: absolute; top: 0; bottom: 0; left: 0; background: #a9c8f6; }
.pl-total-bar b { position: relative; display: block; text-align: center; font-size: 11px; line-height: 20px; font-variant-numeric: tabular-nums; }
.pl-hour-facts { padding-bottom: 6px; }
.pl-hour-bar { height: 10px; border-radius: 5px; background: var(--chip); overflow: hidden; margin: 0 0 6px; }
.pl-hour-bar i { display: block; height: 100%; background: var(--accent); }
.pl-hour-list { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.pl-hour-list li { background: var(--hover); border-radius: 6px; padding: 4px 8px; overflow-wrap: anywhere; }
.pl-hour-list li.warn { background: #fff7e0; color: var(--warn); }
.pl-empty-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 8px; }

/* ---- reports (stages 7-9): alocat vs realizat, and the day of one screen - */
.rp-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 0 12px; margin-bottom: 10px; }
.rp-filters .ct-field { margin-bottom: 8px; }
.rp-totals { margin-bottom: 12px; }
.rp-span { grid-column: 1 / -1; margin: 0; }
.rp-gran { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rp-table-wrap { margin-bottom: 12px; max-width: 940px; }
.rp-table { min-width: 640px; }
.rp-table .rp-cell-label { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-cell-bar { width: 150px; }
.rp-bar { position: relative; display: block; height: 18px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.rp-bar i { position: absolute; top: 0; bottom: 0; left: 0; background: #bfe6cb; }
.rp-bar.is-short i { background: #f6dfae; }
.rp-bar b { position: relative; display: block; text-align: center; font-size: 11px; line-height: 18px; font-variant-numeric: tabular-nums; }
.rp-row.is-shed td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.rp-exports { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.rp-reports h3 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rp-report-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rp-report { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--card); }
.rp-report.is-failed { background: #fff7e0; border-color: #f0dda6; }
.rp-report.is-failed .pill.warn { background: var(--card); box-shadow: inset 0 0 0 1px #e6ce92; }
.rp-report-main { display: flex; flex-direction: column; flex: 1 1 220px; min-width: 0; }
.rp-report-main .warn { color: var(--warn); }
.rp-report .pill { margin-left: 0; }
.rp-two { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.rp-col h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rp-log-head, .rp-program-head { margin: 0 0 8px; }
.rp-hour { border: 1px solid var(--line); border-radius: 8px; background: var(--card); margin-bottom: 8px; overflow: hidden; }
.rp-hour-head { display: flex; align-items: center; gap: 8px; padding: 5px 10px; background: var(--hover); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.rp-log-items { list-style: none; margin: 0; padding: 0; }
.rp-log-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 10px; font-size: 12.5px; }
.rp-log-item + .rp-log-item { border-top: 1px solid #f1f4f8; }
.rp-log-item.is-off { background: #fffaf0; }
.rp-log-clock { font-variant-numeric: tabular-nums; color: var(--muted); flex: none; }
.rp-log-name { font-weight: 600; flex: 1 1 130px; min-width: 0; overflow-wrap: anywhere; }
.rp-log-duration { flex: none; font-variant-numeric: tabular-nums; }
.rp-log-item .pill { margin-left: 0; }
.rp-hour-closed td { color: var(--muted); background: var(--hover); }
.rp-empty { min-height: 0; padding: 26px 18px; }

/* ---- administration (stage 8): people, rights, the bin, the machine ----- */
.adm-denied { max-width: 760px; margin: 0 auto; }
.adm-list { background: transparent; border: 0; border-radius: 0; overflow: visible; }
.adm-list .table-wrap { max-width: 1000px; }
.adm-notice { margin-bottom: 12px; }
.adm-inline-field { margin-bottom: 0; }
.adm-last-super-note { max-width: 1000px; margin: 8px 0 0; }
.adm-table { min-width: 640px; }
.adm-table th, .adm-table td { padding: 6px 10px; vertical-align: middle; }
.adm-cell-name { min-width: 150px; overflow-wrap: anywhere; }
.adm-cell-date { white-space: nowrap; }
.adm-cell-actions { white-space: nowrap; }
.adm-cell-actions .btn { margin-right: 4px; }
.adm-user.is-off .adm-username { color: var(--muted); }
.adm-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.adm-table .pill { margin-left: 0; margin-right: 4px; white-space: nowrap; }
.adm-group-picker, .adm-member-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 0 14px; max-height: 208px; overflow: auto; }
.adm-super-check { margin: 6px 0 2px; }
.adm-last-super { margin-top: 0; }

.adm-group { border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 8px 12px 10px; margin-bottom: 10px; }
.adm-group.is-open { box-shadow: var(--shadow); }
.adm-group-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.adm-group-head .tree-name-text { flex: 1; }
.adm-group h3 { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.adm-rights { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.adm-right { display: flex; align-items: center; gap: 8px; font-size: 13px; background: var(--hover); border-radius: 6px; padding: 4px 4px 4px 9px; }
.adm-right-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.adm-rights-compact { margin-top: 4px; }
.adm-rights-compact .adm-right { background: transparent; color: var(--muted); padding: 0 0 0 34px; font-size: 12.5px; }
.adm-right-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; align-items: end; margin-top: 10px; }
.adm-right-form .ct-field { margin-bottom: 6px; }
.adm-field-wide { grid-column: span 2; }
.adm-owner-check { align-self: center; }
.adm-right-go > span { visibility: hidden; }
.adm-right-go .btn { width: 100%; padding: 7px 10px; }
.adm-right-preview { margin: 4px 0 0; }

.adm-live { border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 8px 12px 10px; margin-bottom: 14px; }
.adm-live-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.adm-live-head .lc-dot { margin-right: 0; }
.adm-live-hint { margin-left: auto; }
.adm-live-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 168px; overflow: auto; font-size: 12.5px; }
.adm-live-item { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.adm-live-clock { font-variant-numeric: tabular-nums; color: var(--muted); flex: none; }
.adm-live-kind { flex: none; }
.adm-live-text { min-width: 0; overflow-wrap: anywhere; }

.adm-buttons { margin: 0 0 12px; }
.adm-result { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; background: var(--hover); font-size: 13px; }
.adm-result.is-ok { background: #eefaf1; border-color: #bfe6cb; }
.adm-result.is-warn { background: #fff7e0; border-color: #f0dda6; color: var(--warn); }
.adm-json { margin: 6px 0 0; max-height: 180px; overflow: auto; font: 12px ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-grid { align-items: start; }
.adm-card .ct-meta { margin-top: 0; }
.adm-card .pill { margin-left: 0; }
.adm-jobs-failed { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; }
.adm-jobs-failed li.warn { color: var(--warn); }
.ct-notice.adm-ok { background: #eefaf1; border-color: #bfe6cb; color: var(--ok); }

@media (max-width: 900px) {
  .rp-two { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .pl-ask-grid { grid-template-columns: 1fr 1fr; }
  .pl-col-name { min-width: 122px; }
  .pl-field .ct-input.small, .pl-field-wide .ct-input.small { min-width: 118px; }
  .rp-filters { grid-template-columns: 1fr; }
  .rp-cell-bar { width: 104px; }
  .adm-right-form { grid-template-columns: 1fr; }
  .adm-field-wide { grid-column: auto; }
  .adm-group-picker, .adm-member-picker { grid-template-columns: 1fr; }
  .adm-live-hint { display: none; }
}
