/* =====================================================================
   STREAM PANEL — dark "monitoring console" theme
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=IBM+Plex+Sans:wght@400;500;600&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg:        #070a0d;
  --bg-2:      #0d1117;
  --panel:     #1b212b;
  --panel-2:   #232b37;
  --line:      #323c4a;
  --line-2:    #3f4b5c;
  --text:      #eef2f7;
  --text-dim:  #a3b1c2;
  --text-mut:  #6b7888;
  --accent:    #38e08a;   /* signal green */
  --accent-2:  #19c977;
  --accent-dim:#0f3d2a;
  --info:      #4aa8ff;
  --warn:      #f5b53d;
  --danger:    #ff5d63;
  --danger-dim:#3a1417;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 8px 30px -10px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.02);
  --sidebar-w: 252px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --display: 'Sora', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(1200px 600px at 100% -10%, #11261c 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 0%, #16202c 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }

::selection { background: var(--accent); color: #04130b; }

/* ---------------- Auth (login) screen ---------------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 38px 34px; box-shadow: var(--shadow);
}
.auth-card .brand { display:flex; align-items:center; gap:11px; margin-bottom: 6px; }
.auth-card h1 { font-size: 22px; margin-top: 18px; }
.auth-card p.sub { color: var(--text-dim); margin-bottom: 26px; font-size: 13.5px; }

/* ---------------- Layout shell ---------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-2), #0a0c0f);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 22px; border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #04130b; font-weight: 800;
  font-family: var(--display); font-size: 17px;
  box-shadow: 0 0 0 1px rgba(56,224,138,.35), 0 6px 18px -6px var(--accent-2);
}
.brand-name { font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing:-.02em; }
.brand-name small { display:block; color: var(--text-mut); font-size: 10.5px; font-weight: 500; letter-spacing:.08em; text-transform: uppercase; font-family: var(--sans); }

.nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-mut); padding: 14px 12px 7px; font-weight: 600;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-dim);
  font-size: 14px; font-weight: 500; margin-bottom: 2px; transition: .15s;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active {
  background: linear-gradient(90deg, var(--accent-dim), transparent);
  color: var(--accent); box-shadow: inset 2px 0 0 var(--accent);
}
.nav a.active svg { opacity: 1; }

.sidebar-foot { padding: 14px; border-top: 1px solid var(--line); }
.user-chip { display:flex; align-items:center; gap:10px; padding: 8px; border-radius: var(--radius-sm); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink:0;
  background: var(--panel-2); border:1px solid var(--line-2);
  display:grid; place-items:center; font-family: var(--display); font-weight:700; font-size:13px; color: var(--accent);
}
.user-chip .u-name { font-size: 13px; font-weight: 600; }
.user-chip .u-role { font-size: 11px; color: var(--text-mut); }

/* ---------------- Main column ---------------- */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px; background: rgba(11,13,16,.78);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; }
.topbar .crumb { color: var(--text-mut); font-size: 12.5px; font-weight: 500; }
.topbar .spacer { flex: 1; }
.hamburger { display:none; background: var(--panel); border:1px solid var(--line); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor:pointer; align-items:center; justify-content:center; }

.content { padding: 26px; max-width: 1320px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); cursor: pointer; transition: .15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--text-mut); background: #20262f; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04130b; border-color: transparent; box-shadow: 0 6px 18px -8px var(--accent-2);
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-danger { color: var(--danger); border-color: var(--danger-dim); background: var(--danger-dim); }
.btn-danger:hover { background: #4a191d; border-color: var(--danger); color:#fff; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- Cards / panels ---------------- */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.015);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-head h2 { font-size: 15.5px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 18px; }
.grid-stats { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ---------------- Stat tiles ---------------- */
.stat {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px 18px; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.stat::before {
  content:''; position:absolute; left:0; top:0; right:0; height:3px;
  background: linear-gradient(90deg, var(--accent), transparent 60%); opacity:.7;
}
.stat::after {
  content:''; position:absolute; right:-30px; top:-30px; width: 120px; height: 120px;
  background: radial-gradient(circle, var(--accent-dim), transparent 70%); opacity:.45;
}
.stat .label { color: var(--text-dim); font-size: 12.5px; font-weight: 500; display:flex; align-items:center; gap:7px; }
.stat .label svg { width:15px; height:15px; color: var(--accent); }
.stat .value { font-family: var(--display); font-size: 30px; font-weight: 800; margin-top: 8px; letter-spacing:-.03em; }
.stat .delta { font-size: 12px; margin-top: 4px; font-family: var(--mono); }
.delta.up { color: var(--accent); }
.delta.down { color: var(--danger); }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; padding: 12px 16px; color: var(--text-mut);
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: .12s; }
table.tbl tbody tr:hover { background: var(--bg-2); }
.td-domain { font-weight: 600; }
.td-domain a { color: var(--text); }
.td-domain a:hover { color: var(--accent); }
.td-sub { color: var(--text-mut); font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text-dim);
}
.badge.dot::before { content:''; width:6px; height:6px; border-radius:50%; background: currentColor; }
.badge-green  { color: var(--accent); border-color: var(--accent-dim); background: rgba(56,224,138,.08); }
.badge-blue   { color: var(--info);   border-color: #173049; background: rgba(74,168,255,.08); }
.badge-amber  { color: var(--warn);   border-color: #3d3115; background: rgba(245,181,61,.08); }
.badge-red    { color: var(--danger); border-color: var(--danger-dim); background: rgba(255,93,99,.08); }
.badge-gray   { color: var(--text-mut); }
.pill-cat { text-transform: capitalize; }

/* ---------------- Forms ---------------- */
.field { margin-bottom: 16px; }
.field label { display:block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.field .hint { font-size: 11.5px; color: var(--text-mut); margin-top: 5px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=url], select, textarea {
  width: 100%; font-family: var(--sans); font-size: 14px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 10px 13px; transition: .15s; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,224,138,.13); background: var(--bg);
}
input::placeholder, textarea::placeholder { color: var(--text-mut); }
textarea { resize: vertical; min-height: 90px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2393a0b0'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.field-row { display:flex; gap: 14px; }
.field-row > * { flex: 1; }
.input-mono { font-family: var(--mono); font-size: 12.5px; }

/* checkbox / switch */
.check { display:flex; align-items:center; gap: 9px; cursor:pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 6px; flex-wrap: wrap; }
.tab-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; padding: 13px 16px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: .15s;
  display:flex; align-items:center; gap:8px;
}
.tab-btn svg { width:16px; height:16px; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------------- Toast / flash ---------------- */
.flash-stack { position: fixed; top: 18px; right: 18px; z-index: 100; display:flex; flex-direction:column; gap:10px; max-width: 360px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  padding: 13px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13.5px;
  display:flex; gap:10px; animation: slidein .25s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warn); }
@keyframes slidein { from { transform: translateX(20px); opacity:0;} to {transform:none; opacity:1;} }

/* ---------------- SEO score ring ---------------- */
.score-ring { position: relative; width: 96px; height: 96px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .num { position:absolute; inset:0; display:grid; place-items:center; font-family: var(--display); font-weight:800; font-size: 24px; }

.seo-issue { display:flex; gap:12px; padding: 12px 0; border-bottom:1px solid var(--line); align-items:flex-start; }
.seo-issue:last-child { border-bottom:none; }
.seo-ico { width:22px; height:22px; border-radius:6px; flex-shrink:0; display:grid; place-items:center; font-weight:800; font-size:13px; margin-top:1px; }
.seo-ico.critical { background: var(--danger-dim); color: var(--danger); }
.seo-ico.warning  { background: #3d3115; color: var(--warn); }
.seo-ico.good     { background: var(--accent-dim); color: var(--accent); }
.seo-issue .lbl { font-weight: 600; font-size: 13.5px; }
.seo-issue .det { color: var(--text-mut); font-size: 12.5px; }

/* ---------------- Misc ---------------- */
.empty { text-align:center; padding: 56px 20px; color: var(--text-mut); }
.empty svg { width: 46px; height: 46px; opacity:.4; margin-bottom: 14px; }
.empty h3 { color: var(--text-dim); margin-bottom: 6px; font-size: 16px; }
.page-actions { display:flex; gap:10px; align-items:center; margin-bottom: 18px; flex-wrap: wrap; }
.page-actions .spacer { flex: 1; }
.section-gap { margin-top: 22px; }
.log-box { background: #07090b; border:1px solid var(--line); border-radius: 10px; padding: 14px; font-family: var(--mono); font-size: 12px; line-height: 1.7; max-height: 320px; overflow:auto; }
.log-box .ok { color: var(--accent); } .log-box .error { color: var(--danger); }
.log-box .warning { color: var(--warn); } .log-box .info { color: var(--text-dim); }
.muted { color: var(--text-mut); }
.kbd { font-family: var(--mono); background: var(--panel-2); border:1px solid var(--line-2); border-radius:5px; padding:1px 6px; font-size:12px; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.flex { display:flex; align-items:center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* bar chart (pure CSS) */
.bars { display:flex; align-items:flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bars .bar { flex:1; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 5px 5px 0 0; min-height: 3px; position: relative; opacity:.85; transition:.2s; }
.bars .bar:hover { opacity:1; }
.bars .bar span { position:absolute; bottom:-20px; left:0; right:0; text-align:center; font-size:10px; color: var(--text-mut); }
.bars .bar em { position:absolute; top:-18px; left:0; right:0; text-align:center; font-size:10px; color: var(--text-dim); font-style:normal; font-family: var(--mono); opacity:0; transition:.2s; }
.bars .bar:hover em { opacity:1; }

/* ---------------- Responsive ---------------- */
.backdrop { display:none; }
@media (max-width: 1100px) { .grid-stats { grid-template-columns: repeat(2,1fr);} .grid-3{grid-template-columns:repeat(2,1fr);} }
@media (max-width: 920px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display:block; position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:45; }
  .main { margin-left: 0; }
  .hamburger { display:flex; }
  .content { padding: 18px; }
  .topbar { padding: 12px 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; gap: 0; }
}
@media (max-width: 560px) {
  .grid-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat .value { font-size: 24px; }
  table.tbl th:nth-child(n+4), table.tbl td:nth-child(n+4) { display: none; }
  .content { padding: 14px; }
}
