:root {
  --oeg: #1d72d6;
  --oeg-dark: #1558b0;
  --oeg-soft: #e8f1fc;
  --ink: #16202b;
  --ink-2: #41515f;
  --ink-3: #71828f;
  --line: #e4e9ee;
  --line-2: #eef2f5;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --navy: #1d2a37;
  --navy-2: #243443;
  --ok: #15915b;
  --ok-bg: #e4f5ec;
  --warn: #b7791f;
  --warn-bg: #fbf1dc;
  --err: #c0392b;
  --err-bg: #fbe7e4;
  --blue: #1d72d6;
  --blue-bg: #e8f1fc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 32, 43, 0.06), 0 4px 16px rgba(20, 32, 43, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

.layout { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--navy);
  color: #c7d2dc;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}
.brand-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.brand-logo {
  height: 38px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}
.brand-logo--sm { height: 28px; }
.sidebar .brand-logo,
.topbar .brand-logo {
  background: #fff;
  padding: 6px 10px;
  border-radius: 6px;
}
.topbar .brand-logo { padding: 4px 8px; border-radius: 5px; }
.brand-mark {
  width: 42px; height: 42px;
  background: var(--oeg);
  color: #fff;
  border-radius: 9px;
  font-weight: 800;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 800; color: #fff; font-size: 18px; letter-spacing: 0.5px; }
.brand-sub { font-size: 10px; color: #8ea0ae; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; line-height: 1.3; }
.topbar-title { font-weight: 700; font-size: 13px; color: #fff; letter-spacing: 0.2px; white-space: normal; line-height: 1.2; max-width: 160px; }

.nav {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
}
.nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.38); }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px;
  border-radius: 8px;
  color: #b4c2cd;
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: var(--oeg); color: #fff; box-shadow: 0 2px 8px rgba(29, 114, 214, 0.4); }
.nav-ico { width: 18px; text-align: center; font-size: 15px; opacity: 0.95; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 10px 6px; }
.sidebar-foot {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}
.foot-line { font-size: 11.5px; color: #8ea0ae; font-weight: 600; }
.foot-dim { font-size: 11px; color: #5f7283; margin-top: 3px; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; padding: 26px 32px 48px; transition: padding 0.2s ease; }

/* ---------- Sidebar collapse (desktop) ---------- */
.main-chrome {
  display: none;
}
.sidebar-collapse-btn {
  display: none;
}
@media (min-width: 821px) {
  .main-chrome {
    display: flex;
    align-items: center;
    margin: -8px 0 14px;
  }
  .sidebar {
    transition: width 0.2s ease, opacity 0.2s ease;
  }
  .sidebar-collapse-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f3f5f7;
    color: var(--ink-2);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s, box-shadow 0.12s;
    font-family: inherit;
  }
  .sidebar-collapse-btn:hover,
  .sidebar-collapse-btn:focus-visible {
    background: var(--panel);
    color: var(--oeg);
    border-color: #c5daf4;
    box-shadow: var(--shadow);
  }
  .sidebar-collapse-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(29, 114, 214, 0.18);
  }
  .sidebar-layout-icon { display: block; }
  .sidebar-layout-pane { opacity: 0.22; transition: opacity 0.15s; }
  .sidebar-collapse-btn.is-sidebar-hidden .sidebar-layout-pane { opacity: 0.55; }
  .sidebar-collapse-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 100;
    min-width: 220px;
    max-width: 280px;
    padding: 8px 11px;
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    white-space: normal;
    text-align: left;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  }
  .sidebar-collapse-btn::before {
    content: "";
    position: absolute;
    left: 14px;
    top: calc(100% + 2px);
    border: 6px solid transparent;
    border-bottom-color: var(--navy);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
  }
  .sidebar-collapse-btn:hover::after,
  .sidebar-collapse-btn:focus-visible::after,
  .sidebar-collapse-btn:hover::before,
  .sidebar-collapse-btn:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  body.sidebar-collapsed .sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }
  body.sidebar-collapsed .main {
    padding-left: 28px;
  }
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-title { font-size: 23px; font-weight: 800; letter-spacing: -0.3px; margin: 0; }
.page-sub { color: var(--ink-3); font-size: 13.5px; margin-top: 3px; }
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.crumbs a:hover { color: var(--oeg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--panel);
  color: var(--ink);
  transition: all 0.12s;
  font-family: inherit;
}
.btn:hover { background: var(--line-2); }
.btn-primary { background: var(--oeg); color: #fff; border-color: var(--oeg); }
.btn-primary:hover { background: var(--oeg-dark); }
.btn-outline { border-color: var(--line); background: var(--panel); }
.btn-outline:hover { border-color: var(--ink-3); background: var(--panel); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-danger { color: var(--err); border-color: transparent; background: transparent; }
.btn-danger:hover { background: var(--err-bg); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-pad { padding: 20px 22px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.panel-head .sub { color: var(--ink-3); font-size: 12.5px; font-weight: 500; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--oeg); }
.stat-label { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 7px; letter-spacing: -0.5px; }
.stat-meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.stat.blue::before { background: var(--blue); }
.stat.green::before { background: var(--ok); }
.stat.navy::before { background: var(--navy); }
.stat.amber::before { background: #f59e0b; }
.stat.amber { background: #fffbeb; }

/* ---------- Role dashboards ---------- */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  align-items: start;
}
.dashboard-side { display: flex; flex-direction: column; gap: 16px; }
.dashboard-kpis { margin-bottom: 18px; }

.dashboard-inbox .panel-head { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.dashboard-inbox-list { max-height: 420px; overflow-y: auto; }
.dashboard-inbox-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
}
.dashboard-inbox-item.unread { background: #f8fbff; }
.dashboard-inbox-item.priority-urgent { border-left: 3px solid var(--err); }
.dashboard-inbox-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.dashboard-inbox-body { flex: 1; min-width: 0; }
.dashboard-inbox-msg { font-size: 12.5px; color: var(--ink-2); margin: 6px 0 0; line-height: 1.4; }

.dashboard-deadline-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
  color: var(--ink);
}
.dashboard-deadline-row:last-child { border-bottom: none; }
.dashboard-deadline-row:hover { color: var(--oeg); }

@media (max-width: 960px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-side { order: -1; }
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

/* ---------- Horizontal scroll rails (wide list tables) ---------- */
.table-scroll-sync { position: relative; }
.table-scroll-sync .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.table-scroll-top-bar {
  display: none;
  padding: 8px 12px 6px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid var(--line-2);
}
.table-scroll-sync.has-h-scroll .table-scroll-top-bar { display: block; }
.table-scroll-hint {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  text-align: center;
  margin-bottom: 6px;
  user-select: none;
  letter-spacing: 0.01em;
}
.table-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  cursor: ew-resize;
}
.table-scroll-top-inner,
.table-scroll-sticky-inner {
  height: 1px;
  pointer-events: none;
}
.table-scroll-sticky {
  display: none;
  position: sticky;
  bottom: 0;
  z-index: 25;
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  margin-top: -1px;
  background: rgba(250, 251, 252, 0.97);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
  cursor: ew-resize;
}
.table-scroll-sync.has-h-scroll .table-scroll-sticky { display: block; }
.table-scroll-top::-webkit-scrollbar,
.table-scroll-sticky::-webkit-scrollbar,
.table-scroll-sync .table-wrap::-webkit-scrollbar {
  height: 10px;
}
.table-scroll-top::-webkit-scrollbar-thumb,
.table-scroll-sticky::-webkit-scrollbar-thumb,
.table-scroll-sync .table-wrap::-webkit-scrollbar-thumb {
  background: #b8c4d0;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.table-scroll-top::-webkit-scrollbar-thumb:hover,
.table-scroll-sticky::-webkit-scrollbar-thumb:hover,
.table-scroll-sync .table-wrap::-webkit-scrollbar-thumb:hover {
  background: #8fa3b8;
  background-clip: padding-box;
}

table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th {
  text-align: left; padding: 11px 14px;
  font-size: 11px; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line); background: #f8fafc; white-space: nowrap;
  vertical-align: bottom;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; background: var(--panel); }
table.data tbody tr:hover td { background: #f8fbff; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr.datatable-row { transition: background 0.1s; }
.num-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-strong { font-weight: 700; }
.t-dim { color: var(--ink-3); }
.t-mono { font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; }

/* ---------- Modern datatable ---------- */
.datatable-card { overflow: hidden; padding: 0; }
.datatable-card .empty { padding: 48px 24px; }
.datatable-scroll { max-width: 100%; overflow-x: auto; }
.datatable { min-width: 1180px; }
.datatable thead th {
  position: sticky; top: 0; z-index: 5;
  background: #f1f5f9; box-shadow: 0 1px 0 var(--line);
}
.datatable .th-stack { display: flex; flex-direction: column; gap: 2px; line-height: 1.25; }
.datatable .th-main {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--ink-2);
}
.datatable .th-sub {
  font-size: 10px; font-weight: 500; text-transform: none;
  letter-spacing: 0; color: var(--ink-3);
}
.datatable .th-sort-link { display: block; color: inherit; text-decoration: none; }
.datatable .th-sort-link:hover .th-main { color: var(--oeg); }
.datatable .th-sort-ind { color: var(--oeg); font-weight: 800; margin-left: 2px; }
.datatable .col-sticky-l { position: sticky; left: 0; z-index: 3; box-shadow: 4px 0 8px -4px rgba(15, 23, 42, 0.08); }
.datatable thead .col-sticky-l { z-index: 6; background: #f1f5f9; }
.datatable .col-sticky-r { position: sticky; right: 0; z-index: 3; box-shadow: -4px 0 8px -4px rgba(15, 23, 42, 0.08); }
.datatable thead .col-sticky-r { z-index: 6; background: #f1f5f9; }
.datatable .col-name { min-width: 148px; }
.datatable .col-code { min-width: 108px; }
.datatable .col-money { min-width: 108px; text-align: right; }
.datatable .col-actions { min-width: 132px; text-align: right; }
.datatable .cell-primary { font-weight: 600; color: var(--ink); text-decoration: none; }
.datatable .cell-primary:hover { color: var(--oeg); }
.datatable .col-money .money-val { display: block; text-align: right; }
.datatable .cell-link { color: var(--ink-3); text-decoration: none; }
.datatable .cell-link:hover { color: var(--oeg); }
.datatable .cell-wrap { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.datatable .cell-empty { color: var(--ink-3); opacity: 0.55; }
.datatable .cell-date { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.money-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.money-val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); white-space: nowrap; }
.money-flag {
  display: inline-block; font-size: 10px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 999px; background: var(--err-bg); color: var(--err);
  text-transform: uppercase; letter-spacing: 0.02em;
}
.tag {
  display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.tag-neutral { background: #eef2f6; color: var(--ink-2); border: 1px solid var(--line); }
.status-pill {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; line-height: 1.2; white-space: nowrap;
}
.status-pill.s-Active { background: var(--ok-bg); color: var(--ok); }
.status-pill.s-On\.Bench { background: #eef2ff; color: #4338ca; }
.status-pill.s-Inactive { background: var(--line-2); color: var(--ink-3); }
.row-actions { display: inline-flex; align-items: center; gap: 2px; justify-content: flex-end; }
.row-actions form { display: inline; margin: 0; }
.action-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 30px; padding: 0 8px; border: none; border-radius: 6px;
  background: transparent; color: var(--ink-2); font-size: 11.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; font-family: inherit;
  transition: background 0.1s, color 0.1s;
}
.action-btn:hover { background: var(--blue-bg); color: var(--oeg); }
.action-btn-danger:hover { background: var(--err-bg); color: var(--err); }
.table-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfc;
}
.table-footer-summary { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pager-modern { display: inline-flex; align-items: center; gap: 8px; }
.pager-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-size: 18px; font-weight: 600;
  line-height: 1; text-decoration: none;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.pager-btn:hover:not(.is-disabled) { background: var(--blue-bg); border-color: #c5daf4; color: var(--oeg); }
.pager-btn.is-disabled { opacity: 0.35; pointer-events: none; }
.pager-status { font-size: 13px; color: var(--ink-3); padding: 0 4px; white-space: nowrap; }
.list-search-modern { margin-bottom: 14px !important; gap: 8px; }
.search-modern { position: relative; flex: 1; max-width: 440px; }
.search-modern .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); font-size: 15px; pointer-events: none;
}
.search-modern input {
  width: 100%; padding-left: 36px !important; border-radius: 8px !important;
  border: 1px solid var(--line) !important; background: var(--panel) !important; height: 40px;
}
.search-modern input:focus {
  outline: none; border-color: var(--oeg) !important;
  box-shadow: 0 0 0 3px rgba(29, 114, 214, 0.12);
}
.result-summary { font-size: 13px; color: var(--ink-3); }
.result-summary strong { color: var(--ink); font-weight: 700; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.b-gray { background: var(--line-2); color: var(--ink-2); }
.b-blue { background: var(--blue-bg); color: var(--blue); }
.b-green { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-red { background: var(--err-bg); color: var(--err); }
.b-oeg { background: var(--oeg-soft); color: var(--oeg-dark); }
.badge.plain::before { display: none; }

/* status helpers */
.s-Identified, .s-Pending { background: var(--line-2); color: var(--ink-2); }
.s-In.Progress { background: var(--blue-bg); color: var(--blue); }
.s-Submitted { background: var(--warn-bg); color: var(--warn); }
.s-Won, .s-Completed, .s-Active { background: var(--ok-bg); color: var(--ok); }
.s-Lost, .s-Dropped, .s-Inactive { background: var(--err-bg); color: var(--err); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
input[type=text], input[type=number], input[type=date], input[type=email],
input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13.5px; font-family: inherit; color: var(--ink);
  background: #fff; transition: border 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--oeg); box-shadow: 0 0 0 3px rgba(29, 114, 214, 0.12);
}
textarea { resize: vertical; min-height: 70px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ink-3); margin: 26px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}

/* ---------- Flash ---------- */
.flash-wrap { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 11px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 500; border: 1px solid; }
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: #bfe6cf; }
.flash-error { background: var(--err-bg); color: var(--err); border-color: #f3c9c3; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search { position: relative; }
.search input { padding-left: 32px; min-width: 240px; }
.search::before { content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 16px; }
.filter-tabs { display: inline-flex; background: var(--line-2); border-radius: 8px; padding: 3px; gap: 2px; }
.filter-tabs a { padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.filter-tabs a.active { background: #fff; color: var(--oeg); box-shadow: var(--shadow); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--ink-3); }
.empty .ico { font-size: 38px; opacity: 0.35; }
.empty h3 { color: var(--ink-2); margin: 14px 0 5px; font-size: 16px; }
.empty p { margin: 0 0 18px; }

/* ---------- Layout helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.mt-20 { margin-top: 20px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- Detail meta list ---------- */
.meta-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-2); border-radius: 8px; overflow: hidden; }
.meta-list .mi { background: #fff; padding: 12px 15px; }
.meta-list .mk { font-size: 11.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.meta-list .mv { font-size: 14px; font-weight: 600; margin-top: 3px; }

/* ---------- Workflow timeline ---------- */
.wf-level { margin-bottom: 18px; }
.wf-level-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.wf-level-badge {
  background: var(--navy); color: #fff; font-size: 11.5px; font-weight: 700;
  padding: 4px 10px; border-radius: 6px; letter-spacing: 0.4px;
}
.wf-level-title { font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.wf-act {
  border: 1px solid var(--line); border-radius: 9px; padding: 13px 15px; margin-bottom: 8px;
  background: #fff; transition: border 0.12s;
}
.wf-act.done { border-left: 3px solid var(--ok); }
.wf-act.prog { border-left: 3px solid var(--blue); }
.wf-act.pend { border-left: 3px solid var(--line); }
.wf-act-top { display: flex; align-items: flex-start; gap: 12px; }
.wf-no {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; background: var(--line-2);
  color: var(--ink-2); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.wf-act.done .wf-no { background: var(--ok); color: #fff; }
.wf-act.prog .wf-no { background: var(--blue); color: #fff; }
.sbp-req-table td { vertical-align: top; font-size: 13px; }
.sbp-req-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.alert-warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; padding: 12px 14px; border-radius: 8px; }

/* Bid deadline banner & milestone schedule */
.deadline-banner {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
  margin-top: 16px; padding: 18px 22px; border-radius: 12px; border: 2px solid var(--line);
  background: linear-gradient(135deg, #fff 0%, #fef2f2 100%);
}
.deadline-banner.deadline-critical,
.deadline-banner.deadline-overdue {
  border-color: #fca5a5; background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
}
.deadline-banner.deadline-warning { border-color: #fcd34d; background: linear-gradient(135deg, #fff 0%, #fffbeb 100%); }
.deadline-banner.deadline-ok { border-color: #86efac; background: linear-gradient(135deg, #fff 0%, #f0fdf4 100%); }
.deadline-banner-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-3); }
.deadline-banner-datetime { font-size: 22px; font-weight: 700; color: var(--ink); margin-top: 4px; }
.deadline-banner-countdown { margin-top: 8px; }
.deadline-days {
  font-size: 20px; font-weight: 800; color: #dc2626; letter-spacing: -0.02em;
}
.deadline-days.critical { color: #dc2626; }
.deadline-days.overdue { color: #991b1b; }
.deadline-days-inline { font-size: 12px; font-weight: 700; color: #dc2626; margin-top: 2px; }
.deadline-banner-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.deadline-milestones .ms-overdue { background: #fef2f2; }
.deadline-milestones .ms-due_soon { background: #fffbeb; }
.deadline-milestones .ms-completed { background: #f0fdf4; }
.ms-status-completed { background: #dcfce7 !important; color: #166534 !important; }
.ms-status-overdue { background: #fee2e2 !important; color: #991b1b !important; }
.ms-status-due_soon { background: #fef3c7 !important; color: #92400e !important; }
.ms-status-on_track { background: #dbeafe !important; color: #1e40af !important; }
.deadline-banner-closed { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }

.wf-desc { flex: 1; font-size: 13.5px; font-weight: 500; }
.wf-meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.wf-edit-form { margin-top: 11px; display: none; grid-template-columns: 150px 150px 1fr auto; gap: 8px; align-items: end; }
.wf-edit-form.open { display: grid; }
.evidence-upload-form {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
}
.wf-edit-form .field label { font-size: 11px; }

/* progress bar */
.pbar { height: 7px; background: var(--line-2); border-radius: 20px; overflow: hidden; min-width: 90px; }
.pbar > span { display: block; height: 100%; background: var(--oeg); border-radius: 20px; }
.pbar.green > span { background: var(--ok); }

/* ---------- Estimation line editor ---------- */
.est-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.est-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); font-weight: 700; padding: 8px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.est-table td { padding: 5px 6px; border-bottom: 1px solid var(--line-2); }
.est-table input, .est-table select { padding: 7px 8px; font-size: 13px; }
.est-table input.num { text-align: right; }
.est-table .x-col { width: 34px; text-align: center; }
.row-del { background: transparent; border: none; color: var(--ink-3); cursor: pointer; font-size: 16px; padding: 4px; border-radius: 6px; }
.row-del:hover { background: var(--err-bg); color: var(--err); }

.totals-box { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; font-size: 14px; max-width: 360px; margin-left: auto; }
.totals-box .tk { color: var(--ink-2); }
.totals-box .tv { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.totals-box .grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px; font-size: 17px; font-weight: 800; }
.totals-box .grand .tv { color: var(--oeg-dark); }

.quote-banner {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff; border-radius: var(--radius); padding: 22px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.quote-banner .ql { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.6px; color: #9fb1c0; font-weight: 600; }
.quote-banner .qv { font-size: 30px; font-weight: 800; margin-top: 4px; }
.quote-banner .qv .cur { font-size: 17px; opacity: 0.7; margin-right: 4px; }
.quote-step { text-align: center; }
.quote-step .ql { color: #9fb1c0; }
.quote-step .sv { font-size: 19px; font-weight: 700; margin-top: 3px; }
.quote-arrow { color: var(--oeg); font-size: 22px; }

.help-card { background: var(--oeg-soft); border: 1px solid #b8d4f0; border-radius: var(--radius); padding: 16px 18px; font-size: 13px; color: var(--ink-2); }
.help-card h4 { margin: 0 0 8px; color: var(--oeg-dark); font-size: 13px; }
.help-card ul { margin: 0; padding-left: 18px; }
.help-card li { margin-bottom: 4px; }

.chip { display: inline-block; padding: 2px 8px; background: var(--line-2); border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 2px; }

/* ---------- Mobile topbar (hidden on desktop) ---------- */
.topbar { display: none; }
.nav-overlay { display: none; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  /* Topbar with hamburger */
  .topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 50;
    background: var(--navy); color: #fff; padding: 10px 14px;
    box-shadow: 0 1px 10px rgba(20, 32, 43, 0.22);
  }
  .hamburger {
    width: 40px; height: 40px; flex-shrink: 0; padding: 0;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    background: rgba(255, 255, 255, 0.08); border: none; border-radius: 8px; cursor: pointer;
  }
  .hamburger span { width: 18px; height: 2px; background: #fff; border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
  body.nav-open .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.nav-open .hamburger span:nth-child(2) { opacity: 0; }
  body.nav-open .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .brand-mark.sm { width: 32px; height: 32px; font-size: 13px; border-radius: 7px; }
  .topbar-title { font-weight: 700; font-size: 12px; color: #fff; letter-spacing: 0.2px; white-space: normal; line-height: 1.2; max-width: 140px; }

  /* Sidebar becomes an off-canvas drawer */
  .layout { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 70;
    height: 100vh; width: 270px; max-width: 84vw;
    max-height: 100vh;
    overflow: hidden;
    transform: translateX(-100%); transition: transform 0.25s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: 4px 0 28px rgba(0, 0, 0, 0.32); }

  .nav-overlay {
    display: block; position: fixed; inset: 0; z-index: 60;
    background: rgba(10, 16, 22, 0.5);
    opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s;
  }
  body.nav-open .nav-overlay { opacity: 1; visibility: visible; }
  body.nav-open { overflow: hidden; }

  /* Content density on small screens */
  .main { padding: 18px 16px 40px; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .meta-list { grid-template-columns: 1fr; }
  .wf-edit-form, .wf-edit-form.open { grid-template-columns: 1fr 1fr; }
  .totals-box { max-width: none; }
  .search { flex: 1; }
  .search input { min-width: 0; width: 100%; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 20px; }
  .quote-banner .qv { font-size: 24px; }
  .wf-edit-form, .wf-edit-form.open { grid-template-columns: 1fr; }
}

/* ---------- Pipeline state badges ---------- */
.s-Ingested       { background: #f0f2f5; color: #41515f; }
.s-Prospect       { background: var(--blue-bg); color: var(--blue); }
.s-Selected       { background: #fff4e0; color: #9a6000; }
.s-SBP-Active     { background: #e8f1fc; color: var(--oeg); }
.s-Bid-Submitted  { background: #f0eafd; color: #6b3fa0; }
.s-Won            { background: var(--ok-bg); color: var(--ok); }
.s-Lost           { background: var(--err-bg); color: var(--err); }
.s-Dropped        { background: #f0f2f5; color: #71828f; }

/* ---------- Login page ---------- */
.login-body { background: var(--bg); display: flex; flex-direction: column; min-height: 100vh; align-items: center; justify-content: center; }
.login-wrap { width: 100%; max-width: 420px; padding: 24px 16px; }
.login-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px 32px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.login-brand--stack { flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.login-brand .brand-logo { height: 44px; width: auto; max-width: 220px; object-fit: contain; }
.login-heading { font-size: 18px; font-weight: 700; margin: 0 0 20px; color: var(--ink); }
.login-btn { width: 100%; margin-top: 8px; padding: 11px; font-size: 15px; }
.login-foot { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 20px; }

/* ---------- Vendor portal (no sidebar) ---------- */
.vendor-portal-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.vendor-portal-header {
  background: var(--ink);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.vendor-portal-brand { display: flex; align-items: center; gap: 12px; }
.vendor-portal-brand .brand-logo {
  height: 32px;
  background: #fff;
  padding: 4px 8px;
  border-radius: 5px;
}
.vendor-portal-title { font-weight: 700; font-size: 16px; }
.vendor-portal-sub { font-size: 12px; color: #9aabb8; }
.vendor-portal-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.vendor-portal-main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 20px 40px; }
.vendor-portal-foot { text-align: center; font-size: 12px; color: var(--ink-3); padding: 16px; border-top: 1px solid var(--line); }

/* Vendor RFP multi-profile UI */
.vendor-rfp-table tfoot .vendor-rfp-total-row { background: var(--bg); font-size: 14px; }
.vendor-rfp-table tfoot .vendor-rfp-total-row td { border-top: 2px solid var(--line); padding-top: 12px; }
.vendor-rfp-table .vendor-rate-input { max-width: 140px; text-align: right; }
.vendor-profile-list { list-style: none; margin: 0; padding: 0; }
.vendor-profile-item { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 12px; margin-bottom: 6px; }
.vendor-profile-link { color: var(--blue); font-weight: 600; text-decoration: none; }
.vendor-profile-link:hover { text-decoration: underline; }
.vendor-remove-form { display: inline; margin-left: 4px; }
.btn-remove {
  background: var(--err-bg); color: var(--err); border: none; border-radius: 50%;
  width: 22px; height: 22px; font-size: 16px; line-height: 1; cursor: pointer; padding: 0;
}
.btn-remove:hover { background: var(--err); color: #fff; }
.upload-slots { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.upload-slot-form { display: flex; flex-direction: column; gap: 4px; padding: 8px; background: var(--bg); border-radius: 8px; border: 1px solid var(--line); }

/* ---------- Sidebar enhancements ---------- */
.nav-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px; color: #5f7283; font-weight: 700; padding: 14px 14px 4px; }
.nav-sub { padding-left: 30px; font-size: 13px; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.07); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-shrink: 0; }
.foot-user { min-width: 0; }
.foot-logout { color: #8ea0ae; font-size: 17px; flex-shrink: 0; padding: 4px 6px; border-radius: 6px; transition: background 0.12s, color 0.12s; }
.foot-logout:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ---------- Topbar right area ---------- */
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.notif-bell { position: relative; color: #b4c2cd; font-size: 18px; padding: 4px 6px; border-radius: 6px; transition: background 0.12s; border: none; background: transparent; cursor: pointer; line-height: 1; }
.notif-bell:hover { background: rgba(255,255,255,0.1); }
.notif-badge { position: absolute; top: 0; right: 0; background: var(--err); color: #fff; font-size: 10px; font-weight: 800; border-radius: 8px; padding: 1px 4px; min-width: 16px; text-align: center; }

.inbox-bell-wrap { position: relative; }
.inbox-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(20, 32, 43, 0.18);
  z-index: 200;
  overflow: hidden;
}
.inbox-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  font-size: 14px;
}
.inbox-dropdown-list { max-height: 320px; overflow-y: auto; }
.inbox-dropdown-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--line-2);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.inbox-dropdown-item:hover { background: var(--line-2); }
.inbox-dropdown-item.unread { background: #f8fbff; }
.inbox-dd-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.inbox-dd-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inbox-dd-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.inbox-dd-msg { font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.inbox-dd-open { border: none; background: transparent; color: var(--oeg); font-weight: 700; cursor: pointer; padding: 4px; }
.inbox-dropdown-empty { padding: 20px 14px; margin: 0; font-size: 13px; text-align: center; }
.inbox-dropdown-foot { padding: 10px 12px; border-top: 1px solid var(--line-2); }

.nav-badge {
  margin-left: auto;
  background: var(--err);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

/* ---------- Inbox ---------- */
.inbox-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.inbox-stat a {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.inbox-stat a:hover { border-color: var(--oeg); }
.inbox-stat-active a {
  border-color: var(--oeg);
  box-shadow: 0 0 0 2px var(--oeg-soft);
}
.inbox-stat-val { display: block; font-size: 22px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.inbox-stat-label { display: block; font-size: 11px; font-weight: 600; color: var(--ink-3); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.3px; }

.inbox-toolbar { margin-bottom: 14px; }
.inbox-panel { padding: 0; overflow: hidden; }
.inbox-panel .table-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2, #fafafa);
}
.inbox-day-group { padding: 8px 0; }
.inbox-day-group + .inbox-day-group { border-top: 1px solid var(--line-2); }
.inbox-day-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-3);
  padding: 12px 18px 6px;
  margin: 0;
}
.inbox-item {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  align-items: flex-start;
}
.inbox-item:last-child { border-bottom: none; }
.inbox-item-unread { background: linear-gradient(90deg, #f0f7ff 0%, #fff 120px); }
.inbox-item.priority-urgent { border-left: 3px solid var(--err); }
.inbox-item.priority-high { border-left: 3px solid #f59e0b; }
.inbox-item-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.inbox-item-unread .inbox-item-icon { background: var(--oeg-soft); }
.inbox-item-body { flex: 1; min-width: 0; }
.inbox-item-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.inbox-item-title { font-size: 14px; color: var(--ink); }
.inbox-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--oeg);
  margin-right: 6px;
  vertical-align: middle;
}
.inbox-ref { font-size: 10px; margin-left: 6px; vertical-align: middle; }
.inbox-time { font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.inbox-tender-name { font-size: 13px; margin: 4px 0 2px; }
.inbox-message { font-size: 13px; color: var(--ink-2); margin: 6px 0 8px; line-height: 1.45; }
.inbox-item-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inbox-cat { font-size: 10px; }
.inbox-item-actions { flex-shrink: 0; padding-top: 2px; }

@media (max-width: 640px) {
  .inbox-item { flex-wrap: wrap; }
  .inbox-item-actions { width: 100%; padding-left: 50px; }
}

/* ---------- Role badges ---------- */
.role-admin    { background: #f0eafd; color: #6b3fa0; }
.role-bd_head  { background: #fff4e0; color: #9a6000; }
.role-bd_manager { background: var(--blue-bg); color: var(--blue); }
.role-hr_user  { background: var(--ok-bg); color: var(--ok); }
.role-finance  { background: #e8f1fc; color: var(--oeg); }
.role-vendor   { background: #e8f4fd; color: #1565a8; }
.badge-ok  { background: var(--ok-bg); color: var(--ok); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- AI score badges ---------- */
.ai-score-high { background: var(--ok-bg); color: var(--ok); }
.ai-score-mid  { background: var(--warn-bg); color: var(--warn); }
.ai-score-low  { background: var(--err-bg); color: var(--err); }

/* ---------- Error pages ---------- */
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; }
.error-code { font-size: 72px; font-weight: 900; color: var(--line); margin-bottom: 8px; line-height: 1; }
.error-title { font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.error-sub { color: var(--ink-3); margin-bottom: 24px; }

/* ---------- Prospecting / AI score UI ---------- */
.go-badge  { background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.nogo-badge { background: var(--err-bg); color: var(--err); font-weight: 700; }

/* ---------- HR Requests ---------- */
.line-pending   { color: var(--warn); }
.line-confirmed { color: var(--ok); }

/* ---------- Changes & Bugs ---------- */
.bug-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 1100px) { .bug-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .bug-stats { grid-template-columns: repeat(2, 1fr); } }

.bug-stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  transition: box-shadow 0.12s, border-color 0.12s;
  display: block;
}
.bug-stat-card:hover { box-shadow: var(--shadow); border-color: var(--ink-3); }
.bug-stat-card.active { border-width: 2px; }
.bug-stat-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); margin-bottom: 6px; }
.bug-stat-count { font-size: 26px; font-weight: 800; line-height: 1; }

.bug-stat-open      .bug-stat-label { color: #b45309; }
.bug-stat-open      .bug-stat-count { color: #b45309; }
.bug-stat-open.active { border-color: #b45309; background: var(--warn-bg); }

.bug-stat-inprogress .bug-stat-label { color: var(--blue); }
.bug-stat-inprogress .bug-stat-count { color: var(--blue); }
.bug-stat-inprogress.active { border-color: var(--blue); background: var(--blue-bg); }

.bug-stat-fixed     .bug-stat-label { color: var(--ok); }
.bug-stat-fixed     .bug-stat-count { color: var(--ok); }
.bug-stat-fixed.active { border-color: var(--ok); background: var(--ok-bg); }

.bug-stat-closed    .bug-stat-label { color: var(--ink-3); }
.bug-stat-closed    .bug-stat-count { color: var(--ink-3); }

.bug-stat-notabug   .bug-stat-label { color: var(--ink-3); }
.bug-stat-notabug   .bug-stat-count { color: var(--ink-3); }

.bug-stat-moreinfo  .bug-stat-label { color: #5c35cc; }
.bug-stat-moreinfo  .bug-stat-count { color: #5c35cc; }
.bug-stat-moreinfo.active { border-color: #5c35cc; background: #f0eafd; }

/* Priority badges */
.bug-p-critical { background: var(--err-bg);  color: var(--err);  font-weight: 700; }
.bug-p-high     { background: #fff0e0;         color: #c05000;     font-weight: 700; }
.bug-p-medium   { background: var(--warn-bg);  color: var(--warn); font-weight: 600; }
.bug-p-low      { background: var(--line-2);   color: var(--ink-3);}

/* Status badges */
.bug-s-open                { background: #fff3e0;         color: #b45309; font-weight: 600; }
.bug-s-in-progress         { background: var(--blue-bg);  color: var(--blue); font-weight: 600; }
.bug-s-fixed               { background: var(--ok-bg);    color: var(--ok); font-weight: 600; }
.bug-s-closed              { background: var(--line-2);   color: var(--ink-3); }
.bug-s-not-a-bug           { background: var(--line-2);   color: var(--ink-3); }
.bug-s-more-info-required  { background: #f0eafd;         color: #5c35cc; font-weight: 600; }

/* Table tweaks */
.bugs-table td { vertical-align: middle; }
.bug-id-link {
  font-family: monospace; font-size: 12.5px; font-weight: 700;
  color: var(--blue); text-decoration: none;
}
.bug-id-link:hover { text-decoration: underline; }
.bug-title-link { color: var(--ink); text-decoration: none; }
.bug-title-link:hover { color: var(--oeg); }
.bug-comment-count { font-size: 11.5px; color: var(--ink-3); margin-left: 6px; }
.bug-action-btn {
  background: none; border: none; cursor: pointer; font-size: 15px;
  padding: 3px 5px; border-radius: 5px; transition: background 0.1s;
  text-decoration: none; display: inline-flex; align-items: center;
}
.bug-action-btn:hover { background: var(--line-2); }

/* Comment thread */
.bug-comments { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.bug-comment { background: var(--bg); border-radius: 8px; padding: 10px 14px; border-left: 3px solid var(--line); }
.bug-comment-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; font-size: 12.5px; }
.bug-comment-text { font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; line-height: 1.6; }

/* Pipeline activity timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px;
  width: 2px; background: var(--line);
}
.timeline-item { position: relative; padding: 0 0 16px 22px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: 0; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--oeg); border: 2px solid var(--panel);
}
.timeline-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.timeline-meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.timeline-when { font-size: 11px; color: var(--ink-3); margin-bottom: 2px; }
.timeline-what { font-size: 13px; color: var(--ink); line-height: 1.45; }

.btn-icon { min-width: 34px; padding: 4px 10px; font-size: 15px; line-height: 1.2; }
.btn-icon-danger:hover { color: var(--err); border-color: var(--err); }
.row-muted td { opacity: 0.72; }

/* Inline banners (e.g. auto-generated preliminary estimate notice) */
.banner { padding: 12px 16px; border-radius: 8px; font-size: 13px; line-height: 1.55; border: 1px solid var(--line); background: var(--panel-2, #f7f8fa); }
.banner a { color: var(--oeg); font-weight: 600; }
.banner-warn { background: #fff8e6; border-color: #f3d98b; color: #6b520a; }
.banner-warn a { color: #8a5b00; }

/* List pagination, sort, loading */
.sortable a { color: inherit; text-decoration: none; white-space: nowrap; }
.sortable a:hover { color: var(--oeg); text-decoration: underline; }
.list-result-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.list-search-form.toolbar { display: flex; align-items: center; flex-wrap: wrap; }
.list-loading {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(255, 255, 255, 0.72);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.list-loading[hidden] { display: none !important; }
body.page-loading .main { visibility: hidden; }
.list-loading-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 24px 32px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  font-size: 14px; color: var(--ink-2); font-weight: 500;
}
.list-loading-inner strong { color: var(--ink); font-size: 15px; }
.list-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--oeg);
  animation: list-spin 0.7s linear infinite;
}
@keyframes list-spin { to { transform: rotate(360deg); } }
.pager-nav .btn.disabled { pointer-events: none; }
tr.row-highlight { background: #f0fdf4; }

/* Integration log detail */
.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 16px;
  margin: 0;
  font-size: 13.5px;
}
.detail-grid dt { margin: 0; color: var(--ink-3); font-weight: 500; }
.detail-grid dd { margin: 0; color: var(--ink); }
.log-error-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 320px;
  overflow: auto;
}
.log-error-list li {
  padding: 8px 10px;
  margin-bottom: 6px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 12px;
  word-break: break-word;
}
.log-error-list code {
  background: transparent;
  padding: 0;
  white-space: pre-wrap;
}

/* ---------- Bid analysis ---------- */
.vendor-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.vendor-pick-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface);
}
.vendor-pick-card.is-selected {
  border-color: var(--oeg);
  box-shadow: 0 0 0 1px var(--oeg-soft);
}
.bid-col-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.bid-col-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.bid-col-highlight { border-color: #fbbf24; background: #fffbeb; }
.bid-col-final { border-color: #86efac; background: #f0fdf4; }
.bid-col-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.bid-col-val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bid-th-prelim { background: #f8fafc; }
.bid-th-vendor { background: #eff6ff; }
.bid-th-working { background: #fffbeb; }
.bid-th-post { background: #f0fdf4; }
.rfp-vendor-picker { position: relative; }
.rfp-vendor-picker summary::-webkit-details-marker { display: none; }
@media (max-width: 900px) {
  .bid-col-summary { grid-template-columns: repeat(2, 1fr); }
}
.bid-delta-strip { border-left: 4px solid var(--oeg); }
.bid-delta-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.bid-delta-flow { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 14px; }
.bid-delta-arrow { color: var(--ink-3); }
.bid-delta-pct.ok { color: var(--ok); font-weight: 600; }
.bid-delta-pct.warn { color: var(--warn); font-weight: 600; }

/* ---------- BD Team Board ---------- */
.board-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.board-kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.board-kpi-warn { border-color: #fcd34d; background: linear-gradient(135deg, #fff 0%, #fffbeb 100%); }
.board-kpi-ceo { border-color: #c7d2fe; background: linear-gradient(135deg, #fff 0%, #eef2ff 100%); }
.board-kpi-val { font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.board-kpi-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); margin-top: 6px; }
.board-kpi-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.board-toolbar-right { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.team-lane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.team-lane-unassigned {
  border-color: #fcd34d;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 48px);
}
.team-lane-orphan { border-style: dashed; }
.team-lane-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-2);
}
.team-lane-identity { display: flex; gap: 12px; align-items: center; }
.team-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--oeg-soft); color: var(--oeg);
  font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.team-lane-title { font-size: 16px; font-weight: 700; margin: 0; color: var(--ink); }
.team-lane-sub { font-size: 12.5px; color: var(--ink-3); margin: 2px 0 0; }
.team-lane-stats { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); }
.team-stat strong { color: var(--ink); font-weight: 700; }
.team-stat-warn strong { color: #b45309; }

.bid-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.bid-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.bid-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(20, 32, 43, 0.08);
}
.bid-card-attn {
  border-color: #fca5a5;
  background: linear-gradient(135deg, #fff 0%, #fef2f2 100%);
}
.bid-card-top {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
}
.bid-card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--oeg);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}
.bid-card-title:hover { text-decoration: underline; }
.bid-card-arrow { opacity: 0.5; font-weight: 400; margin-left: 2px; }
.bid-card-meta { font-size: 12px; margin-bottom: 8px; }
.bid-card-deadline {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
}
.bid-card-deadline.deadline-overdue { background: #fef2f2; color: #991b1b; }
.bid-card-deadline.deadline-critical { background: #fff7ed; color: #c2410c; }
.bid-card-deadline.deadline-warning { background: #fffbeb; color: #b45309; }
.bid-card-deadline.deadline-ok { background: #f0fdf4; color: #15803d; }
.bid-card-deadline.deadline-none { background: var(--line-2); color: var(--ink-3); font-weight: 500; }

.bid-card-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bid-card-progress .pbar { flex: 1; }
.bid-card-pct { font-size: 11px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }

.ms-strip { display: flex; gap: 5px; margin-bottom: 10px; flex-wrap: wrap; }
.ms-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
}
.ms-dot.ms-completed { background: var(--ok); }
.ms-dot.ms-overdue { background: #dc2626; box-shadow: 0 0 0 2px #fecaca; }
.ms-dot.ms-due_soon { background: #f59e0b; }
.ms-dot.ms-upcoming { background: #94a3b8; }
.ms-dot.ms-pending { background: var(--line); }

.bid-card-next {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.45;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--panel);
  border-radius: 6px;
  border: 1px solid var(--line-2);
}
.bid-card-next-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-3);
  display: block;
  margin-bottom: 2px;
}
.bid-card-next-done { color: var(--ok); font-weight: 600; background: var(--ok-bg); border-color: transparent; }

.bid-card-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #bbf7d0; }
.chip-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #fde68a; }
.chip-err { background: var(--err-bg); color: var(--err); border: 1px solid #fecaca; }
.chip-ceo { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }
.chip-muted { background: var(--line-2); color: var(--ink-3); }

@media (max-width: 640px) {
  .board-toolbar { flex-direction: column; align-items: stretch; }
  .board-toolbar-right { flex-direction: column; align-items: stretch; }
  .bid-card-grid { grid-template-columns: 1fr; }
}

.view-toggle {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.view-toggle-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  color: var(--ink-3);
  transition: background 0.12s, color 0.12s;
}
.view-toggle-btn:hover { color: var(--ink); background: var(--line-2); }
.view-toggle-btn.active {
  background: var(--oeg);
  color: #fff;
  box-shadow: 0 1px 4px rgba(29, 114, 214, 0.35);
}

.board-list-table .board-list-attn { background: #fffbfb; }
.board-list-table .board-list-attn:hover { background: #fef2f2; }
.board-list-table td { vertical-align: middle; }

/* ---------- Management Review (Team Board) ---------- */
.review-search { margin-bottom: 18px; }
.mgmt-review {
  margin-bottom: 22px;
}
.mgmt-unassigned {
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 16px 18px 18px;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 56px);
}
.mgmt-orphan { opacity: 0.95; }
.mgmt-person-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.mgmt-person-identity { display: flex; gap: 12px; align-items: center; }
.mgmt-person-title { font-size: 17px; font-weight: 700; margin: 0; color: var(--ink); }
.mgmt-person-sub { font-size: 12.5px; color: var(--ink-3); margin: 2px 0 0; }
.mgmt-rollup {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.mgmt-stat strong { color: var(--ink); font-weight: 700; }
.mgmt-stat-warn strong { color: #b45309; }

.review-table { font-size: 13px; }
.review-table th { font-size: 11px; white-space: nowrap; }
.review-table td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.review-table th:last-child,
.review-table td.board-actions { min-width: 280px; }
.board-reassign-form { gap: 6px; flex-wrap: wrap; align-items: center; }
.board-reassign-select {
  font-size: 12px;
  min-width: 160px;
  max-width: 240px;
  width: auto;
}
.mgmt-roster-warn { color: #b45309; }
.review-row-attn { background: #fffbfb; }
.review-row-attn:hover { background: #fef2f2; }
.review-id { font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.review-phase-cell { min-width: 180px; max-width: 240px; }

.phase-rail {
  display: flex;
  gap: 3px;
  align-items: stretch;
  min-height: 42px;
}
.phase-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.phase-seg-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
}
.phase-seg-active .phase-seg-bar {
  background: var(--oeg);
  box-shadow: 0 0 0 2px var(--oeg-soft);
}
.phase-seg-empty .phase-seg-bar { background: var(--line-2); opacity: 0.6; }
.phase-seg-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ink-3);
  white-space: nowrap;
}
.phase-seg-active .phase-seg-label { color: var(--oeg); }
.phase-seg-time {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.phase-seg-empty .phase-seg-time { color: var(--ink-3); }

.age-pill, .dwell-pill, .deadline-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.age-pill.age-ok, .dwell-pill { background: var(--line-2); color: var(--ink-2); }
.age-pill.age-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.age-pill.age-overdue { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.deadline-pill.deadline-ok { background: #f0fdf4; color: #15803d; }
.deadline-pill.deadline-warning { background: #fffbeb; color: #b45309; }
.deadline-pill.deadline-critical { background: #fff7ed; color: #c2410c; }
.deadline-pill.deadline-overdue { background: #fef2f2; color: #991b1b; }

.review-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.review-flags .chip { font-size: 10px; padding: 2px 6px; }

@media (max-width: 960px) {
  .review-table .review-phase-cell { min-width: 140px; }
  .phase-seg-label { font-size: 8px; }
}

