:root{
  --bg:#0f172a;
  --panel:#111827;
  --border:#1f2937;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --accent:#60a5fa;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  min-height:100vh;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:radial-gradient(circle at top,#1e293b 0%,var(--bg) 60%);
}

.wrap{
  max-width:1200px;
  margin:0 auto;
  padding:22px 16px;
}

.header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:12px;
}

.header-main{
  min-width:0;
}

.header-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:2px;
  flex-shrink:0;
}

.header-actions .btn{
  flex:0 1 auto;
  min-width:0;
  text-align:center;
  white-space:nowrap;
}

.title{
  font-size:20px;
  font-weight:750;
  line-height:1.25;
}

.meta{
  font-size:13px;
  line-height:1.4;
  color:var(--muted);
}

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

.col-4,
.col-6,
.stack.col-6{
  grid-column:span 12;
}

.stack{
  display:flex;
  flex-direction:column;
  gap:12px;
  align-self:start;
}

@media (min-width:980px){
  .col-4{
    grid-column:span 4;
  }

  .col-6,
  .stack.col-6{
    grid-column:span 6;
  }

  .header-actions .btn{
    min-width:130px;
  }
}

.card{
  padding:14px 14px 12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--panel);
  box-shadow:0 10px 40px rgba(0,0,0,.35);
}

.k{
  margin-bottom:6px;
  font-size:12px;
  color:var(--muted);
}

.v{
  margin-bottom:8px;
  font-size:18px;
  font-weight:750;
}

.small{
  font-size:13px;
  color:var(--muted);
}

.bar{
  height:10px;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:999px;
  background:#0b1220;
}

.fill{
  height:100%;
  background:linear-gradient(90deg, rgba(96,165,250,.9), rgba(96,165,250,.25));
}

.tbl{
  width:100%;
  margin-top:8px;
  border-collapse:collapse;
}

.tbl th,
.tbl td{
  padding:9px 8px;
  border-bottom:1px solid rgba(31,41,55,.8);
  font-size:13px;
  text-align:left;
  vertical-align:middle;
}

.tbl th{
  font-weight:650;
  color:var(--muted);
}

.st{
  display:inline-block;
  padding:2px 8px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:999px;
  font-size:12px;
}

.st.ok{
  color:#a7f3d0;
  border-color:rgba(167,243,208,.25);
}

.st.off{
  color:#fed7aa;
  border-color:rgba(254,215,170,.25);
}

.st.bad{
  color:#fecaca;
  border-color:rgba(254,202,202,.25);
}

.st.unk{
  color:#c7d2fe;
  border-color:rgba(199,210,254,.25);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  border-color:rgba(148,163,184,.22);
  background:rgba(148,163,184,.08);
  color:#cbd5f5;
  font-size:13px;
  text-decoration:none;
  cursor:pointer;
  transition:background .15s ease,border-color .15s ease,color .15s ease;
}

.btn:hover{
  border-color:rgba(148,163,184,.45);
  background:rgba(148,163,184,.14);
}

.btn_create{
  border-color:rgba(34,197,94,.18);
  background:rgba(34,197,94,.10);
  color:#a7f3d0;
}

.btn_create:hover{
  border-color:rgba(34,197,94,.45);
  background:rgba(34,197,94,.16);
}

.btn_cfg{
  border-color:rgba(14,165,233,.22);
  background:rgba(14,165,233,.10);
  color:#bae6fd;
}

.btn_cfg:hover{
  border-color:rgba(14,165,233,.45);
  background:rgba(14,165,233,.18);
}

.btn_delete{
  border-color:rgba(239,68,68,.18);
  background:rgba(239,68,68,.10);
  color:#fecaca;
}

.btn_delete:hover{
  border-color:rgba(239,68,68,.45);
  background:rgba(239,68,68,.16);
}

.btn_mail{
  border-color:rgba(59,130,246,.35);
  background:rgba(59,130,246,.12);
  color:#93c5fd;
}

.btn_mail:hover{
  border-color:rgba(59,130,246,.60);
  background:rgba(59,130,246,.20);
}

.btn_av{
  border-color:rgba(245,158,11,.18);
  background:rgba(245,158,11,.10);
  color:#fde68a;
}

.btn_av:hover{
  border-color:rgba(245,158,11,.45);
  background:rgba(245,158,11,.16);
}

.btn_users{
  border-color:rgba(139,92,246,.20);
  background:rgba(139,92,246,.10);
  color:#c4b5fd;
}

.btn_users:hover{
  border-color:rgba(139,92,246,.45);
  background:rgba(139,92,246,.18);
}

.btn_logout{
  border-color:rgba(239,68,68,.18);
  background:rgba(239,68,68,.10);
  color:#fecaca;
}

.btn_logout:hover{
  border-color:rgba(239,68,68,.45);
  background:rgba(239,68,68,.16);
}


.auth-page{
  display:grid;
  place-items:center;
  min-height:100vh;
  margin:0;
  background:radial-gradient(circle at top,#1e293b 0%,var(--bg) 60%);
}

.auth-card{
  width:min(420px,92vw);
  padding:24px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--panel);
  box-shadow:0 10px 40px rgba(0,0,0,.35);
}

.auth-title{
  margin:0 0 8px;
  font-size:22px;
  font-weight:750;
}

.auth-meta{
  margin-bottom:16px;
  font-size:13px;
  color:var(--muted);
}

.auth-label{
  display:block;
  margin:12px 0 6px;
  font-size:13px;
  color:var(--muted);
}

.auth-input{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  outline:none;
  background:#0b1220;
  color:var(--text);
}

.auth-input:focus{
  border-color:rgba(96,165,250,.55);
}

.auth-btn{
  width:100%;
  margin-top:16px;
  padding:10px 12px;
  border:1px solid rgba(96,165,250,.35);
  border-radius:10px;
  background:rgba(96,165,250,.10);
  color:var(--text);
  cursor:pointer;
}

.auth-btn:hover{
  background:rgba(96,165,250,.16);
}

.auth-err{
  margin-top:14px;
  padding:10px 12px;
  border:1px solid rgba(251,113,133,.25);
  border-radius:10px;
  background:rgba(251,113,133,.08);
  color:var(--text);
  font-size:13px;
}

@media (max-width:860px){
  .header{
    flex-direction:column;
    align-items:stretch;
    gap:14px;
  }

  .header-main,
  .header-actions{
    width:100%;
  }

  .header-actions{
    flex-direction:column;
    align-items:stretch;
    gap:8px;
    margin-top:0;
  }

  .header-actions .btn{
    width:100%;
    min-width:0;
    flex:1 1 auto;
  }
}

@media (max-width:520px){
  .wrap{
    padding:16px 12px;
  }

  .title{
    font-size:16px;
  }

  .meta{
    font-size:12px;
  }

  .header-actions .btn{
    width:100%;
    min-width:0;
    flex:1 1 auto;
    padding:10px 12px;
    font-size:14px;
  }

  .card{
    padding:12px;
  }

  .tbl th,
  .tbl td{
    padding:8px 6px;
    font-size:12px;
  }
}

.term-body::-webkit-scrollbar{
  width:10px;
}

.term-body::-webkit-scrollbar-track{
  background:#0b1628;
  border-left:1px solid rgba(255,255,255,.05);
}

.term-body::-webkit-scrollbar-thumb{
  background:#2a3c55;
  border-radius:8px;
  border:2px solid #0b1628;
}

.term-body::-webkit-scrollbar-thumb:hover{
  background:#3a516f;
}

.term-body{
  scrollbar-width:thin;
  scrollbar-color:#2a3c55 #0b1628;
}

.svc-restart-btn{
  width:90px;
  text-align:center;
}

.sites-table{
  width:100%;
  table-layout:fixed;
}

.sites-table th:nth-child(1),
.sites-table td:nth-child(1){
  width:55%;
}

.sites-table th:nth-child(2),
.sites-table td:nth-child(2){
  width:10%;
  white-space:nowrap;
}

.sites-table th:nth-child(3),
.sites-table td:nth-child(3){
  width:35%;
}

.sites-table td:nth-child(1){
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.sites-table td:nth-child(3){
  overflow-wrap:anywhere;
  word-break:break-word;
}

.sites-modal[hidden]{
  display:none;
}

.sites-modal{
  position:fixed;
  inset:0;
  z-index:9998;
}

.sites-modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(3,8,20,.72);
  backdrop-filter:blur(4px);
}

.sites-modal__dialog{
  position:relative;
  z-index:1;
  width:min(560px, calc(100vw - 32px));
  margin:12vh auto 0;
  padding:20px 20px 18px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:16px;
  background:linear-gradient(180deg, rgba(8,20,46,.98), rgba(6,16,38,.98));
  box-shadow:0 20px 80px rgba(0,0,0,.45);
}

.sites-modal__kicker{
  margin-bottom:8px;
  color:var(--muted);
  font-size:11.5px;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.sites-modal__actions{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:10px;
  margin-top:30px;
}

.sites-modal__close{
  position:absolute;
  top:12px;
  right:12px;
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  color:var(--text);
  font-size:22px;
  line-height:1;
  cursor:pointer;
}

.sites-modal__close:hover{
  background:rgba(255,255,255,.08);
}

.sites-modal__title{
  font-size:20px;
  font-weight:800;
  line-height:1.2;
  margin-bottom:16px;
}

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

.sites-modal__btn{
  width:100%;
  min-height:42px;
  text-align:center;
}

@media (max-width:640px){
  .sites-modal__dialog{
    width:min(100vw - 20px, 560px);
    margin:6vh auto 0;
    padding:18px 16px 16px;
  }

  .sites-modal__title{
    font-size:18px;
  }

  .sites-modal__actions{
    grid-template-columns:1fr;
  }
}