/* =========================================================
   TOKENS
   ========================================================= */
:root{
  --bg:#0b0f14;
  --panel:#0f1620;
  --panel2:#0c121a;

  --surface-1:rgba(255,255,255,.03);
  --surface-2:rgba(255,255,255,.05);
  --surface-3:rgba(255,255,255,.08);

  --bd:rgba(255,255,255,.10);
  --bd-strong:rgba(255,255,255,.16);

  --txt:rgba(255,255,255,.92);
  --mut:rgba(255,255,255,.62);

  --acc:#38bdf8;
  --good:#22c55e;
  --warn:#f59e0b;
  --bad:#ef4444;

  --r-sm:10px;
  --r-md:14px;
  --r-lg:18px;
  --r-xl:22px;

  --sp-1:6px;
  --sp-2:10px;
  --sp-3:14px;
  --sp-4:18px;

  --shadow-1:0 12px 32px rgba(0,0,0,.22);
  --shadow-2:0 30px 90px rgba(0,0,0,.55);
  --shadow-3:0 35px 110px rgba(0,0,0,.70);

  --mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* =========================================================
   BASE
   ========================================================= */
*{box-sizing:border-box}

html{color-scheme:dark}

body{
  margin:0;
  background:var(--bg);
  color:var(--txt);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

a{
  color:inherit;
  text-decoration:none;
}

button,
input,
select,
textarea{
  font:inherit;
}

:focus-visible{
  outline:2px solid rgba(56,189,248,.85);
  outline-offset:2px;
}

@media (prefers-reduced-motion: reduce){
  *,
  *::before,
  *::after{
    animation:none !important;
    transition:none !important;
    scroll-behavior:auto !important;
  }
}

/* =========================================================
   UTILITAIRES
   ========================================================= */
.muted{color:var(--mut);font-size:13px}
.mini{font-size:12px}
.space{height:10px}
.link{color:var(--acc)}
.code,
.pre,
.kpi,
.num{
  font-family:var(--mono);
  font-variant-numeric:tabular-nums;
}
.pre{
  white-space:pre-wrap;
  font-size:12px;
}
.bad{color:var(--bad)}
.warn{color:var(--warn)}
.good{color:var(--good)}
.dot{opacity:.35;margin:0 6px}
.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.stack{
  display:grid;
  grid-template-columns:1fr;
  gap:16px;
}
.center{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
}
.list{
  margin:0;
  padding-left:18px;
}
.rowbad{background:rgba(239,68,68,.08)}

/* =========================================================
   LAYOUT
   ========================================================= */
.layout{
  display:flex;
  min-height:100vh;
}

.main{
  flex:1;
  min-width:0;
  padding:16px;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:12px;
  margin-bottom:14px;
}

.topbar-left{
  display:flex;
  align-items:flex-end;
  gap:10px;
}

.topbar-actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.h1{
  margin:0;
  font-size:20px;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar{
  width:260px;
  height:100vh;
  position:sticky;
  top:0;
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:14px;
  background:var(--panel2);
  border-right:1px solid var(--bd);
  overflow:hidden;
}

.brand{
  font-weight:900;
  letter-spacing:.2px;
}

.brandline{
  display:flex;
  gap:10px;
  align-items:center;
}

.brand-ico{
  width:34px;
  height:34px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background:var(--surface-2);
}

.brand-ico svg{width:18px;height:18px}

.brandtitle{
  font-weight:900;
  letter-spacing:.2px;
}

.brandsub{
  margin-top:1px;
}

.nav{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:6px;
  overflow:auto;
  padding-right:6px;
}

.nav a,
.navlink{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px;
  border-radius:12px;
  border:1px solid transparent;
  color:var(--mut);
}

.nav a:hover,
.navlink:hover{
  border-color:var(--bd);
  background:var(--surface-2);
  color:var(--txt);
}

.navlink.active{
  color:var(--txt);
  border-color:rgba(56,189,248,.30);
  background:rgba(56,189,248,.12);
  box-shadow:0 0 0 3px rgba(56,189,248,.06) inset;
}

.navsection{margin:2px 6px 0}

.navico{
  width:20px;
  height:20px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  opacity:.9;
}

.navico svg{width:20px;height:20px}

.sep{
  height:1px;
  background:var(--bd);
  margin:10px 0;
}

.sidefoot{
  margin-top:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.userpill{
  border:1px solid rgba(255,255,255,.10);
  background:var(--surface-2);
  border-radius:14px;
  padding:10px 12px;
}

.sidebar::-webkit-scrollbar,
.nav::-webkit-scrollbar{
  width:10px;
}

.sidebar::-webkit-scrollbar-thumb,
.nav::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.10);
  border-radius:999px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.nav::-webkit-scrollbar-thumb:hover{
  background:rgba(255,255,255,.16);
}

/* =========================================================
   BURGER / MOBILE NAV
   ========================================================= */
.burger{
  display:none;
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background:var(--surface-2);
  color:var(--txt);
  cursor:pointer;
}

.burger:hover{
  background:var(--surface-3);
}

.burger svg{width:20px;height:20px}

.scrim{
  display:none;
  position:fixed;
  inset:0;
  z-index:40;
  background:rgba(0,0,0,.62);
  backdrop-filter:blur(4px);
}

/* =========================================================
   COMPONENTS
   ========================================================= */
.card{
  background:var(--panel);
  border:1px solid var(--bd);
  border-radius:14px;
  padding:12px;
  box-shadow:var(--shadow-1);
}

.access-card{
  background:
    radial-gradient(650px 220px at 20% -20%, rgba(56,189,248,.16), transparent 60%),
    linear-gradient(180deg, rgba(15,22,32,.98), rgba(12,18,26,.98));
}

.grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}

.grid2{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.btn,
.btn-ghost,
.auth-btn,
.xbtn,
.linkbtn{
  color:var(--txt);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:9px 12px;
  border-radius:10px;
  border:1px solid var(--bd);
  background:var(--surface-2);
  color:var(--txt);
  cursor:pointer;
}

.btn:hover{
  background:var(--surface-3);
}

.btn-ghost{
  background:transparent;
}

.linkbtn{
  border:0;
  background:transparent;
  cursor:pointer;
  text-decoration:underline;
  text-underline-offset:3px;
  opacity:.85;
}

.linkbtn:hover{
  opacity:1;
}

.input,
select.input{
  padding:9px 10px;
  border-radius:10px;
  border:1px solid var(--bd);
  background:rgba(255,255,255,.04);
  color:var(--txt);
  outline:none;
  color-scheme:dark;
}

.input:focus,
select.input:focus{
  border-color:rgba(56,189,248,.45);
  box-shadow:0 0 0 4px rgba(56,189,248,.12);
}

select.input option,
select.input optgroup{
  background:var(--panel);
  color:var(--txt);
}

.table{
  width:100%;
  border-collapse:collapse;
}

.table th,
.table td{
  padding:9px 8px;
  border-bottom:1px solid rgba(255,255,255,.06);
  text-align:left;
  vertical-align:top;
  white-space:nowrap;
}

.table th{
  position:sticky;
  top:0;
  background:rgba(0,0,0,.18);
  color:var(--mut);
  font-weight:600;
}

.kpi{
  font-size:22px;
  font-weight:900;
  margin-top:4px;
}

.flashwrap{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin:10px 0;
}

.flash{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--bd);
  background:var(--surface-2);
}

.flash.error{
  border-color:rgba(239,68,68,.35);
  background:rgba(239,68,68,.12);
}

.pill,
.badge,
.tag{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
  font-size:12px;
  line-height:1.4;
  border:1px solid rgba(255,255,255,.12);
  border-radius:999px;
}

.pill{
  padding:3px 8px;
  color:var(--mut);
  background:rgba(255,255,255,.04);
}

.badge{
  padding:3px 8px;
  background:rgba(255,255,255,.06);
}

.tag{
  padding:6px 10px;
  background:rgba(255,255,255,.05);
}

.badge-soft{background:rgba(255,255,255,.06)}
.badge-ok{
  background:rgba(46,204,113,.12);
  border-color:rgba(46,204,113,.25);
}

/* =========================================================
   DIALOG / MODAL COMMUN
   ========================================================= */
dialog{
  border:none;
  background:transparent;
  padding:0;
}

dialog::backdrop{
  background:rgba(0,0,0,.68);
  backdrop-filter:blur(6px);
}

.modal{
  width:min(900px,94vw);
  max-height:80vh;
  overflow:auto;
}

.modalbox,
:is(#dlg-licences, #dlg-users) .card.modal{
  width:min(980px,94vw);
  max-height:84vh;
  overflow:auto;
  border:1px solid rgba(255,255,255,.16);
  border-radius:18px;
  padding:14px;
  background:
    radial-gradient(900px 380px at 18% -12%, rgba(56,189,248,.20), transparent 62%),
    linear-gradient(180deg, rgba(20,30,44,.99), rgba(12,18,26,.99));
  box-shadow:var(--shadow-3);
  color:var(--txt);
}

.modalbox *{color:inherit}

.mhead{
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  align-items:flex-start;
}

.mtitle{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.mtitle .line{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.mtitle h2{
  margin:0;
  font-size:18px;
}

.meta{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  font-size:12px;
  color:var(--mut);
}

.code{color:var(--txt)}

.xbtn{
  width:38px;
  height:38px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.10);
  cursor:pointer;
  font-size:22px;
  line-height:1;
}

.xbtn:hover{
  background:rgba(255,255,255,.16);
}

.seg{
  margin-top:12px;
  display:flex;
  gap:6px;
  padding:6px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
}

.seg button{
  flex:1;
  padding:9px 12px;
  border-radius:12px;
  border:1px solid transparent;
  background:transparent;
  color:rgba(255,255,255,.86);
  cursor:pointer;
  opacity:.78;
}

.seg button:hover{
  opacity:1;
  background:rgba(255,255,255,.06);
}

.seg button.on{
  opacity:1;
  background:rgba(56,189,248,.18);
  border-color:rgba(56,189,248,.45);
  color:rgba(255,255,255,.96);
}

.foot{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid rgba(255,255,255,.08);
  color:var(--mut);
  font-size:12px;
}

.modalbox .muted,
:is(#dlg-licences, #dlg-users) .muted{
  color:rgba(255,255,255,.72);
}

.modalbox .card{
  background:rgba(255,255,255,.08);
  border-color:rgba(255,255,255,.14);
}

.modalbox .table th,
:is(#dlg-licences, #dlg-users) .table th{
  color:rgba(255,255,255,.78);
  background:rgba(0,0,0,.24);
  border-bottom:1px solid rgba(255,255,255,.10);
}

.modalbox .table td,
:is(#dlg-licences, #dlg-users) .table td{
  color:rgba(255,255,255,.92);
}

.modalbox .input,
:is(#dlg-licences, #dlg-users) .input{
  background:rgba(0,0,0,.26);
  border-color:rgba(255,255,255,.14);
}

/* =========================================================
   ACRONIS
   ========================================================= */
.vlist{
  border:1px solid var(--bd);
  background:rgba(255,255,255,.02);
  border-radius:16px;
  padding:10px;
}

.vrow{
  width:100%;
  display:grid;
  grid-template-columns:1.2fr .6fr .6fr .6fr .6fr;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  background:rgba(255,255,255,.04);
  color:inherit;
  text-align:left;
}

.vrow:hover{
  border-color:rgba(56,189,248,.35);
  background:rgba(56,189,248,.08);
}

.vhead{
  background:transparent;
  border:none;
  cursor:default;
  color:var(--mut);
  padding:6px 12px;
}

.vhead .h{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.12em;
}

.name{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.name strong{font-size:14px}

.mode{
  color:var(--mut);
  font-size:12px;
}

.num{
  text-align:right;
}

/* =========================================================
   IT GLUE
   ========================================================= */
#dlg-licences::backdrop,
#dlg-users::backdrop{
  background:rgba(0,0,0,.72);
  backdrop-filter:blur(6px);
}

#dlg-licences .input:focus,
#dlg-users .input:focus{
  border-color:rgba(56,189,248,.45);
  box-shadow:0 0 0 4px rgba(56,189,248,.12);
}

#dlg-licences tbody tr:hover,
#dlg-users tbody tr:hover{
  background:rgba(56,189,248,.06);
}

/* =========================================================
   ADMIN ASSIGN
   ========================================================= */
.checkgrid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
}

.checkitem{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  background:rgba(255,255,255,.03);
}

.checkitem:hover{
  background:rgba(56,189,248,.06);
  border-color:rgba(56,189,248,.25);
}

.checkitem input{
  margin-top:3px;
}

.checkitem .meta{
  margin-top:2px;
  font-family:var(--mono);
  font-size:11px;
  color:var(--mut);
}

.capswarn{
  margin-top:8px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(245,158,11,.35);
  background:rgba(245,158,11,.12);
  color:rgba(255,255,255,.92);
  font-size:12px;
}

/* =========================================================
   AUTH
   ========================================================= */
.auth-bg{
  position:relative;
  overflow:hidden;
  min-height:100vh;
  margin:0;
  background:
    radial-gradient(1000px 420px at 50% -10%, rgba(56,189,248,.16), transparent 60%),
    linear-gradient(180deg, #060a10, #04070c);
  color:var(--txt);
}

.auth-bg::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size:44px 44px;
  opacity:.08;
  pointer-events:none;
}

.auth-bg::after{
  content:"";
  position:absolute;
  inset:-20%;
  background:radial-gradient(closest-side, rgba(56,189,248,.12), transparent 65%);
  filter:blur(12px);
  pointer-events:none;
}

.auth-center{
  position:relative;
  z-index:1;
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.authcard{width:min(420px,94vw)}

.auth-card{
  width:min(560px,94vw);
  padding:26px 26px 22px;
  border-radius:18px;
  border:1px solid rgba(56,189,248,.18);
  background:linear-gradient(180deg, rgba(10,16,24,.92), rgba(8,12,18,.92));
  box-shadow:0 30px 90px rgba(0,0,0,.62);
}

.auth-brand{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  margin-bottom:10px;
}

.auth-logo{
  width:auto;
  height:84px;
  display:block;
  margin:0 auto 10px;
  filter:drop-shadow(0 6px 18px rgba(0,0,0,.45));
}

.auth-logo-text{
  font-weight:900;
  letter-spacing:.2px;
  font-size:28px;
  line-height:1;
  opacity:.95;
}

.auth-sub{
  color:var(--mut);
  font-size:11px;
  letter-spacing:.18em;
  text-transform:uppercase;
}

.auth-title{
  margin:12px 0 18px;
  text-align:center;
  font-size:26px;
  letter-spacing:.2px;
}

.auth-label{
  display:block;
  margin:12px 0 8px;
  color:rgba(190,210,230,.80);
  font-size:14px;
}

.auth-input{
  width:100%;
  padding:14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.22);
  color:var(--txt);
  outline:none;
}

.auth-input:focus{
  border-color:rgba(56,189,248,.35);
  box-shadow:0 0 0 4px rgba(56,189,248,.10);
}

.auth-pass{position:relative}

.auth-pass .auth-input{
  padding-right:44px;
}

.auth-eye{
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  width:36px;
  height:36px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  color:rgba(255,255,255,.75);
  cursor:pointer;
}

.auth-eye:hover{
  background:rgba(255,255,255,.08);
  color:rgba(255,255,255,.92);
}

.auth-btn{
  width:100%;
  margin-top:18px;
  padding:13px 14px;
  border-radius:14px;
  border:1px solid rgba(56,189,248,.28);
  background:rgba(56,189,248,.16);
  color:rgba(255,255,255,.95);
  font-weight:700;
  cursor:pointer;
}

.auth-btn:hover{
  background:rgba(56,189,248,.24);
}

.auth-flashwrap{
  margin:10px 0 6px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.auth-flash{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.05);
  color:var(--txt);
  font-size:13px;
}

.auth-flash.error{
  border-color:rgba(239,68,68,.35);
  background:rgba(239,68,68,.12);
}

/* =========================================================
   SEWAN
   ========================================================= */
.sew-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}

.sew-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.06);
}

.sew-item:hover{
  background:rgba(56,189,248,.10);
  border-color:rgba(56,189,248,.35);
}

.sew-name strong{
  font-size:14px;
}

.sew-open{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.18);
  font-family:var(--mono);
  opacity:.85;
}

.sew-table tbody tr:hover{
  background:rgba(56,189,248,.06);
}

#sew-month{
  background:rgba(255,255,255,.06);
  color:rgba(255,255,255,.92);
  border:1px solid rgba(255,255,255,.12);
}

#sew-month:focus{
  border-color:rgba(56,189,248,.55);
  box-shadow:0 0 0 3px rgba(56,189,248,.18);
}

#sew-month option{
  background:#0c121a;
  color:rgba(255,255,255,.92);
}

#sew-month option:hover{
  background:#101a26;
}

#sew-month option:checked{
  background:rgba(56,189,248,.28);
}

/* =========================================================
   SOURCES / DASHBOARD
   ========================================================= */
.source-grid{
  gap:10px;
}

.source-card{
  padding:12px;
}

.source-card:hover{
  border-color:rgba(56,189,248,.30);
  background:rgba(56,189,248,.06);
}

.srow{
  display:flex;
  align-items:center;
  gap:12px;
}

.sico{
  width:40px;
  height:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.05);
}

.sico svg{
  width:20px;
  height:20px;
  opacity:.92;
}

.scol{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:0;
}

.stitle{font-weight:800}

.sarrow{
  margin-left:auto;
  opacity:.55;
  font-size:22px;
  line-height:1;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 980px){
  .grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .grid2{grid-template-columns:1fr}
  .checkgrid{grid-template-columns:1fr}
  .sew-list{grid-template-columns:1fr}

  .burger{
    display:inline-flex;
    align-items:center;
    justify-content:center;
  }

  .sidebar{
    position:fixed;
    top:0;
    left:0;
    bottom:0;
    z-index:50;
    width:220px;
    transform:translateX(-110%);
    transition:transform .18s ease;
    box-shadow:0 40px 120px rgba(0,0,0,.65);
  }

  body.nav-open .sidebar{
    transform:translateX(0);
  }

  body.nav-open .scrim{
    display:block;
  }
}

@media (max-width: 860px){
  .vrow{
    grid-template-columns:1fr .7fr .7fr;
  }

  .hide-m{
    display:none;
  }
}
