@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url(../fonts/sans-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url(../fonts/sans-latin-ext-400.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap; src: url(../fonts/sans-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap; src: url(../fonts/sans-latin-ext-500.woff2) format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url(../fonts/sans-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url(../fonts/sans-latin-ext-600.woff2) format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF; }
@font-face { font-family: "PlexMono"; font-weight: 400; font-display: swap; src: url(../fonts/mono-latin-400.woff2) format("woff2"); }

:root {
  --bg: #0a0c0f;
  --panel: #111419;
  --panel-2: #171b21;
  --panel-3: #1e232b;
  --line: #252b34;
  --line-2: #323a45;
  --text: #e4e7eb;
  --muted: #8a929d;
  --faint: #5d6570;
  --accent: #6aa9d8;
  --accent-ink: #0a0c0f;
  --rec: #e5484d;
  --ok: #46a758;
  --warn: #d6a243;
  --radius: 6px;
  --bar: 48px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --mono: "PlexMono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #root { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 "Plex", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Bara de sus ---------- */
.topbar {
  height: var(--bar);
  display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s4);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: var(--s2); white-space: nowrap; }
.brand i { width: 8px; height: 8px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 0 3px rgb(229 72 77 / .18); }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav a {
  color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: var(--radius);
  white-space: nowrap; transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a.on { color: var(--text); background: var(--panel-3); }
.clock { color: var(--muted); font-size: 13px; white-space: nowrap; }
.who { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: 13px; white-space: nowrap; }

main { height: calc(100% - var(--bar)); overflow: auto; }
.page { padding: var(--s5); max-width: 1280px; margin: 0 auto; }
.page h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 var(--s4); }
.page h2 { font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: var(--s5) 0 var(--s3); }

/* ---------- Controale ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  background: var(--panel-3); border: 1px solid var(--line-2); border-radius: var(--radius);
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: #262c35; border-color: #3d4652; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn.primary:hover { background: #82b8e0; }
.btn.danger { color: #ff8a8d; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  height: 32px; padding: 0 10px; width: 100%;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius);
}
textarea { height: 64px; padding: 8px 10px; resize: vertical; }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.form { display: grid; gap: var(--s3); grid-template-columns: 1fr; }
@media (min-width: 720px) { .form.two { grid-template-columns: 1fr 1fr; } .form .full { grid-column: 1 / -1; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: var(--s4); }
.cards { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 22px; font-weight: 500; margin-top: 4px; letter-spacing: -0.01em; }
.stat .s { color: var(--muted); font-size: 13px; }
.bar { height: 6px; background: var(--panel-3); border-radius: 3px; overflow: hidden; margin-top: var(--s3); display: flex; }
.bar > span { display: block; height: 100%; }

table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px; border-bottom: 1px solid var(--line); }
.t td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:hover td { background: var(--panel); }
.tablewrap { overflow-x: auto; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel-3); color: var(--muted); white-space: nowrap; }
.pill.rec { color: #ff9a9c; background: rgb(229 72 77 / .12); }
.pill.rec::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--rec); animation: pulse 2s infinite; }
.pill.err { color: var(--warn); background: rgb(214 162 67 / .12); }
.pill.ok { color: #7fd08e; background: rgb(70 167 88 / .12); }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pill.rec::before { animation: none; } }

/* ---------- Toast + modal ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--panel-3); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: var(--radius); max-width: 360px; box-shadow: 0 8px 24px rgb(0 0 0 / .4); }
.toast.err { border-left-color: var(--rec); }
.modal-bg { position: fixed; inset: 0; background: rgb(0 0 0 / .6); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal .body { padding: var(--s5); }
.modal footer { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s4) var(--s5); border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }

/* ---------- Login ---------- */
.login { height: 100%; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); display: grid; gap: var(--s3); }
.login h1 { font-size: 22px; font-weight: 600; margin: 0 0 var(--s2); display: flex; align-items: center; gap: 10px; letter-spacing: -0.01em; }
.login .err { color: #ff8a8d; font-size: 13px; min-height: 20px; }

/* ---------- Live ---------- */
.live { height: 100%; display: flex; flex-direction: column; }
.toolbar { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 160px; }
.live-body { flex: 1; display: flex; min-height: 0; }
.grid { flex: 1; display: grid; gap: 2px; background: #000; min-height: 0; }
.tile { position: relative; background: #050607; overflow: hidden; min-height: 0; min-width: 0; outline: 1px solid #0d0f12; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: 12px; display: flex; align-items: center; gap: 6px;
  background: linear-gradient(transparent, rgb(0 0 0 / .7)); pointer-events: none; }
.tile .cap i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.tile .cap i.rec { background: var(--rec); }
.tile .cap i.err { background: var(--warn); }
.tile .msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 12px; text-align: center; padding: 8px; pointer-events: none; }
.tile.empty { display: grid; place-items: center; color: var(--faint); font-size: 12px; }
.tile.sel { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; }
.tile.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.tile .x { position: absolute; top: 6px; right: 6px; z-index: 2; }
.single { position: absolute; inset: 0; z-index: 5; background: #000; }
.single .tile { position: absolute; inset: 0; touch-action: none; }
.single .tile.zoomed { cursor: grab; }
.single .tile.zoomed:active { cursor: grabbing; }
.single .tile.zoomed .cap { display: none; }
.single .back { position: absolute; top: 10px; left: 10px; z-index: 6; display: flex; gap: 8px; }

.editor { width: 280px; border-left: 1px solid var(--line); background: var(--panel); overflow: auto; padding: var(--s3); display: grid; gap: var(--s3); align-content: start; }
.camlist { display: grid; gap: 4px; }
.camlist .ci { padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); cursor: grab; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.camlist .ci:hover { border-color: var(--line-2); }
.camlist .ci.used { opacity: .5; }
@media (max-width: 760px) {
  .live-body { flex-direction: column; }
  .editor { width: auto; border-left: 0; border-top: 1px solid var(--line); max-height: 45%; }
  .grid.mobile { grid-template-columns: 1fr 1fr !important; grid-auto-rows: calc((100vw - 2px) / 2 * 9 / 16); grid-template-rows: none !important; overflow: auto; align-content: start; }
}

/* ---------- Playback ---------- */
.pb { height: 100%; display: flex; flex-direction: column; }
.pb-grid { flex: 1; display: grid; gap: 2px; background: #000; min-height: 0; }
.pb-grid .tile video { object-fit: contain; }
.pb-ctl { background: var(--panel); border-top: 1px solid var(--line); padding: var(--s2) var(--s3) var(--s3); display: grid; gap: var(--s2); }
.timeline { position: relative; user-select: none; cursor: pointer; touch-action: none; }
.tl-axis { position: relative; height: 18px; font-size: 11px; color: var(--faint); }
.tl-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 8px; height: 18px; }
.tl-row .nm { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; height: 10px; background: var(--panel-3); border-radius: 2px; overflow: hidden; }
.tl-track b { position: absolute; top: 0; bottom: 0; background: #3f6f93; }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); pointer-events: none; }
.tl-sel { position: absolute; top: 0; bottom: 0; background: rgb(106 169 216 / .15); border-left: 1px solid var(--accent); border-right: 1px solid var(--accent); pointer-events: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; font-size: 13px; color: var(--muted); }
.chip.on { background: rgb(106 169 216 / .15); border-color: var(--accent); color: var(--text); }
.now { font-size: 15px; min-width: 150px; }

@media (max-width: 760px) {
  .page { padding: var(--s4); }
  .topbar { gap: var(--s2); padding: 0 var(--s2); }
  .clock, .who span { display: none; }
  .tl-row { grid-template-columns: 70px 1fr; }
}
@media (max-width: 760px) { .desk { display: none !important; } .toolbar select { min-width: 0; flex: 1; } }
a.btn { text-decoration: none; }

/* ---------- v0.3: ecran complet, meniu hamburger, tab-uri, afisare ---------- */
.ico { width: 18px; height: 18px; display: block; }
.icon-btn { width: 34px; padding: 0; justify-content: center; margin-left: auto; }
body.fs .topbar { display: none; }
body.fs main { height: 100%; }
.fs-burger {
  display: none; position: fixed; right: 10px; bottom: 10px; z-index: 30;
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid rgb(255 255 255 / .15);
  background: rgb(10 12 15 / .45); color: rgb(255 255 255 / .75); cursor: pointer;
  align-items: center; justify-content: center; opacity: .45; transition: opacity .2s, background .2s;
}
.fs-burger:hover, .fs-burger:focus-visible { opacity: 1; background: rgb(10 12 15 / .85); }
body.fs .fs-burger { display: flex; }
.fs-menu {
  position: fixed; right: 10px; bottom: 56px; z-index: 31; min-width: 220px;
  background: rgb(17 20 25 / .96); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px;
  display: grid; box-shadow: 0 12px 32px rgb(0 0 0 / .5);
}
.fs-menu a { color: var(--text); text-decoration: none; padding: 9px 12px; border-radius: 6px; }
.fs-menu a:hover, .fs-menu a.on { background: var(--panel-3); }

.live-body { height: 100%; }
.grid.fit-fill .tile video, .single.fit-fill video { object-fit: fill; }
.grid.fit-contain .tile video, .single.fit-contain video { object-fit: contain; }
.grid.fit-cover .tile video, .single.fit-cover video { object-fit: cover; }
.tile .snap { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }

/* tab-uri tip dosar */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); margin-bottom: var(--s5); overflow-x: auto; scrollbar-width: none; }
.tab {
  padding: 9px 16px; color: var(--muted); text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; margin-bottom: -1px;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); background: var(--panel); }
.tab.on { color: var(--text); background: var(--panel); border-color: var(--line-2); border-bottom: 1px solid var(--panel); }

/* tabele: maxim ~10 randuri vizibile, restul cu derulare */
.scroll10 { max-height: 470px; overflow: auto; }
.scroll10 thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }

/* editor matrice */
.matrix-wrap { display: flex; gap: var(--s3); align-items: flex-start; }
.matrix-stage { flex: 1; min-width: 0; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.matrix-stage .grid { height: 100%; }
.matrix-wrap .editor { border: 1px solid var(--line); border-radius: 6px; max-height: 70vh; }
.matrix-grid .tile.empty span { color: var(--faint); font-size: 12px; }
@media (max-width: 900px) { .matrix-wrap { flex-direction: column; } .matrix-wrap .editor { width: 100%; } }

/* controale player pe ecran complet (Inregistrari) */
.pctl { display: none; position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 28px 16px 12px;
  background: linear-gradient(transparent, rgb(0 0 0 / .8)); opacity: 0; transition: opacity .25s; }
.tile:fullscreen .pctl { display: block; }
.tile:fullscreen.awake .pctl, .tile:fullscreen .pctl:hover { opacity: 1; }
.tile:fullscreen .cap { display: none; }
.tile:fullscreen video { object-fit: contain; }
.prow { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.pbtn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .12); color: #fff; cursor: pointer; display: grid; place-items: center; }
.pbtn:hover { background: rgb(255 255 255 / .25); }
.ptime { color: #fff; font-size: 15px; }
.pname { color: rgb(255 255 255 / .7); font-size: 13px; }
.pspeed { width: auto; height: 30px; background: rgb(0 0 0 / .5); border-color: rgb(255 255 255 / .25); }
.pbar { position: relative; height: 8px; background: rgb(255 255 255 / .15); border-radius: 4px; cursor: pointer; overflow: hidden; }
.pbar b { position: absolute; top: 0; bottom: 0; background: rgb(106 169 216 / .7); }
.pbar i { position: absolute; top: -2px; bottom: -2px; width: 3px; background: #fff; transform: translateX(-1px); }

/* miniatura pe linia de timp */
.thumb-tip { position: fixed; z-index: 60; width: 320px; background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 4px; pointer-events: none; box-shadow: 0 10px 28px rgb(0 0 0 / .5); }
.thumb-tip img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: fill; background: #000; border-radius: 4px; }
.thumb-tip div { font-size: 12px; color: var(--muted); padding: 4px 2px 0; }
.name-row { display: flex; gap: 8px; align-items: center; }
.name-row input[type=text] { flex: 1; }
.name-chk { display: inline-flex; align-items: center; cursor: pointer; padding: 0 4px; }
.cam-preview { position: relative; aspect-ratio: 16 / 9; max-height: 340px; width: 100%; margin: 0 auto var(--s4); background: #000; border-radius: 6px; overflow: hidden; }
.cam-preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam-preview.off { display: grid; place-items: center; aspect-ratio: auto; height: 80px; color: var(--faint); font-size: 13px; }
.cam-preview .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 6px; font-size: 12px; background: linear-gradient(transparent, rgb(0 0 0 / .7)); pointer-events: none; }
.srow { display: flex; align-items: center; gap: 6px; }
.recdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.recdot.on { background: var(--rec); box-shadow: 0 0 0 2px rgb(229 72 77 / .2); }
