:root{
  --bg:#0b0f19;
  --card:#101827;
  --muted:#9aa4b2;
  --text:#e8eef7;
  --accent:#37ffb3;
  --accent2:#5aa7ff;
  --danger:#ff4d6d;
  --warning:#ffcc66;
  --line:rgba(255,255,255,.08);
  --line-strong:rgba(255,255,255,.14);
  --shadow:0 12px 30px rgba(0,0,0,.35);
  --shadow-lg:0 20px 50px rgba(0,0,0,.45);
  --r:18px;
  --r-sm:14px;
}

*{
  box-sizing:border-box;
  min-width:0;
}

html,
body{
  height:100%;
  margin:0;
  padding:0;
}

body{
  font-family:ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(90,167,255,.25), transparent 60%),
    radial-gradient(1200px 700px at 90% 0%, rgba(55,255,179,.18), transparent 55%),
    var(--bg);
  color:var(--text);
  overflow-x:hidden;
}

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

.container{
  max-width:1200px;
  margin:0 auto;
  padding:18px;
}

.app{
  display:grid;
  grid-template-columns:260px minmax(0, 1fr);
  gap:16px;
  min-height:100vh;
  width:100%;
  padding:16px;
}

.sidebar{
  background:rgba(16,24,39,.75);
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:16px;
  position:sticky;
  top:16px;
  height:calc(100vh - 32px);
  overflow:auto;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom:14px;
}

.logo{
  width:44px;
  height:44px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg, rgba(55,255,179,.2), rgba(90,167,255,.2));
  border:1px solid var(--line);
  font-weight:800;
  flex-shrink:0;
}

.brand h1{
  margin:0;
  font-size:14px;
  letter-spacing:.3px;
}

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

.nav{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:10px;
}

.nav a{
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.03);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  transition:.2s ease;
}

.nav a:hover{
  background:rgba(255,255,255,.05);
  border-color:var(--line-strong);
}

.nav a.active{
  outline:2px solid rgba(55,255,179,.18);
  border-color:rgba(55,255,179,.28);
  background:linear-gradient(135deg, rgba(55,255,179,.08), rgba(90,167,255,.06));
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background:rgba(255,255,255,.03);
  font-size:12px;
  color:var(--muted);
  margin-top:12px;
}

.dot{
  width:9px;
  height:9px;
  border-radius:50%;
  background:var(--danger);
  flex-shrink:0;
}

.dot.ok{
  background:var(--accent);
}

.main{
  display:flex;
  flex-direction:column;
  gap:16px;
  min-width:0;
}

.topbar{
  background:rgba(16,24,39,.60);
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:14px;
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
}

.search{
  display:flex;
  gap:10px;
  align-items:center;
  width:min(520px, 100%);
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px 12px;
  background:rgba(255,255,255,.03);
}

.search input{
  background:transparent;
  border:0;
  outline:0;
  color:var(--text);
  width:100%;
}

.search input::placeholder,
.input input::placeholder,
.input textarea::placeholder{
  color:#7f8aa0;
}

.btn{
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  transition:.2s ease;
  white-space:nowrap;
}

.btn:hover{
  transform:translateY(-1px);
  border-color:var(--line-strong);
}

.btn.primary{
  border-color:rgba(55,255,179,.28);
  background:linear-gradient(135deg, rgba(55,255,179,.18), rgba(90,167,255,.12));
}

.btn.danger{
  border-color:rgba(255,77,109,.35);
  background:rgba(255,77,109,.08);
}

.btn.success{
  border-color:rgba(55,255,179,.30);
  background:rgba(55,255,179,.08);
}

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

.card{
  background:rgba(16,24,39,.60);
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  padding:14px;
  min-width:0;
}

.kpi{
  grid-column:span 3;
  min-height:120px;
}

.kpi .label{
  color:var(--muted);
  font-size:12px;
}

.kpi .value{
  font-size:24px;
  font-weight:800;
  margin-top:6px;
  word-break:break-word;
}

.tableWrap{
  overflow-x:auto;
  max-width:100%;
  border-radius:14px;
}

table{
  width:100%;
  border-collapse:collapse;
  min-width:700px;
}

th,
td{
  padding:10px;
  border-bottom:1px solid var(--line);
  text-align:left;
  font-size:13px;
  vertical-align:middle;
}

th{
  color:var(--muted);
  font-weight:600;
  background:rgba(255,255,255,.01);
  position:sticky;
  top:0;
  z-index:1;
}

tr:hover td{
  background:rgba(255,255,255,.02);
}

.badge{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  font-size:12px;
  color:var(--muted);
  background:rgba(255,255,255,.03);
}

.badge.overdue{
  border-color:rgba(255,77,109,.35);
  color:#ffd3dc;
  background:rgba(255,77,109,.08);
}

.form{
  display:grid;
  gap:10px;
}

.input{
  display:grid;
  gap:6px;
}

.input label{
  font-size:12px;
  color:var(--muted);
}

.input input,
.input select,
.input textarea{
  width:100%;
  background:rgba(255,255,255,.03);
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px 12px;
  color:var(--text);
  outline:none;
  transition:.2s ease;
}

.input input:focus,
.input select:focus,
.input textarea:focus,
.search input:focus{
  outline:none;
}

.input input:focus,
.input select:focus,
.input textarea:focus{
  border-color:rgba(90,167,255,.35);
  box-shadow:0 0 0 3px rgba(90,167,255,.08);
}

.input textarea{
  resize:vertical;
  min-height:92px;
}

.input select{
  appearance:none;
}

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

.msg{
  margin-top:8px;
  color:var(--muted);
  font-size:13px;
  line-height:1.4;
}

.msg.err{
  color:#ffd3dc;
}

.msg.ok{
  color:#c8ffe8;
}

/* CUSTOMERS PAGE */
.customersPage{
  display:grid;
  grid-template-columns:minmax(0, 2fr) minmax(320px, 1fr);
  gap:16px;
  align-items:start;
}

/* ACTION BUTTON WRAPS */
.actions,
.td-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}

/* DASHBOARD HELPERS */
.col-12{ grid-column:span 12; }
.col-8{ grid-column:span 8; }
.col-7{ grid-column:span 7; }
.col-6{ grid-column:span 6; }
.col-5{ grid-column:span 5; }
.col-4{ grid-column:span 4; }
.col-3{ grid-column:span 3; }

/* MODALS */
[id$="Modal"]{
  backdrop-filter:blur(6px);
}

[id$="Modal"] .card{
  background:rgba(16,24,39,.96);
  border:1px solid rgba(255,255,255,.10);
  box-shadow:var(--shadow-lg);
}

.modalHead,
.modal-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.modalBody,
.modal-body{
  margin-top:12px;
}

.modalActions,
.modal-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin-top:10px;
}

/* DETAILS / HISTORY LOOK */
.detailsHead,
#detailsHead{
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(255,255,255,.03);
}

.timelineRowTitle{
  font-weight:800;
  background:rgba(255,255,255,.04);
}

pre,
.codeBox{
  white-space:pre-wrap;
  word-break:break-word;
  background:rgba(255,255,255,.03);
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  color:var(--text);
}

/* LOGIN PAGE SUPPORT */
.loginWrap{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
}

.loginCard{
  width:min(100%, 420px);
  background:rgba(16,24,39,.75);
  border:1px solid var(--line);
  border-radius:22px;
  box-shadow:var(--shadow-lg);
  padding:22px;
}

/* SMALL HELPERS */
.w100{ width:100%; }
.mt8{ margin-top:8px; }
.mt10{ margin-top:10px; }
.mt12{ margin-top:12px; }
.mt16{ margin-top:16px; }
.center{ text-align:center; }
.right{ text-align:right; }
.muted{ color:var(--muted); }
.nowrap{ white-space:nowrap; }

/* SCROLLBAR */
*::-webkit-scrollbar{
  width:10px;
  height:10px;
}

*::-webkit-scrollbar-track{
  background:transparent;
}

*::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.12);
  border-radius:999px;
}

*::-webkit-scrollbar-thumb:hover{
  background:rgba(255,255,255,.18);
}

/* TABLET */
@media (max-width: 980px){
  .app{
    grid-template-columns:1fr;
  }

  .sidebar{
    position:relative;
    top:0;
    height:auto;
  }

  .kpi{
    grid-column:span 6;
  }

  .customersPage{
    grid-template-columns:1fr;
  }

  .col-8,
  .col-7,
  .col-6,
  .col-5,
  .col-4,
  .col-3{
    grid-column:span 12;
  }

  table{
    min-width:640px;
  }
}

/* MOBILE */
@media (max-width: 560px){
  .app{
    padding:10px;
  }

  .sidebar{
    padding:12px;
  }

  .main{
    gap:12px;
  }

  .card{
    padding:12px;
  }

  .row{
    grid-template-columns:1fr;
  }

  .kpi{
    grid-column:span 12;
  }

  .topbar{
    align-items:stretch;
    padding:12px;
  }

  .search{
    width:100%;
  }

  .btn{
    width:100%;
    justify-content:center;
    text-align:center;
  }

  .actions .btn,
  .td-actions .btn,
  td .btn{
    width:auto;
  }

  table{
    min-width:560px;
  }

  .brand h1{
    font-size:13px;
  }

  .logo{
    width:40px;
    height:40px;
  }
}