:root{
  --bg:#f6f8fc;
  --panel:#ffffff;
  --panel2:#fbfcff;
  --text:#0b1220;
  --muted:#64748b;
  --border:#e5e7eb;
  --shadow: 0 12px 30px rgba(2,6,23,.08);
  --shadow2: 0 8px 18px rgba(2,6,23,.06);
  --radius: 16px;
  --radius2: 12px;
  --accent:#2563eb;
  --accent2:#0ea5e9;
  --danger:#dc2626;
  --ok:#16a34a;
  --warn:#f59e0b;
  --focus: 0 0 0 4px rgba(37,99,235,.18);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
.hidden{ display:none !important; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
  background:
    radial-gradient(1100px 700px at 10% -10%, rgba(37,99,235,.18), transparent 55%),
    radial-gradient(900px 650px at 95% 0%, rgba(14,165,233,.12), transparent 55%),
    var(--bg);
}

a{ color:var(--accent); text-decoration:none; }
a:hover{ text-decoration:underline; }

/* Layout */
.appShell{ display:flex; min-height:100%; }
.sidebar{
  width: 270px;
  padding: 18px 16px;
  border-right:1px solid var(--border);
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(10px);
}
.brand{
  display:flex; align-items:center; gap:10px;
  padding: 10px 10px;
  border-radius: 14px;
}
.brandMark{
  width:38px; height:38px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(37,99,235,.95), rgba(14,165,233,.95));
  box-shadow: var(--shadow2);
}
.brandTitle{ font-weight: 800; letter-spacing:.2px; }
.brandSub{ font-size:12px; color:var(--muted); margin-top:2px; }

.nav{ margin-top: 14px; display:flex; flex-direction:column; gap:6px; }
.nav a{
  display:flex; align-items:center; gap:10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: #0b1220;
  border: 1px solid transparent;
}
.nav a:hover{ background: rgba(37,99,235,.06); border-color: rgba(37,99,235,.12); text-decoration:none; }
.nav .active{ background: rgba(37,99,235,.10); border-color: rgba(37,99,235,.18); }
.nav small{ color:var(--muted); }

.main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding: 14px 18px;
  border-bottom:1px solid var(--border);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(10px);
}
.topbar h1{ font-size: 16px; margin:0; }
.topbarRight{ display:flex; align-items:center; gap:10px; }

.page{ padding: 18px; max-width: 1180px; width: 100%; margin: 0 auto; }

.grid2{ display:grid; grid-template-columns: 1.05fr .95fr; gap: 14px; }
@media (max-width: 980px){
  .sidebar{ display:none; }
  .grid2{ grid-template-columns: 1fr; }
  .page{ padding: 14px; }
}

/* Cards + UI */
.card{
  background: rgba(255,255,255,.78);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.cardHeader{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.cardHeader h2{ margin:0; font-size: 16px; letter-spacing:.2px; }
.sub{ color:var(--muted); font-size:13px; line-height:1.45; margin-top:6px; }

.row{ display:flex; gap:10px; align-items:center; }
.row > *{ flex:1; }
.row.tight > *{ flex:0 0 auto; }
.stack{ display:flex; flex-direction:column; gap:10px; }
.sep{ height:1px; background: var(--border); margin: 14px 0; }

label{ display:block; color:var(--muted); font-size:13px; margin: 10px 0 6px; }
input, select, textarea{
  width:100%;
  padding: 11px 12px;
  border:1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.9);
  color: var(--text);
  outline:none;
  box-shadow: inset 0 0 0 1px transparent;
}
input:focus, select:focus, textarea:focus{ box-shadow: var(--focus); border-color: rgba(37,99,235,.35); }
textarea{ min-height: 92px; resize: vertical; }

.btn{
  appearance:none;
  border:1px solid var(--border);
  background: rgba(255,255,255,.92);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  cursor:pointer;
  box-shadow: var(--shadow2);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-weight:600;
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn.primary{ border-color: rgba(37,99,235,.35); background: rgba(37,99,235,.10); }
.btn.danger{ border-color: rgba(220,38,38,.35); background: rgba(220,38,38,.08); color: #991b1b; }
.btn.ghost{ box-shadow:none; background:transparent; }
.btn:disabled{ opacity:.55; cursor:not-allowed; transform:none; }
.btn.sm{ padding: 7px 10px; border-radius: 12px; font-weight:600; }

.pill{
  display:inline-flex; align-items:center; gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.7);
  color: var(--muted);
  font-size: 12px;
}
.pill.ok{ color:#14532d; border-color: rgba(22,163,74,.35); background: rgba(22,163,74,.08); }
.pill.warn{ color:#7c2d12; border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.10); }
.pill.bad{ color:#7f1d1d; border-color: rgba(220,38,38,.35); background: rgba(220,38,38,.08); }

table{ width:100%; border-collapse: separate; border-spacing: 0; overflow:hidden; border:1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.8); }
th, td{ padding: 11px 10px; border-bottom:1px solid var(--border); font-size: 13px; text-align:left; }
th{ color: var(--muted); font-weight:700; background: rgba(2,6,23,.02); }
tr:last-child td{ border-bottom:none; }
.actions{ display:flex; flex-wrap:wrap; gap:8px; }

.hint{ font-size:12px; color: var(--muted); }
code{ background: rgba(2,6,23,.06); padding: 2px 6px; border-radius: 8px; }
pre{ background: rgba(2,6,23,.04); border:1px solid var(--border); border-radius: 14px; padding: 12px; overflow:auto; }

/* Toast */
.toastHost{ position: fixed; right: 16px; bottom: 16px; display:flex; flex-direction:column; gap:10px; z-index: 999; }
.toast{
  width: min(420px, calc(100vw - 32px));
  background: rgba(255,255,255,.9);
  border:1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px 12px;
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
}
.toast.ok{ border-color: rgba(22,163,74,.35); }
.toast.warn{ border-color: rgba(245,158,11,.35); }
.toast.bad{ border-color: rgba(220,38,38,.35); }
.toastX{
  border:1px solid var(--border);
  background: rgba(2,6,23,.03);
  border-radius: 12px;
  width:34px; height:34px;
  cursor:pointer;
  font-size: 18px;
  line-height: 30px;
}
.toastX:hover{ background: rgba(2,6,23,.06); }
.toastTitle{ font-weight:800; font-size: 13px; }
.toastMsg{ font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Modal */
.modalOverlay{ position:fixed; inset:0; background: rgba(2,6,23,.45); display:flex; align-items:center; justify-content:center; padding: 18px; z-index: 1000; }
.modal{ width: min(560px, 100%); background: rgba(255,255,255,.94); border:1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; }
.modalHeader{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.modalTitle{ font-weight: 800; font-size: 16px; }
.modalBody{ margin-top: 10px; }
.modalFooter{ display:flex; gap:10px; justify-content:flex-end; margin-top: 14px; }

/* Live view */
.tiles{ display:grid; gap:12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px){ .tiles{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px){ .tiles{ grid-template-columns: 1fr; } }
.tile{
  border:1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
  background: rgba(255,255,255,.8);
  box-shadow: var(--shadow);
  cursor:pointer;
}
.tileTop{ display:flex; justify-content:space-between; align-items:center; padding: 10px 12px; border-bottom:1px solid var(--border); }
.tile video{ width:100%; height: 220px; background:#000; display:block; object-fit:cover; }
.tile:hover{ border-color: rgba(37,99,235,.35); }

.kbd{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono"; font-size:12px; padding: 2px 6px; border:1px solid var(--border); border-bottom-width: 2px; border-radius: 10px; background: rgba(255,255,255,.9); }
