:root{
  --bg:#0f1220;
  --panel:#171a2b;
  --panel-2:#1e2237;
  --text:#e9ecf1;
  --muted:#a9b3c9;
  --brand:#6c9cff;
  --brand-2:#5a82e6;
  --danger:#ff5c7a;
  --warn:#f6c044;
  --success:#2ecc71;
  --border:#2a2f47;
  --shadow:0 10px 30px rgba(0,0,0,.35);

  /* extras */
  --ring:0 0 0 2px rgba(108,156,255,.25);
}

*{box-sizing:border-box}
html,body{height:100%;min-height:100%}
body{
  margin:0;
  background:
    radial-gradient(1200px 800px at 10% -10%, #1b1f33 0%, #0e111d 60%, #0b0e18 100%);
  background-attachment: fixed;
  color:var(--text);
  font:15px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
}

/* ===== Nav/Header ===== */
.nav{
  position:sticky; top:0; z-index:50;
  backdrop-filter: blur(10px);
  background: rgba(15,18,32,.78);
  border-bottom:1px solid var(--border);
}
.nav-inner{
  max-width:1120px; margin:0 auto; padding:12px 16px;
  display:flex; align-items:center; gap:16px; justify-content:space-between;
}
.brand{
  display:flex; align-items:center; gap:10px; text-decoration:none; color:var(--text);
}
.brand h1{font-size:18px; margin:0; letter-spacing:.3px; white-space:nowrap}

/* Single-outline, bigger site logo (works for <img class="logo">) */
.brand .logo{
  height:44px; width:auto; display:block;
  border:0; outline:0; box-shadow:none; background:transparent;
  border-radius:12px; /* keeps rounded corners without extra ring */
}
@media (max-width:700px){
  .brand .logo{ height:36px; border-radius:10px }
}

/* Nav links */
.nav-links{display:flex; flex-wrap:wrap; gap:4px}
.nav-links a{
  color:var(--muted); text-decoration:none; padding:8px 10px; border-radius:10px;
}
.nav-links a.active,
.nav-links a:hover{ background:var(--panel); color:var(--text) }

/* Optional hamburger support (hidden by default; show if you inject a toggle) */
.nav-toggle{display:none}
@media (max-width:900px){
  .nav-inner{ gap:10px }
  .nav-links{ display:none } /* let your JS open a drawer/menu */
}

/* ===== Layout ===== */
.container{ max-width:1120px; margin:0 auto; padding:24px 16px }
.page-title{ font-size:28px; margin:16px 0 20px }

/* Cards & grid */
.grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap:16px;
}
.card{
  background:linear-gradient(180deg, var(--panel), var(--panel-2));
  border:1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius:16px; padding:18px;
}
.card h2{ margin:0 0 12px; font-size:16px; color:#dbe4ff; letter-spacing:.3px }

/* KPIs */
.kpi{ font-size:30px; font-weight:800; margin-top:4px }

/* Tables */
.table{
  width:100%; border-collapse:separate; border-spacing:0;
  overflow:hidden; border:1px solid var(--border);
  border-radius:12px; box-shadow: var(--shadow);
}
.table th, .table td{
  text-align:left; padding:12px 14px; border-bottom:1px solid var(--border); color: var(--text);
}
.table thead th{
  background:#121528; color:#9fb4ff; text-transform:uppercase; font-size:12px; letter-spacing:.6px
}
.table tbody tr:hover{ background: rgba(255,255,255,.02) }

/* Badges */
.badge{ padding:4px 8px; border-radius:999px; font-weight:700; font-size:12px }
.badge.success{ background: rgba(46,204,113,.15); color:#86f7b8 }
.badge.danger{  background: rgba(255,92,122,.15); color:#ffb1c0 }
.badge.warn{    background: rgba(246,192,68,.15); color:#ffe3a6 }

/* Buttons */
.btn, .btn-primary, .btn-danger{
  appearance:none; border:0; padding:10px 14px; border-radius:12px; cursor:pointer;
  color:#fff; font-weight:800; letter-spacing:.3px;
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease, filter .2s ease;
  background: var(--panel-2);
  border:1px solid var(--border);
}
.btn:hover{ transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0,0,0,.35); filter:brightness(1.04) }
.btn:active{ transform: translateY(0); box-shadow:none }
.btn:focus-visible{ box-shadow: var(--ring) }
.btn-primary{ background: linear-gradient(180deg, var(--brand), var(--brand-2)); border-color: transparent }
.btn-danger{  background: linear-gradient(180deg, #ff6b81, #ff416d); border-color: transparent }

/* Forms */
.form-grid{
  display:grid; gap:12px;
  grid-template-columns: 160px 1fr;
  align-items:center;
}
@media (max-width:720px){
  .form-grid{ grid-template-columns: 1fr }
}
.form-grid input[type="text"],
.form-grid input[type="date"],
.form-grid input[type="email"],
.form-grid input[type="password"],
.form-grid select{
  width:100%; padding:10px 12px; border-radius:10px; color:var(--text);
  border:1px solid var(--border); background:#0f1324;
}
form .actions{ margin-top:8px }

/* Flashes (unified) */
.flash{
  padding:12px 14px; border-radius:12px; margin:10px 0; display:flex; align-items:center; gap:10px; font-weight:700;
  border:1px solid transparent;
}
.flash.success{ background: rgba(46,204,113,.12); border-color: rgba(46,204,113,.35); color:#b9fbd5 }
.flash.error{   background: rgba(255,92,122,.12); border-color: rgba(255,92,122,.35); color:#ffc2cd }
.flash.info{    background: rgba(108,156,255,.12); border-color: rgba(108,156,255,.35); color:#cfe0ff }
.flash.warn{    background: rgba(246,192,68,.12);  border-color: rgba(246,192,68,.35);  color:#ffe3a6 }

/* Modal */
.modal{
  position: fixed; inset:0; display:none; align-items:center; justify-content:center;
  background: rgba(0,0,0,.55); z-index:100;
}
.modal .modal-content{
  width:min(680px, 92vw);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border:1px solid var(--border); border-radius:16px; box-shadow: var(--shadow);
  padding:18px; max-height: 86vh; overflow:auto;
}
.modal .modal-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px }
.modal .modal-title{ font-size:18px; font-weight:800 }
.modal .close{ background:transparent; border:0; color:var(--muted); font-size:22px; cursor:pointer}
.show{ display:flex }

/* Login box */
.login-box{
  max-width:420px; margin:10vh auto; padding:22px; border-radius:16px;
  background:linear-gradient(180deg, var(--panel), var(--panel-2));
  border:1px solid var(--border);
  box-shadow: var(--shadow);
}
.login-box h1{ margin:0 0 12px; font-size:20px }
.login-box form{ display:grid; gap:12px }
.login-box label{ color:#c7d2fe }
.login-box input{
  padding:10px 12px; border-radius:10px; border:1px solid var(--border);
  background:#0f1324; color:var(--text)
}
.login-box .actions{ display:flex; justify-content:flex-end }

/* Footer */
footer{ color:var(--muted); text-align:center; padding:30px 0 }

/* Charts (global helpers) */
.chart-box{
  height: 260px; max-height: 260px;
  background:#0f142b; border:1px solid var(--border); border-radius:12px; padding:10px;
}
.chart-box canvas{
  width:100% !important; height:100% !important; display:block;
}
@media (max-width:760px){
  .chart-box{ height:220px; max-height:220px }
}

/* Utilities */
.visually-hidden{
  position:absolute!important; height:1px; width:1px; overflow:hidden; clip:rect(1px,1px,1px,1px);
  white-space:nowrap; border:0; padding:0; margin:-1px;
}
