﻿:root{
  /* LIGHT default */
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel2: #fbfdff;
  --border: rgba(15,23,42,.10);
  --text: rgba(15,23,42,.92);
  --muted: rgba(15,23,42,.60);
  --accent: #c9a100;
  --accent2:#2563eb;

  --shadow: 0 18px 46px rgba(2,6,23,.10);
  --shadow2: 0 10px 26px rgba(2,6,23,.08);

  --r: 18px;
  --r2: 14px;

  --sidebar-w: 270px;
}

body.theme-dark{
  --bg: #0b1220;
  --panel: rgba(255,255,255,.06);
  --panel2: rgba(255,255,255,.04);
  --border: rgba(255,255,255,.10);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);
  --shadow: 0 18px 46px rgba(0,0,0,.35);
  --shadow2: 0 10px 26px rgba(0,0,0,.26);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 12% -12%, rgba(201,161,0,.12), transparent 60%),
    radial-gradient(900px 520px at 92% 12%, rgba(37,99,235,.10), transparent 60%),
    var(--bg);
}

/* ====== APP LAYOUT ====== */
.app{
  min-height:100vh;
  display:grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

.sidebar{
  position: sticky;
  top:0;
  height:100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
}

.brand{
  display:flex;
  gap:10px;
  align-items:center;
  padding:12px 12px;
  border:1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow2);
}
.brand .logo{
  width:38px;height:38px;
  border-radius: 12px;
  display:grid; place-items:center;
  border:1px solid var(--border);
  background: rgba(201,161,0,.12);
}
.brand h1{ margin:0; font-size:14px; letter-spacing:.2px; }
.brand span{ display:block; margin-top:2px; font-size:12px; color:var(--muted); }

.nav{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.nav a{
  display:flex;
  gap:10px;
  align-items:center;
  padding: 11px 12px;
  border-radius: 14px;
  border:1px solid transparent;
  color: var(--text);
  text-decoration:none;
  transition:.15s ease;
}
.nav a i{ width:18px; text-align:center; opacity:.9; }
.nav a:hover{
  background: rgba(37,99,235,.08);
  border-color: rgba(37,99,235,.20);
  transform: translateY(-1px);
}
.nav a.active{
  background: rgba(201,161,0,.14);
  border-color: rgba(201,161,0,.30);
}

.side-foot{
  position:absolute;
  left:14px;
  right:14px;
  bottom:14px;
  border:1px solid var(--border);
  border-radius: var(--r);
  background: rgba(0,0,0,.02);
  padding: 10px 12px;
}
body.theme-dark .side-foot{ background: rgba(0,0,0,.10); }
.side-foot .muted{ color:var(--muted); font-size:12px; }

/* ====== MAIN ====== */
.main{
  padding: 18px 22px 22px;
}

.header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 14px 16px;
  border:1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  box-shadow: var(--shadow);
}

.header .title{
  display:flex; flex-direction:column; gap:2px;
}
.header .title b{ font-size:15px; }
.header .title span{ color:var(--muted); font-size:12px; }

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

.btn{
  border:1px solid var(--border);
  background: rgba(255,255,255,.60);
  color:var(--text);
  padding:10px 12px;
  border-radius: 12px;
  cursor:pointer;
  transition: .15s ease;
  display:inline-flex;
  align-items:center;
  gap:8px;
  text-decoration:none;
  user-select:none;
}
body.theme-dark .btn{ background: rgba(255,255,255,.06); }
.btn:hover{ transform: translateY(-1px); border-color: rgba(37,99,235,.25); }
.btn.primary{
  border-color: rgba(201,161,0,.35);
  background: linear-gradient(180deg, rgba(201,161,0,.18), rgba(255,255,255,.55));
}
body.theme-dark .btn.primary{
  background: linear-gradient(180deg, rgba(201,161,0,.22), rgba(255,255,255,.06));
}
.btn.ghost{
  background: transparent;
}
.btn.small{ padding:8px 10px; border-radius: 11px; font-size: 13px; }
.is-busy{
  opacity:.65;
  filter: grayscale(.2);
}

/* ====== GRID + CARDS ====== */
.grid{
  margin-top: 16px;
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.card{
  grid-column: span 6;
  border:1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border-radius: var(--r);
  box-shadow: var(--shadow2);
  padding: 14px;
}
.card h3{ margin:0 0 6px 0; font-size:12px; color: var(--muted); font-weight:800; }
.card .value{ font-size: 26px; font-weight: 950; letter-spacing:.2px; }

.panel{
  grid-column: span 12;
  border:1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px;
}

.panel-head{
  display:flex; justify-content:space-between; align-items:center; gap:12px;
  margin-bottom: 10px;
}
.panel-head h2{ margin:0; font-size:14px; }
.panel-head .hint{ color:var(--muted); font-size:12px; }

.canvas-wrap{
  border:1px solid var(--border);
  border-radius: var(--r2);
  padding: 12px;
  background: rgba(255,255,255,.55);
}
body.theme-dark .canvas-wrap{ background: rgba(0,0,0,.12); }

/* Legend bonita (HTML) */
.legend{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 8px 10px;
}
.legend .item{
  display:flex; align-items:center; gap:8px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.55);
  font-size:12px;
  color: var(--text);
  cursor:pointer;
  user-select:none;
}
body.theme-dark .legend .item{ background: rgba(255,255,255,.06); }
.legend .dot{
  width:10px; height:10px; border-radius: 50%;
  border:1px solid var(--border);
}
.legend .name{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 180px;
}
.legend .muted{ color:var(--muted); }

.toast{
  position: fixed;
  right: 16px;
  bottom: 16px;
  min-width: 260px;
  max-width: 360px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 12px 12px;
  box-shadow: var(--shadow);
  display:none;
}
body.theme-dark .toast{ background: rgba(15,23,42,.92); }
.toast.show{ display:block; }
.toast .t{ font-weight:900; font-size:13px; margin:0 0 4px; }
.toast .m{ margin:0; font-size:12px; color: var(--muted); }

/* ====== DASHBOARD FILTERS ====== */
.container{
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 22px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border:1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  box-shadow: var(--shadow);
}

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

.topbar-title h1{
  margin:0;
  font-size:15px;
}

.topbar-title span{
  color: var(--muted);
  font-size: 12px;
}

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

.dash-filters-form{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:10px;
  align-items:end;
}

.dash-filter-field{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.dash-filter-field label{
  font-size:12px;
  color:var(--muted);
  font-weight:800;
}

.dash-filter-field input[type="date"],
.nt-input{
  width:100%;
  border:1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.75);
  color: var(--text);
  padding:10px 12px;
  outline:0;
}

body.theme-dark .dash-filter-field input[type="date"],
body.theme-dark .nt-input{
  background: rgba(255,255,255,.06);
}

.dash-filter-field input[type="date"]:focus,
.nt-input:focus{
  border-color: rgba(37,99,235,.35);
  box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}

.dash-filter-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.dash-filter-info{
  font-size:12px;
  color: var(--muted);
  align-self:center;
}

/* ====== LIST PAGES ====== */
.nt-page{
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 22px;
}

.nt-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  border:1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

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

.nt-head .sub{
  margin-top:4px;
  color: var(--muted);
  font-size:12px;
}

.nt-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.nt-panel{
  margin-top:14px;
  border:1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  box-shadow: var(--shadow2);
  padding: 14px;
}

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

.nt-filter-field{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.nt-filter-field label{
  font-size:12px;
  color: var(--muted);
  font-weight:800;
}

.nt-table-wrap{
  margin-top:14px;
  border:1px solid var(--border);
  border-radius: var(--r2);
  overflow:auto;
  background: rgba(255,255,255,.55);
}

body.theme-dark .nt-table-wrap{
  background: rgba(0,0,0,.12);
}

.nt-table{
  width:100%;
  border-collapse: collapse;
  min-width: 780px;
}

.nt-table th,
.nt-table td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  text-align:left;
  font-size:13px;
  vertical-align:top;
}

.nt-table th{
  color: var(--muted);
  font-weight:800;
}

.nt-table tbody tr:hover td{
  background: rgba(37,99,235,.06);
}

.nt-mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.nt-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
  border-radius: 999px;
  padding: 4px 9px;
  font-size:11px;
  font-weight:800;
}

.nt-badge.is-in{
  border-color: rgba(22,163,74,.35);
  background: rgba(22,163,74,.14);
}

.nt-badge.is-out{
  border-color: rgba(239,68,68,.35);
  background: rgba(239,68,68,.14);
}

.nt-badge.is-info{
  border-color: rgba(37,99,235,.35);
  background: rgba(37,99,235,.14);
}

.nt-badge.is-error{
  border-color: rgba(239,68,68,.35);
  background: rgba(239,68,68,.14);
}

.nt-empty{
  color: var(--muted);
  font-size:13px;
  padding: 14px 0;
}

.nt-log-msg{
  margin:0;
  white-space:pre-wrap;
  word-break:break-word;
  color: var(--text);
}

@media (max-width: 980px){
  :root{ --sidebar-w: 86px; }
  .brand h1, .brand span, .side-foot{ display:none; }
  .nav a span{ display:none; }
  .nav a{ justify-content:center; }
  .legend{ grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topbar{
    flex-direction:column;
    align-items:flex-start;
  }
  .dash-filters-form{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nt-filter-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nt-head{
    flex-direction:column;
    align-items:flex-start;
  }
}
@media (max-width: 860px){
  .app{ grid-template-columns: 1fr; }
  .sidebar{ position: relative; height:auto; }
  .card{ grid-column: span 12; }
  .dash-filters-form{
    grid-template-columns: 1fr;
  }
  .nt-filter-grid{
    grid-template-columns: 1fr;
  }
}

/* ==================================================
   AUTH / LOGIN — PREMIUM (LEFT FORM)
================================================== */
body.auth{
  min-height: 100vh;
}

.auth-shell{
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 18px;
  padding: 22px;
  max-width: 1180px;
  margin: 0 auto;
}

.auth-shell-login{
  grid-template-columns: minmax(320px, 560px);
  justify-content: center;
}

.auth-shell-login .auth-right{
  display: none;
}

.auth-left{
  display:flex;
  flex-direction:column;
  gap: 14px;
}

.auth-right{
  display:flex;
  align-items:stretch;
}

.auth-brand{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  box-shadow: var(--shadow2);
  position: relative;
}

.auth-logo{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  border: 1px solid var(--border);
  background: rgba(201,161,0,.12);
}

.auth-name{
  font-weight: 950;
  letter-spacing: .2px;
  font-size: 14px;
}

.auth-sub{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.auth-theme{
  margin-left: auto;
}

.auth-card{
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  box-shadow: var(--shadow);
  padding: 18px;
}

.auth-title{
  margin: 0;
  font-size: 20px;
  letter-spacing: .2px;
  font-weight: 950;
}

.auth-desc{
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-alert{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding: 10px 12px;
  border: 1px solid rgba(239,68,68,.30);
  background: rgba(239,68,68,.08);
  border-radius: 14px;
  margin: 10px 0 12px;
  color: var(--text);
  font-size: 13px;
}

.auth-form{
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.auth-label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  margin-top: 6px;
}

.auth-field{
  display:flex;
  align-items:center;
  gap: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.70);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow2);
}

body.theme-dark .auth-field{
  background: rgba(255,255,255,.06);
}

.auth-field i{
  width: 18px;
  text-align:center;
  opacity: .9;
  color: var(--muted);
}

.auth-field input{
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.auth-field:focus-within{
  border-color: rgba(37,99,235,.35);
  box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}

.auth-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-top: 4px;
}

.auth-check{
  display:flex;
  align-items:center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  user-select:none;
}

.auth-check input{
  width: 16px;
  height: 16px;
}

.auth-link{
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed rgba(37,99,235,.35);
}

.auth-link:hover{
  border-bottom-style: solid;
}

.auth-submit{
  width: 100%;
  justify-content:center;
  margin-top: 8px;
}

.auth-actions{
  display:flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.auth-foot{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
  justify-content:center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.auth-hero{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background:
    radial-gradient(900px 520px at 10% -10%, rgba(201,161,0,.18), transparent 60%),
    radial-gradient(900px 520px at 92% 12%, rgba(37,99,235,.14), transparent 60%),
    linear-gradient(180deg, var(--panel), var(--panel2));
  box-shadow: var(--shadow);
  padding: 18px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.auth-hero-badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  width: fit-content;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(201,161,0,.35);
  background: rgba(201,161,0,.10);
  font-size: 12px;
  color: var(--text);
  font-weight: 800;
}

.auth-hero h2{
  margin: 10px 0 6px;
  font-size: 22px;
  font-weight: 950;
}

.auth-hero p{
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-hero-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
  margin-top: 6px;
}

.auth-mini{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,.60);
}

body.theme-dark .auth-mini{
  background: rgba(255,255,255,.06);
}

.auth-mini .k{
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
}

.auth-mini .v{
  margin-top: 4px;
  font-size: 13px;
  font-weight: 850;
}

@media (max-width: 980px){
  .auth-shell{
    grid-template-columns: 1fr;
  }
  .auth-right{
    order: -1;
  }
}
