/* WayGo Super Admin V3 — navy & gold, 3D buttons, neon KPI cards. */
:root {
  --bg: #070f24;
  --bg2: #0b1631;
  --panel: #0d1a38;
  --panel2: #11214a;
  --line: rgba(120, 150, 220, .18);
  --text: #e9eefc;
  --muted: #93a3c7;
  --gold: #f6b919;
  --gold2: #ffd65a;
  --gold3: #b57a00;
  --green: #22d47b;
  --blue: #2f8cff;
  --purple: #9b5cff;
  --red: #ff4d5e;
  --teal: #1fd4c3;
  --orange: #ff9a2e;
  --pink: #ff5fa2;
  --grey: #9aa6bf;
  --radius: 16px;
  --font: "Segoe UI", "Tajawal", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
html[dir="rtl"] body { font-family: "Tajawal", "Segoe UI", system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.v3 { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh;
  background: radial-gradient(1200px 500px at 70% -10%, rgba(47,140,255,.12), transparent 60%), radial-gradient(900px 400px at 0% 100%, rgba(246,185,25,.08), transparent 60%), var(--bg); }

/* Sidebar */
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px; background: linear-gradient(180deg, #081335, #050c22);
  border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.brand { text-align: center; padding: 6px 0 14px; }
.brand img { width: 84px; height: 84px; border-radius: 20px; filter: drop-shadow(0 8px 18px rgba(246,185,25,.35)); }
.brand h1 { margin: 6px 0 0; font-size: 28px; font-weight: 900; background: linear-gradient(180deg, var(--gold2), var(--gold) 55%, var(--gold3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand h2 { margin: 2px 0 8px; font-size: 18px; font-weight: 800; color: #fff; }
.brand .pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #1a1200; background: linear-gradient(180deg, var(--gold2), var(--gold)); box-shadow: 0 4px 12px rgba(246,185,25,.35); }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: #c9d4f2; font-weight: 600; font-size: 15px; transition: background .2s, color .2s, transform .15s; }
.nav-link svg { flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; transform: translateX(2px); }
html[dir="rtl"] .nav-link:hover { transform: translateX(-2px); }
.nav-link.on { background: linear-gradient(180deg, var(--gold2), var(--gold) 60%, #e0a200); color: #1a1200; font-weight: 800; box-shadow: 0 6px 18px rgba(246,185,25,.35), inset 0 1px 0 rgba(255,255,255,.6); }
.nav-link .tag { margin-inline-start: auto; font-size: 10px; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.1); color: var(--muted); }
.side-foot { margin-top: auto; padding-top: 16px; text-align: center; }
.side-foot .city { height: 120px; border-radius: 14px; background: linear-gradient(180deg, transparent, rgba(246,185,25,.18)), repeating-linear-gradient(90deg, rgba(246,185,25,.25) 0 6px, transparent 6px 18px); mask-image: linear-gradient(180deg, transparent, #000 40%); }
.side-foot b { display: block; font-size: 24px; font-weight: 900; color: var(--gold); margin-top: 6px; }
.side-foot small { color: #c9d4f2; line-height: 1.5; }

/* Main */
.main { padding: 14px 20px 30px; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.top h1 { margin: 0; font-size: 26px; font-weight: 800; flex: 1; min-width: 220px; }
.top h1 b { color: var(--gold); }
.chip-ctl { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.chip-ctl select { background: transparent; color: var(--text); border: 0; outline: none; cursor: pointer; }
.chip-ctl select option { color: #000; }
.chip-ctl.gold { border-color: rgba(246,185,25,.6); box-shadow: 0 0 0 1px rgba(246,185,25,.2) inset; }
.live { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.live b { color: var(--text); font-weight: 700; }
.live i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-inline-end: 6px; box-shadow: 0 0 0 0 rgba(34,212,123,.7); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,212,123,0); } 100% { box-shadow: 0 0 0 0 rgba(34,212,123,0); } }
.bell { position: relative; padding: 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--gold); display: inline-flex; }
.bell span { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.me .av { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--gold2), var(--gold3)); display: grid; place-items: center; color: #1a1200; font-weight: 900; }
.me small { display: block; color: var(--gold); font-size: 12px; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lang a { padding: 7px 10px; font-size: 12px; font-weight: 800; color: var(--muted); }
.lang a.on { background: var(--gold); color: #1a1200; }

/* Family bar (3D buttons) */
.families { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 10px; margin: 8px 0 14px; }
.fam { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(180deg, #13244f, #0b1736);
  border: 1px solid rgba(120,160,255,.28); box-shadow: 0 6px 0 #050c22, 0 10px 20px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.12);
  transition: transform .12s, box-shadow .12s, border-color .2s; min-width: 0; }
.fam:hover { transform: translateY(-2px); border-color: rgba(246,185,25,.6); }
.fam:active { transform: translateY(4px); box-shadow: 0 2px 0 #050c22, 0 4px 10px rgba(0,0,0,.35); }
.fam .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; color: #fff;
  background: linear-gradient(160deg, #3c8bff, #1747b8); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 10px rgba(0,0,0,.35); }
.fam b { display: block; font-size: 14px; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fam small { display: block; font-size: 11px; color: var(--muted); }
.fam.on { background: linear-gradient(180deg, var(--gold2), var(--gold) 55%, #d69a00); border-color: #ffe38a; color: #1a1200;
  box-shadow: 0 6px 0 #8a5b00, 0 12px 26px rgba(246,185,25,.35), inset 0 1px 0 rgba(255,255,255,.7); }
.fam.on small { color: #3a2a00; }
.fam.on .ic { background: linear-gradient(160deg, #20305e, #0b1533); color: var(--gold2); }

/* Section heading */
.headline { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
.headline .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--gold); }
.headline h2 { margin: 0; font-size: 24px; font-weight: 800; }
.headline p { margin: 0; color: var(--muted); }
.wave { flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--blue), transparent); opacity: .6; }

/* KPI cards */
.kpis { display: grid; gap: 14px; }
.kpis.r1 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis.r2 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 14px; }
.kpi { --c: var(--blue); position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, #0b1736), #0a1430 70%);
  border: 1.5px solid color-mix(in srgb, var(--c) 75%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--c) 35%, transparent), inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .18s, box-shadow .18s; animation: rise .5s both; }
.kpi:hover { transform: translateY(-3px); box-shadow: 0 0 28px color-mix(in srgb, var(--c) 55%, transparent); }
.kpi .ic { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 85%, #fff), color-mix(in srgb, var(--c) 70%, #000));
  box-shadow: 0 8px 18px color-mix(in srgb, var(--c) 45%, transparent), inset 0 2px 0 rgba(255,255,255,.35); }
.kpi .lbl { font-size: 15px; color: #dbe4ff; }
.kpi .val { font-size: 30px; font-weight: 800; line-height: 1.15; direction: ltr; unicode-bidi: isolate; }
.kpi .tr { font-size: 13px; font-weight: 700; }
.kpi .tr.up { color: var(--green); } .kpi .tr.down { color: var(--red); } .kpi .tr.flat { color: var(--muted); font-weight: 600; }
.kpi .spark { position: absolute; inset-inline-end: 10px; bottom: 10px; width: 80px; height: 34px; opacity: .9; }
.kpi .detail { font-size: 12px; color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.c-green { --c: var(--green); } .c-blue { --c: var(--blue); } .c-gold { --c: var(--gold); } .c-purple { --c: var(--purple); }
.c-red { --c: var(--red); } .c-grey { --c: var(--grey); } .c-teal { --c: var(--teal); } .c-orange { --c: var(--orange); }

/* Panels & charts */
.charts { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 14px; margin-top: 16px; }
.panel { background: linear-gradient(180deg, rgba(17,33,74,.85), rgba(10,20,48,.9)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); min-width: 0; animation: rise .6s both; }
.panel h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 17px; font-weight: 800; }
.panel h3 svg { color: var(--gold); }
.chart-box { position: relative; height: 230px; }
.empty-chart { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 14px; padding: 20px; }
.legend { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.legend li:hover { color: var(--gold2); }
.legend i { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.legend span { margin-inline-start: auto; color: #dbe4ff; font-weight: 700; direction: ltr; }
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; }
.donut-wrap .chart-box { height: 160px; }
.geo { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: center; }
.geo .legend li { min-width: 0; }
.tn-map { width: 100%; height: auto; max-height: 520px; display: block; direction: ltr; }
.tn-map path { stroke: #4f8dff; stroke-width: 1.1; stroke-linejoin: round; transition: fill .2s; cursor: pointer; }
.tn-map a:hover path, .tn-map path.on { fill: rgba(246,185,25,.55); stroke: #f6b919; }
.tn-map text { font: 700 16px system-ui, 'Segoe UI', Tahoma, sans-serif; fill: #c9d5f2; paint-order: stroke; stroke: #0b1530; stroke-width: 4px; pointer-events: none; }
.tn-map text.hot { fill: #ffd257; font-weight: 800; }
.tn-map .lead { stroke: #8fa6d8; stroke-width: .8; stroke-dasharray: 2 2; }

/* Table */
.table-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 22px 0 10px; }
.table-head h2 { margin: 0; font-size: 22px; font-weight: 800; flex: 1; min-width: 240px; display: flex; align-items: center; gap: 10px; }
.table-head h2 svg { color: var(--gold); }
.ctl { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); outline: none; }
.ctl:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246,185,25,.18); }
.ctl option { color: #000; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); min-width: 300px; }
.search input { background: transparent; border: 0; color: var(--text); padding: 9px 0; outline: none; width: 100%; }
.btn3d { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 0; cursor: pointer; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, #2ee68e, #12a35c); box-shadow: 0 4px 0 #0b6a3c, 0 8px 16px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.4); transition: transform .1s, box-shadow .1s; }
.btn3d:active { transform: translateY(3px); box-shadow: 0 1px 0 #0b6a3c; }
.btn3d.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1a1200; box-shadow: 0 4px 0 #8a5b00, 0 8px 16px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.6); }
.btn3d.ghost { background: var(--panel2); box-shadow: 0 4px 0 #050c22; color: var(--text); }
.grid-wrap { border-radius: var(--radius); border: 1px solid rgba(246,185,25,.35); overflow: auto; background: rgba(8,16,38,.85); }
table.xl { width: 100%; border-collapse: collapse; min-width: 1350px; font-size: 13.5px; }
.xl th { position: sticky; top: 0; background: linear-gradient(180deg, #1a2a58, #142249); color: var(--gold2); font-weight: 800; padding: 10px 8px; text-align: start; white-space: nowrap; border-bottom: 1px solid rgba(246,185,25,.35); }
.xl th a { display: inline-flex; gap: 4px; align-items: center; }
.xl td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.xl tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.xl tr:hover td { background: rgba(246,185,25,.06); }
.xl .num { text-align: end; direction: ltr; unicode-bidi: isolate; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(246,185,25,.6); background: linear-gradient(135deg, #22356c, #101d40); display: grid; place-items: center; font-weight: 800; color: var(--gold2); }
.svc { display: inline-flex; align-items: center; gap: 6px; }
.svc svg { color: var(--gold); }
.badge { display: inline-block; padding: 4px 10px; border-radius: 8px; font-weight: 800; font-size: 12px; }
.b-active { background: linear-gradient(180deg, #27d988, #14a862); color: #fff; }
.b-pending { background: linear-gradient(180deg, #ffb53d, #e98900); color: #fff; }
.b-suspended { background: linear-gradient(180deg, #ff5a6a, #d82738); color: #fff; }
.acts { display: flex; gap: 6px; }
.act { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 800; border: 0; cursor: pointer; color: #fff;
  box-shadow: 0 3px 0 rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.3); transition: transform .1s, filter .15s; }
.act:hover { filter: brightness(1.12); } .act:active { transform: translateY(2px); box-shadow: none; }
.act.view { background: linear-gradient(180deg, #4b9bff, #1b62d6); }
.act.edit { background: linear-gradient(180deg, #d9a52b, #a87300); }
.act.off { background: linear-gradient(180deg, #ff5a6a, #c81f30); }
.act.on { background: linear-gradient(180deg, #2ee68e, #12a35c); }
.act.del { background: linear-gradient(180deg, #f2394d, #a3121f); }
.act[disabled] { opacity: .45; cursor: not-allowed; }
.foot-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; color: var(--muted); }
.pager { display: flex; gap: 6px; margin-inline-start: auto; }
.pager a, .pager span { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 9px; display: grid; place-items: center; border: 1px solid rgba(246,185,25,.45); color: var(--text); font-weight: 700; }
.pager .on { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1a1200; border-color: var(--gold); }
.empty-row { text-align: center; padding: 40px 10px !important; color: var(--muted); }

/* Alerts & modal */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; font-weight: 700; }
.flash.ok { background: rgba(34,212,123,.12); border: 1px solid rgba(34,212,123,.5); color: #8ff0bd; }
.flash.err { background: rgba(255,77,94,.12); border: 1px solid rgba(255,77,94,.5); color: #ffb3bb; }
dialog.modal { border: 1px solid rgba(246,185,25,.5); border-radius: 18px; background: linear-gradient(180deg, #13244f, #0b1736); color: var(--text); padding: 22px; width: min(460px, 92vw); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
dialog.modal::backdrop { background: rgba(3,8,20,.7); backdrop-filter: blur(3px); }
dialog.modal h3 { margin: 0 0 10px; color: var(--gold2); }
dialog.modal label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
dialog.modal input, dialog.modal textarea, dialog.modal select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
dialog.modal .row-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.menu-btn { display: none; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 1400px) { .families { grid-template-columns: repeat(5, minmax(0, 1fr)); } .charts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1100px) { .kpis.r1 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpis.r2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .v3 { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; width: 260px; inset-block: 0; inset-inline-start: 0; transform: translateX(-100%); transition: transform .2s; }
  html[dir="rtl"] .side { transform: translateX(100%); }
  .side.open { transform: none !important; }
  .menu-btn { display: inline-flex; }
  .families { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .charts, .kpis.r1, .kpis.r2 { grid-template-columns: 1fr; }
  .search { min-width: 0; flex: 1; }
}

/* Compact family buttons: full labels on desktop */
.fam { padding: 9px 10px; gap: 8px; }
.fam .ic { width: 32px; height: 32px; border-radius: 10px; }
.fam .ic svg { width: 19px; height: 19px; }
.fam b { font-size: 13px; letter-spacing: 0; overflow: visible; }
/* Compact table, actions column always visible */
table.xl { min-width: 1100px; font-size: 12.8px; }
.xl th, .xl td { padding: 7px 6px; }
.avatar { width: 30px; height: 30px; }
.act { padding: 6px 8px; }

/* Actions: icons (with tooltips); labels come back on very wide screens */
.act .lbl { display: none; }
.act { width: 32px; height: 30px; justify-content: center; padding: 0; }
@media (min-width: 1880px) { .act .lbl { display: inline; } .act { width: auto; padding: 6px 9px; } }

/* Long names and categories wrap so the whole row fits on a laptop screen */
.xl td.wrap { white-space: normal; min-width: 100px; max-width: 160px; line-height: 1.25; }

/* Headers wrap on two lines, so columns are as wide as their values */
.xl th { white-space: normal; line-height: 1.2; vertical-align: bottom; }
table.xl { min-width: 980px; }

/* Geographic section: real governorate map + ranking */
.geo-panel { margin-top: 14px; }
.geo-panel h3 small { font-weight: 600; font-size: 13px; }
.geo-grid { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 24px; align-items: start; }
.geo-rank { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 22px; }
.geo-rank li { display: grid; grid-template-columns: 110px 1fr 44px 52px; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; cursor: pointer; font-size: 13px; background: rgba(120,150,220,.05); }
.geo-rank li:hover, .geo-rank li.on { background: rgba(246,185,25,.12); }
.geo-rank b { font-weight: 700; color: #e6edff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.geo-rank .bar { height: 8px; border-radius: 6px; background: rgba(120,150,220,.12); overflow: hidden; }
.geo-rank .bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #2f8cff, #1fd4c3); }
.geo-rank em { font-style: normal; font-weight: 800; color: #fff; text-align: end; direction: ltr; }
.geo-rank small { color: #8fa6d8; text-align: end; direction: ltr; }
@media (max-width: 1280px) { .geo-rank { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .geo-grid { grid-template-columns: 1fr; } .geo-grid .tn-map { max-height: 460px; margin: 0 auto; width: auto; } }

/* Shared page pieces (V3 pages) */
.muted { color: var(--muted); }
.crumbs { margin: 4px 0 12px; font-weight: 700; }
.crumbs a { color: var(--gold); }
.profile { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile .av { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; font-weight: 900; color: #1a1200; background: linear-gradient(135deg, var(--gold2), var(--gold3)); flex-shrink: 0; }
.profile .who { min-width: 0; }
.profile h2 { margin: 0 0 4px; font-size: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile p { margin: 2px 0; color: #c9d4f2; font-size: 14px; }
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv th { text-align: start; color: var(--muted); font-weight: 600; padding: 7px 10px 7px 0; width: 38%; vertical-align: top; }
.kv td { padding: 7px 0; color: #fff; border-bottom: 1px solid rgba(255,255,255,.05); }
.line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 14px; }
.line > :last-child { margin-inline-start: auto; }
.line small { color: var(--muted); }
.line code { color: var(--gold2); font-size: 13px; }
.tabs { display: flex; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
.tabs a { padding: 9px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: #c9d4f2; font-weight: 700; }
.tabs a.on { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1a1200; border-color: transparent; }
.b-info { background: linear-gradient(180deg, #4ea2ff, #1f6fe0); color: #fff; }
.b-grey { background: rgba(255,255,255,.12); color: #dbe4ff; }
.stars { color: var(--gold); letter-spacing: 1px; white-space: nowrap; }
.chk { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.03); font-size: 13px; }
.chk i { width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.chk.ok i { background: var(--green); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; align-items: end; }
.form-grid label, .panel form label { display: block; font-size: 13px; font-weight: 700; color: #c9d4f2; margin: 8px 0 5px; }
.panel input:not([type=checkbox]):not([type=radio]), .panel select, .panel textarea { width: 100%; box-sizing: border-box; min-height: 40px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line); background: rgba(6,13,34,.7); color: #fff; font: inherit; }
.panel textarea { min-height: 80px; }
.panel select option { color: #000; }
.nav-group { margin-top: 10px; }
.nav-group > summary { list-style: none; cursor: pointer; padding: 6px 12px; font-size: 11px; font-weight: 800; letter-spacing: 1.4px; color: var(--gold); display: flex; align-items: center; justify-content: space-between; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: '▾'; color: var(--muted); }
.nav-group:not([open]) > summary::after { content: '▸'; }
.nav-group .nav-link { padding: 8px 12px; font-size: 14px; }
.map-box { height: 520px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
@media (max-width: 1100px) { .charts { grid-template-columns: 1fr !important; } }

/* Compact people tables: actions always visible without horizontal scroll */
table.xl { min-width: 0; font-size: 12.5px; }
.xl th, .xl td { padding: 7px 5px; }
.xl td.wrap { max-width: 140px; }
.xl td.when { line-height: 1.2; }
.who-cell { display: inline-flex; align-items: center; gap: 7px; color: inherit; }
.who-cell .avatar { width: 28px; height: 28px; font-size: 13px; flex-shrink: 0; }
.xl .acts { gap: 4px; flex-wrap: nowrap; }
.xl .act { width: 28px; height: 28px; }
.xl .badge { padding: 3px 8px; font-size: 11.5px; }

/* V2 screens inside the V3 shell */
.v3-frame-wrap { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #081335; min-height: 420px; }
.v3-frame-wrap iframe { display: block; width: 100%; height: 640px; border: 0; background: #081335; }
.v3-frame-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-weight: 700; pointer-events: none; }
.v3-frame-wrap.ready .v3-frame-loading { display: none; }

/* People search panel */
.filters { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(5, minmax(140px, 1fr)) auto; gap: 10px 12px; align-items: end; margin: 0 0 12px; padding: 14px 16px; }
.filters label { display: block; font-size: 12px; font-weight: 700; color: #c9d4f2; margin: 0 0 5px; }
.filters .inp { position: relative; }
.filters .inp svg { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.filters .inp input { padding-inline-start: 34px !important; }
.filters select:disabled { opacity: .5; }
.filters .f-btns { display: flex; gap: 8px; }
.filters .f-btns .btn3d { min-height: 40px; white-space: nowrap; }
@media (max-width: 1500px) { .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); } .filters .f-q { grid-column: span 2; } }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr; } .filters .f-q { grid-column: auto; } }
.region-tag { margin: 10px 4px; padding: 10px 12px; border-radius: 12px; background: rgba(246,185,25,.1); border: 1px solid rgba(246,185,25,.35); color: #ffd65a; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
dialog.modal.wide { width: min(860px, 94vw); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; padding: 4px; }
.perm-grid fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin: 0; }
.perm-grid legend { color: var(--gold2); font-weight: 800; font-size: 12px; text-transform: uppercase; padding: 0 4px; }
dialog.modal label.perm { display: flex; align-items: flex-start; gap: 6px; color: #dbe4ff; font-size: 12.5px; margin: 4px 0; }
dialog.modal label.perm input { width: auto; margin-top: 2px; }
.ad-thumb { width: 150px; aspect-ratio: 16 / 9; object-fit: contain; background: #0b1a2e; border-radius: 10px; display: block; border: 1px solid var(--line); }
.act.perm { background: linear-gradient(180deg, #a77bff, #6b3fd6); }
.acts form { display: inline-flex; margin: 0; }
/* Sign-out button in the top bar */
.top-logout { margin: 0; }
.logout-btn { background: linear-gradient(180deg, #ff5a6a, #c81f30) !important; color: #fff !important; box-shadow: 0 4px 0 #7a0f1a, 0 8px 18px rgba(200,31,48,.35) !important; display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; }
@media (max-width: 900px) { .logout-btn span { display: none; } }

/* Sign-in pages (login, first password) */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.lg-card { width: min(100%, 980px); display: grid; grid-template-columns: 1.05fr 1fr; border-radius: 26px; overflow: hidden;
    background: linear-gradient(160deg, rgba(23,38,82,.96), rgba(9,18,44,.98)); border: 1px solid rgba(246,185,25,.35);
    box-shadow: 0 30px 90px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06); }
.lg-hero { position: relative; padding: 30px 30px 22px; background: radial-gradient(circle at 30% 20%, rgba(47,140,255,.22), transparent 60%), linear-gradient(180deg, #0f1d44, #0a1430);
    border-inline-end: 1px solid rgba(246,185,25,.18); display: flex; flex-direction: column; gap: 18px; }
.lg-brand { display: flex; align-items: center; gap: 14px; }
.lg-brand img { width: 62px; height: 62px; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(246,185,25,.35)); }
.lg-brand b { display: block; font-size: 27px; color: #fff; letter-spacing: .5px; }
.lg-brand small { display: block; color: var(--gold, #f6b919); font-size: 11px; letter-spacing: 2.5px; font-weight: 800; }
.lg-hero p { margin: 0; color: #b7c4e6; line-height: 1.6; font-size: 14px; }
.lg-hero .tn-map { max-height: 470px; margin: 0 auto; width: auto; }
.lg-hero .tn-map path { cursor: default; }
.lg-form { padding: 38px 34px; display: flex; flex-direction: column; }
.lg-form .tag { color: var(--gold, #f6b919); font-size: 12px; font-weight: 800; letter-spacing: 1.6px; }
.lg-form h1 { margin: 8px 0 6px; font-size: 28px; color: #fff; }
.lg-form .sub { margin: 0 0 20px; color: #9fb0d6; font-size: 14px; line-height: 1.55; }
.lg-lang { display: flex; gap: 8px; margin-bottom: 20px; }
.lg-lang a { padding: 7px 13px; border-radius: 9px; border: 1px solid rgba(143,166,216,.35); color: #dbe4ff; text-decoration: none; font-size: 12px; font-weight: 700; }
.lg-lang a.on { background: linear-gradient(180deg, #ffd257, #e3a500); color: #1a1300; border-color: transparent; }
.lg-form label { display: block; font-weight: 700; font-size: 13px; color: #dbe4ff; margin: 14px 0 6px; }
.lg-field { position: relative; }
.lg-field > svg { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: #8fa6d8; pointer-events: none; }
.lg-form input[type=email], .lg-form input[type=password], .lg-form input[type=text] { width: 100%; min-height: 48px; padding: 11px 14px; padding-inline-start: 42px; border-radius: 12px;
    border: 1px solid rgba(143,166,216,.35); background: rgba(6,13,34,.75); color: #fff; font: inherit; font-size: 15px; box-sizing: border-box; }
.lg-form input:focus { outline: 2px solid rgba(246,185,25,.7); outline-offset: 1px; border-color: transparent; }
.lg-eye { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: #8fa6d8; cursor: pointer; padding: 6px; }
.lg-submit { margin-top: 22px; width: 100%; min-height: 50px; justify-content: center; font-size: 16px; }
.lg-err { background: rgba(255,90,106,.12); border: 1px solid rgba(255,90,106,.5); color: #ffb3bb; border-radius: 12px; padding: 11px 13px; font-size: 13px; margin-bottom: 4px; }
.lg-foot { margin-top: auto; padding-top: 22px; font-size: 12px; color: #7f8fb5; display: flex; align-items: center; gap: 8px; }
.lg-form .wg-altcha-box { background: rgba(6,13,34,.75); border-color: rgba(143,166,216,.35); color: #dbe4ff; }
@media (max-width: 820px) { .lg-card { grid-template-columns: 1fr; } .lg-hero .tn-map { display: none; } .lg-hero { padding: 24px 22px; } .lg-form { padding: 26px 22px; } }
.pw-rules { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; color: #9fb0d6; }
.pw-rules li::before { content: '○ '; color: #ff8a96; }
.pw-rules li.ok { color: #7ff0b5; }
.pw-rules li.ok::before { content: '✓ '; color: #22d47b; }
/* Sign-out: icon under the administrator name */
.me-out { margin: 3px 0 0; }
.me-out button { display: inline-grid; place-items: center; width: 26px; height: 22px; padding: 0; border: 1px solid rgba(255,90,106,.55); border-radius: 7px; background: rgba(255,90,106,.12); color: #ff8a96; cursor: pointer; }
.me-out button:hover { background: #e23347; color: #fff; }
