/* ============================================================
   MAHUNE OPS — Admin Dashboard
   ============================================================ */
:root {
  --navy: #075E6E; --navy-2: #053F4A; --amber: #0AB4CE; --amber-2: #0891A8;
  --bg: #F2F5F9; --card: #fff; --ink: #1B2A3A; --muted: #5A6572; --line: #DDE4EC;
  --ok: #2E7D32; --ok-bg: #E8F5E9; --bad: #C62828; --bad-bg: #FDECEA;
  --warn: #EF6C00; --warn-bg: #FFF3E0; --info: #1565C0; --info-bg: #E3F2FD;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); font-family: var(--font); color: var(--ink); }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13.5px; }
a { color: var(--info); }

/* ---------- login (electric-night theme — matches the mobile app) ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(120% 70% at 50% -12%, rgba(71,121,234,.55) 0%, rgba(71,121,234,.16) 44%, transparent 70%),
    radial-gradient(90% 55% at 50% 112%, rgba(136,177,227,.30) 0%, transparent 62%),
    linear-gradient(180deg, #D9EBFA 0%, #7FA8F0 9%, #4779EA 17%, #2554BF 29%, #0C2566 44%, #040E2F 60%, #020A24 77%, #0A1C4A 93%, #54689A 100%);
}
.login-box {
  background: rgba(4, 14, 47, .88); border: 1px solid rgba(203, 230, 245, .20);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-radius: 18px; padding: 34px 30px; width: 100%; max-width: 400px; text-align: center;
  box-shadow: 0 30px 70px rgba(1, 8, 28, .62), 0 0 44px rgba(37, 84, 191, .28);
}
.login-logo { width: 84px; height: 84px; border-radius: 18px; object-fit: contain; background: transparent; }
.login-logo.wide { width: 100%; max-width: 280px; height: auto; border-radius: 12px; padding: 8px; }
/* electric-night login: logo floats on the dark card, no white chip */
#admin-login .login-logo { background: transparent; }
#admin-login .login-logo.wide { max-width: 330px; padding: 0; }
.login-box h1 { color: #E8F2FC; margin: 10px 0 4px; font-size: 24px; text-shadow: 0 0 26px rgba(71,121,234,.55); }
.login-box p { color: #F2F8FE; font-size: 13px; margin: 0 0 18px; }
.login-box input { width: 100%; padding: 12px 14px; border: 1.5px solid #2E4A8F; border-radius: 10px; margin-bottom: 10px; font-size: 14px; background: rgba(10, 28, 74, .65); color: #E8F2FC; }
.login-box input::placeholder { color: #7FA3C9; }
.login-box input:focus { outline: none; border-color: #4779EA; box-shadow: 0 0 0 3px rgba(71,121,234,.28); }
.login-box input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #0A1C4A inset; -webkit-text-fill-color: #E8F2FC; caret-color: #E8F2FC; }
#admin-login .btn-primary { background: linear-gradient(135deg, #4779EA, #2554BF); box-shadow: 0 4px 16px rgba(37, 84, 191, .55); }
.hint-box { margin-top: 14px; background: rgba(37, 84, 191, .14); border: 1px solid rgba(136, 177, 227, .22); padding: 10px; border-radius: 10px; font-size: 11.5px; color: #C9E0F2; text-align: left; line-height: 1.6; }
.hint-box code { background: rgba(8, 20, 52, .9); color: #CBE6F5; border: 1px solid rgba(136, 177, 227, .28); border-radius: 4px; padding: 1px 5px; font-size: 10.5px; }
.cross-link {
  display: flex; align-items: center; gap: 10px; text-align: left;
  margin: 14px 0 10px; padding: 11px 13px; text-decoration: none;
  background: linear-gradient(135deg, #4779EA, #0C2566); color: #fff;
  border: 1px solid rgba(136, 177, 227, .25);
  border-radius: 12px; box-shadow: 0 4px 16px rgba(37, 84, 191, .4);
}
.cross-link .cross-icon { font-size: 20px; flex: none; }
.cross-link span:nth-child(2) { flex: 1; font-size: 11.5px; line-height: 1.35; }
.cross-link b { font-size: 13px; }
.cross-link .cross-arrow { font-size: 18px; font-weight: 800; }
.cross-link:active { transform: scale(.98); }

/* ---------- layout ---------- */
#admin-app { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: linear-gradient(180deg, var(--navy-2), var(--navy)); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex: none; }
.sb-brand { display: flex; gap: 10px; align-items: center; padding: 16px 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sb-logo { width: 38px; height: 38px; border-radius: 10px; background: transparent; object-fit: contain; }
.sb-brand b { display: block; font-size: 15px; }
.sb-brand span { font-size: 10.5px; color: #B9C9DE; letter-spacing: .4px; }
#sb-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
#sb-nav button { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; color: #C6D4E4; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600; text-align: left; margin-bottom: 2px; position: relative; }
#sb-nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
#sb-nav button.active { background: var(--amber); color: #1B2A3A; box-shadow: 0 4px 12px rgba(242,169,0,.35); }
.nav-badge { font-style: normal; background: var(--bad); color: #fff; border-radius: 20px; font-size: 10px; padding: 1px 7px; margin-left: auto; }
#sb-nav button.active .nav-badge { background: #7c1c1c; }
.sb-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: #C6D4E4; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; background: #fff; padding: 14px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar-title { font-weight: 800; font-size: 18px; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.body { padding: 20px 22px 60px; }

/* ---------- cards & grid ---------- */
.card { background: var(--card); border-radius: 14px; box-shadow: 0 2px 8px rgba(7,31,61,.07); padding: 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 14px; font-size: 13px; color: var(--navy); text-transform: uppercase; letter-spacing: .6px; }
.grid { display: grid; gap: 14px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.cols2 { grid-template-columns: 1.4fr 1fr; }
.grid.cols3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
@media (max-width: 1100px) { .grid.cols2 { grid-template-columns: 1fr; } }

.kpi { background: #fff; border-radius: 14px; padding: 16px; box-shadow: 0 2px 8px rgba(7,31,61,.07); border-top: 4px solid var(--navy); }
.kpi.amber { border-top-color: var(--amber); }
.kpi.bad { border-top-color: var(--bad); }
.kpi.ok { border-top-color: var(--ok); }
.kpi .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.kpi .v { font-size: 24px; font-weight: 800; color: var(--navy); margin-top: 4px; }
.kpi .s { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 10px 10px; background: var(--bg); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--bg); vertical-align: top; }
.tbl tr:hover td { background: #FAFBFD; }
.tbl .num { text-align: right; white-space: nowrap; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 800; letter-spacing: .3px; white-space: nowrap; }
.chip.SUBMITTED { background: var(--info-bg); color: var(--info); }
.chip.PENDING_APPROVAL { background: var(--warn-bg); color: var(--warn); }
.chip.APPROVED { background: var(--ok-bg); color: var(--ok); }
.chip.REJECTED { background: var(--bad-bg); color: var(--bad); }
.chip.COMPLETED { background: #E8EAF6; color: #283593; }
.chip.EXPIRED, .chip.BLOCKED { background: var(--bad-bg); color: var(--bad); }
.chip.EXPIRING { background: var(--warn-bg); color: var(--warn); }
.chip.VALID, .chip.PASS { background: var(--ok-bg); color: var(--ok); }
.chip.DUE_SOON { background: var(--warn-bg); color: var(--warn); }
.chip.PENDING { background: #ECEFF1; color: #546E7A; }
.chip.SENT { background: var(--ok-bg); color: var(--ok); }
.chip.MOCKED { background: var(--info-bg); color: var(--info); }
.chip.QUEUED { background: #ECEFF1; color: #546E7A; }
.chip.FAILED { background: var(--bad-bg); color: var(--bad); }
.chip.DUALKEY { background: var(--warn-bg); color: #7a3b00; border: 1px solid var(--warn); }

/* ---------- buttons & inputs ---------- */
.btn { border: none; border-radius: 8px; padding: 5px 11px; font-size: 11.5px; font-weight: 700; }
.btn-primary { background: linear-gradient(135deg, var(--navy), #0A7A8F); color: #fff; }
.btn-amber { background: linear-gradient(135deg, var(--amber), var(--amber-2)); color: #fff; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.btn-sm { padding: 5px 11px; font-size: 11.5px; border-radius: 8px; }
.btn-block {
  display: block; margin-left: auto; margin-right: auto;
  padding: 5px 11px; font-size: 11.5px; font-weight: 700; border-radius: 8px;
}
.btn:disabled { opacity: .5; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.field label { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.field input, .field select { padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; min-width: 150px; }
.search { padding: 9px 13px; border: 1.5px solid var(--line); border-radius: 9px; min-width: 220px; }

/* ---------- progress / meters ---------- */
.meter { height: 9px; background: #E6EBF2; border-radius: 6px; overflow: hidden; }
.meter > div { height: 100%; border-radius: 6px; }
.meter .ok { background: #2E7D32; } .meter .warn { background: #EF6C00; } .meter .bad { background: #C62828; }
.prog-dualkey { display: flex; align-items: center; gap: 8px; }
.keys { display: flex; gap: 4px; }
.keys i { width: 12px; height: 12px; border-radius: 50%; background: #E6EBF2; border: 2px solid #CBD6E2; display: inline-block; }
.keys i.on { background: var(--ok); border-color: var(--ok); }
.keys i.miss { background: var(--warn); border-color: var(--warn); }

/* ---------- banners ---------- */
.banner { border-radius: 10px; padding: 11px 14px; font-size: 12.5px; font-weight: 600; margin-bottom: 14px; line-height: 1.5; }
.banner.ok { background: var(--ok-bg); color: #1b4d1f; border: 1px solid #BFE3C2; }
.banner.bad { background: var(--bad-bg); color: #7c1c1c; border: 1px solid #F3C1BE; }
.banner.warn { background: var(--warn-bg); color: #7a3b00; border: 1px solid #FFD9A8; }
.banner.info { background: var(--info-bg); color: #14375f; border: 1px solid #BBD6F0; }

/* ---------- modal ---------- */
#a-modal-root .m-back { position: fixed; inset: 0; background: rgba(4,14,28,.55); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; }
#a-modal-root .m-box { background: #fff; border-radius: 16px; max-width: 720px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 22px; }
.m-box h3 { margin: 0 0 14px; color: var(--navy); }
.m-close { float: right; background: var(--bg); border: none; border-radius: 8px; width: 30px; height: 30px; color: var(--muted); font-size: 15px; }

/* ---------- toast ---------- */
#a-toast-root { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy-2); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 13px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: 380px; }
.toast.err { background: var(--bad); } .toast.ok { background: var(--ok); } .toast.warn { background: var(--warn); }

/* ---------- misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }
.flex1 { flex: 1; min-width: 0; }
.rank-1 { background: #FFF8E1; font-weight: 800; }
/* inline icons in banners/headings/buttons stay small (no 300px SVGs) */
.banner svg { width: 15px; height: 15px; flex: none; }
h1 svg, h2 svg, h3 svg, .card h3 svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.btn svg { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; }

.kv { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.kv td { padding: 7px 8px; border-bottom: 1px solid var(--bg); vertical-align: top; }
.kv td:first-child { color: var(--muted); font-weight: 600; width: 40%; white-space: nowrap; }
.seg { display: inline-flex; background: var(--bg); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 14px; }
.seg button { border: none; background: none; padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.seg button.active { background: #fff; color: var(--navy); box-shadow: 0 2px 6px rgba(7,31,61,.15); }
.spark svg { display: block; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 13px; }
.gold { color: var(--amber-2); font-weight: 800; }

/* Compliance Records banner strip — SLIM: full width, no taller than ~1 cm */
.compliance-strip {
  display: flex; align-items: center; gap: 8px;
  border-radius: 8px; padding: 5px 12px; margin-bottom: 12px;
  cursor: pointer; border: 1px solid transparent;
  transition: transform .08s ease, box-shadow .08s ease;
  font-size: 11.5px; line-height: 1.2;
  max-height: 34px;              /* ≈ 1 cm */
  width: 100%;                   /* full display width within the content area */
  white-space: nowrap;
}
.compliance-strip:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(7,31,61,.14); }
.compliance-strip .cs-icon { font-size: 14px; flex: none; }
.compliance-strip .cs-body { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compliance-strip .cs-sweep { color: inherit; opacity: .75; font-size: 10px; }
.compliance-strip .cs-action {
  flex: none; font-weight: 800; font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 10px; border-radius: 14px; background: #fff;
  color: #1B4D1F;             /* readable dark text on the white pill */
}
.compliance-strip.warn .cs-action { color: #7A3B00; }
.compliance-strip.bad  .cs-action { color: #7C1C1C; }
.compliance-strip.ok { background: linear-gradient(135deg, #2E7D32, #43A047); color: #fff; border-color: #2E7D32; }
.compliance-strip.warn { background: linear-gradient(135deg, #EF6C00, #F57C00); color: #fff; border-color: #EF6C00; }
.compliance-strip.bad { background: linear-gradient(135deg, #C62828, #E53935); color: #fff; border-color: #C62828; }
.compliance-strip .cs-body b { text-decoration: underline; text-underline-offset: 2px; }

/* ============================================================================
   MIDNIGHT FIELD THEME (v70) — dark-navy console skin (default), amber accent.
   Classic teal stays available via the topbar 🌗 toggle.
   ========================================================================== */
body.midnight {
  --navy: #FFB020; --navy-2: #E89A00;
  --amber: #FFB020; --amber-2: #E89A00;
  --bg: #0A1020; --card: #131C30; --ink: #E8ECF5; --muted: #A3ACC0;
  --line: #26314E;
  --ok: #37C56A; --ok-bg: #12271A;
  --bad: #FF5A5A; --bad-bg: #2A1418;
  --warn: #FFB020; --warn-bg: #2A2210;
  --info: #5AA7FF; --info-bg: #101E33;
  background: var(--bg); color: var(--ink);
}
body.midnight .sidebar { background: linear-gradient(180deg, #0E1527, #16233C); border-right: 1px solid var(--line); }
body.midnight .topbar { background: #0E1527; border-bottom-color: var(--line); color: var(--ink); }
body.midnight .card, body.midnight .kpi { background: var(--card); box-shadow: 0 2px 8px rgba(0,0,0,.4); }
body.midnight .kpi { border-top-color: var(--amber); }
body.midnight .tbl th { background: #16233C; color: var(--muted); }
body.midnight .tbl td { color: var(--ink); border-bottom-color: #1D2740; }
body.midnight .tbl tr { background: var(--card); }
body.midnight #a-modal-root .m-box { background: var(--card); border: 1px solid var(--line); }
body.midnight #a-modal-root .m-back { background: rgba(4,8,18,.72); }
body.midnight .btn-primary { background: linear-gradient(135deg, #E89A00, #FFB020); color: #1A1202; }
body.midnight .btn-amber { background: linear-gradient(135deg, #E89A00, #FFB020); color: #1A1202; }
body.midnight .btn-ghost { background: transparent; color: var(--ink); }
body.midnight .field input, body.midnight .field select, body.midnight .field textarea,
body.midnight input, body.midnight select, body.midnight textarea {
  background: #0E1527 !important; color: var(--ink) !important; border-color: var(--line) !important; }
body.midnight .rank-1 { background: #2A2210; }
body.midnight .list-item { background: var(--card); border: 1px solid var(--line); }
body.midnight .m-close { background: transparent; color: var(--muted); }
body.midnight .toast { background: #1F2538; border: 1px solid var(--line); color: var(--ink); }
body.midnight .chip.COMPLETED { background: #12271A; color: #8FE3AF; }
body.midnight .hint-box { background: #131C30; }
body.midnight .inline-form .field label { color: var(--muted); }

/* ---- v77 contrast fixes: hover rows, banners, chips, seg controls ---- */
/* Row hover must stay DARK — the base #FAFBFD highlight made light text invisible. */
body.midnight .tbl tr:hover td { background: #1B2540; }
/* Banners carried hardcoded dark text colours (teal-theme only) — on the dark
   skin they were dark-on-dark. Light text + soft borders now. */
body.midnight .banner.ok { color: #8FE3AF; border-color: #2A4A36; }
body.midnight .banner.bad { color: #FFA3A3; border-color: #542A2E; }
body.midnight .banner.warn { color: #FFD08A; border-color: #54431E; }
body.midnight .banner.info { color: #A8CDFF; border-color: #29456B; }
body.midnight .banner.ok svg, body.midnight .banner.bad svg,
body.midnight .banner.warn svg, body.midnight .banner.info svg { opacity: .95; }
/* Chips with hardcoded light-theme text */
body.midnight .chip.PENDING, body.midnight .chip.QUEUED { background: #1F2A3F; color: #B8C6DA; }
body.midnight .chip.DUALKEY { background: #2A2210; color: #FFD08A; }
/* Segmented control active pill: amber with dark text instead of white-on-white */
body.midnight .seg button.active { background: var(--amber); color: #1A1202; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
/* Any dynamic row built with an inline white background inherits the card colour */
body.midnight [style*="background:#fff"],
body.midnight [style*="background: #fff"] { background: var(--card) !important; }
body.midnight .meter { background: #26314E; }
