/* =====================================================================
   Mira · "Admin panel" theme
   Clean light admin look: grey page, white cards with title bars,
   left sidebar menu, top bar with search, blue + yellow chart colours.
   Loaded after site.css and grid.css. Layout of the sidebar/top bar is
   built by /js/shell.js.
   ===================================================================== */

:root{
  --bg:#F3F5F9; --panel:#FFFFFF; --panel2:#F7F9FC; --line:#E7EBF1;
  --text:#1F2937; --muted:#6B7280; --accent:#3B82F6; --mira:#EAB308;
  --ok:#22C55E; --warn:#EAB308; --bad:#EF4444; --crit:#DC2626; --info:#0EA5E9; --review:#8B5CF6;
  --orange:#F97316; --pink:#EC4899;
  --sidebar-w:250px; --topbar-h:68px;
  --radius:6px;
  --shadow:0 1px 2px rgba(16,24,40,.04),0 2px 8px rgba(16,24,40,.04);
  /* grid.css colours */
  --grid-head:#EEF3FB; --grid-head-text:#374151; --grid-stripe:#FFFFFF; --grid-row-line:#EEF1F5;
  --grid-hover:#F5F8FF; --grid-accent:#3B82F6; --grid-alert:#FEF2F2;
}

html,body{background:var(--bg)}
body{font-family:"Segoe UI",-apple-system,Roboto,"Helvetica Neue",Arial,sans-serif;color:var(--text);font-size:13.5px}

/* ---------------- Sidebar ---------------- */
.sidebar{position:fixed;inset:0 auto 0 0;width:var(--sidebar-w);background:#FFFFFF;border-right:1px solid var(--line);z-index:30;display:flex;flex-direction:column;overflow-y:auto;transition:transform .2s}
.sb-brand{display:flex;align-items:center;gap:10px;height:var(--topbar-h);padding:0 22px;text-decoration:none;color:var(--text);font-size:22px;font-weight:700;letter-spacing:-.01em;flex:none}
.sb-brand .logo{width:34px;height:34px;border-radius:9px;font-size:16px}
.sb-brand small{font-size:12px;font-weight:600;color:var(--accent);letter-spacing:.02em;margin-left:2px}
.sb-profile{display:flex;align-items:center;gap:12px;margin:0;padding:16px 22px;background:#F4F7FD;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
.avatar{width:42px;height:42px;border-radius:8px;background:linear-gradient(135deg,#3B82F6,#1D4ED8);color:#fff;display:grid;place-items:center;font-weight:700;font-size:14px;flex:none}
.sb-name{font-weight:600;font-size:13px}
.sb-role{font-size:12px;color:var(--muted);margin-top:2px}
.sb-nav{padding:10px 0 20px;flex:1}
.sb-h{font-size:14px;font-weight:700;color:var(--text);padding:18px 22px 8px}
.sb-link{display:flex;align-items:center;gap:12px;padding:9px 22px;color:#374151;text-decoration:none;font-size:13px;border-left:3px solid transparent;cursor:pointer}
.sb-link svg{width:17px;height:17px;flex:none;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.sb-link:hover{color:var(--accent);background:#F5F8FF}
.sb-link.active{color:var(--accent);background:#EEF4FF;border-left-color:var(--accent);font-weight:600}
.sb-link .sb-badge{margin-left:auto;font-size:10.5px;font-weight:600;padding:1px 7px;border-radius:4px;background:#FDE2E2;color:#DC2626}
.sb-link .sb-badge.ok{background:#DCFCE7;color:#15803D}
.sb-badge:empty{display:none}
.sb-foot{padding:14px 22px;font-size:11.5px;color:var(--muted);border-top:1px solid var(--line)}

/* ---------------- Main area + top bar ---------------- */
.app-main{margin-left:var(--sidebar-w);min-height:100vh;transition:margin .2s}
body.sb-collapsed .sidebar{transform:translateX(-100%)}
body.sb-collapsed .app-main{margin-left:0}
@media(max-width:1000px){
  .sidebar{transform:translateX(-100%)} .app-main{margin-left:0}
  body.sb-open .sidebar{transform:none;box-shadow:0 0 40px rgba(0,0,0,.2)}
}

header.topbar{position:sticky;top:0;z-index:20;height:var(--topbar-h);padding:0 24px;background:#FFFFFF;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:16px;flex-wrap:nowrap}
.tb-burger{background:none!important;border:none!important;padding:6px!important;color:#4B5563;cursor:pointer;display:grid;place-items:center}
.tb-burger svg,.tb-icon svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.tb-search{display:flex;align-items:center;background:#F1F4F9;border:1px solid transparent;border-radius:6px;padding:0 12px;width:340px;height:40px}
.tb-search:focus-within{border-color:#BFD3FB;background:#fff}
.tb-search input{border:none!important;background:transparent!important;min-width:0!important;flex:1;height:38px;padding:0!important;font-size:13px;outline:none;box-shadow:none!important}
.tb-search svg{width:17px;height:17px;stroke:#6B7280;fill:none;stroke-width:2}
.tb-right{margin-left:auto;display:flex;align-items:center;gap:6px}
.tb-icon{background:none!important;border:none!important;color:#4B5563;width:36px;height:36px;border-radius:8px!important;display:grid;place-items:center;cursor:pointer;padding:0!important;text-decoration:none;position:relative}
.tb-icon:hover{background:#F1F4F9!important;color:var(--accent)}
.tb-icon .dotbadge{position:absolute;top:5px;right:5px;min-width:15px;height:15px;border-radius:999px;background:#22C55E;color:#fff;font-size:9px;font-weight:700;display:grid;place-items:center;padding:0 3px}
.tb-status{display:flex;align-items:center;gap:8px;margin-right:6px;font-size:12px;color:var(--muted)}
.tb-user{display:flex;align-items:center;gap:10px;padding-left:16px;margin-left:8px;border-left:1px solid var(--line);height:44px}
.tb-user .avatar{width:38px;height:38px}
.tb-user .n{font-size:13px;font-weight:600}
.tb-user .r{font-size:11.5px;color:var(--muted)}
@media(max-width:1250px){.tb-user .who,.tb-status .clockwrap{display:none}}
@media(max-width:800px){.tb-search{width:auto;flex:1}}

/* page title row */
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;padding:20px 24px 0}
.page-head h1{font-size:20px;font-weight:600;margin:0}
.page-head .crumbs{font-size:12px;color:var(--muted);margin-top:4px}
.page-head .crumbs a{color:var(--accent);text-decoration:none}

/* ---------------- Layout grid & cards ---------------- */
main{padding:18px 24px 24px;gap:20px}
.card{background:var(--panel);border:none;border-radius:var(--radius);box-shadow:var(--shadow);padding:16px 18px}
.card > h2{
  margin:-16px -18px 16px;padding:14px 18px;border-bottom:1px solid var(--line);
  font-size:15px;font-weight:600;color:var(--text);text-transform:none;letter-spacing:0;
  display:flex;align-items:center;gap:10px
}
/* items after the title go to the right; the ⋮ menu mark sits at the far right */
.card > h2 > :not(:first-child){margin-left:auto}
.card > h2 > :not(:first-child) ~ *{margin-left:0}
.card > h2::after{content:"⋮";color:#9CA3AF;font-size:18px;line-height:1;margin-left:auto;padding-left:6px}
.card > h2:has(> :not(:first-child))::after{margin-left:0}
.section-t{font-size:12.5px;font-weight:600;text-transform:none;letter-spacing:0;color:#374151}

/* ---------------- KPI cards (sparkline style) ---------------- */
.kpi{padding:16px 18px 14px;display:flex;flex-direction:column}
.kpi-top{display:flex;align-items:flex-start;justify-content:space-between}
.kpi-ico{width:28px;height:28px;color:#111827;display:grid;place-items:center}
.kpi-ico svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.kpi-badge{font-size:10px;font-weight:600;padding:2px 7px;border-radius:3px;background:#5B9BF6;color:#fff}
.kpi-viz{height:58px;margin:8px -4px 6px;display:flex;align-items:center}
.kpi-viz svg{width:100%;height:58px;overflow:visible}
.kpi-meter{width:100%;height:8px;background:#EEF2F7;border-radius:999px;overflow:hidden}
.kpi-meter i{display:block;height:100%;border-radius:999px;background:var(--accent)}
.kpi .v{font-size:20px;font-weight:700;color:#111827;margin-top:2px;letter-spacing:-.01em}
.kpi .l{font-size:12px;color:var(--muted);text-transform:none;letter-spacing:0;order:5;margin-top:2px}
.kpi .d{font-size:11.5px;color:#9CA3AF;order:6;margin-top:2px}
.kpi.bad .v,.kpi.ok .v,.kpi.warn .v,.kpi.gold .v{color:#111827}

/* ---------------- Pills → small rectangular labels ---------------- */
.pill{border-radius:3px;font-size:10.5px;font-weight:600;padding:2px 7px;border:1px solid transparent;letter-spacing:.01em}
.p-ok{background:#DCFCE7;color:#15803D;border-color:#BBF7D0}
.p-warn{background:#FEF3C7;color:#A16207;border-color:#FDE68A}
.p-bad{background:#FFEDD5;color:#C2410C;border-color:#FED7AA}
.p-crit{background:#FEE2E2;color:#B91C1C;border-color:#FECACA}
.p-review{background:#EDE9FE;color:#6D28D9;border-color:#DDD6FE}
.p-info{background:#E0F2FE;color:#0369A1;border-color:#BAE6FD}
.p-gold{background:#FEF9C3;color:#854D0E;border-color:#FEF08A}
.p-dim{background:#F3F4F6;color:#4B5563;border-color:#E5E7EB}

/* ---------------- Buttons & inputs ---------------- */
button,a.btn{border-radius:5px;background:#FFFFFF;border:1px solid #DDE3EC;color:#374151;font-size:12.5px;padding:7px 12px}
button:hover,a.btn:hover{border-color:var(--accent);color:var(--accent)}
.btn-primary{background:var(--accent)!important;color:#fff!important;border-color:var(--accent)!important;box-shadow:0 1px 2px rgba(59,130,246,.3)}
input,select,textarea{border-radius:5px;border:1px solid #DDE3EC;background:#FFFFFF;color:var(--text);font-size:12.5px}
input:focus,select:focus,textarea:focus{outline:none;border-color:#93B8F8;box-shadow:0 0 0 3px rgba(59,130,246,.12)}

/* ---------------- Banner ---------------- */
.banner{margin:16px 24px 0;background:#EFF5FF;border:1px solid #D4E3FC;color:#1E3A8A;border-radius:var(--radius);font-size:12.5px}
.banner a{color:var(--accent)}

/* ---------------- Incidents list ---------------- */
.inc{background:#FFFFFF;border:1px solid var(--line);border-left-width:3px;border-radius:5px;box-shadow:none}
.inc:hover{border-color:#BFD3FB}
.inc-title{font-size:13.5px}
.inc-desc{color:#4B5563}

/* ---------------- Charts ---------------- */
svg text{fill:#9CA3AF;font-size:11px}
.hbar .track,.bar{background:#EEF2F7}
.heat .c{color:#FFFFFF;border-radius:3px}
.heat .h{color:#6B7280;font-weight:600}
.legend{font-size:12.5px}

/* ---------------- Grid (tables) ---------------- */
.tbl-wrap{border:1px solid var(--line);border-radius:var(--radius);box-shadow:none}
.tbl-wrap th{text-transform:none;letter-spacing:0;font-size:12.5px;font-weight:600;padding:12px 14px;border-bottom:1px solid #DCE6F5}
.tbl-wrap td{padding:11px 14px}
.tbl-wrap td.id{color:#1F2937;font-family:inherit;font-size:12.5px}

/* ---------------- Feed, drawer ---------------- */
.feed div{background:#F7F9FC;border-radius:4px}
.drawer{background:#FFFFFF;border-left:1px solid var(--line);box-shadow:-10px 0 40px rgba(16,24,40,.1)}
pre{background:#F7F9FC;border-color:var(--line)}
footer{padding:0 24px 24px}

/* ---------------- Admin page bits ---------------- */
.tabs{margin:18px 24px 0}
.tabs button{border-radius:5px}
.tabs button.active{background:var(--accent);color:#fff;border-color:var(--accent)}
.toast{background:#111827}

/* Brand mark in blue to match the theme */
.logo{background:linear-gradient(135deg,#60A5FA,#2563EB);color:#FFFFFF;box-shadow:none}
.dot{background:var(--ok)}
/* keep anchored cards clear of the sticky top bar */
[id^="sec-"]{scroll-margin-top:calc(var(--topbar-h) + 16px)}

/* ---------- Incident cards: UAE flag bar on top instead of the left border ---------- */
.inc{
  position:relative;
  overflow:hidden;
  flex-shrink:0;                   /* keep full height inside the scrolling list */
  border-left-width:1px;
  border-left-color:var(--line);   /* removes the red/orange/yellow left bar */
  padding-top:18px;                /* room for the flag bar */
}
/* also override the severity colours, which are more specific than .inc */
.inc.critical,.inc.high,.inc.medium{border-left-color:var(--line)}
.inc:hover,.inc.critical:hover,.inc.high:hover,.inc.medium:hover{border-color:#BFD3FB}
.inc::before{
  content:"";
  position:absolute; left:0; right:0; top:0; height:6px;
  /* UAE flag: red band, then green / white / black */
  background:linear-gradient(90deg,
    #EF3340 0 16%,
    #00843D 16% 44%,
    #FFFFFF 44% 72%,
    #000000 72% 100%);
  box-shadow:0 1px 0 rgba(0,0,0,.08);  /* keeps the white segment visible on a white card */
}

/* Fix: let the "↳ response" line wrap instead of being cut off */
.tags .pill.p-dim{white-space:normal}

/* Brand: "Mira Security / for AI Agents" on two lines */
.sb-brand-text{display:flex;flex-direction:column;line-height:1.1}
.sb-brand-text b{font-size:20px;letter-spacing:-.01em;font-weight:700;color:var(--text);white-space:nowrap}
.sb-brand-text small{margin:2px 0 0;font-size:12px;font-weight:600;color:var(--accent);letter-spacing:.01em;white-space:nowrap}

/* UAE flag as the brand icon */
.sb-flag{width:44px;height:22px;border-radius:3px;flex:none;box-shadow:0 0 0 1px rgba(15,23,42,.12),0 2px 6px rgba(15,23,42,.12)}

/* Logo fonts, bundled in /fonts (SIL Open Font License; see fonts/LICENSE-*.txt) */
@font-face{font-family:"Manrope";font-weight:800;font-style:normal;font-display:swap;src:url(/fonts/manrope-latin-800-normal.woff2) format("woff2")}
@font-face{font-family:"Barlow Condensed";font-weight:800;font-style:normal;font-display:swap;src:url(/fonts/barlow-condensed-latin-800-normal.woff2) format("woff2")}
/* Vulnx wordmark: same styling as the logo on vulnx.ca (Manrope 800 + Barlow Condensed V, brand blue #1B6FB8) */
:root{--ice:#1B6FB8;--ink:#0A1020}
.sb-brand{height:auto;min-height:var(--topbar-h);padding:12px 22px}
.wordmark{display:flex;align-items:center;font-family:Manrope,"Segoe UI",Arial,sans-serif;font-size:28px;font-weight:800;letter-spacing:-2px;color:var(--ink);line-height:1}
.brand-mark{display:inline-block;color:var(--ice);border-left:2px solid var(--ice);margin-right:10px;padding-left:6px;font-family:"Barlow Condensed","Arial Narrow",sans-serif;font-size:31px;line-height:1;transform:skew(-12deg)}
.brand-dot{color:var(--ice)}
.sb-brand-text small{margin-top:4px;color:var(--ice)}

/* Project owner: Vulnx.ca */
.sb-owner{text-decoration:none;color:inherit}
.sb-owner:hover .sb-name{color:var(--ice)}
.avatar-vx{background:linear-gradient(135deg,#2B86D6,#1B6FB8)}
.sb-foot a,.owner-line a{color:var(--ice);font-weight:600;text-decoration:none}
.owner-line{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;border-top:1px solid var(--line);padding-top:14px;margin-top:4px;font-size:12px;color:var(--muted)}
.owner-line b{color:var(--text)}

/* Client branding: Mira with the UAE flag */
.client-flag{width:46px;height:23px;border-radius:3px;flex:none;box-shadow:0 0 0 1px rgba(15,23,42,.12),0 2px 6px rgba(15,23,42,.12)}
.tb-user .client-flag{width:40px;height:20px}
.h1-flag{width:34px;height:17px;border-radius:2px;vertical-align:middle;margin:-3px 10px 0 0;box-shadow:0 0 0 1px rgba(15,23,42,.12)}
.owner-line .client-flag{width:22px;height:11px;border-radius:2px;vertical-align:middle;margin:-2px 4px 0 2px;box-shadow:0 0 0 1px rgba(15,23,42,.15)}

/* ---------- Real-time mode: LIVE strip, change pop-up, flashing numbers ---------- */
.rt-strip{display:flex;align-items:center;gap:12px;flex-wrap:wrap;white-space:nowrap;margin:14px 24px 0;padding:10px 14px;
  background:#FFFFFF;border:1px solid #CFE0FB;border-left:4px solid var(--accent);border-radius:var(--radius);
  box-shadow:var(--shadow);font-size:12.5px;color:#374151}
.rt-strip b{color:#111827}
.rt-live{display:inline-flex;align-items:center;gap:6px;background:#DC2626;color:#FFFFFF;font-weight:700;
  font-size:11px;letter-spacing:.08em;padding:3px 9px 3px 8px;border-radius:4px}
.rt-dot{width:8px;height:8px;border-radius:50%;background:#FFFFFF;animation:rtPulse 1.2s ease-in-out infinite}
@keyframes rtPulse{0%,100%{opacity:1}50%{opacity:.25}}
.rt-sep{width:1px;height:16px;background:var(--line)}
.rt-btn{margin-left:auto;padding:5px 12px!important;font-size:12px!important}

.rt-toast{position:fixed;right:24px;bottom:24px;z-index:70;max-width:440px;display:flex;flex-direction:column;gap:3px;
  background:#FFFFFF;border:1px solid var(--line);border-left:5px solid var(--accent);border-radius:8px;
  box-shadow:0 18px 40px rgba(15,23,42,.18);padding:12px 16px;font-size:13px;color:#111827;
  opacity:0;transform:translateY(16px);pointer-events:none;transition:opacity .25s,transform .25s}
.rt-toast.show{opacity:1;transform:none}
.rt-toast-t{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.rt-toast.lvl-bad{border-left-color:#DC2626}
.rt-toast.lvl-warn{border-left-color:#EAB308}
.rt-toast.lvl-ok{border-left-color:#22C55E}

@keyframes kpiFlash{0%{box-shadow:0 0 0 3px rgba(59,130,246,.55),var(--shadow);background:#EFF5FF}100%{box-shadow:var(--shadow);background:var(--panel)}}
.kpi.flash{animation:kpiFlash 1.6s ease-out}
.p-new{background:#2563EB;color:#FFFFFF;border-color:#2563EB;animation:rtPulse 1.2s ease-in-out 3}
.feed .feed-change{background:#EEF4FF;border-left:3px solid var(--accent)}
