:root{
  --bg:#0b1220;
  --panel:rgba(255,255,255,.06);
  --card:rgba(255,255,255,.08);
  --stroke:rgba(255,255,255,.12);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.65);
  --accent:#7c3aed;
  --accent2:#22c55e;
  --danger:#ef4444;
  --shadow:0 18px 45px rgba(0,0,0,.45);
  --radius:16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial;
  color:var(--text);
  background:transparent;
}

body::before{
  content:"";
  position:fixed;
  inset:0;
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(120,90,255,.25), transparent 60%),
    radial-gradient(1000px 600px at 80% 70%, rgba(0,200,180,.18), transparent 60%),
    linear-gradient(135deg,#0a0d16,#0e1324 50%,#0a1b1c);
  z-index:-1;
  pointer-events:none;
}

.layout{
  min-height:100vh;
  display:grid;
  grid-template-columns:300px 1fr;
}

.sidebar{
  border-right:1px solid var(--stroke);
  padding:18px;
  background:rgba(0,0,0,.18);
  backdrop-filter:blur(10px);
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding:14px;
  border:1px solid var(--stroke);
  background:var(--panel);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.brandIcon{
  width:44px;height:44px;
  display:grid;place-items:center;
  border-radius:12px;
  background:rgba(124,58,237,.25);
  border:1px solid rgba(124,58,237,.35);
}
.brandTitle{font-weight:900;letter-spacing:.2px}
.brandSub{font-size:12px;color:var(--muted);margin-top:2px}

.userChip{
  margin-top:12px;
  padding:12px 14px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.05);
  border-radius:14px;
}
.userName{font-weight:800}
.userRole{font-size:12px;color:var(--muted);margin-top:2px}
.userLogout{
  display:inline-block;
  margin-top:8px;
  font-size:12px;
  color:rgba(255,255,255,.85);
  text-decoration:none;
  padding:6px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.18);
}
.userLogout:hover{background:rgba(255,255,255,.08)}

.nav{margin-top:12px;display:flex;flex-direction:column;gap:8px}
.navItem{
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.05);
  color:var(--text);
  padding:11px 12px;
  border-radius:12px;
  cursor:pointer;
  text-align:left;
  font-weight:650;
}
.navItem:hover{background:rgba(255,255,255,.08)}
.navItem.active{
  background:rgba(124,58,237,.22);
  border-color:rgba(124,58,237,.40);
}
.navSep{height:10px}

.sidebarFooter{margin-top:14px}
.hint{
  font-size:12px;
  color:var(--muted);
  padding:12px;
  border:1px dashed rgba(255,255,255,.15);
  border-radius:14px;
}
.hint code{display:block;margin-top:6px;color:rgba(255,255,255,.85);word-break:break-all}

.content{padding:20px 20px 40px}
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:14px;
}
.pageTitle{font-size:22px;font-weight:950}
.pageSub{font-size:13px;color:var(--muted);margin-top:4px}
.topRight{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.pill{
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
  border-radius:999px;
  padding:8px 12px;
  box-shadow:var(--shadow);
  font-size:13px;
}

.panel{margin-top:14px}
.card{
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:14px;
}
.cardHead{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:12px}
.cardTitle{font-weight:900}
.cardSub{font-size:12px;color:var(--muted);margin-top:4px}
.cardActions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}

.btn{
  border:1px solid rgba(124,58,237,.45);
  background:rgba(124,58,237,.85);
  color:white;
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
}
.btn:hover{filter:brightness(1.05)}
.btn.ghost{
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.14);
  color:rgba(255,255,255,.9);
}
.btn.danger{
  background:rgba(239,68,68,.85);
  border-color:rgba(239,68,68,.55);
}
.btn.small{padding:7px 10px;border-radius:10px;font-weight:800;font-size:12px}
.btn.full{width:100%}

.iconBtn{
  width:40px;height:40px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:rgba(255,255,255,.9);
  cursor:pointer;
}
.iconBtn:hover{background:rgba(255,255,255,.1)}

.muted{color:var(--muted);font-size:13px}

.filesGrid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(240px, 1fr));
  gap:12px;
}
.fileCard{
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.18);
  border-radius:14px;
  overflow:hidden;
}
.filePreview{
  height:140px;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,.05);
  border-bottom:1px solid rgba(255,255,255,.10);
}
.filePreview img{width:100%;height:100%;object-fit:cover;display:block}
.fileIcon{
  font-weight:900;
  padding:8px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.06);
}
.fileName{
  padding:10px 12px 0;
  font-size:12px;
  color:rgba(255,255,255,.86);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.fileActions{
  padding:10px 12px 12px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
}

.tableWrap{overflow:auto;border-radius:14px;border:1px solid rgba(255,255,255,.12)}
.gridTable{width:100%;border-collapse:collapse;min-width:880px}
.gridTable th,.gridTable td{
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
  text-align:left;
  font-size:13px;
}
.gridTable th{font-size:12px;color:rgba(255,255,255,.78);letter-spacing:.2px}
.gridTable tr:hover td{background:rgba(255,255,255,.04)}

.kpiGrid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:12px;
}
.kpi{
  padding:14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.18);
}
.kpiTitle{font-size:12px;color:rgba(255,255,255,.72)}
.kpiValue{font-size:22px;font-weight:950;margin-top:6px}
.kpiSub{font-size:12px;color:rgba(255,255,255,.62);margin-top:6px}
.kpiPos{color:rgba(34,197,94,.95)}
.kpiNeg{color:rgba(239,68,68,.95)}

.empty{
  padding:28px;
  border:1px dashed rgba(255,255,255,.14);
  border-radius:16px;
  text-align:center;
}
.emptyTitle{font-weight:950}
.emptySub{color:var(--muted);margin-top:6px;font-size:13px}

.modal{
  position:fixed;inset:0;
  background:rgba(0,0,0,.55);
  display:none;
  place-items:center;
  padding:18px;
  z-index:80;
}
.modal.show{display:grid}
.modalCard{
  width:min(1100px, 100%);
  max-height:86vh;
  display:flex;
  flex-direction:column;
  background:rgba(8,12,20,.92);
  border-radius:18px;
  box-shadow:var(--shadow);
  overflow:hidden;
  border:1px solid rgba(255,255,255,.12);
}
.modalHead{
  padding:14px 14px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.modalTitle{font-weight:950}
.modalSub{font-size:12px;color:var(--muted);margin-top:4px}
.modalBody{
  padding:14px;
  overflow:auto;
}
.modalFoot{
  padding:12px 14px;
  border-top:1px solid rgba(255,255,255,.10);
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
}

.formGrid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}
.formGrid label{font-size:12px;color:rgba(255,255,255,.78);display:flex;flex-direction:column;gap:6px}
input,select,textarea{
  width:100%;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(0,0,0,.20);
  color:var(--text);
  border-radius:12px;
  padding:10px 12px;
  outline:none;
}
textarea{min-height:96px;resize:vertical}
.checkRow{display:flex;gap:10px;align-items:center;margin-top:12px;flex-wrap:wrap}

.splitPreview{
  display:grid;
  grid-template-columns: 1.2fr 1fr;
  gap:14px;
}
.previewBox{
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.18);
  border-radius:14px;
  overflow:hidden;
}
.previewHead{
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,.10);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.previewBody{height:520px}
.previewBody iframe,
.previewBody object{
  width:100%;
  height:100%;
  border:0;
  display:block;
  background:white;
}
.previewBody img{width:100%;height:100%;object-fit:contain;display:block;background:#0b1220}

.toast{
  position:fixed;
  right:18px;
  bottom:18px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.55);
  backdrop-filter:blur(10px);
  box-shadow:var(--shadow);
  display:none;
  z-index:90;
  font-weight:800;
}
.toast.show{display:block}
.toast.ok{border-color:rgba(34,197,94,.5)}
.toast.warn{border-color:rgba(245,158,11,.5)}
.toast.err{border-color:rgba(239,68,68,.55)}

.authBg .layout{display:none}
.authWrap{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:18px;
}
.authCard{
  width:min(440px,100%);
  border-radius:18px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(8,12,20,.75);
  backdrop-filter:blur(12px);
  box-shadow:var(--shadow);
  padding:18px;
}
.authTitle{font-size:20px;font-weight:950;margin-bottom:10px}
.authForm{display:flex;flex-direction:column;gap:10px}
.authLabel{font-size:12px;color:rgba(255,255,255,.78)}
.authInput{padding:12px 12px;border-radius:14px}
.authError{color:rgba(239,68,68,.95);font-weight:900;font-size:12px}
.authOk{color:rgba(34,197,94,.95);font-weight:900;font-size:12px}
.authHint{margin-top:6px;color:rgba(255,255,255,.55);font-size:12px}

@media (max-width:1100px){
  .layout{grid-template-columns:1fr}
  .sidebar{position:sticky;top:0}
  .splitPreview{grid-template-columns:1fr}
  .kpiGrid{grid-template-columns:repeat(2, minmax(0, 1fr))}
  .previewBody{height:420px}
}
@media (max-width: 768px) {
  .layout {
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--stroke);
  }

  .content {
    padding: 10px;
  }

  .kpiGrid {
    grid-template-columns: 1fr;
  }

  .gridTable {
    display: block;
    overflow-x: auto;
  }

  .navItem {
    font-size: 14px;
    padding: 10px;
  }
}
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #333;
  }

  .content {
    width: 100%;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .navItem {
    display: block;
    width: 100%;
    text-align: left;
  }

  .panel,
  .card,
  .modalCard {
    width: 100% !important;
  }

  table {
    font-size: 14px;
  }
}
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid #333;
  }
  .content {
    width: 100%;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .navItem {
    width: 100%;
    text-align: left;
  }
  .panel, .card, .modalCard {
    width: 100%;
  }
  table {
    font-size: 14px;
  }
}
