/* B9 Admin CSS split: base.css
   Source: admin.css split by main menu domains.
   Do not rename selectors here; keep handler/layout loading separate.
*/

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; background:#0b1020; color:#e7eaf3; }

.app { display:flex; min-height:100vh; }
.sidebar { width:260px; background:#0f1730; border-right:1px solid rgba(255,255,255,0.08); padding:16px; }
.main { flex:1; display:flex; flex-direction:column; }

.brand { margin-bottom:16px; }
.brand-title { font-weight:700; font-size:18px; }
.brand-sub { font-size:12px; opacity:0.7; margin-top:4px; }

.nav { display:flex; flex-direction:column; gap:6px; margin-top:12px; }
.nav-item { display:block; padding:10px 10px; border-radius:10px; color:#e7eaf3; text-decoration:none; background:rgba(255,255,255,0.03); }
.nav-item:hover { background:rgba(255,255,255,0.06); }
.nav-item.active { background:rgba(120,140,255,0.18); border:1px solid rgba(120,140,255,0.25); }
.nav-item.disabled { opacity:0.45; cursor:not-allowed; }

.sidebar-foot { margin-top:16px; font-size:12px; opacity:0.7; }

.topbar { display:flex; align-items:center; justify-content:space-between; padding:14px 18px; border-bottom:1px solid rgba(255,255,255,0.08); background:#0c1430; }
.crumb { font-size:13px; opacity:0.8; }

.btn { display:inline-block; padding:8px 12px; border-radius:10px; background:rgba(255,255,255,0.06); color:#e7eaf3; text-decoration:none; border:1px solid rgba(255,255,255,0.10); }
.btn:hover { background:rgba(255,255,255,0.10); }

.content { padding:18px; }
h1 { margin:0 0 14px 0; font-size:22px; }

.cards { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:12px; }
.card { background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08); border-radius:14px; padding:14px; }
.card-title { font-weight:700; margin-bottom:8px; }
.card-body { opacity:0.9; }
.muted { opacity:0.7; }


/* --- Shared UI: cards, buttons, forms, tables, badges, flash --- */
/* -----------------------------------------------------------
   Admin Tables + Badges + Flash (Users/RBAC UI)
----------------------------------------------------------- */
.card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.flash{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.10);
  background:rgba(255,255,255,0.04);
  margin: 0 0 12px 0;
  font-size:13px;
}
.flash-ok{
  border-color: rgba(120,255,190,0.25);
  background: rgba(120,255,190,0.10);
}
.flash-err{
  border-color: rgba(255,120,120,0.25);
  background: rgba(255,120,120,0.10);
}

.tbl{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
}

.tbl thead th{
  text-align:left;
  font-size:12px;
  letter-spacing:0.2px;
  opacity:0.85;
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

.tbl tbody td{
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,0.06);
  font-size:13px;
  vertical-align:middle;
}

.tbl tbody tr:hover td{
  background: rgba(255,255,255,0.03);
}

.tbl tbody tr:last-child td{
  border-bottom:none;
}

.badge{
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  font-size:12px;
  line-height:1;
}

.badge-ok{
  border-color: rgba(120,255,190,0.30);
  background: rgba(120,255,190,0.12);
}

.badge-no{
  border-color: rgba(255,120,120,0.30);
  background: rgba(255,120,120,0.12);
}

/* Buttons: variants */
.btn.btn-ghost{
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.10);
}
.btn.btn-ghost:hover{
  background: rgba(255,255,255,0.07);
}

/* VOL5: danger button (Delete) */
.btn.btn-danger{
  background: rgba(255,120,120,0.10);
  border: 1px solid rgba(255,120,120,0.28);
}
.btn.btn-danger:hover{
  background: rgba(255,120,120,0.16);
}

.btn:disabled{
  opacity:0.55;
  cursor:not-allowed;
}

/* -----------------------------------------------------------
   Users list layout polish (VOL5)
----------------------------------------------------------- */

/* 1) Tee content laiemaks, et tabel ei oleks “kitsas” */
.content { 
  width:100%; 
  max-width:1600px; 
}

/* 2) Users table spacing */
.tbl thead th,
.tbl tbody td{
  padding: 12px 16px;
}

.tbl thead th{
  font-weight: 700;
}

/* Users columns widths (fallback) */
.tbl td:nth-child(1),
.tbl th:nth-child(1){ width: 12%; }
.tbl td:nth-child(2),
.tbl th:nth-child(2){ width: 12%; }
.tbl td:nth-child(3),
.tbl th:nth-child(3){ width: 22%; }
.tbl td:nth-child(4),
.tbl th:nth-child(4){ width: 8%;  white-space: nowrap; }
.tbl td:nth-child(5),
.tbl th:nth-child(5){ width: 16%; }

.tbl td:nth-child(6),
.tbl th:nth-child(6),
.tbl td:nth-child(7),
.tbl th:nth-child(7){
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tbl td:nth-child(8),
.tbl th:nth-child(8){
  width: 320px;
  white-space: nowrap;
}

.tbl-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:nowrap;
  white-space:nowrap;
}

.tbl-actions .inline-form,
.tbl-actions .form-inline{
  display:inline;
  margin:0;
}

.tbl td:last-child{ white-space: nowrap; }

/* Head / button spacing */
.card-head{
  margin-bottom: 16px;
}
.card-head .muted{
  max-width: 520px;
}
.card-head .btn{
  margin-left: 12px;
}

@media (max-width: 1100px){
  .content{ max-width: 100%; }
  .card-head{
    flex-direction: column;
    align-items: flex-start;
  }
  .card-head .btn{
    margin-left: 0;
    margin-top: 10px;
  }
  .tbl-actions{ flex-wrap:wrap; }
}

/* --- CSP-safe helpers (no inline styles) --- */
.logout-form{ margin:0; }
.form-inline{ display:inline; }

.debug-pre{
  white-space: pre-wrap;
  color:#fff;
  background:#300;
  padding:12px;
  border-radius:10px;
}

/* -----------------------------------------------------------
   Forms (Create Admin / future forms)
----------------------------------------------------------- */
.form{ margin-top: 8px; }

.form-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 720px;
}

.form .field span{ opacity: 0.85; }

.check{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:13px;
  opacity: 0.95;
  margin-top: 4px;
  margin-bottom: 14px;
}
.check input{
  width: 16px;
  height: 16px;
}

.form-actions{
  display:flex;
  gap:10px;
  margin-top: 0;
}

.form-inline{ display:inline; }

/* --- Roles UI helpers (CSP safe) --- */
.input-pill{
  padding:10px 12px;
  border-radius:12px;
  min-width:220px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.04);
  color:#e7eaf3;
  outline:none;
}
.select-pill{
  padding:10px 12px;
  border-radius:12px;
  min-width:260px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.04);
  color:#e7eaf3;
  outline:none;
}


/* --- Shared select/dropdown support --- */
/* -----------------------------------------------------------
   Dark select / dropdown support
----------------------------------------------------------- */
select,
.field select{
  background:#1a2135;
  color:#eef2ff;
  border:1px solid rgba(255,255,255,0.10);
}

select:focus,
.field select:focus{
  border-color:rgba(120,140,255,0.40);
  box-shadow:0 0 0 3px rgba(120,140,255,0.10);
  outline:none;
}

select option{
  background:#11182b;
  color:#eef2ff;
}

select optgroup{
  background:#11182b;
  color:#cfd7ee;
}

select:disabled,
.field select:disabled{
  opacity:0.65;
  cursor:not-allowed;
}

select,
.field select{
  background:rgba(255,255,255,0.04);
  color:#e7eaf3;
  border:1px solid rgba(255,255,255,0.10);
}

select option,
select optgroup{
  background:#0f1628;
  color:#e7eaf3;
}


/* --- Shared alert variants --- */
/* -----------------------------------------------------------
   Alert variants for settings/auth views
----------------------------------------------------------- */
.alert.success{
  border-color: rgba(120,255,190,0.25);
  background: rgba(120,255,190,0.10);
  color: #dff8ea;
}

.alert.error{
  border-color: rgba(255,120,120,0.25);
  background: rgba(255,120,120,0.10);
  color: #ffe1e1;
}

/* --- Shared spacing/utilities --- */
.mb-16 { margin-bottom: 16px; }
.grid-full { grid-column: 1 / -1; }
.wrap { flex-wrap: wrap; }
.pre-wrap { white-space: pre-wrap; }
.mt-8 { margin-top: 8px; }
.mt-6 { margin-top: 6px; }
.mb-16 {
  margin-bottom: 16px;
}

.grid-full {
  grid-column: 1 / -1;
}

.wrap {
  flex-wrap: wrap;
}

.m-0 {
  margin: 0;
}

.input-w-220 {
  max-width: 220px;
  min-width: 220px;
}

.input-w-260 {
  max-width: 260px;
  min-width: 260px;
}

.pre-wrap {
  white-space: pre-wrap;
}

.mt-4 {
  margin-top: 4px;
}

.mt-6 {
  margin-top: 6px;
}

.mt-8 {
  margin-top: 8px;
}


/* --- Sidebar section spacing polish --- */
/* -----------------------------------------------------------
   Sidebar section spacing polish
----------------------------------------------------------- */
.nav-section{
  margin-top: 22px;
  margin-bottom: 10px;
  padding-left: 6px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.86);
}

.nav-section:first-of-type{
  margin-top: 0;
}

.nav-section-platform-users{
  margin-top: 28px;
}

.nav + .nav-section{
  margin-top: 28px;
}

.sidebar .nav{
  margin-top: 0;
}

.sidebar .nav + .nav{
  margin-top: 10px;
}

/* --- Auth (login) --- */
.auth-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:
    radial-gradient(1200px 600px at 30% 10%, rgba(120,140,255,0.18), transparent 60%),
    radial-gradient(1200px 600px at 70% 90%, rgba(120,255,190,0.10), transparent 60%),
    #0b1020;
}

.auth-card{
  width:420px;
  max-width:100%;
  display:block;
  background:rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.10);
  border-radius:18px;
  padding:18px;
  box-shadow:0 10px 40px rgba(0,0,0,0.35);
}

.auth-head{ margin-bottom:14px; }
.auth-title{ font-size:22px; font-weight:800; }
.auth-sub{ font-size:13px; opacity:0.75; margin-top:4px; }

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

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:13px;
}
.field span{ opacity:0.8; }

.field input{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.04);
  color:#e7eaf3;
  outline:none;
}

.field input:focus{
  border-color:rgba(120,140,255,0.45);
  box-shadow:0 0 0 3px rgba(120,140,255,0.15);
}

.btn.primary{
  width:100%;
  text-align:center;
  padding:10px 12px;
  border-radius:12px;
  background:rgba(120,140,255,0.22);
  border:1px solid rgba(120,140,255,0.30);
  color:#e7eaf3;
  font-weight:700;
}
.btn.primary:hover{ background:rgba(120,140,255,0.28); }

.auth-foot{ margin-top:4px; font-size:12px; opacity:0.7; }

.alert{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  margin-bottom: 10px;
  font-size: 13px;
}
.alert.error{
  border-color: rgba(255,120,120,0.25);
  background: rgba(255,120,120,0.08);
}

/* --- Auth language selector (login) --- */
.auth-lang{
  display:flex;
  align-items:center;
  gap:8px;
  margin: 10px 0 12px 0;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

.lang-pill{
  display:inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #e7eaf3;
  text-decoration: none;
  font-size: 12px;
}
.lang-pill:hover{
  background: rgba(255,255,255,0.08);
}
.lang-pill.active{
  background: rgba(120,140,255,0.22);
  border-color: rgba(120,140,255,0.30);
  font-weight: 700;
}

/* ---  Shared UI > Native dark select support--- */
.field select {
  width: 100%;
  color-scheme: dark;
  background-color: #0f172a !important;
  color: #e7eaf3 !important;
  border: 1px solid rgba(120,140,255,0.35);
}

.field select option,
.field select optgroup {
  background-color: #0f172a !important;
  color: #e7eaf3 !important;
}