:root {
  --bg: #0b1220;
  --bg-elev: #121a2b;
  --bg-soft: #182033;
  --line: #243049;
  --text: #e8eef9;
  --muted: #93a0b8;
  --brand: #3b82f6;
  --brand-2: #60a5fa;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --urgent: #fb7185;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #1e3a8a44, transparent),
              radial-gradient(900px 500px at 100% 0%, #0ea5e933, transparent),
              var(--bg);
  color: var(--text);
}

a { color: var(--brand-2); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
.brand-logo {
  height: 42px;
  background: #fff;
  border-radius: 10px;
  padding: 4px 8px;
}
.login-logo {
  display: block;
  width: min(280px, 100%);
  margin: 0 auto 18px;
  background: #fff;
  border-radius: 16px;
  padding: 16px 18px;
}
.login-card h1 { text-align: center; }
.login-card .muted.center { text-align: center; margin-bottom: 8px; }
.sidebar .brand {
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 18px;
}
.sidebar .brand-logo {
  height: 54px;
  width: auto;
  max-width: 100%;
}
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0 0 8px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field span { font-size: 13px; color: var(--muted); }
input, select, textarea {
  background: #0d1524;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--brand);
  color: white;
  font-weight: 600;
}
.btn.secondary { background: #243049; color: var(--text); }
.btn.danger { background: #9f1239; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.ok { background: #047857; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100%; }
.sidebar {
  background: rgba(12, 18, 32, 0.92);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
}
.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 4px 0;
}
.nav-btn.active, .nav-btn:hover { background: #1d4ed833; color: white; }
.main { padding: 24px; overflow: auto; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.stat { font-size: 28px; font-weight: 700; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
}
.badge.open { background: #1d4ed855; color: #93c5fd; }
.badge.in_progress { background: #854d0e55; color: #fde68a; }
.badge.resolved { background: #065f4655; color: #6ee7b7; }
.badge.closed { background: #33415588; color: #cbd5e1; }
.badge.low { background: #164e6355; color: #67e8f9; }
.badge.medium { background: #1e3a8a55; color: #93c5fd; }
.badge.high { background: #9a341255; color: #fdba74; }
.badge.urgent { background: #9f123955; color: #fda4af; }
.badge.online { background: #065f4655; color: #6ee7b7; }
.badge.offline { background: #33415588; color: #94a3b8; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.error { color: var(--danger); font-size: 14px; margin: 8px 0; }
.success { color: var(--ok); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input, .filters select { min-width: 140px; }
.status-edit {
  min-width: 140px;
  padding: 6px 8px;
}
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.modal-bg {
  position: fixed; inset: 0; background: #020617aa;
  display: grid; place-items: center; padding: 16px; z-index: 20;
}
.modal {
  width: min(640px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 16px;
}
.shot { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--bg-soft); border-radius: 12px; padding: 10px 12px; }
.keybox { background: #0d1524; border: 1px dashed var(--line); border-radius: 10px; padding: 10px; word-break: break-all; }
.remote-wrap { padding: 12px; }
.display-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.display-bar .btn.active { background: var(--brand); color: #fff; }
#remote-canvas {
  width: 100%;
  max-height: calc(100vh - 180px);
  background: #000;
  border-radius: 12px;
  cursor: crosshair;
  outline: none;
}
.nav-count {
  margin-left: 8px;
  background: #dc2626;
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}
#toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  width: min(320px, 90vw);
  background: #0f172a;
  border: 1px solid #334155;
  border-left: 4px solid #3b82f6;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.toast-low { border-left-color: #22d3ee; }
.toast-medium { border-left-color: #3b82f6; }
.toast-high { border-left-color: #f59e0b; }
.toast-urgent { border-left-color: #ef4444; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; gap: 8px; overflow: auto; }
  .detail-grid { grid-template-columns: 1fr; }
}
