/* ==========================================================
   Astraal InsightIQ (TM) -- Demo POC branding
   Palette: Emerald Green / Aqua Blue / White / Silver-Grey
   ========================================================== */

:root {
  --emerald: #0E7C5A;
  --emerald-dark: #0B5C43;
  --emerald-light: #E4F5EE;
  --aqua: #0AA8C7;
  --aqua-dark: #087F97;
  --aqua-light: #E3F7FB;
  --amber: #C0791E;
  --amber-light: #FBF1E1;
  --red: #C0362C;
  --red-light: #FCEBEA;
  --ink: #14212B;
  --grey-900: #1F2B33;
  --grey-700: #445059;
  --grey-500: #78838C;
  --grey-300: #C7CFD6;
  --grey-200: #E1E6EA;
  --grey-100: #F1F4F6;
  --silver: #B7C0C7;
  --white: #FFFFFF;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20,33,43,.06), 0 1px 1px rgba(20,33,43,.04);
  --shadow-md: 0 6px 20px rgba(20,33,43,.08);
  --grad-brand: linear-gradient(120deg, var(--emerald) 0%, var(--aqua) 100%);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  color: var(--grey-900);
  background: var(--grey-100);
  font-size: 14.5px;
  line-height: 1.5;
}
a { color: var(--emerald-dark); text-decoration: none; }
a:hover { color: var(--aqua-dark); }
h1, h2, h3, h4 { font-weight: 700; color: var(--ink); margin: 0 0 6px; letter-spacing: -0.01em; }
p { margin: 0 0 10px; color: var(--grey-700); }
code { background: var(--grey-100); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
svg.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }

/* ---------------- Layout shell ---------------- */
.iq-shell { display: flex; min-height: 100vh; }

.iq-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--emerald-dark) 0%, #0A4A38 100%);
  color: #EAF6F0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.iq-sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.iq-sidebar .brand .mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.iq-sidebar .brand .name { font-weight: 800; font-size: 15.5px; color: #fff; line-height: 1.2; }
.iq-sidebar .brand .tag { font-size: 10.5px; color: #9FD9C4; text-transform: uppercase; letter-spacing: .06em; }

.iq-sidebar nav { padding: 12px 10px; flex: 1; }
.iq-sidebar .nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px; margin-bottom: 2px;
  color: #CDE9DD; font-size: 13.6px; font-weight: 500;
}
.iq-sidebar .nav-link svg { width: 17px; height: 17px; opacity: .85; }
.iq-sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.iq-sidebar .nav-link.active { background: rgba(10,168,199,.28); color: #fff; box-shadow: inset 3px 0 0 var(--aqua); }
.iq-sidebar .nav-section { padding: 14px 14px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6FAB94; font-weight: 700; }

.iq-sidebar .foot {
  padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.12);
  font-size: 11.5px; color: #7FBFA8;
}

.iq-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.iq-topbar {
  height: 62px; background: #fff; border-bottom: 1px solid var(--grey-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.iq-topbar .title { font-size: 17px; font-weight: 700; color: var(--ink); }
.iq-topbar .crumbs { font-size: 12px; color: var(--grey-500); }
.iq-topbar .right { display: flex; align-items: center; gap: 16px; }

.iq-role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--emerald-light); color: var(--emerald-dark);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.iq-tenant-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--grey-100); color: var(--grey-700);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--grey-200);
}
.bell-wrap { position: relative; color: var(--grey-700); }
.bell-dot {
  position: absolute; top: -3px; right: -3px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--grad-brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

.iq-content { padding: 24px 26px 60px; max-width: 1320px; width: 100%; margin: 0 auto; }

/* ---------------- Cards / KPIs ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  background: #fff; border: 1px solid var(--grey-200); border-radius: var(--radius-lg);
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi-card .top-line { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad-brand); }
.kpi-card .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--grey-500); font-weight: 700; }
.kpi-card .value { font-size: 30px; font-weight: 800; color: var(--ink); margin: 4px 0 2px; }
.kpi-card .delta { font-size: 12px; color: var(--emerald); font-weight: 600; }
.kpi-card .delta.down { color: var(--red); }
.kpi-card .delta.flat { color: var(--grey-500); }

.card {
  background: #fff; border: 1px solid var(--grey-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.card .card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--grey-200);
}
.card .card-head h3 { font-size: 15px; margin: 0; }
.card .card-head .sub { font-size: 12px; color: var(--grey-500); margin-top: 2px; }
.card .card-body { padding: 18px 20px; }
.card .card-body.pad-0 { padding: 0; }

.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

/* ---------------- Badges / Tags ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: capitalize;
  white-space: nowrap;
}
.badge-emerald { background: var(--emerald-light); color: var(--emerald-dark); }
.badge-aqua { background: var(--aqua-light); color: var(--aqua-dark); }
.badge-amber { background: var(--amber-light); color: var(--amber); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-grey { background: var(--grey-100); color: var(--grey-700); border: 1px solid var(--grey-200); }

.engine-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: #eef7ff; color: #0A5C79; border: 1px solid #d6ecf7;
}

/* ---------------- Tables ---------------- */
table.iq-table { width: 100%; border-collapse: collapse; font-size: 13.3px; }
table.iq-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--grey-500); font-weight: 700; padding: 10px 16px; border-bottom: 2px solid var(--grey-200);
  background: var(--grey-100);
}
table.iq-table td { padding: 12px 16px; border-bottom: 1px solid var(--grey-200); color: var(--grey-900); vertical-align: middle; }
table.iq-table tr:last-child td { border-bottom: none; }
table.iq-table tr:hover td { background: #FAFCFB; }
.table-scroll { overflow-x: auto; }
.cell-muted { color: var(--grey-500); font-size: 12.5px; }
.cell-strong { font-weight: 700; color: var(--ink); }

/* ---------------- Buttons / Forms ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font-size: 13px; font-weight: 700; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; transition: .15s; line-height: 1.2;
}
.btn-primary { background: var(--grad-brand); color: #fff; box-shadow: 0 2px 8px rgba(14,124,90,.25); }
.btn-primary:hover { filter: brightness(1.06); color: #fff; }
.btn-outline { background: #fff; border-color: var(--grey-300); color: var(--grey-900); }
.btn-outline:hover { border-color: var(--emerald); color: var(--emerald-dark); }
.btn-danger { background: var(--red-light); color: var(--red); border-color: #f2c9c5; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 700; color: var(--grey-700); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--grey-300); border-radius: 8px;
  font-size: 13.5px; color: var(--ink); background: #fff;
}
.form-control:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(14,124,90,.12); }
textarea.form-control { resize: vertical; min-height: 80px; }
.help-text { font-size: 11.5px; color: var(--grey-500); margin-top: 4px; }

/* ---------------- Alerts / flash ---------------- */
.alert-box { padding: 12px 16px; border-radius: 9px; font-size: 13px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--emerald-light); color: var(--emerald-dark); border: 1px solid #bfe6d6; }
.alert-error { background: var(--red-light); color: var(--red); border: 1px solid #f2c9c5; }
.alert-info { background: var(--aqua-light); color: var(--aqua-dark); border: 1px solid #c3e9f1; }

/* ---------------- Stepper (workflows) ---------------- */
.stepper { display: flex; align-items: flex-start; margin: 10px 0 6px; }
.step { flex: 1; text-align: center; position: relative; }
.step .dot {
  width: 30px; height: 30px; border-radius: 50%; background: var(--grey-200); color: var(--grey-500);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; font-weight: 800; font-size: 12.5px;
  border: 3px solid #fff; box-shadow: 0 0 0 1px var(--grey-300); position: relative; z-index: 2;
}
.step.done .dot { background: var(--grad-brand); color: #fff; box-shadow: 0 0 0 1px var(--emerald); }
.step.current .dot { background: #fff; color: var(--aqua-dark); box-shadow: 0 0 0 2px var(--aqua); }
.step .line { position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: var(--grey-200); z-index: 1; }
.step:first-child .line { display: none; }
.step.done .line { background: var(--emerald); }
.step .st-label { font-size: 10.8px; color: var(--grey-700); font-weight: 600; max-width: 96px; margin: 0 auto; }
.step.done .st-label, .step.current .st-label { color: var(--ink); }

/* ---------------- Timeline (audit / lineage) ---------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline:before { content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--grey-200); }
.t-item { position: relative; padding-bottom: 18px; }
.t-item:before {
  content: ''; position: absolute; left: -26px; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--aqua); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--aqua);
}
.t-item .t-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.t-item .t-meta { font-size: 11.5px; color: var(--grey-500); margin-top: 1px; }
.t-item .t-notes { font-size: 12.5px; color: var(--grey-700); margin-top: 3px; }

/* ---------------- Progress bars ---------------- */
.progress { height: 7px; border-radius: 999px; background: var(--grey-200); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--grad-brand); border-radius: 999px; }

/* ---------------- Empty state ---------------- */
.empty-state { text-align: center; padding: 44px 20px; color: var(--grey-500); }
.empty-state svg { width: 40px; height: 40px; color: var(--grey-300); margin-bottom: 10px; }

/* ---------------- Login / Landing ---------------- */
.iq-auth-wrap { min-height: 100vh; display: flex; }
.iq-auth-side {
  flex: 1.1; background: linear-gradient(150deg, var(--emerald-dark) 0%, var(--emerald) 55%, var(--aqua) 130%);
  color: #fff; padding: 60px 54px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.iq-auth-side .glow { position: absolute; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.14), transparent 65%); top: -140px; right: -140px; }
.iq-auth-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: #fff; }
.iq-auth-box { width: 100%; max-width: 400px; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.role-chip {
  border: 1px solid var(--grey-200); border-radius: 9px; padding: 9px 10px; font-size: 11.5px; font-weight: 700;
  color: var(--grey-700); cursor: pointer; background: #fff; text-align: left;
}
.role-chip:hover { border-color: var(--emerald); color: var(--emerald-dark); background: var(--emerald-light); }
.role-chip .sub { display: block; font-weight: 500; color: var(--grey-500); font-size: 10.3px; margin-top: 2px; }

/* ---------------- Landing page ---------------- */
.lp-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 5%; position: sticky; top: 0; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); z-index: 30; border-bottom: 1px solid var(--grey-200); }
.lp-hero { background: linear-gradient(160deg, #0A4A38 0%, var(--emerald) 45%, var(--aqua) 130%); color: #fff; padding: 90px 5% 110px; text-align: center; position: relative; overflow: hidden; }
.lp-hero .glow1 { position: absolute; width: 560px; height: 560px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.12), transparent 65%); top: -220px; left: -120px; }
.lp-hero .glow2 { position: absolute; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(circle, rgba(10,168,199,.35), transparent 65%); bottom: -220px; right: -80px; }
.lp-hero h1 { font-size: 46px; max-width: 820px; margin: 18px auto 16px; position: relative; z-index: 2; color: #fff; line-height: 1.15; }
.lp-hero p.lead { font-size: 17px; max-width: 680px; margin: 0 auto 30px; color: #DFF7EE; position: relative; z-index: 2; }
.lp-kicker { display: inline-block; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); padding: 6px 16px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .05em; position: relative; z-index: 2; }
.lp-section { padding: 70px 5%; max-width: 1180px; margin: 0 auto; }
.lp-section h2 { font-size: 28px; text-align: center; margin-bottom: 10px; }
.lp-section p.center-lead { text-align: center; max-width: 640px; margin: 0 auto 40px; color: var(--grey-500); }
.lp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .lp-grid { grid-template-columns: 1fr 1fr; } .lp-hero h1 { font-size: 32px; } }
.lp-card { background: #fff; border: 1px solid var(--grey-200); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.lp-card .eng-icon { width: 44px; height: 44px; border-radius: 11px; background: var(--grad-brand); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.lp-card .eng-icon svg { color: #fff; width: 22px; height: 22px; }
.lp-card h4 { font-size: 15px; margin-bottom: 6px; }
.lp-card p { font-size: 13px; margin: 0; }
.lp-footer { background: var(--grey-900); color: #B9C3CA; padding: 34px 5%; text-align: center; font-size: 12.5px; }
.lp-footer strong { color: #fff; }

.arch-flow { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; justify-content: center; margin-top: 30px; }
.arch-node { flex: 1; min-width: 180px; background: #fff; border: 1px solid var(--grey-200); border-radius: 14px; padding: 18px; box-shadow: var(--shadow-sm); }
.arch-node .n-title { font-weight: 800; color: var(--emerald-dark); font-size: 13.5px; margin-bottom: 4px; }
.arch-node .n-desc { font-size: 12px; color: var(--grey-500); }
.arch-arrow { display: flex; align-items: center; color: var(--grey-300); font-size: 22px; }

/* ---------------- Misc ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font-size: 21px; }
.page-head .desc { font-size: 13px; color: var(--grey-500); margin-top: 3px; }
.pill-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pill-nav a { padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--grey-200); font-size: 12.5px; font-weight: 600; color: var(--grey-700); }
.pill-nav a.active, .pill-nav a:hover { background: var(--emerald-light); border-color: #bfe6d6; color: var(--emerald-dark); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.chip-list { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--grey-100); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--grey-500); }
.detail-row .v { font-weight: 700; color: var(--ink); }

.accordion-item { border: 1px solid var(--grey-200); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.accordion-head { padding: 14px 16px; background: #fff; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13.6px; }
.accordion-head:hover { background: var(--grey-100); }
.accordion-body { padding: 0 16px 16px; display: none; }
.accordion-item.open .accordion-body { display: block; }
.sop-check { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; font-size: 13px; color: var(--grey-700); }
.sop-check input { margin-top: 3px; }

.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow-md); opacity: 0; transform: translateY(-6px); transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }

.qtag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--silver); color: #fff; }
.classification-Public { background: #DDEFE6; color: #1D6E4C; }
.classification-Internal { background: var(--aqua-light); color: var(--aqua-dark); }
.classification-Confidential { background: var(--amber-light); color: var(--amber); }
.classification-Restricted { background: var(--red-light); color: var(--red); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 860px) {
  .iq-sidebar { position: fixed; left: -260px; z-index: 50; transition: .2s; }
  .iq-sidebar.open { left: 0; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------------- Use Case gallery / grid cards ---------------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 18px; }
.uc-card .card-body { display: flex; flex-direction: column; }
.uc-icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.uc-icon .icon { width: 20px; height: 20px; color: #fff; }
.uc-block { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--grey-200); }
.uc-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: var(--aqua-dark); margin-bottom: 3px; }
.uc-label-green { color: var(--emerald-dark); }

/* ---------------- SOP checklist ---------------- */
.sop-list { margin: 0; padding-left: 20px; }
.sop-list li { font-size: 13px; color: var(--grey-700); padding: 5px 0; line-height: 1.5; }
.sop-list li::marker { color: var(--emerald); font-weight: 800; }

/* ---------------- Key/value table (settings) ---------------- */
.kv-table { width: 100%; border-collapse: collapse; }
.kv-table td { padding: 8px 0; border-bottom: 1px solid var(--grey-100, #F1F4F6); font-size: 13px; color: var(--grey-700); vertical-align: top; }
.kv-table td:first-child { color: var(--grey-500); width: 40%; }

/* ---------------- Brand swatches ---------------- */
.brand-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.swatch { font-size: 11px; color: var(--grey-700); text-align: center; font-weight: 600; }
.swatch .sw { display: block; width: 100%; height: 46px; border-radius: 8px; margin-bottom: 6px; }
.swatch code { font-size: 10px; color: var(--grey-500); font-weight: 500; }
