/* Super Admin shell — builds on app.css brand tokens (#1e326c). */

.nav-right { margin-left:auto; display:flex; align-items:center; gap:10px; }
.clock { color:#fff; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:12px;
         background:rgba(255,255,255,.12); padding:5px 10px; border-radius:8px; white-space:nowrap; }
.icon-btn { background:rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.18); color:#fff;
            width:34px; height:34px; border-radius:8px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.icon-btn:hover { background:rgba(255,255,255,.22); }
.usermenu { position:relative; }
.user-trigger { display:flex; align-items:center; gap:9px; background:rgba(255,255,255,.12);
                border:1px solid rgba(255,255,255,.18); color:#fff; border-radius:22px; padding:4px 10px 4px 4px; cursor:pointer; }
.user-trigger:hover { background:rgba(255,255,255,.22); }
.avatar { width:28px; height:28px; border-radius:50%; background:#fff; color:var(--brand);
          font-weight:700; font-size:12px; display:flex; align-items:center; justify-content:center; }
.user-name { font-size:13px; font-weight:600; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dropdown { position:absolute; right:0; top:46px; background:#fff; border:1px solid #e5e7eb; border-radius:10px;
            box-shadow:0 14px 36px rgba(0,0,0,.18); min-width:230px; padding:8px; z-index:80; display:none; }
.dropdown.open { display:block; }
.dd-head { padding:8px 10px 10px; border-bottom:1px solid #eef0f3; margin-bottom:6px; }
.dd-head .n { font-weight:700; color:#111827; font-size:14px; }
.dd-head .e { color:#6b7280; font-size:12px; }
.chip { font-family:ui-monospace,Menlo,Consolas,monospace; font-size:11px; background:var(--brand-50); color:var(--brand);
        border:1px solid #dbe3ff; border-radius:6px; padding:2px 7px; display:inline-block; margin:6px 4px 0 0; }
.dd-item { display:flex; align-items:center; gap:10px; width:100%; text-align:left; background:none; border:0;
           font:inherit; color:#374151; padding:9px 10px; border-radius:7px; cursor:pointer; }
.dd-item:hover { background:#f3f5f8; } .dd-item i { width:16px; color:var(--brand); text-align:center; }
.dd-item.danger { color:#b42318; } .dd-item.danger i { color:#b42318; }
.dd-divider { height:1px; background:#eef0f3; margin:6px 4px; }

/* sidebar */
.admin-side { width:240px; background:#fff; border-right:1px solid #e5e7eb; padding:14px 10px; transition:width .2s ease, padding .2s ease; }
.menu-label { font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:#9aa7b5; margin:6px 10px 8px; }
.menu-item { display:flex; align-items:center; gap:11px; padding:11px 12px; border-radius:9px; color:#374151;
             font-weight:600; font-size:14px; cursor:pointer; text-decoration:none; margin-bottom:2px; }
.menu-item i { width:18px; text-align:center; color:#9aa7b5; }
.menu-item:hover { background:#f3f5f8; }
.menu-item.active { background:var(--brand-50); color:var(--brand); }
.menu-item.active i { color:var(--brand); }
.tree-head { display:flex; align-items:center; }
.tree-head .menu-item { flex:1; min-width:0; }
.tree-toggle { background:none; border:0; cursor:pointer; color:#9aa7b5; width:20px; flex:none; padding:6px 0; font-size:11px; display:flex; align-items:center; justify-content:center; }
.tree-toggle i { transition:transform .15s; }
.tree-node.expanded > .tree-head .tree-toggle i { transform:rotate(90deg); }
.submenu { display:none; flex-direction:column; margin:2px 0 4px; }
.tree-node.expanded > .submenu { display:flex; }
.menu-item.sub { padding:7px 12px 7px 34px; font-size:13px; border-radius:8px; }
.menu-item.sub i { font-size:11px; width:14px; }
.submenu-empty { padding:6px 12px 6px 34px; color:#9aa7b5; font-size:12px; }
.menu-item.sub .tw-caret { width:13px; display:inline-flex; align-items:center; justify-content:center; color:#9aa7b5; font-size:10px; flex:none; }
.menu-item.sub .tw-caret.empty { visibility:hidden; }
.menu-item.sub .tw-label { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.menu-item.sub .tw-add { color:#9aa7b5; padding:0 6px; opacity:0; flex:none; border-radius:5px; }
.menu-item.sub:hover .tw-add { opacity:1; }
.menu-item.sub .tw-add:hover { color:var(--brand); background:#e2e8f0; }
.tree-head .tree-add { background:none; border:0; color:#9aa7b5; cursor:pointer; padding:6px 10px; font-size:12px; flex:none; }
.tree-head .tree-add:hover { color:var(--brand); }
/* Per-company branch: expands into Settings / Licensing / Invoicing / Activity */
.co-branch .co-caret { cursor:pointer; }
.co-branch .co-caret i { transition:transform .15s; }
.co-branch.open > .menu-item .co-caret i { transform:rotate(90deg); }
.co-subs { display:none; flex-direction:column; margin:1px 0 3px; }
.co-branch.open > .co-subs { display:flex; }
.menu-item.co-sub2 { padding:6px 12px 6px 52px; font-size:12.5px; }
.menu-item.co-sub2 i { font-size:11px; width:14px; }
/* Company sub-pages (licensing / invoicing / activity) tables */
.sub-tbl { width:100%; border-collapse:collapse; font-size:13.5px; }
.sub-tbl th, .sub-tbl td { padding:7px 10px; border-bottom:1px solid #eef0f3; text-align:left; }
.sub-tbl thead th { color:var(--brand); font-size:12px; border-bottom:2px solid #e5e7eb; }
.sub-tbl tbody tr:hover { background:#f9fafb; }
.sub-tbl td.over { color:#dc2626; font-weight:700; }
.sub-tbl tfoot td { border-bottom:0; }
.act-tbl td { font-size:13px; }

.admin-main { flex:1; padding:24px; max-width:1120px; overflow-x:hidden; }
.page-title { font-size:22px; font-weight:700; color:#111827; margin:0 0 4px; }
.page-sub { color:#6b7280; margin:0 0 20px; font-size:14px; }

.cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:14px; margin-bottom:22px; }
.card { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:16px 18px; }
.stat .k { font-size:11px; color:#6b7280; font-weight:700; text-transform:uppercase; letter-spacing:.4px; }
.stat .v { font-size:28px; font-weight:800; color:var(--brand); margin-top:6px; line-height:1; }
.stat .i { float:right; color:var(--brand); opacity:.35; font-size:20px; }
.section { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:20px; margin-bottom:18px; }
.settings-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:18px; align-items:stretch; }
.settings-grid .section { margin-bottom:0; height:100%; }
@media (max-width:1100px){ .settings-grid { grid-template-columns:1fr 1fr; } }
@media (max-width:760px){ .settings-grid { grid-template-columns:1fr; } }
.section h2 { font-size:15px; margin:0 0 14px; color:var(--brand); }
.kv { display:grid; grid-template-columns:auto 1fr; gap:8px 16px; font-size:13.5px; }
.kv dt { color:#6b7280; } .kv dd { margin:0; font-family:ui-monospace,Menlo,Consolas,monospace; }

.bar { height:12px; background:#eef0f3; border-radius:999px; overflow:hidden; margin:8px 0; }
.bar > span { display:block; height:100%; background:linear-gradient(90deg,var(--brand),var(--brand-700)); }
.spark { display:flex; align-items:flex-end; gap:2px; height:70px; }
.spark > i { flex:1; background:var(--brand); opacity:.75; border-radius:2px 2px 0 0; min-height:2px; }

.tbl { width:100%; border-collapse:collapse; }
.tbl th { text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.4px; color:#6b7280; padding:10px 12px; border-bottom:2px solid #eef0f3; }
.tbl td { padding:11px 12px; border-bottom:1px solid #f1f3f6; font-size:14px; vertical-align:middle; }
.tbl tr:hover td { background:#fafbfc; }
.badge { font-size:11px; font-weight:700; padding:2px 9px; border-radius:999px; }
.badge.on { background:#dff3e6; color:#1c6b3f; } .badge.off { background:#fceedd; color:#8a4b12; }
.rowact { display:flex; gap:6px; flex-wrap:wrap; }
.mini { font:inherit; font-size:12px; font-weight:600; border:1px solid #e5e7eb; background:#fff; color:#374151;
        border-radius:7px; padding:5px 9px; cursor:pointer; }
.mini:hover { border-color:var(--brand); color:var(--brand); }
.mini.danger:hover { border-color:#dc2626; color:#dc2626; }

.btn.secondary { background:#fff; color:var(--brand); border:1px solid var(--brand); }
.btn.danger { background:#dc2626; }
.btn:disabled { opacity:.6; cursor:default; }

.f-row { margin-bottom:14px; } .f-row label { display:block; font-size:13px; font-weight:600; color:#374151; margin-bottom:6px; }
.f-in { width:100%; padding:10px 12px; border:1.5px solid #e5e7eb; border-radius:8px; font-size:14px; background:#f9fafb; box-sizing:border-box; }
.f-in:focus { outline:none; border-color:var(--brand); background:#fff; }
.f-in[readonly] { background:#f1f3f6; color:#6b7280; }
.f-two { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
textarea.f-in { resize:vertical; min-height:64px; font-family:inherit; }
.switch { display:inline-flex; align-items:center; gap:10px; width:auto; height:auto; background:none; border-radius:0; font-size:14px; color:#374151; cursor:pointer; line-height:1.3; vertical-align:middle; }
.switch::after { content:none; }
.switch > input[type="checkbox"] { -webkit-appearance:none; appearance:none; position:relative; flex:0 0 auto; width:42px; height:23px; margin:0; background:#cbd5e1; border-radius:999px; cursor:pointer; transition:background .2s; }
.switch > input[type="checkbox"]::after { content:""; position:absolute; top:2.5px; left:3px; width:18px; height:18px; background:#fff; border-radius:50%; box-shadow:0 1px 2px rgba(0,0,0,.25); transition:left .2s; }
.switch > input[type="checkbox"]:checked { background:var(--brand); }
.switch > input[type="checkbox"]:checked::after { left:21px; }

.overlay { position:fixed; inset:0; background:rgba(15,23,34,.5); display:none; align-items:center; justify-content:center; z-index:100; padding:16px; }
.overlay.open { display:flex; }
.modal { background:#fff; border-radius:14px; width:520px; max-width:94vw; box-shadow:0 24px 60px rgba(0,0,0,.3); max-height:92vh; display:flex; flex-direction:column; }
.modal.sm { width:420px; }
.modal-head { padding:18px 20px; border-bottom:1px solid #eef0f3; display:flex; align-items:center; justify-content:space-between; }
.modal-head h3 { margin:0; font-size:16px; color:var(--brand); }
.modal-head .x { background:none; border:0; font-size:18px; color:#9aa7b5; cursor:pointer; }
.modal-body { padding:20px; overflow:auto; }
.modal-foot { padding:16px 20px; border-top:1px solid #eef0f3; display:flex; gap:10px; justify-content:flex-end; }
.m-msg { font-size:13px; margin-top:12px; display:none; } .m-msg.err { color:#b42318; display:block; } .m-msg.ok { color:#16a34a; display:block; }
.codebox { font-family:ui-monospace,Menlo,Consolas,monospace; font-size:12.5px; background:#0f1b22; color:#cfe3e0;
           border-radius:8px; padding:12px; word-break:break-all; margin-top:10px; }

.toast { position:fixed; bottom:22px; left:50%; transform:translateX(-50%); background:#111827; color:#fff;
         padding:11px 18px; border-radius:10px; font-size:13.5px; box-shadow:0 10px 30px rgba(0,0,0,.3); display:none; z-index:120; }
.toast.show { display:block; }
.extra-row { display:grid; grid-template-columns:1fr 1fr auto; gap:8px; margin-bottom:8px; }
.extra-row .mini { padding:8px 10px; }

/* Logo upload widget */
.logo-up { display:flex; gap:16px; align-items:flex-start; }
.logo-preview { width:84px; height:84px; border:1.5px solid #e5e7eb; border-radius:12px; background:#f9fafb;
                display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0; }
.logo-preview img { width:100%; height:100%; object-fit:contain; display:none; }
.logo-empty { color:#9aa7b5; font-size:12px; }
.logo-ctrls { display:flex; flex-direction:column; gap:8px; align-items:flex-start; }
.logo-hint { font-size:11.5px; color:#9aa7b5; }
.logo-thumb { width:22px; height:22px; border-radius:5px; object-fit:contain; background:#fff; border:1px solid #eef0f3; vertical-align:middle; }

/* responsive helpers */
.two-col { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.nav-burger { display:inline-flex; align-items:center; background:none; border:0; color:#fff; font-size:18px; cursor:pointer; padding:4px 8px; margin-right:2px; }
/* Desktop fold: collapse the sidebar to zero width (content reflows to fill). */
@media (min-width:901px) {
    body.side-collapsed .admin-side { width:0; padding:0; overflow:hidden; border:none; }
}
.side-backdrop { display:none; position:fixed; inset:45px 0 0 0; background:rgba(0,0,0,.35); z-index:85; }

@media (max-width:900px) {
    .nav-burger { display:inline-flex; }
    .admin-side { position:fixed; top:45px; left:0; bottom:0; width:250px; z-index:90;
                  transform:translateX(-100%); transition:transform .25s ease; box-shadow:0 12px 40px rgba(0,0,0,.25); overflow:auto; }
    body.side-open .admin-side { transform:none; }
    body.side-open .side-backdrop { display:block; }
    .admin-main { padding:16px; }
    .two-col { grid-template-columns:1fr; }
    .clk-date, .clk-tz { display:none; }
    .user-name { display:none; }
}
@media (max-width:560px) {
    .f-two { grid-template-columns:1fr; }
    .clock { display:none; }
    .modal-body { padding:16px; }
    .extra-row { grid-template-columns:1fr 1fr; }
    .extra-row .mini { grid-column:1 / -1; }
}

/* ============================================================
   Full-width pages + dashboard data-visualisations (no libs)
   ============================================================ */
.admin-main.full { max-width:none; }

.dash-grid { display:grid; gap:18px; grid-template-columns:repeat(12,1fr); }
.dash-grid > .section { margin-bottom:0; }
.col-3 { grid-column:span 3; }
.col-4 { grid-column:span 4; }
.col-6 { grid-column:span 6; }
.col-8 { grid-column:span 8; }
.col-12 { grid-column:span 12; }
@media (max-width:1200px){ .col-3{grid-column:span 6;} .col-4{grid-column:span 6;} .col-8{grid-column:span 12;} }
@media (max-width:820px){ .dash-grid{grid-template-columns:1fr;} .col-3,.col-4,.col-6,.col-8,.col-12{grid-column:1/-1;} }

.section .sub { font-weight:400; color:#6b7280; font-size:12px; }

/* donut + legend */
.donut-wrap { display:flex; align-items:center; gap:20px; flex-wrap:wrap; }
.donut { width:128px; height:128px; flex:none; }
.donut .val { transition:stroke-dasharray .6s ease; }
.donut-center { font-size:22px; font-weight:800; fill:#111827; }
.donut-sub { font-size:9px; fill:#6b7280; letter-spacing:.4px; }
.legend { display:flex; flex-direction:column; gap:9px; font-size:13px; min-width:150px; flex:1; }
.legend .li { display:flex; align-items:center; gap:9px; }
.legend .dot { width:11px; height:11px; border-radius:3px; flex:none; }
.legend .lt { color:#374151; }
.legend .lv { margin-left:auto; font-weight:800; font-family:ui-monospace,Menlo,Consolas,monospace; color:#111827; }

/* horizontal bars */
.hbars { display:flex; flex-direction:column; gap:13px; }
.hbar { display:grid; grid-template-columns:minmax(90px,150px) 1fr 44px; align-items:center; gap:12px; font-size:13px; }
.hbar .lbl { color:#374151; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.hbar .track { height:15px; background:#eef0f3; border-radius:999px; overflow:hidden; }
.hbar .fill { height:100%; background:linear-gradient(90deg,var(--brand),var(--brand-700)); border-radius:999px; transition:width .6s ease; min-width:2px; }
.hbar .num { font-weight:800; font-family:ui-monospace,Menlo,Consolas,monospace; color:#111827; text-align:right; }
.hbar.g2 .fill { background:linear-gradient(90deg,#0ea5e9,#0369a1); }
.empty-hint { color:#9aa7b5; font-size:13px; padding:6px 0; }

/* area chart */
.chart-meta { display:flex; gap:26px; margin-bottom:12px; flex-wrap:wrap; }
.chart-meta .m .n { font-size:11px; color:#6b7280; text-transform:uppercase; letter-spacing:.4px; font-weight:700; }
.chart-meta .m .x { font-size:22px; font-weight:800; color:var(--brand); line-height:1.1; }
.area-chart { width:100%; height:160px; display:block; }
.area-axis { font-size:10px; color:#9aa7b5; display:flex; justify-content:space-between; margin-top:4px; }

/* Dashboards sidebar: project -> pages tree */
.proj-node > .proj-head { display:flex; align-items:center; gap:0; }
.proj-node > .proj-head .menu-item.sub { flex:1; min-width:0; }
.proj-node > .proj-head .menu-item.sub span,
.proj-node > .proj-head .menu-item.sub { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tree-toggle.sm { width:18px; padding:4px 0; font-size:10px; margin-left:14px; }
.proj-node > .proj-head .tree-toggle.sm i { transition:transform .15s; }
.proj-node.open > .proj-head .tree-toggle.sm i { transform:rotate(90deg); }
.proj-pages { display:none; }
.proj-node.open > .proj-pages { display:block; }
.menu-item.sub.page { padding-left:52px; font-size:12.5px; }
.submenu-label { padding:10px 12px 4px 20px; color:#9aa7b5; font-size:10.5px;
  text-transform:uppercase; letter-spacing:.5px; font-weight:600; }
.menu-item.sub.page { display:flex; align-items:center; gap:6px; }
.menu-item.sub.page .pg-tag { margin-left:auto; font-size:9.5px; text-transform:uppercase;
  letter-spacing:.4px; color:#9aa7b5; border:1px solid #dbe1e8; border-radius:4px;
  padding:1px 4px; flex:none; }

/* Company info card: copyable Company ID */
.cid-row { display:flex; align-items:center; gap:8px; margin:2px 0 10px; flex-wrap:wrap; }
.cid-row .cid-lbl { font-size:11px; text-transform:uppercase; letter-spacing:.3px;
  color:#94a3b8; font-weight:700; }
.cid-row input { flex:1; min-width:230px; font-family:ui-monospace,Consolas,monospace;
  font-size:12.5px; border:1px solid #e5e7eb; border-radius:8px; padding:5px 9px;
  background:#f8fafc; color:#334155; }
.cid-row button { border:1px solid #c7d2fe; background:#eef2ff; color:#3730a3;
  border-radius:8px; padding:5px 9px; font-size:12px; cursor:pointer;
  display:inline-flex; gap:5px; align-items:center; }
.cid-row button:hover { background:#e0e7ff; }
.ci-grid { margin-bottom:10px; }
.ci-row { display:flex; gap:10px; padding:4px 0; font-size:13px; }
.ci-row .ci-lbl { min-width:70px; font-size:11px; text-transform:uppercase;
  letter-spacing:.3px; color:#94a3b8; font-weight:700; padding-top:2px; }
.ci-val { color:#334155; word-break:break-word; }
.ci-note { margin:0; font-size:11.5px; color:#94a3b8; }

/* Company ID row inside a kv list (super-admin company detail) */
.kv dd.kv-id { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.kv dd.kv-id code { font-family:inherit; background:#f8fafc; border:1px solid #e5e7eb;
  border-radius:6px; padding:2px 7px; color:#334155; user-select:all; }
.kv-copy { border:1px solid #c7d2fe; background:#eef2ff; color:#3730a3; border-radius:6px;
  padding:3px 7px; font-size:11.5px; line-height:1; cursor:pointer; }
.kv-copy:hover { background:#e0e7ff; }
