/* ═══════════════════════════════════════
   SaskHost — Dark Indigo Theme
   ═══════════════════════════════════════ */

:root {
  --bg:      #07090f;
  --bg2:     #0d1117;
  --bg3:     #13192a;
  --bg4:     #1a2235;
  --border:  #1e2d45;
  --bd2:     #263650;
  --accent:  #6366f1;
  --accent2: #818cf8;
  --teal:    #14b8a6;
  --green:   #22c55e;
  --yellow:  #eab308;
  --red:     #ef4444;
  --orange:  #f97316;
  --blue:    #3b82f6;
  --pink:    #ec4899;
  --text:    #e2e8f0;
  --muted:   #4a6080;
  --muted2:  #7a93b0;
  --font:    'Nunito', system-ui, -apple-system, sans-serif;
  --mono:    'IBM Plex Mono', 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  display: flex;
  flex-direction: column;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── LOGIN SCREEN ── */
.login-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.login-screen.hide { display: none; }
.login-grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,.04) 1px, transparent 1px);
  background-size: 40px 40px;
}
.login-box {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--bd2);
  border-radius: 20px;
  padding: 40px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 0 80px rgba(99,102,241,.1);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { font-size: 44px; display: block; margin-bottom: 8px; }
.login-logo-name { font-size: 24px; font-weight: 900; letter-spacing: -0.5px; }
.login-logo-name span { color: var(--accent); }
.login-sub { font-size: 12px; color: var(--muted2); font-family: var(--mono); margin-top: 2px; }

.login-tabs { display: flex; background: var(--bg3); border-radius: 10px; padding: 4px; margin-bottom: 24px; gap: 4px; }
.ltab { flex: 1; text-align: center; padding: 8px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted2); transition: all .2s; }
.ltab.active { background: var(--accent); color: #fff; }

.lform { display: none; }
.lform.show { display: block; }

.lfield { margin-bottom: 14px; }
.lfield label { display: block; font-size: 11px; font-family: var(--mono); color: var(--muted2); letter-spacing: 1px; margin-bottom: 5px; text-transform: uppercase; }
.lfield input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 11px 14px; color: var(--text);
  font-family: var(--mono); font-size: 13px; outline: none;
  transition: border-color .2s;
}
.lfield input:focus { border-color: var(--accent); }

.lbtn {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-family: var(--font);
  font-weight: 800; font-size: 14px; cursor: pointer;
  transition: all .2s; margin-top: 4px;
}
.lbtn:hover { background: #4f46e5; transform: translateY(-1px); }

.login-error {
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
  color: var(--red); padding: 10px; border-radius: 8px; font-size: 12px;
  text-align: center; margin-bottom: 14px; display: none;
}
.login-error.show { display: block; }

.demo-hint {
  text-align: center; margin-top: 16px;
  font-size: 11px; font-family: var(--mono); color: var(--muted);
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px;
}
.demo-hint span { color: var(--teal); }

/* ── APP SHELL ── */
.app { display: flex; height: 100vh; overflow: hidden; }
.app.hide { display: none; }

/* ── SIDEBAR ── */
.sidebar {
  width: 230px; min-width: 230px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sb-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sb-logo { font-size: 22px; }
.sb-name { font-size: 16px; font-weight: 900; letter-spacing: -.3px; }
.sb-name span { color: var(--accent); }
.sb-role {
  font-size: 9px; font-family: var(--mono);
  padding: 2px 7px; border-radius: 4px; margin-left: auto;
  font-weight: 700;
}
.role-admin { background: rgba(99,102,241,.2); color: var(--accent); }
.role-client { background: rgba(20,184,166,.2); color: var(--teal); }

.sb-user {
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sb-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; flex-shrink: 0;
}
.av-admin { background: rgba(99,102,241,.2); color: var(--accent); }
.av-client { background: rgba(20,184,166,.2); color: var(--teal); }
.sb-uname { font-size: 13px; font-weight: 700; }
.sb-uemail { font-size: 10px; color: var(--muted2); font-family: var(--mono); }

.sb-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.sb-section { font-size: 9px; font-family: var(--mono); letter-spacing: 2px; color: var(--muted); padding: 12px 20px 4px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--muted2);
  border-left: 2px solid transparent;
  transition: all .15s;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.03); }
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(99,102,241,.06); }
.nav-ico { font-size: 16px; width: 20px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 9px; padding: 1px 6px; border-radius: 10px; font-family: var(--mono); font-weight: 700; }
.nav-badge.green { background: var(--green); }

.sb-bottom { border-top: 1px solid var(--border); padding: 12px 20px; }
.sb-logout {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: var(--muted2);
  cursor: pointer; padding: 8px; border-radius: 8px;
  transition: all .2s;
}
.sb-logout:hover { color: var(--red); background: rgba(239,68,68,.08); }

/* ── TOPBAR ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 50px; min-height: 50px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 22px; gap: 14px;
}
.tb-title { font-size: 15px; font-weight: 800; }
.tb-sub { font-size: 10px; font-family: var(--mono); color: var(--muted2); }
.tb-spacer { flex: 1; }
.tb-btn {
  padding: 7px 14px; border-radius: 8px; font-family: var(--font);
  font-weight: 700; font-size: 12px; cursor: pointer; border: none;
  transition: all .2s; display: inline-flex; align-items: center; gap: 5px;
}
.tb-btn:hover { transform: translateY(-1px); }
.tbb-primary { background: var(--accent); color: #fff; }
.tbb-ghost { background: transparent; color: var(--muted2); border: 1px solid var(--border); }
.tbb-ghost:hover { color: var(--text); }

/* ── CONTENT ── */
.content { flex: 1; overflow-y: auto; padding: 22px; }

/* ── SECTIONS ── */
.sec { display: none; }
.sec.show { display: block; }

/* ── STAT CARDS ── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; position: relative; overflow: hidden;
  transition: transform .2s, border-color .2s; cursor: default;
}
.stat:hover { transform: translateY(-2px); border-color: var(--bd2); }
.stat-stripe { position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.stat-lbl { font-size: 10px; font-family: var(--mono); color: var(--muted2); letter-spacing: 1px; text-transform: uppercase; }
.stat-val { font-size: 28px; font-weight: 900; margin: 6px 0 3px; line-height: 1; }
.stat-sub { font-size: 11px; font-family: var(--mono); color: var(--muted2); }
.stat-ico { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 28px; opacity: .12; }

/* ── CARD ── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.card-t { font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.card-b { padding: 16px 18px; }

/* ── GRID ── */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.gauto { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* ── BADGE ── */
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-family: var(--mono); font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.b-green { background: rgba(34,197,94,.12); color: var(--green); }
.b-red { background: rgba(239,68,68,.12); color: var(--red); }
.b-yellow { background: rgba(234,179,8,.12); color: var(--yellow); }
.b-blue { background: rgba(59,130,246,.12); color: var(--blue); }
.b-purple { background: rgba(99,102,241,.12); color: var(--accent); }
.b-teal { background: rgba(20,184,166,.12); color: var(--teal); }
.b-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ── BUTTON ── */
.btn {
  padding: 7px 14px; border: none; border-radius: 8px; font-family: var(--font);
  font-weight: 700; font-size: 12px; cursor: pointer; transition: all .2s;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: transparent; color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn-red:hover { background: rgba(239,68,68,.1); }
.btn-ghost { background: transparent; color: var(--muted2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--bd2); }
.btn-sm { padding: 5px 10px; font-size: 11px; }

/* ── FORM ── */
.fg { margin-bottom: 14px; }
.fl { display: block; font-size: 10px; font-family: var(--mono); color: var(--muted2); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
.fi, .fsel, .fta {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; color: var(--text);
  font-family: var(--mono); font-size: 12px; outline: none;
  transition: border-color .2s;
}
.fi:focus, .fsel:focus, .fta:focus { border-color: var(--accent); }
.fsel { cursor: pointer; }
.fta { resize: vertical; min-height: 80px; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── TABLE ── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-size: 10px; font-family: var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 1px; padding: 0 0 10px; text-align: left; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px 0; font-size: 12px; border-bottom: 1px solid rgba(30,45,69,.5); vertical-align: middle; }
.tbl tr:last-child td { border: none; }
.tbl tr:hover td { background: rgba(255,255,255,.015); }

/* ── RESOURCE BAR ── */
.rbar { margin-bottom: 10px; }
.rbar-top { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 11px; }
.rbar-lbl { font-family: var(--mono); color: var(--muted2); }
.rbar-val { font-family: var(--mono); font-weight: 700; }
.track { height: 5px; background: var(--bg4); border-radius: 3px; overflow: hidden; }
.fill { height: 100%; border-radius: 3px; transition: width 1s ease; }
.f-purple { background: linear-gradient(90deg, #4338ca, var(--accent)); }
.f-teal { background: linear-gradient(90deg, #0f766e, var(--teal)); }
.f-green { background: linear-gradient(90deg, #15803d, var(--green)); }
.f-yellow { background: linear-gradient(90deg, #a16207, var(--yellow)); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  backdrop-filter: blur(6px); z-index: 200;
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--bd2);
  border-radius: 16px; padding: 26px; width: 520px;
  max-width: 95vw; max-height: 90vh; overflow-y: auto;
  animation: mIn .25s ease;
}
@keyframes mIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.m-title { font-size: 16px; font-weight: 900; margin-bottom: 20px; }
.m-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── TOAST ── */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; min-width: 280px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  animation: toastIn .3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.toast.success { border-color: rgba(34,197,94,.4); }
.toast.error { border-color: rgba(239,68,68,.4); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* ── LOADING ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-full {
  display: flex; align-items: center; justify-content: center;
  height: 200px; color: var(--muted2); font-size: 13px;
  flex-direction: column; gap: 12px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .f2 { grid-template-columns: 1fr; }
}

/* ═══════ TABS ═══════ */
.tab-bar { display:flex; gap:0; border-bottom:2px solid var(--bg3); margin-bottom:18px; overflow-x:auto; }
.tab-item { padding:10px 18px; font-size:12px; font-weight:700; cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-2px; color:var(--muted2); white-space:nowrap; transition:all .2s; }
.tab-item.active { color:var(--accent); border-bottom-color:var(--accent); }
.tab-item:hover { color:var(--text); }

/* ═══════ MODAL ═══════ */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.65); z-index:100; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(4px); animation:fadeIn .2s; }
.modal-box { background:var(--bg2); border:1px solid var(--border); border-radius:12px; padding:24px; max-width:500px; width:calc(100% - 32px); animation:slideUp .25s; max-height:85vh; overflow-y:auto; }
.modal-title { font-size:16px; font-weight:800; margin-bottom:16px; }
.modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:18px; }
@keyframes fadeIn { from{opacity:0}to{opacity:1} }
@keyframes slideUp { from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)} }

/* ═══════ FILE BROWSER ═══════ */
.file-row { display:flex; align-items:center; gap:10px; padding:8px 12px; border-bottom:1px solid rgba(30,45,69,.3); cursor:pointer; transition:background .15s; }
.file-row:hover { background:var(--bg3); }
.file-ico { font-size:16px; width:24px; text-align:center; flex-shrink:0; }
.file-name { flex:1; font-size:12px; font-family:var(--mono); overflow:hidden; text-overflow:ellipsis; }
.file-size { font-size:10px; font-family:var(--mono); color:var(--muted2); width:60px; text-align:right; }
.file-date { font-size:10px; font-family:var(--mono); color:var(--muted2); width:100px; }
.file-actions { display:flex; gap:4px; }
.file-editor { width:100%; min-height:400px; background:var(--bg3); color:var(--text); border:1px solid var(--border); border-radius:8px; font-family:var(--mono); font-size:12px; padding:12px; resize:vertical; line-height:1.6; tab-size:4; }
.breadcrumb { font-size:11px; font-family:var(--mono); color:var(--muted2); margin-bottom:12px; display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.breadcrumb a { color:var(--accent); cursor:pointer; }
.breadcrumb a:hover { text-decoration:underline; }

/* ═══════ STATUS DOT ═══════ */
.ssl-ok { color:var(--green); }
.ssl-no { color:var(--yellow); }
