@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ===========================================================
   CSS VARIABLES
   =========================================================== */
:root {
  /* Brand accent */
  --accent:        #6366f1;
  --accent-dark:   #4f46e5;
  --accent-dim:    #eef2ff;
  --accent-bd:     #c7d2fe;

  /* Sidebar (light) */
  --sb-bg:         #ffffff;
  --sb-w:          240px;
  --sb-text:       #64748b;
  --sb-muted:      #94a3b8;
  --sb-hover:      #f8fafc;
  --sb-active:     #eef2ff;
  --sb-active-t:   #4338ca;
  --sb-border:     #e2e8f0;

  /* Shell */
  --nav-h:         76px;
  --bg:            #f1f5f9;
  --card:          #ffffff;
  --border:        #e2e8f0;
  --border-2:      #f1f5f9;

  /* Text */
  --t1: #0f172a;
  --t2: #475569;
  --t3: #94a3b8;

  /* Status colours */
  --c-green:       #10b981;
  --c-green-bg:    #ecfdf5;
  --c-green-bd:    #a7f3d0;
  --c-green-t:     #065f46;

  --c-red:         #ef4444;
  --c-red-bg:      #fef2f2;
  --c-red-bd:      #fecaca;
  --c-red-t:       #991b1b;

  --c-yellow:      #f59e0b;
  --c-yellow-bg:   #fffbeb;
  --c-yellow-bd:   #fde68a;
  --c-yellow-t:    #92400e;

  --c-blue:        #6366f1;
  --c-blue-bg:     #eef2ff;
  --c-blue-bd:     #c7d2fe;
  --c-blue-t:      #3730a3;

  --c-purple:      #8b5cf6;
  --c-purple-bg:   #f5f3ff;
  --c-purple-bd:   #ddd6fe;
  --c-purple-t:    #5b21b6;
}

/* ===========================================================
   RESET + BASE
   =========================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--t1);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; }

/* ===========================================================
   APP SHELL
   =========================================================== */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ===========================================================
   TOP NAVBAR
   =========================================================== */
.navbar {
  height: var(--nav-h);
  background: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 1.5rem 0 0;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 300;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.navbar-brand {
  width: var(--sb-w);
  min-width: var(--sb-w);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-logo {
  height: auto;
  width: auto;
  max-width: 140px;
  max-height: 70px;
  object-fit: contain;
}
.brand-logo:hover { opacity: .85; }
/* Fallback text mark when logo not available */
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-name {
  font-size: 13px; font-weight: 700; color: var(--t1);
  letter-spacing: -.01em; white-space: nowrap;
}

/* Hamburger button — shown only on mobile via @media */
.nav-hamburger {
  display: none;
  width: 36px; height: 36px; border-radius: 8px;
  border: 1.5px solid var(--border); background: transparent;
  cursor: pointer; align-items: center; justify-content: center;
  color: var(--t2); flex-shrink: 0; margin-left: 0.25rem;
  transition: background .15s;
}
.nav-hamburger:hover { background: var(--bg); }

/* Sidebar backdrop — shown only on mobile when sidebar is open */
.sb-backdrop {
  display: none; position: fixed; inset: 0;
  z-index: 240; background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
}
.sb-backdrop.open { display: block; }

/* Navbar right */
.nav-user {
  display: flex; align-items: center; gap: 12px; margin-left: auto;
}
.nav-fullname { font-size: 13px; font-weight: 600; color: var(--t2); }
.hint-text    { font-size: 11px; color: var(--t3); font-weight: 400; }

/* ===========================================================
   PAGE BODY
   =========================================================== */
.page-body { display: flex; flex: 1; padding-top: var(--nav-h); }

/* ===========================================================
   SIDEBAR
   =========================================================== */
.sidebar {
  width: var(--sb-w);
  min-width: var(--sb-w);
  background: var(--sb-bg);
  padding: 1rem 0;
  position: fixed;
  top: var(--nav-h); left: 0;
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  z-index: 200;
  border-right: 1px solid var(--sb-border);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--sb-muted); border-radius: 2px; }

.sidebar-section { padding: 0 0.625rem; margin-bottom: 0.5rem; }
.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--sb-muted);
  padding: 0 0.625rem; margin-bottom: 3px; margin-top: 6px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  text-decoration: none; color: var(--sb-text);
  font-size: 13px; font-weight: 500;
  transition: all .15s;
  margin-bottom: 1px;
  position: relative;
}
.sidebar-link:hover   { background: var(--sb-hover); color: var(--t1); text-decoration: none; }
.sidebar-link.active  { background: var(--sb-active); color: var(--sb-active-t); font-weight: 600; }
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -10px; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
/* SVG icon wrapper inside sidebar links */
.sidebar-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: .65;
}
.sidebar-link:hover .sidebar-icon,
.sidebar-link.active .sidebar-icon { opacity: 1; }

/* Sidebar divider */
.sb-divider {
  height: 1px; background: var(--sb-border);
  margin: 6px 10px 10px;
}

/* ===========================================================
   MAIN CONTENT
   =========================================================== */
.main-content {
  flex: 1;
  margin-left: var(--sb-w);
  padding: 2rem 2.25rem;
  min-width: 0;
}

/* ===========================================================
   PAGE HEADER
   =========================================================== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem;
}
.page-header-left h1,
.page-head h1 {
  font-size: 22px; font-weight: 800;
  letter-spacing: -.025em; color: var(--t1); margin-bottom: 2px;
}
.page-subtitle, .sub { font-size: 13px; color: var(--t3); }
.page-head { margin-bottom: 1.75rem; }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--t3); margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--border); }

/* ===========================================================
   BUTTONS
   =========================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--card);
  color: var(--t2); font-family: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all .15s;
  text-decoration: none; white-space: nowrap; line-height: 1.4;
}
.btn:hover              { background: #f8fafc; border-color: #cbd5e1; color: var(--t1); text-decoration: none; }
.btn:disabled           { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn-sm                 { padding: 4px 12px; font-size: 12px; border-radius: 6px; }
.btn-outline            { border-color: var(--border); background: var(--card); color: var(--t2); }
.btn-outline:hover      { background: #f8fafc; border-color: #cbd5e1; color: var(--t1); }
.btn-primary, .btn-blue {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(99,102,241,.3);
}
.btn-primary:hover, .btn-blue:hover {
  background: var(--accent-dark); border-color: var(--accent-dark);
  color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,.4);
}
.btn-green-active       { background: var(--c-green); color: #fff; border-color: var(--c-green); }
.btn-green-active:hover { background: #059669; border-color: #059669; color: #fff; }
.btn-red-active         { background: var(--c-red);   color: #fff; border-color: var(--c-red); }
.btn-red-active:hover   { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger             { background: var(--c-red-bg); color: var(--c-red-t); border-color: var(--c-red-bd); }
.btn-danger:hover       { background: #fee2e2; }
.btn-group              { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-back {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 7px;
  border: 1.5px solid var(--border); background: var(--card);
  color: var(--t3); font-size: 12px; font-weight: 600;
  text-decoration: none; cursor: pointer; font-family: inherit;
  transition: all .15s;
}
.btn-back:hover { background: #f8fafc; color: var(--t2); border-color: #cbd5e1; text-decoration: none; }
.btn-back-old { background: var(--card); border: 1px solid var(--border); border-radius: 8px; color: var(--t3); padding: 7px 14px; font-size: 12px; cursor: pointer; font-family: inherit; font-weight: 600; text-decoration: none; white-space: nowrap; display: inline-block; }

.mt8  { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb16 { margin-bottom: 16px; }

/* ===========================================================
   BADGES
   =========================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.badge-pass    { background: var(--c-green-bg);  color: var(--c-green-t);  }
.badge-fail    { background: var(--c-red-bg);    color: var(--c-red-t);    }
.badge-pending { background: #f1f5f9;             color: var(--t3);         }
.badge-info    { background: var(--c-blue-bg);   color: var(--c-blue-t);   }
.badge-warn    { background: var(--c-yellow-bg); color: var(--c-yellow-t); }
.badge-purple  { background: var(--c-purple-bg); color: var(--c-purple-t); }

/* ===========================================================
   ALERTS
   =========================================================== */
.alert,
.alert-error,
.alert-success,
.alert-info {
  padding: 12px 16px; border-radius: 10px;
  font-size: 13px; margin-bottom: 1.25rem;
  display: flex; align-items: flex-start; gap: 8px;
  border: 1px solid transparent; line-height: 1.5;
}
.alert-error,   .alert.alert-error   { background: var(--c-red-bg);    border-color: var(--c-red-bd);    color: var(--c-red-t);    }
.alert-success, .alert.alert-success { background: var(--c-green-bg);  border-color: var(--c-green-bd);  color: var(--c-green-t);  }
.alert-info,    .alert.alert-info    { background: var(--c-blue-bg);   border-color: var(--c-blue-bd);   color: var(--c-blue-t);   }

/* ===========================================================
   FORMS
   =========================================================== */
.form-section { max-width: 540px; }
.field-row    { display: flex; flex-direction: column; margin-bottom: 16px; }
.field-label  { font-size: 12px; font-weight: 600; color: var(--t2); margin-bottom: 5px; display: block; letter-spacing: .01em; }
.input, .textarea {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; color: var(--t1);
  background: var(--card); line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; }
.input:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.input-hint { font-size: 11px; color: var(--t3); margin-top: 4px; }

/* ===========================================================
   CARDS
   =========================================================== */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.5rem; margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card-green  { background: var(--c-green-bg);  border-color: var(--c-green-bd); }
.card-red    { background: var(--c-red-bg);    border-color: var(--c-red-bd);   }
.card-yellow { background: var(--c-yellow-bg); border-color: var(--c-yellow-bd);}

/* ===========================================================
   STAT GRID (dashboard)
   =========================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem; margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent); opacity: .6;
  border-radius: 14px 14px 0 0;
}
.stat-card-green::before  { background: var(--c-green); }
.stat-card-yellow::before { background: var(--c-yellow); }
.stat-value {
  font-size: 40px; font-weight: 800;
  letter-spacing: -.04em; color: var(--t1); line-height: 1; margin-bottom: 6px;
}
.stat-label {
  font-size: 11px; color: var(--t3); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
}
.dash-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===========================================================
   DATA TABLES
   =========================================================== */
.table-wrap {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-2);
}
.table-title { font-size: 14px; font-weight: 700; color: var(--t1); }
.data-table  { width: 100%; border-collapse: collapse; }
.data-table thead tr { border-bottom: 1px solid var(--border-2); background: #f8fafc; }
.data-table th {
  padding: 10px 16px; text-align: left;
  font-size: 11px; font-weight: 700; color: var(--t3);
  letter-spacing: .07em; text-transform: uppercase; white-space: nowrap;
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border-2); vertical-align: middle; font-size: 13px; color: var(--t2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafcff; }
.td-name    { font-weight: 600; color: var(--t1) !important; }
.td-mono    { font-family: 'Courier New', monospace; font-size: 12px; color: var(--t3) !important; }
.td-actions { display: flex; gap: 6px; align-items: center; }
.row-inactive td { opacity: .45; }

/* ===========================================================
   GROUPED PRODUCT LIST (Asana-style)
   =========================================================== */
.products-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 1.75rem;
}
.products-title { font-size: 22px; font-weight: 800; letter-spacing: -.025em; color: var(--t1); margin-bottom: 2px; }
.products-sub   { font-size: 13px; color: var(--t3); }

.product-group { margin-bottom: 1.25rem; }

.product-group-header {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 4px;
  cursor: pointer; user-select: none;
  transition: background .15s;
  width: 100%; text-align: left; font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.product-group-header:hover { background: #f8fafc; }

.group-chevron {
  width: 16px; height: 16px;
  transition: transform .2s; color: var(--t3); flex-shrink: 0;
}
.product-group.collapsed .group-chevron { transform: rotate(-90deg); }

.group-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.group-dot-yellow { background: var(--c-yellow); }
.group-dot-red    { background: var(--c-red);    }
.group-dot-gray   { background: var(--t3);       }
.group-dot-green  { background: var(--c-green);  }

.group-label {
  font-size: 12px; font-weight: 700; color: var(--t2);
  text-transform: uppercase; letter-spacing: .07em; flex: 1;
}
.group-count {
  font-size: 11px; font-weight: 600; color: var(--t3);
  background: #f1f5f9; padding: 1px 9px; border-radius: 10px;
}

.product-group-body {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
.product-group.collapsed .product-group-body { display: none; }

.product-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--border-2);
  transition: background .12s;
}
.product-row:last-child { border-bottom: none; }
.product-row:hover { background: #fafcff; text-decoration: none; }

.product-row-avatar {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff; flex-shrink: 0;
  letter-spacing: -.01em;
}
.product-row-info { flex: 1; min-width: 0; }
.product-row-name {
  font-size: 14px; font-weight: 600; color: var(--t1); margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.product-row-meta { display: flex; align-items: center; gap: 10px; }
.mini-progress {
  width: 80px; height: 5px; border-radius: 99px;
  background: #f1f5f9; overflow: hidden; display: flex; flex-shrink: 0;
}
.mini-seg         { height: 100%; }
.mini-approved    { background: var(--c-green);  }
.mini-rejected    { background: var(--c-red);    }
.mini-pending     { background: var(--c-yellow); }
.product-row-counts { font-size: 11px; color: var(--t3); white-space: nowrap; }

.product-row-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.product-row-arrow {
  font-size: 14px; color: var(--t3); transition: transform .15s, color .15s;
}
.product-row:hover .product-row-arrow { transform: translateX(3px); color: var(--accent); }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--t3); }
.empty-state-icon { font-size: 36px; margin-bottom: 10px; }
.empty-state-text { font-size: 14px; }

/* ===========================================================
   PRODUCT / SCENARIO DETAIL HEADER
   =========================================================== */
.prod-header, .detail-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 1.75rem; padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.prod-label, .detail-eyebrow {
  font-size: 11px; color: var(--t3); letter-spacing: .1em;
  text-transform: uppercase; font-weight: 700; margin-bottom: 3px;
}
.prod-title, .detail-title {
  font-size: 22px; font-weight: 800; letter-spacing: -.025em; color: var(--t1);
}
.prod-meta, .detail-meta { flex: 1; }

/* ===========================================================
   SECTION LABELS
   =========================================================== */
.sec-label {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--t3); margin-bottom: 10px;
}

/* ===========================================================
   TEAM ROW
   =========================================================== */
.team-row { display: flex; gap: 2rem; flex-wrap: wrap; }
.team-row strong { color: var(--t1); }

/* ===========================================================
   SCENARIO CARDS
   =========================================================== */
.scenario-desc         { font-size: 14px; color: var(--t2); line-height: 1.6; }
.scenario-desc-empty   { font-size: 13px; color: var(--t3); font-style: italic; }
.scenario-desc-inline  { font-size: 12px; color: var(--t3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 460px; }

.scenario-card      { background: var(--card); border-radius: 10px; margin-bottom: 8px; border: 1.5px solid var(--border); overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: box-shadow .15s; }
.scenario-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.07); }

.border-green       { border-color: var(--c-green)    !important; }
.border-red         { border-color: var(--c-red)      !important; }
.border-green-light { border-color: var(--c-green-bd) !important; }
.border-red-light   { border-color: var(--c-red-bd)   !important; }
.border-default     { border-color: var(--border)     !important; }

.scenario-header     { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.scenario-title-wrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.scen-num { width: 30px; height: 30px; border-radius: 8px; background: var(--c-blue-bg); color: var(--c-blue-t); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.scenario-title      { font-weight: 600; font-size: 14px; color: var(--t1); }
.test-count-hint     { font-size: 12px; color: var(--t3); }

/* ===========================================================
   TEST ROWS
   =========================================================== */
.test-row          { border: 1.5px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 10px; background: var(--card); }
.test-row-pass     { border-color: var(--c-green-bd);  background: var(--c-green-bg);  }
.test-row-fail     { border-color: var(--c-red-bd);    background: var(--c-red-bg);    }
.test-row-rejected { border-color: var(--c-yellow-bd); background: var(--c-yellow-bg); }
.prev-result-hint  { font-size: 11px; color: var(--t3); font-style: italic; white-space: nowrap; }
.test-header    { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.test-num-badge { width: 26px; height: 26px; border-radius: 6px; background: #f1f5f9; color: var(--t3); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.test-label     { font-size: 13px; font-weight: 600; color: var(--t1); }

/* ===========================================================
   TRACKER CHIPS
   =========================================================== */
.tracker-chip {
  font-family: 'Courier New', monospace; font-size: 11px; font-weight: 700;
  letter-spacing: .03em; padding: 3px 9px; border-radius: 5px;
  border: 1px solid currentColor; cursor: pointer; user-select: none;
  transition: opacity .15s; white-space: nowrap;
}
.tracker-chip:hover  { opacity: .75; }
.tracker-pass    { color: var(--c-green-t); background: var(--c-green-bg); border-color: var(--c-green-bd); }
.tracker-fail    { color: var(--c-red-t);   background: var(--c-red-bg);   border-color: var(--c-red-bd);   }
.tracker-pending { color: var(--t3);        background: #f1f5f9;           border-color: var(--border);     }

/* ===========================================================
   COMMENT / EVIDENCE / RCA
   =========================================================== */
.comment-section  { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(0,0,0,.05); }
.evidence-section { margin-top: 10px; }
.file-chip        { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; background: var(--c-blue-bg); border: 1px solid var(--c-blue-bd); border-radius: 7px; font-size: 12px; }
.file-chip a      { color: var(--accent); text-decoration: none; font-weight: 500; }
.file-input       { font-size: 12px; margin-top: 6px; display: block; }

.rca-box   { padding: 12px 14px; background: var(--card); border: 1px solid var(--c-red-bd); border-left: 3px solid var(--c-red); border-radius: 8px; margin-top: 10px; }
.rca-label { font-size: 11px; color: var(--c-red); font-weight: 700; display: block; margin-bottom: 6px; letter-spacing: .04em; text-transform: uppercase; }
.rca-text  { font-size: 13px; color: var(--t2); line-height: 1.6; }
.hint-red  { font-size: 12px; color: var(--c-red); margin-top: 6px; }

/* ===========================================================
   FILE DROP ZONE
   =========================================================== */
/* Required field star */
.required-star { color: var(--c-red-t); font-weight: 700; margin-left: 2px; }

/* Combined record-result form */
.record-result-form { padding: 2px 0; }
.record-result-form .drop-zone { margin-top: 4px; }

.drop-zone {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 18px 16px 14px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
  background: #fafafa; margin-top: 8px; user-select: none;
}
.drop-zone:hover     { border-color: var(--c-blue-bd); background: var(--c-blue-bg); }
.dz-required         { border-color: var(--c-red-bd); background: var(--c-red-bg); }
.dz-required:hover   { border-color: var(--c-red); background: var(--c-red-bg); }
.drop-zone.dragover  { border-color: var(--accent);    background: var(--c-blue-bg); }
.drop-zone.has-file  { border-color: var(--c-green-bd); background: var(--c-green-bg); }
.drop-zone-icon      { font-size: 26px; display: block; margin-bottom: 6px; line-height: 1; color: var(--t3); }
.drop-zone.dragover  .drop-zone-icon { color: var(--accent);  }
.drop-zone.has-file  .drop-zone-icon { color: var(--c-green); }
.drop-zone-text      { font-size: 13px; color: var(--t2); }
.drop-zone-text strong { color: var(--accent); }
.drop-zone-hint      { font-size: 11px; color: var(--t3); margin-top: 4px; }
.drop-zone-file {
  display: none; margin-top: 8px;
  background: var(--c-blue-bg); border: 1px solid var(--c-blue-bd);
  border-radius: 8px; padding: 8px 12px;
  font-size: 12px; color: var(--c-blue-t);
  align-items: center; gap: 8px;
}
.drop-zone-file.show { display: flex; }
.drop-zone-filename  { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===========================================================
   APPROVAL / BUBBLE / COUNTER
   =========================================================== */
.approver-box { padding: 16px; background: var(--c-blue-bg); border: 1px solid var(--c-blue-bd); border-radius: 10px; }
.bubble       { padding: 10px 14px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); font-size: 13px; line-height: 1.6; }
.bubble-meta  { font-size: 10px; font-weight: 700; color: var(--t3); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }

.counter-row { display: flex; align-items: center; gap: 10px; }
.count-btn   { width: 32px; height: 32px; background: var(--card); border: 1.5px solid var(--border); border-radius: 8px; font-size: 18px; cursor: pointer; font-family: inherit; color: var(--t2); display: flex; align-items: center; justify-content: center; transition: all .12s; }
.count-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.count-val   { font-size: 20px; font-weight: 800; min-width: 32px; text-align: center; color: var(--t1); }

/* ===========================================================
   LEGACY PRODUCT CARDS (kept for compatibility)
   =========================================================== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.product-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 1.25rem;
  text-decoration: none; color: inherit; display: block; position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: box-shadow .18s, transform .15s, border-color .15s;
}
.product-card:hover { box-shadow: 0 6px 24px rgba(99,102,241,.12); transform: translateY(-2px); border-color: var(--c-blue-bd); text-decoration: none; }
.card-top   { display: flex; justify-content: space-between; margin-bottom: 10px; }
.card-index { font-size: 11px; color: var(--t3); font-weight: 700; letter-spacing: .1em; }
.card-name  { font-size: 15px; font-weight: 700; color: var(--t1); margin-bottom: 10px; }
.card-meta  { margin-top: 8px; }
.card-arrow { position: absolute; bottom: 14px; right: 16px; font-size: 14px; color: var(--t3); }

/* Progress bar segments */
.prog-track    { height: 6px; border-radius: 99px; background: #f1f5f9; overflow: hidden; display: flex; margin-bottom: 12px; }
.prog-seg      { height: 100%; transition: width .3s; }
.prog-approved { background: var(--c-green);  }
.prog-rejected { background: var(--c-red);    }
.prog-pending  { background: var(--c-yellow); }

/* Card stats */
.card-stats  { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.card-stat   { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--t3); }
.stat-dot    { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-approved    { background: var(--c-green);  }
.dot-rejected    { background: var(--c-red);    }
.dot-pending     { background: var(--c-yellow); }
.stat-approved   { color: var(--c-green-t);  }
.stat-rejected   { color: var(--c-red-t);    }
.stat-waiting    { color: var(--c-yellow-t); }
.stat-total      { color: var(--t3); margin-left: auto; }

/* ===========================================================
   LOGIN PAGE
   =========================================================== */
.login-outer {
  min-height: 100vh; display: flex; background: var(--bg);
}
.login-left {
  width: 400px; min-width: 400px;
  background: var(--accent-dim);
  border-right: 1px solid var(--accent-bd);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 3rem 2.5rem;
  position: relative; overflow: hidden;
}
/* Decorative circles */
.login-left::before {
  content: '';
  position: absolute; bottom: -80px; right: -80px;
  width: 280px; height: 280px; border-radius: 50%;
  background: rgba(99,102,241,.1);
  pointer-events: none;
}
.login-left::after {
  content: '';
  position: absolute; top: -60px; left: -60px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(99,102,241,.07);
  pointer-events: none;
}
.login-left-inner { position: relative; z-index: 1; text-align: center; }
.login-left-logo { width: 140px; height: auto; margin-bottom: 2rem; }
.login-left-title { font-size: 20px; font-weight: 800; color: var(--t1); margin-bottom: 0.5rem; letter-spacing: -.02em; }
.login-left-sub   { font-size: 13px; color: var(--t2); line-height: 1.6; max-width: 240px; }

.login-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-form-card {
  width: 100%; max-width: 400px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 2.5rem 2rem;
  box-shadow: 0 8px 40px rgba(0,0,0,.07);
}
.login-form-title { font-size: 22px; font-weight: 800; color: var(--t1); letter-spacing: -.025em; margin-bottom: 4px; }
.login-form-sub   { font-size: 13px; color: var(--t3); margin-bottom: 2rem; }
.login-submit-btn { width: 100%; justify-content: center; padding: 10px; font-size: 14px; margin-top: 6px; }

/* Legacy login classes (fallback) */
.login-body     { background: #f1f5f9; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap     { width: 100%; max-width: 400px; padding: 1.5rem; }
.login-card     { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 2.5rem 2rem; box-shadow: 0 8px 32px rgba(0,0,0,.07); }
.login-logo     { display: flex; align-items: center; gap: 10px; margin-bottom: 1.75rem; }
.login-app-name { font-size: 15px; font-weight: 700; color: var(--t1); }
.login-title    { font-size: 20px; font-weight: 700; margin-bottom: 1.5rem; color: var(--t1); }
.login-btn      { width: 100%; margin-top: 8px; padding: 10px; font-size: 14px; justify-content: center; }

/* ===========================================================
   MISC HELPERS
   =========================================================== */
.hint-text        { font-size: 11px; color: var(--t3); font-weight: 400; }
.toggle-label     { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; color: var(--t2); }
.inline-edit-wrap { display: flex; align-items: center; gap: 10px; }

/* ===========================================================
   BUTTON LOADING STATE
   =========================================================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  cursor: not-allowed;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 13px; height: 13px;
  top: 50%; left: 50%;
  margin-top: -6.5px; margin-left: -6.5px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  color: inherit;
}
/* Keep the spinner visible by restoring the border colour */
.btn-primary.btn-loading::after,
.btn-blue.btn-loading::after   { border-color: rgba(255,255,255,.5); border-top-color: transparent; }
.btn-green-active.btn-loading::after { border-color: rgba(255,255,255,.5); border-top-color: transparent; }
.btn-red-active.btn-loading::after   { border-color: rgba(255,255,255,.5); border-top-color: transparent; }
.btn-outline.btn-loading::after,
.btn.btn-loading::after              { border-color: var(--accent); border-top-color: transparent; }

/* Page-level loading overlay (for navigation) */
.page-loading-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px; z-index: 9999;
  background: linear-gradient(90deg, var(--accent), #8b5cf6, var(--accent));
  background-size: 200% 100%;
  animation: loading-bar 1s linear infinite;
  transform-origin: left;
}
@keyframes loading-bar {
  0%   { background-position: 0% 0%; }
  100% { background-position: -200% 0%; }
}

/* ===========================================================
   NAVBAR SEARCH
   =========================================================== */
.nav-search-wrap {
  flex: 1; max-width: 380px; margin: 0 1.5rem; position: relative;
}
.nav-search-form {
  display: flex; align-items: center; gap: 0;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 9px; padding: 0 10px; height: 34px;
  transition: border-color .15s, box-shadow .15s;
}
.nav-search-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
  background: var(--card);
}
.nav-search-icon { color: var(--t3); flex-shrink: 0; }
.nav-search-input {
  flex: 1; border: none; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--t1);
  padding: 0 8px; outline: none;
}
.nav-search-input::placeholder { color: var(--t3); }

/* Live dropdown */
.nav-search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.12);
  z-index: 600; display: none; overflow: hidden;
  max-height: 480px; overflow-y: auto;
}
.nav-search-dropdown.open { display: block; }
.nav-search-dropdown::-webkit-scrollbar { width: 4px; }
.nav-search-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nsd-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--t3);
  padding: 10px 14px 4px; border-top: 1px solid var(--border-2);
}
.nsd-section-label:first-child { border-top: none; padding-top: 8px; }

.nsd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; text-decoration: none; color: inherit;
  transition: background .1s; cursor: pointer;
}
.nsd-item:hover { background: #f8fafc; }
.nsd-item-icon {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nsd-item-body  { flex: 1; min-width: 0; }
.nsd-item-title { font-size: 13px; font-weight: 600; color: var(--t1); display: flex; align-items: center; gap: 6px; }
.nsd-item-meta  { font-size: 11px; color: var(--t3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nsd-item-code  { font-family: 'Courier New', monospace; font-size: 10px; font-weight: 700; color: var(--t3); background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }

.nsd-footer {
  padding: 8px 14px; border-top: 1px solid var(--border-2);
  font-size: 12px; color: var(--accent); font-weight: 600;
  cursor: pointer; text-align: center;
  transition: background .1s;
}
.nsd-footer:hover { background: var(--accent-dim); }

.nsd-empty {
  padding: 20px 14px; text-align: center; font-size: 13px; color: var(--t3);
}
.nsd-loading {
  padding: 16px 14px; display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--t3);
}
.nsd-spin {
  animation: spin .7s linear infinite; flex-shrink: 0;
}
.nsd-group-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--t3);
  padding: 10px 14px 4px; border-top: 1px solid var(--border-2);
  display: flex; align-items: center; gap: 5px;
}
.nsd-group-label:first-child { border-top: none; padding-top: 8px; }
.nsd-item-active { background: #f1f5f9; }
.nsd-icon-product { background: var(--c-blue-bg); color: var(--c-blue-t); }
.nsd-icon-scenario { background: var(--c-purple-bg); color: var(--c-purple-t); }
.nsd-chip {
  font-family: 'Courier New', monospace; font-size: 10px; font-weight: 700;
  color: var(--t3); background: #f1f5f9; padding: 1px 6px; border-radius: 4px;
}
.nsd-arrow { color: var(--t3); flex-shrink: 0; }
.nsd-status-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block;
}
.nsd-status-pass    { background: #22c55e; }
.nsd-status-fail    { background: #ef4444; }
.nsd-status-warn    { background: #f59e0b; }
.nsd-status-pending { background: #94a3b8; }
.nsd-status-txt { font-size: 11px; font-weight: 500; color: var(--t3); }

/* ===========================================================
   SEARCH RESULTS PAGE
   =========================================================== */
.search-page-form { margin-bottom: 1.75rem; }
.search-page-input-wrap {
  display: flex; align-items: stretch; height: 44px;
  border: 1.5px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--card);
  transition: border-color .15s, box-shadow .15s;
  max-width: 680px;
}
.search-page-input-wrap:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.search-page-icon {
  color: var(--t3); flex-shrink: 0; align-self: center; margin-left: 14px;
}
.search-page-input {
  flex: 1; border: none; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--t1);
  padding: 0 12px; outline: none;
}
.search-section        { margin-bottom: 2rem; }
.search-section-label  {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--t3);
  margin-bottom: 10px; padding: 0 2px;
}
.search-results-list {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.search-result-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--border-2);
  text-decoration: none; color: inherit; transition: background .12s;
}
.search-result-row:last-child { border-bottom: none; }
.search-result-row:hover { background: #fafcff; text-decoration: none; }
.search-result-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.search-result-body  { flex: 1; min-width: 0; }
.search-result-title {
  font-size: 14px; font-weight: 600; color: var(--t1);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 3px;
}
.search-result-meta  {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--t3);
}
.search-result-desc  { font-style: italic; }
.search-result-prog  { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.search-result-arrow { color: var(--t3); flex-shrink: 0; transition: transform .15s, color .15s; }
.search-result-row:hover .search-result-arrow { transform: translateX(3px); color: var(--accent); }

.search-meta-pass { color: var(--c-green-t); font-weight: 600; }
.search-meta-fail { color: var(--c-red-t);   font-weight: 600; }

.search-highlight {
  background: #fef9c3; color: #713f12;
  padding: 0 2px; border-radius: 3px;
  font-style: normal;
}
.search-empty-state {
  text-align: center; padding: 4rem 2rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; color: var(--t3);
}
.search-empty-icon  { margin-bottom: 14px; color: var(--border); }
.search-empty-title { font-size: 16px; font-weight: 700; color: var(--t2); margin-bottom: 6px; }
.search-empty-sub   { font-size: 13px; }
.search-empty-sub code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--accent); }

/* ===========================================================
   SIDEBAR BADGE (pending count)
   =========================================================== */
.sb-badge {
  margin-left: auto;
  background: var(--c-red); color: #fff;
  font-size: 10px; font-weight: 800;
  padding: 1px 7px; border-radius: 10px;
  min-width: 20px; text-align: center;
  letter-spacing: 0;
}

/* ===========================================================
   NAVBAR DROPDOWN
   =========================================================== */
.nav-dropdown-wrap { position: relative; }
.nav-dropdown-btn  { min-width: 32px; }
.nav-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; min-width: 190px;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  z-index: 500; display: none; overflow: hidden;
}
.nav-dropdown.open { display: block; }
.nav-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  color: var(--t2); text-decoration: none;
  transition: background .1s;
}
.nav-dropdown-item:hover { background: #f8fafc; color: var(--t1); text-decoration: none; }
.nav-dropdown-item-danger:hover { background: var(--c-red-bg); color: var(--c-red-t); }
.nav-dropdown-div { height: 1px; background: var(--border-2); margin: 4px 0; }

/* ===========================================================
   TOAST NOTIFICATIONS
   =========================================================== */
.toast {
  position: fixed; top: 72px; right: 24px;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  z-index: 9999; max-width: 420px;
  animation: toast-in .25s ease;
  border: 1px solid transparent;
}
.toast-success {
  background: var(--c-green-bg); color: var(--c-green-t);
  border-color: var(--c-green-bd);
}
.toast-error {
  background: var(--c-red-bg); color: var(--c-red-t);
  border-color: var(--c-red-bd);
}
.toast-close {
  margin-left: auto; background: none; border: none;
  font-size: 18px; line-height: 1; cursor: pointer;
  color: currentColor; opacity: .6; padding: 0 0 0 8px;
  font-family: inherit;
}
.toast-close:hover { opacity: 1; }
.toast.toast-hide { animation: toast-out .3s ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(24px); }
}

/* ===========================================================
   STAT CARD ICON
   =========================================================== */
.stat-icon { color: var(--accent); opacity: .5; }
.stat-card-green .stat-icon { color: var(--c-green); }
.stat-card-yellow .stat-icon { color: var(--c-yellow); }

/* ===========================================================
   DASHBOARD QUICK ACTIONS GRID
   =========================================================== */
.dash-quick-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px; margin-top: 4px;
}
.dash-quick-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px; border: 1px solid var(--border);
  border-radius: 10px; text-decoration: none;
  background: var(--bg); transition: all .15s;
  text-align: center;
}
.dash-quick-card:hover {
  border-color: var(--accent-bd); background: var(--card);
  box-shadow: 0 2px 10px rgba(99,102,241,.08); text-decoration: none;
}
.dash-quick-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dash-quick-label { font-size: 12px; font-weight: 600; color: var(--t2); }

/* ===========================================================
   ACTIVITY FEED
   =========================================================== */
.activity-feed { padding: 6px 0; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border-2);
  transition: background .1s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: #fafcff; }
.activity-icon-wrap { flex-shrink: 0; padding-top: 1px; }
.activity-body { flex: 1; min-width: 0; }
.activity-desc {
  font-size: 12px; color: var(--t2); line-height: 1.5;
  word-break: break-word;
}
.activity-desc a { color: var(--accent); font-weight: 600; }
.activity-desc a:hover { text-decoration: underline; }
.activity-time { font-size: 10px; color: var(--t3); margin-top: 2px; }

/* Scrollable activity feed */
.activity-feed-scroll {
  max-height: 380px;
  overflow-y: auto;
}
.activity-feed-scroll::-webkit-scrollbar { width: 4px; }
.activity-feed-scroll::-webkit-scrollbar-track { background: transparent; }
.activity-feed-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Mini activity feed (product detail) */
.activity-feed-mini .activity-item { padding: 10px 16px; }
.activity-feed-mini .activity-item:last-child { border-bottom: none; }

/* ===========================================================
   SCENARIO DETAIL — PAGE HEADER
   =========================================================== */
.sc-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 1.75rem;
  padding-bottom: 1.5rem; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.sc-page-header-left  { display: flex; align-items: flex-start; gap: 16px; flex: 1; min-width: 0; }
.sc-page-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.sc-page-title-wrap   { min-width: 0; }
.sc-page-eyebrow      { font-size: 20px; font-weight: 800; letter-spacing: -.025em; color: var(--t1); }
.sc-page-desc-preview { font-size: 12px; color: var(--t3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }

.sc-progress-wrap  { display: flex; align-items: center; gap: 8px; }
.sc-progress-bar   { width: 100px; height: 6px; border-radius: 99px; background: #f1f5f9; overflow: hidden; display: flex; }
.sc-prog-seg       { height: 100%; }
.sc-prog-pass      { background: var(--c-green); }
.sc-prog-fail      { background: var(--c-red);   }
.sc-progress-label { font-size: 11px; color: var(--t3); white-space: nowrap; }
.sc-count-chip     { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.sc-count-pass     { background: var(--c-green-bg); color: var(--c-green-t); }
.sc-count-fail     { background: var(--c-red-bg);   color: var(--c-red-t);   }

/* ===========================================================
   SCENARIO DETAIL — TWO-COLUMN LAYOUT
   =========================================================== */
.sc-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}
.sc-main    { min-width: 0; }
.sc-sidebar { position: sticky; top: calc(var(--nav-h) + 1.5rem); display: flex; flex-direction: column; gap: 12px; }

/* Rejected banner */
.sc-rejected-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--c-red-bg); border: 1px solid var(--c-red-bd);
  border-left: 4px solid var(--c-red);
  border-radius: 10px; padding: 12px 14px;
  font-size: 13px; color: var(--c-red-t);
  margin-bottom: 1rem;
}

/* ===========================================================
   SCENARIO DETAIL — TEST CARDS
   =========================================================== */
.test-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 12px; margin-bottom: 10px;
  overflow: hidden; transition: box-shadow .15s;
}
.test-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.tc-pass     { border-color: var(--c-green-bd); background: var(--c-green-bg); }
.tc-fail     { border-color: var(--c-red-bd);   background: var(--c-red-bg);   }
.tc-rejected { border-color: var(--c-yellow-bd); background: var(--c-yellow-bg); }
.tc-pending  { border-color: var(--border); background: var(--card); }

/* Test card header */
.tc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; gap: 10px;
}
.tc-header-left  { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.tc-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tc-num {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.08);
  font-size: 11px; font-weight: 800; color: var(--t2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tc-title { font-size: 13px; font-weight: 700; color: var(--t1); margin-bottom: 3px; }

/* Hero pass / fail buttons */
.tc-result-form {
  display: flex; gap: 8px; padding: 0 16px 14px;
}
.tc-result-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 9px;
  border: 1.5px solid var(--border); background: var(--card);
  font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: all .15s; color: var(--t2);
}
.tc-pass-btn:hover             { background: var(--c-green-bg); border-color: var(--c-green-bd); color: var(--c-green-t); }
.tc-fail-btn:hover             { background: var(--c-red-bg);   border-color: var(--c-red-bd);   color: var(--c-red-t);   }
.tc-result-active-pass         { background: var(--c-green) !important; border-color: var(--c-green) !important; color: #fff !important; box-shadow: 0 2px 8px rgba(16,185,129,.3); }
.tc-result-active-fail         { background: var(--c-red)   !important; border-color: var(--c-red)   !important; color: #fff !important; box-shadow: 0 2px 8px rgba(239,68,68,.3);   }

/* Details section */
.tc-details {
  border-top: 1px solid rgba(0,0,0,.06);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 14px;
}
.tc-detail-row       { display: flex; gap: 12px; align-items: flex-start; }
.tc-detail-label     { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--t3); min-width: 58px; padding-top: 2px; flex-shrink: 0; }
.tc-detail-input-row { display: flex; gap: 8px; align-items: flex-end; flex: 1; }
.tc-detail-input-row .textarea { flex: 1; margin: 0; }

/* ===========================================================
   SCENARIO DETAIL — SIDEBAR CARDS
   =========================================================== */
.sc-sb-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.sc-sb-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--t3); margin-bottom: 10px;
}
.sc-sb-card-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--c-green-bg); color: var(--c-green-t);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sc-sb-card-title { font-size: 15px; font-weight: 700; color: var(--t1); }
.sc-sb-card-note  { font-size: 12px; color: var(--t2); margin-top: 4px; line-height: 1.5; }

.sc-sb-approved { border-color: var(--c-green-bd); background: var(--c-green-bg); display: flex; gap: 12px; align-items: flex-start; }
.sc-sb-review   { border-color: var(--c-blue-bd);  background: var(--c-blue-bg); }
.sc-sb-waiting  { border-color: var(--c-yellow-bd); background: var(--c-yellow-bg); }
.sc-sb-submit   { border-color: var(--accent-bd);  background: var(--accent-dim); }

/* Responsive: stack on narrow screens */
@media (max-width: 960px) {
  .sc-layout { grid-template-columns: 1fr; }
  .sc-sidebar { position: static; }
  .sc-page-desc-preview { max-width: 280px; }
}

/* ===========================================================
   SCENARIO REVIEW HISTORY TIMELINE
   =========================================================== */
.sc-history-feed { padding: 8px 16px 4px; }
.sc-history-item {
  display: flex; gap: 14px;
  padding: 10px 0;
  position: relative;
}
.sc-history-spine {
  display: flex; flex-direction: column;
  align-items: center; flex-shrink: 0; width: 26px;
}
.sc-history-dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
  position: relative; z-index: 1;
}
.sc-history-line {
  width: 2px; flex: 1; background: var(--border);
  margin-top: 4px; min-height: 12px;
}
.sc-history-item:last-child .sc-history-line { display: none; }

.sc-history-body   { flex: 1; min-width: 0; padding-bottom: 6px; }
.sc-history-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 5px;
}
.sc-history-actor { font-size: 13px; color: var(--t1); }
.sc-history-time  { font-size: 11px; color: var(--t3); margin-left: auto; white-space: nowrap; }
.sc-history-note  {
  font-size: 12px; color: var(--t2); line-height: 1.55;
  background: var(--bg); border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 0 6px 6px 0; padding: 8px 12px;
  white-space: pre-wrap; word-break: break-word;
}
/* Colour-code the left border by action type */
.sc-history-item:has(.badge-pass)  .sc-history-note { border-left-color: var(--c-green); }
.sc-history-item:has(.badge-fail)  .sc-history-note { border-left-color: var(--c-red);   }
.sc-history-item:has(.badge-warn)  .sc-history-note { border-left-color: var(--c-yellow); }

/* ===========================================================
   SCENARIO NAME INLINE EDIT
   =========================================================== */
.sc-name-form {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
}
.sc-name-input {
  font-size: 18px; font-weight: 700; color: var(--t1);
  background: transparent; border: none; border-bottom: 1.5px solid transparent;
  outline: none; padding: 2px 0; width: 100%; min-width: 0;
  font-family: inherit; transition: border-color .15s;
}
.sc-name-input:focus,
.sc-name-input:hover { border-bottom-color: var(--accent); }
.sc-name-save-btn {
  display: none; background: var(--accent); color: #fff;
  border: none; border-radius: 6px; width: 24px; height: 24px;
  cursor: pointer; flex-shrink: 0; align-items: center; justify-content: center;
}
.sc-name-save-btn:hover { background: var(--accent-hover); }
.sc-page-name-display { font-size: 18px; font-weight: 700; color: var(--t1); margin-top: 4px; }

/* ===========================================================
   SCENARIO DATES STRIP
   =========================================================== */
.sc-dates-strip {
  margin-bottom: 1.5rem; padding: 14px 18px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px;
}
.sc-dates-form  { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.sc-date-field  { display: flex; flex-direction: column; gap: 4px; }
.sc-date-label  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--t3); }
.sc-dates-display  { display: flex; flex-wrap: wrap; gap: 10px; }
.sc-date-chip { font-size: 12px; color: var(--t2); padding: 4px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; }
.sc-date-chip-done { background: var(--c-green-bg); border-color: var(--c-green-bd); color: var(--c-green-t); }

/* ===========================================================
   SUB-SCENARIO RENAME INLINE
   =========================================================== */
.sub-rename-form {
  display: flex; align-items: center; gap: 5px; min-width: 0;
}
.sub-rename-input {
  font-size: 13px; font-weight: 700; color: var(--t1);
  background: transparent; border: none; border-bottom: 1.5px solid transparent;
  outline: none; padding: 2px 0; flex: 1; min-width: 0;
  font-family: inherit; transition: border-color .15s;
}
.sub-rename-input:focus,
.sub-rename-input:hover { border-bottom-color: var(--accent); }
.sub-rename-btn {
  display: none; background: var(--accent); color: #fff;
  border: none; border-radius: 5px; width: 20px; height: 20px;
  cursor: pointer; flex-shrink: 0; align-items: center; justify-content: center;
}
.sub-rename-btn:hover { background: var(--accent-hover); }

/* Attempt badge (shown when retrying) */
.attempt-badge {
  font-size: 11px; font-weight: 700; color: var(--c-yellow-t);
  background: var(--c-yellow-bg); border: 1px solid var(--c-yellow-bd);
  border-radius: 20px; padding: 2px 8px; display: inline-flex; align-items: center; gap: 5px; margin-top: 2px;
}
.attempt-retry-hint { font-weight: 400; opacity: .8; }

/* Previous attempts collapsible history */
.attempt-history { border-top: 1px solid rgba(0,0,0,.06); margin: 0; }
.attempt-history-toggle {
  cursor: pointer; font-size: 11px; color: var(--t3); padding: 8px 16px;
  user-select: none; list-style: none; display: flex; align-items: center; gap: 6px;
}
.attempt-history-toggle::-webkit-details-marker { display: none; }
.attempt-history-toggle::before { content: '▶'; font-size: 9px; }
details[open] .attempt-history-toggle::before { content: '▼'; }
.attempt-history-list {
  padding: 0 16px 12px; display: flex; flex-direction: column; gap: 8px;
}
.attempt-item {
  padding: 10px 12px; border-radius: 8px; font-size: 12px;
}
.attempt-item-fail { background: var(--c-red-bg); border: 1px solid var(--c-red-bd); }
.attempt-item-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.attempt-num-chip {
  font-size: 10px; font-weight: 700; background: rgba(0,0,0,.06);
  padding: 2px 7px; border-radius: 10px; color: var(--t2);
}
.attempt-item-rca { color: var(--c-red-t); margin-top: 4px; line-height: 1.5; }
.attempt-evidence-link { color: var(--accent); text-decoration: none; font-size: 11px; }
.attempt-evidence-link:hover { text-decoration: underline; }

/* Delete / danger icon button */
.btn-icon-danger {
  width: 28px; height: 28px; border-radius: 7px;
  background: transparent; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--t3); transition: all .15s; flex-shrink: 0;
}
.btn-icon-danger:hover { background: var(--c-red-bg); border-color: var(--c-red-bd); color: var(--c-red-t); }

/* Add sub-scenario button */
.add-sub-form { margin-top: 8px; }
.add-sub-btn {
  width: 100%; justify-content: center;
  border-style: dashed !important;
}

/* ===================================================================
   PRODUCT DETAIL — SUB-SCENARIO SUMMARY ROWS
   =================================================================== */
.sub-list {
  border-top: 1px solid var(--border-2);
  padding: 6px 14px 8px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.sub-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 5px 8px; border-radius: 7px;
  background: var(--card-bg);
  border: 1px solid var(--border-2);
  font-size: 12px;
}
.sub-row-pass { border-color: var(--c-green-bd); background: var(--c-green-bg); }
.sub-row-fail { border-color: var(--c-red-bd);   background: var(--c-red-bg); }
.sub-row-name { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--t1); min-width: 110px; }
.sub-row-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--border-2); }
.sub-dot-pass { background: var(--c-green-t); }
.sub-dot-fail { background: var(--c-red-t); }
.sub-dot-pending { background: var(--text-muted); }
.sub-row-slots { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.slot-pip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 22px; border-radius: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
  border: 1px solid transparent; cursor: default;
}
.slot-pip-pass { background: var(--c-green-bg); border-color: var(--c-green-bd); color: var(--c-green-t); }
.slot-pip-fail { background: var(--c-red-bg);   border-color: var(--c-red-bd);   color: var(--c-red-t); }
.slot-pip-ns   { background: var(--bg2);        border-color: var(--border-2);   color: var(--text-muted); }
.sub-row-dates { font-size: 11px; color: var(--text-muted); display: flex; gap: 4px; align-items: center; }

/* Date chips on scenario card in product detail */
.sc-date-chip {
  font-size: 11px; color: var(--text-muted);
  background: var(--bg2); border: 1px solid var(--border-2);
  border-radius: 5px; padding: 1px 7px;
}
.sc-date-chip-done {
  background: var(--c-green-bg); border-color: var(--c-green-bd); color: var(--c-green-t);
}

/* Sub-scenario test count stepper */
.sub-count-wrap { display: flex; align-items: center; gap: 3px; }
.sub-count-wrap .count-val { font-size: 13px; font-weight: 700; min-width: 20px; text-align: center; color: var(--t1); }

/* Slot card — individual test within a sub-scenario */
.slot-card {
  margin: 0 16px 10px;
  border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  background: rgba(255,255,255,.6);
}
.slot-card.tc-pass     { border-color: var(--c-green-bd); background: rgba(220,252,231,.4); }
.slot-card.tc-fail     { border-color: var(--c-red-bd);   background: rgba(254,226,226,.4); }
.slot-card.tc-rejected { border-color: var(--c-yellow-bd); background: rgba(254,243,199,.4); }
.slot-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; gap: 8px;
}
.slot-header-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.slot-num {
  width: 26px; height: 26px; border-radius: 6px;
  background: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.08);
  font-size: 10px; font-weight: 800; color: var(--t2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.slot-card .tc-result-form { padding: 0 12px 10px; }
.slot-card .tc-result-btn  { padding: 7px 12px; font-size: 13px; }
.slot-card .tc-details     { padding: 0 12px 8px; }
.slot-card .attempt-history { border-top: 1px solid rgba(0,0,0,.05); }
.slot-card .attempt-history-toggle { padding: 6px 12px; }
.slot-card .attempt-history-list   { padding: 0 12px 8px; }

/* input-sm override */
.input-sm { font-size: 13px; padding: 5px 10px; height: auto; }

/* ===========================================================
   APPROVER QUEUE STYLES
   =========================================================== */
.queue-product-group { margin-bottom: 2rem; }
.queue-product-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--t3);
  margin-bottom: 10px; padding: 0 2px;
}
.queue-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  overflow: hidden; transition: box-shadow .15s;
}
.queue-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.07); }
.queue-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px 10px;
}
.queue-card-left  { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0; }
.queue-card-right { flex-shrink: 0; }
.queue-card-title { font-weight: 700; font-size: 14px; color: var(--t1); }
.queue-card-desc  { font-size: 12px; color: var(--t3); margin-top: 2px; }

.queue-test-summary { padding: 8px 16px 10px; }
.queue-test-bar {
  height: 6px; border-radius: 99px; background: #f1f5f9;
  overflow: hidden; display: flex; margin-bottom: 8px;
}
.queue-test-chips {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.queue-chip {
  font-size: 11px; font-weight: 600; padding: 2px 9px;
  border-radius: 20px;
}
.queue-chip-pass { background: var(--c-green-bg); color: var(--c-green-t); }
.queue-chip-fail { background: var(--c-red-bg);   color: var(--c-red-t);   }
.queue-chip-pend { background: #f1f5f9; color: var(--t3); }

.queue-actions {
  border-top: 1px solid var(--border-2);
  padding: 12px 16px; background: #fafcff;
}

/* ===========================================================
   WORKFLOW PIPELINE
   =========================================================== */
.wf-pipeline {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 14px 18px; margin-bottom: 1.25rem;
}
.wf-stage {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 10px; border: 1.5px solid transparent;
  transition: background .15s;
}
.wf-stage-icon {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.wf-stage-label { font-size: 12px; font-weight: 600; color: var(--t2); }
.wf-stage-count  { font-size: 11px; color: var(--t3); margin-top: 1px; }
.wf-active  { background: #eef2ff; border-color: #c7d2fe; }
.wf-active .wf-stage-icon  { background: #6366f1; color: #fff; }
.wf-active .wf-stage-label { color: #4338ca; }
.wf-warn    { background: #fffbeb; border-color: #fde68a; }
.wf-warn .wf-stage-icon    { background: #f59e0b; color: #fff; }
.wf-warn .wf-stage-label   { color: #92400e; }
.wf-pass    { background: #f0fdf4; border-color: #bbf7d0; }
.wf-pass .wf-stage-icon    { background: #22c55e; color: #fff; }
.wf-pass .wf-stage-label   { color: #15803d; }
.wf-complete { background: #f0fdf4; border-color: #22c55e; }
.wf-complete .wf-stage-icon { background: #16a34a; color: #fff; }
.wf-complete .wf-stage-label { color: #15803d; font-weight: 700; }
.wf-fail    { background: #fef2f2; border-color: #fecaca; }
.wf-fail .wf-stage-icon    { background: #ef4444; color: #fff; }
.wf-fail .wf-stage-label   { color: #b91c1c; }
.wf-idle    { background: #f8fafc; border-color: var(--border-2); }
.wf-idle .wf-stage-icon    { background: #e2e8f0; color: var(--t3); }
.wf-arrow { color: var(--t3); font-size: 18px; line-height: 1; flex-shrink: 0; }
.wf-overdue-badge {
  margin-left: auto; display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; color: #b45309;
  background: #fffbeb; border: 1px solid #fde68a;
  padding: 4px 10px; border-radius: 99px;
}

/* Due date chips */
.sc-due {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--t3); margin-top: 4px;
}
.sc-due-overdue { color: #b91c1c; font-weight: 600; }

/* ===========================================================
   FLOW VIEW
   =========================================================== */
.fv-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  animation: toast-in .18s ease;
}
.fv-panel {
  background: var(--bg); border-radius: 16px; width: 94vw; max-width: 1200px;
  height: 86vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.22); overflow: hidden;
}
.fv-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border-2); flex-shrink: 0;
}
.fv-panel-title  { font-size: 16px; font-weight: 700; color: var(--t1); }
.fv-panel-sub    { font-size: 12px; color: var(--t3); margin-top: 2px; }
.fv-close {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; cursor: pointer; display: flex; align-items: center;
  justify-content: center; color: var(--t2); transition: background .1s;
}
.fv-close:hover { background: var(--border-2); }

/* Canvas */
.fv-canvas {
  flex: 1; overflow: auto; padding: 40px 32px 60px;
  display: flex; flex-direction: column; align-items: center;
}

/* Root node */
.fv-root { display: flex; flex-direction: column; align-items: center; }

/* Vertical connectors */
.fv-vline {
  width: 2px; height: 36px; background: var(--border); flex-shrink: 0;
}
.fv-vtick {
  width: 2px; height: 24px; background: var(--border); margin: 0 auto;
}

/* Scenario row */
.fv-scenarios-wrap { position: relative; }
.fv-scenarios-row  {
  display: flex; gap: 0; align-items: flex-start;
  position: relative;
}
/* horizontal bar connecting all scenarios */
.fv-scenarios-row::before {
  content: ''; position: absolute; top: 0; left: 50px; right: 50px;
  height: 2px; background: var(--border); z-index: 0;
}
.fv-scen-col {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 12px; min-width: 140px; max-width: 180px;
}

/* Tests row (inside scenario col) */
.fv-tests-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; }
.fv-tests-row  {
  display: flex; gap: 0; align-items: flex-start; position: relative;
}
.fv-tests-row::before {
  content: ''; position: absolute; top: 0; left: 20px; right: 20px;
  height: 2px; background: var(--border); z-index: 0;
}
.fv-test-col {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 8px; min-width: 70px;
}

/* Generic node */
.fv-node {
  position: relative; z-index: 1;
  border: 2px solid var(--border); border-radius: 12px;
  padding: 12px 14px; text-align: center; cursor: default;
  background: var(--card); transition: transform .15s, box-shadow .15s;
  width: 100%;
}
.fv-node:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.08); }

.fv-node-icon  { display: flex; justify-content: center; margin-bottom: 6px; color: var(--accent); }
.fv-node-badge {
  width: 24px; height: 24px; border-radius: 50%; margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.fv-node-title { font-size: 12px; font-weight: 700; color: var(--t1); word-break: break-all; }
.fv-node-desc  { font-size: 11px; color: var(--t3); margin-top: 3px; line-height: 1.4; }
.fv-node-meta  { font-size: 10px; color: var(--t3); margin-top: 4px; }
.fv-expand-hint {
  font-size: 10px; color: var(--accent); margin-top: 5px; opacity: .7;
}

/* Product node */
.fv-node-product {
  border-color: var(--accent); background: #eef2ff;
  min-width: 220px; max-width: 320px; cursor: default;
}
.fv-node-product .fv-node-title { font-size: 15px; color: #3730a3; }
.fv-node-product .fv-node-meta  { color: #6366f1; }

/* Scenario nodes */
.fv-node-scenario { cursor: pointer; }
.fv-node-approved { border-color: #86efac; background: #f0fdf4; }
.fv-node-approved .fv-node-badge { background: #22c55e; color: #fff; }
.fv-node-approved .fv-node-title { color: #15803d; }
.fv-node-rejected { border-color: #fca5a5; background: #fef2f2; }
.fv-node-rejected .fv-node-badge { background: #ef4444; color: #fff; }
.fv-node-rejected .fv-node-title { color: #b91c1c; }
.fv-node-awaiting { border-color: #fde68a; background: #fffbeb; }
.fv-node-awaiting .fv-node-badge { background: #f59e0b; color: #fff; }
.fv-node-awaiting .fv-node-title { color: #92400e; }
.fv-node-pending  { border-color: var(--border); background: var(--card); }
.fv-node-pending  .fv-node-badge { background: #e2e8f0; color: var(--t3); }
.fv-node-expanded { box-shadow: 0 0 0 3px rgba(99,102,241,.2); }

/* Sub-scenario nodes in flow view */
.fv-node-subsec { cursor: default; min-width: 90px; font-size: 11px; }

/* Test nodes */
.fv-node-test { cursor: default; min-width: 60px; }
.fv-node-pass    { border-color: #86efac; background: #f0fdf4; }
.fv-node-pass    .fv-node-badge { background: #22c55e; color: #fff; }
.fv-node-fail    { border-color: #fca5a5; background: #fef2f2; }
.fv-node-fail    .fv-node-badge { background: #ef4444; color: #fff; }
.fv-node-notset  { border-color: var(--border); background: #f8fafc; }
.fv-node-notset  .fv-node-badge { background: #e2e8f0; color: var(--t3); }

/* ===========================================================
   ADMIN CHARTS
   =========================================================== */
.dash-charts-row {
  display: flex; gap: 1.25rem; margin-top: 1.25rem; flex-wrap: wrap;
}
.dash-chart-card { flex: 1; min-width: 260px; }
.chart-legend-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--t2);
}
.chart-legend-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

/* ===========================================================
   RESPONSIVE — LARGE TABLET  ≤ 1100px
   =========================================================== */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-charts-row { flex-wrap: wrap; }
}

/* ===========================================================
   RESPONSIVE — TABLET  ≤ 900px
   =========================================================== */
@media (max-width: 900px) {
  .main-content { padding: 1.5rem 1.25rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .data-table th, .data-table td { padding: 10px 12px; }
  .login-left { width: 320px; min-width: 320px; padding: 2.5rem 2rem; }
}

/* ===========================================================
   RESPONSIVE — MOBILE  ≤ 768px
   =========================================================== */
@media (max-width: 768px) {

  /* ── Sidebar: slide-in drawer ── */
  :root { --sb-w: 0px; }
  .sidebar {
    display: flex !important;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    z-index: 250;
    width: 240px; min-width: 240px;
  }
  .sidebar.mobile-open { transform: translateX(0); }

  /* ── Hamburger ── */
  .nav-hamburger { display: flex; }

  /* ── Navbar compact ── */
  .navbar { padding: 0 0.875rem; }
  .navbar-brand { width: auto; min-width: auto; padding: 0 0.625rem 0 0; }
  .brand-logo { max-height: 32px; max-width: 110px; }
  .nav-search-wrap { max-width: none; flex: 1; margin: 0 0.5rem; }
  .nav-fullname { display: none; }

  /* ── Main content full-width ── */
  .main-content { margin-left: 0; padding: 1rem; }

  /* ── Stat grid ── */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1.25rem; }
  .stat-value { font-size: 32px; }

  /* ── Product list ── */
  .product-grid { grid-template-columns: 1fr; }
  .products-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .product-row-meta { display: none; }
  .product-row { padding: 12px 14px; }

  /* ── Page headers ── */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .prod-header, .detail-header { flex-direction: column; gap: 10px; }
  .prod-title, .detail-title { font-size: 18px; }

  /* ── Scenario 2-col layout: stack ── */
  .sc-layout { grid-template-columns: 1fr; }
  .sc-sidebar { position: static; }
  .sc-page-desc-preview { max-width: 100%; }

  /* ── Tables: horizontal scroll ── */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
  .data-table { min-width: 580px; }

  /* ── Team row ── */
  .team-row { flex-direction: column; gap: 1rem; }
  .field-row { margin-bottom: 12px; }

  /* ── Scenario cards ── */
  .scenario-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .scenario-desc-inline { max-width: 100%; }

  /* ── Test cases ── */
  .test-header { flex-wrap: wrap; gap: 6px; }
  .test-header form { margin-left: 0 !important; width: 100%; }
  .tracker-chip { font-size: 10px; }
  .tc-header { flex-wrap: wrap; }
  .tc-detail-row { flex-direction: column; gap: 6px; }
  .tc-detail-label { min-width: auto; }

  /* ── Buttons & cards ── */
  .btn-group { flex-wrap: wrap; }
  .card-stats { gap: 8px; }
  .stat-total { margin-left: 0; }
  .drop-zone { padding: 14px 12px 10px; }

  /* ── Workflow pipeline: horizontal scroll ── */
  .wf-pipeline {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding: 10px 14px;
    gap: 4px;
  }
  .wf-stage { padding: 8px 12px; flex-shrink: 0; }
  .wf-overdue-badge { flex-shrink: 0; }
  .wf-arrow { flex-shrink: 0; }

  /* ── Admin charts: stack ── */
  .dash-charts-row { flex-direction: column; }

  /* ── Flow visualizer: full-screen on mobile ── */
  .fv-panel { width: 100vw; height: 100dvh; border-radius: 0; }
  .fv-panel-header { padding: 14px 16px; }
  .fv-canvas { padding: 24px 16px 40px; }
  .fv-scenarios-row { min-width: max-content; }
  .fv-scen-col { min-width: 120px; padding: 0 8px; }

  /* ── Approver queue ── */
  .queue-card-header { flex-wrap: wrap; }
  .queue-card-right { width: 100%; margin-top: 4px; }

  /* ── Login ── */
  .login-outer { flex-direction: column; }
  .login-left {
    width: 100%; min-width: 100%;
    flex-direction: row; gap: 16px;
    padding: 1.25rem 1.5rem;
    justify-content: flex-start;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--accent-bd);
  }
  .login-left::before, .login-left::after { display: none; }
  .login-left-inner { display: flex; align-items: center; gap: 14px; }
  .login-left-logo { width: 50px; margin: 0; }
  .login-left-title { font-size: 15px; margin: 0; text-align: left; }
  .login-left-sub { display: none; }
  .login-right { padding: 1.5rem 1rem; align-items: flex-start; }
}

/* ===========================================================
   RESPONSIVE — SMALL PHONE  ≤ 480px
   =========================================================== */
@media (max-width: 480px) {
  /* Hide search bar — too cramped */
  .nav-search-wrap { display: none; }

  .stat-value { font-size: 26px; }
  .stat-card { padding: 1.1rem; }
  .stat-label { font-size: 10px; }

  .prod-title, .detail-title { font-size: 15px; }
  .page-header-left h1 { font-size: 18px; }
  .products-title { font-size: 18px; }

  /* Scenario detail test buttons */
  .tc-result-form { gap: 6px; }
  .tc-result-btn { padding: 9px 10px; font-size: 13px; }

  /* Smaller fv panel header */
  .fv-panel-header { padding: 12px 14px; }
  .fv-panel-title  { font-size: 14px; }

  /* Compact wf pipeline */
  .wf-stage-count { display: none; }
  .wf-stage { gap: 6px; }
  .wf-stage-label { font-size: 11px; }
}
