/* ===========================================================================
   SeerDynamics Vendor Portal - site.css
   ---------------------------------------------------------------------------
   Hand-written stylesheet. No CSS framework, no build step, no CDN.
   The visual language follows the "Vendor Portal F&O - Standalone" reference:
   Microsoft Fluent / Dynamics 365 F&O - black shell bar, white ribbon,
   48px icon rail, 2px corner radius, Segoe UI type ramp.

   Sections
     1  Design tokens
     2  Reset & base
     3  Layout shell (top bar, ribbon, rail, content)
     4  Typography & page headers
     5  Cards, KPI tiles, panels
     6  Data tables & list views
     7  Status pills & badges
     8  Buttons
     9  Forms & wizard
     10 Modals, drawers, toasts
     11 Timeline, empty states, misc
     12 Login & public pages
     13 Responsive
   =========================================================================== */

/* ---------------------------------------------------------------------------
   1  DESIGN TOKENS
   --------------------------------------------------------------------------- */
:root {
  /* Brand & accent */
  --accent:           #0078d4;
  --accent-hover:     #106ebe;
  --accent-pressed:   #005a9e;
  --accent-light:     #eff6fc;
  --accent-border:    #c7e0f4;
  --brand-navy:       #1b3a6b;
  --brand-teal:       #038387;
  --brand-purple:     #8764b8;
  --brand-gold:       #c19c00;

  /* Neutrals (Fluent grey ramp) */
  --shell:            #000000;
  --surface:          #ffffff;
  --canvas:           #faf9f8;
  --hover:            #f3f2f1;
  --divider:          #f3f2f1;
  --border:           #edebe9;
  --border-strong:    #d2d0ce;
  --input-border:     #8a8886;
  --text:             #201f1e;
  --text-muted:       #605e5c;
  --text-subtle:      #8a8886;
  --text-invert:      #ffffff;

  /* Semantic */
  --success:          #107c10;
  --success-bg:       #dff6dd;
  --warning:          #8a6a1f;
  --warning-bg:       #fff4ce;
  --danger:           #a4262c;
  --danger-bg:        #fde7e9;
  --info:             #0078d4;
  --info-bg:          #eff6fc;
  --purple-fg:        #5c2e91;
  --purple-bg:        #f0e8fa;

  /* Geometry */
  --radius:           2px;
  --radius-lg:        4px;
  --rail-w:           48px;
  --rail-expanded-w:  220px;
  --shell-h:          44px;
  --ribbon-h:         40px;

  /* Elevation (Fluent depth ramp) */
  --shadow-2:         0 1.6px 3.6px rgba(0,0,0,.13), 0 .3px .9px rgba(0,0,0,.11);
  --shadow-8:         0 3.2px 7.2px rgba(0,0,0,.13), 0 .6px 1.8px rgba(0,0,0,.11);
  --shadow-16:        0 6.4px 14.4px rgba(0,0,0,.13), 0 1.2px 3.6px rgba(0,0,0,.11);
  --shadow-64:        0 25.6px 57.6px rgba(0,0,0,.22), 0 4.8px 14.4px rgba(0,0,0,.18);

  /* Type */
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Cascadia Mono', Consolas, 'Courier New', monospace;
}

/* ---------------------------------------------------------------------------
   2  RESET & BASE
   --------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent-border); color: #004578; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Visible keyboard focus everywhere -- accessibility baseline. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------------------
   3  LAYOUT SHELL
   --------------------------------------------------------------------------- */

/* --- Top shell bar (black, sticky) --- */
.shell-bar {
  height: var(--shell-h);
  background: var(--shell);
  display: flex;
  align-items: center;
  padding: 0 10px;
  position: sticky;
  top: 0;
  z-index: 200;
}
.shell-bar__waffle,
.shell-bar__icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  cursor: pointer;
  color: #fff;
  background: none; border: none; padding: 0;
  flex-shrink: 0;
  position: relative;
}
.shell-bar__waffle:hover,
.shell-bar__icon:hover { background: rgba(255,255,255,.12); }

.shell-bar__brand {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  cursor: pointer;
  flex-shrink: 0;
  color: #fff;
  text-decoration: none;
}
.shell-bar__brand:hover { text-decoration: none; }
.shell-bar__logo { height: 18px; width: auto; object-fit: contain; flex-shrink: 0; }
.shell-bar__brand-text { font-size: 14px; font-weight: 600; white-space: nowrap; }

.shell-bar__sep {
  width: 1px; height: 20px;
  background: rgba(255,255,255,.25);
  margin: 0 4px;
  flex-shrink: 0;
}
.shell-bar__app {
  padding: 0 12px;
  font-size: 14px; font-weight: 600;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}
.shell-bar__spacer { flex: 1; }

.shell-bar__search {
  width: 340px; max-width: 32vw;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.14);
  border-radius: var(--radius);
  padding: 6px 10px;
  margin-right: 14px;
}
.shell-bar__search input {
  border: none; outline: none; background: none;
  font-size: 12.5px; color: #fff; width: 100%;
  font-family: inherit;
}
.shell-bar__search input::placeholder { color: #c8c6c4; }

.shell-bar__actions { display: flex; align-items: center; gap: 2px; }

.shell-bar__dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid #000;
}

.shell-bar__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #5b5fc7; color: #fff;
  font-weight: 600; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; flex-shrink: 0;
}

/* --- Flyout menus (notifications, profile) --- */
.flyout-anchor { position: relative; }
.flyout {
  position: absolute; right: 0; top: 40px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-16);
  border: 1px solid var(--border);
  overflow: hidden;
  color: var(--text);
  z-index: 250;
}
.flyout--notif { width: 360px; }
.flyout--profile { width: 240px; }
.flyout[hidden] { display: none; }

.flyout__head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 13.5px;
  display: flex; justify-content: space-between; align-items: center;
}
.flyout__count {
  font-weight: 700; font-size: 10.5px;
  color: var(--accent); background: var(--accent-light);
  padding: 2px 8px; border-radius: 10px;
}
.flyout__item {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  font-size: 12px; line-height: 1.5;
  color: var(--text-muted);
  text-decoration: none;
}
.flyout__item:last-child { border-bottom: none; }
.flyout__item:hover { background: var(--hover); text-decoration: none; }
.flyout__item strong { color: var(--text); font-weight: 600; }
.flyout__item--unread { background: #fbfcfe; border-left: 3px solid var(--accent); }
.flyout__time { font-size: 10.5px; color: var(--text-subtle); margin-top: 3px; }
.flyout__foot {
  padding: 10px 16px; text-align: center;
  font-size: 12px; font-weight: 600;
  border-top: 1px solid var(--border);
}
.flyout__user { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.flyout__user-name { font-weight: 600; font-size: 13px; }
.flyout__user-sub { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }
.flyout__menu { padding: 6px 4px; display: flex; flex-direction: column; }
.flyout__menu a, .flyout__menu button {
  padding: 9px 12px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text);
  cursor: pointer; border-radius: var(--radius);
  background: none; border: none; text-align: left;
  font-family: inherit;
}
.flyout__menu a:hover, .flyout__menu button:hover { background: var(--hover); text-decoration: none; }

/* --- Ribbon / command bar --- */
.ribbon {
  min-height: var(--ribbon-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px; gap: 12px;
  position: sticky; top: var(--shell-h);
  z-index: 190;
}
.ribbon__crumb { font-size: 11.5px; color: var(--text-subtle); }
.ribbon__crumb a { color: var(--text-subtle); }
.ribbon__crumb b { color: var(--text); font-weight: 600; }
.ribbon__spacer { flex: 1; }
.ribbon__actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }

/* --- Body split: rail + content --- */
.app-body { display: flex; }

.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: calc(100vh - var(--shell-h) - var(--ribbon-h));
  display: flex; flex-direction: column; align-items: center;
  padding-top: 6px;
  position: relative;
}
.rail__toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #484644;
  margin-bottom: 6px;
  background: none; border: none;
}
.rail__toggle:hover { background: var(--hover); }

.rail__link {
  width: 100%;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 10px 2px;
  cursor: pointer;
  color: #484644;
  border-left: 3px solid transparent;
  font-size: 9px; font-weight: 600;
  text-decoration: none;
  text-align: center;
  position: relative;
}
.rail__link:hover { background: var(--hover); text-decoration: none; }
.rail__link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-light);
}
.rail__badge {
  position: absolute; top: 6px; right: 8px;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 8px;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 15px;
}

.rail__flyout {
  position: absolute; left: var(--rail-w); top: 0;
  width: var(--rail-expanded-w);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 4px 0 14px rgba(0,0,0,.12);
  z-index: 150;
  padding: 8px;
}
.rail__flyout[hidden] { display: none; }
.rail__flyout a {
  display: block;
  padding: 9px 12px;
  font-size: 13px; font-weight: 600;
  color: var(--text);
  border-radius: var(--radius);
}
.rail__flyout a:hover { background: var(--hover); text-decoration: none; }
.rail__flyout a.is-active { color: var(--accent); }
.rail__flyout .rail__group {
  border-top: 1px solid var(--border);
  margin-top: 6px; padding-top: 6px;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 60px;
}
.content--wide { padding: 20px 20px 60px; }

/* ---------------------------------------------------------------------------
   4  TYPOGRAPHY & PAGE HEADERS
   --------------------------------------------------------------------------- */
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
h4 { font-size: 13px; }
p  { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

.page-head {
  display: flex; align-items: flex-start;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head__text { min-width: 0; }
.page-head__title { font-size: 20px; font-weight: 600; }
.page-head__sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.page-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.section-title {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .4px;
  margin: 24px 0 10px;
}
.section-title:first-child { margin-top: 0; }

.muted    { color: var(--text-muted); }
.subtle   { color: var(--text-subtle); }
.small    { font-size: 11.5px; }
.strong   { font-weight: 600; }
.mono     { font-family: var(--font-mono); }
.nowrap   { white-space: nowrap; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

/* --- Hero banner (dashboard greeting) --- */
.hero {
  height: 150px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, #0b2545 0%, #0f3d5f 45%, #0a5a6b 100%);
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  display: flex; align-items: flex-end;
  padding: 20px 26px;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255,255,255,.05) 0 2px, transparent 2px 26px);
}
.hero__inner { position: relative; }
.hero__title { color: #fff; font-size: 22px; font-weight: 600; }
.hero__sub { color: #bcd6e8; font-size: 12.5px; margin-top: 4px; }
.hero--admin { background: linear-gradient(120deg, #17263d 0%, #24406b 50%, #3b2a63 100%); }

/* --- Quick launch tiles --- */
.quicklaunch {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 26px;
}
.quicklaunch__item {
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  padding: 16px 8px;
  border-radius: var(--radius);
  color: var(--text);
  text-align: center;
}
.quicklaunch__item:hover { background: var(--hover); text-decoration: none; }
.quicklaunch__icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.quicklaunch__label { font-size: 12px; font-weight: 600; }
.bg-accent { background: var(--accent); }
.bg-navy   { background: var(--brand-navy); }
.bg-teal   { background: var(--brand-teal); }
.bg-purple { background: var(--brand-purple); }
.bg-gold   { background: var(--brand-gold); }
.bg-green  { background: var(--success); }
.bg-red    { background: var(--danger); }

/* ---------------------------------------------------------------------------
   5  CARDS, KPI TILES, PANELS
   --------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card + .card { margin-top: 12px; }

.card__head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.card__title { font-weight: 600; font-size: 14px; }
.card__sub { font-size: 11.5px; color: var(--text-subtle); margin-top: 2px; }
.card__link { font-size: 12px; font-weight: 600; color: var(--accent); }
.card__body { padding: 16px 18px; }
.card__body--flush { padding: 4px 18px 12px; }
.card__body--tight { padding: 10px 12px; }
.card__foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  background: #fdfdfd;
  flex-wrap: wrap;
}

/* KPI tiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: block;
  color: var(--text);
}
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.kpi__label {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .3px;
}
.kpi__value { font-size: 26px; font-weight: 600; margin-top: 8px; line-height: 1.1; }
.kpi__value--sm { font-size: 17px; }
.kpi__note { font-size: 11px; font-weight: 600; color: var(--text-subtle); margin-top: 6px; }
.kpi__note--up   { color: var(--success); }
.kpi__note--down { color: var(--danger); }
.kpi--accent { border-top: 3px solid var(--accent); }
.kpi--warning { border-top: 3px solid #c19c00; }
.kpi--danger { border-top: 3px solid var(--danger); }
.kpi--success { border-top: 3px solid var(--success); }

/* Two- and three-column dashboard grids */
.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 12px; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-2 > *, .grid-3 > *, .grid-2-even > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row--tight { gap: 4px; }
.row--between { justify-content: space-between; }

/* Definition list used on every detail page */
.deflist { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 24px; }
.deflist--2col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.deflist__label {
  font-size: 10.5px; font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase; letter-spacing: .35px;
}
.deflist__value { font-size: 13px; margin-top: 3px; word-break: break-word; }

/* Bar meter used for spend / performance breakdowns */
.meter { margin-bottom: 12px; }
.meter:last-child { margin-bottom: 0; }
.meter__head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; }
.meter__track { height: 6px; background: var(--divider); border-radius: 3px; overflow: hidden; }
.meter__fill { height: 100%; background: var(--accent); border-radius: 3px; }
.meter__fill--teal { background: var(--brand-teal); }
.meter__fill--gold { background: var(--brand-gold); }
.meter__fill--purple { background: var(--brand-purple); }
.meter__fill--danger { background: var(--danger); }

/* ---------------------------------------------------------------------------
   6  DATA TABLES & LIST VIEWS
   --------------------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-subtle);
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}
.table td {
  padding: 11px 8px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f3f9fd; }
.table__link { color: var(--accent); font-weight: 600; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.muted { color: var(--text-muted); font-size: 12px; }
.table--compact td { padding: 8px; }
.table--lines th { background: #fbfbfa; }
.table tfoot td {
  padding: 10px 8px;
  font-weight: 600;
  border-top: 1px solid var(--border-strong);
  border-bottom: none;
  background: #fbfbfa;
}

/* Filter bar above list views */
.filterbar {
  display: flex; gap: 8px; align-items: flex-end;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: #fdfdfd;
}
.filterbar .field { margin-bottom: 0; }
.filterbar .field__input,
.filterbar .field__select { min-width: 150px; }
.filterbar__spacer { flex: 1; }

/* Pagination */
.pager {
  display: flex; align-items: center; gap: 4px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.pager__info { color: var(--text-muted); margin-right: auto; }
.pager__link {
  min-width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text); font-weight: 600;
}
.pager__link:hover { background: var(--hover); text-decoration: none; }
.pager__link.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager__link.is-disabled { color: var(--text-subtle); pointer-events: none; opacity: .5; }

/* Tabs */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tabs__item {
  padding: 9px 14px;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs__item:hover { color: var(--text); text-decoration: none; background: var(--hover); }
.tabs__item.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------------------
   7  STATUS PILLS & BADGES
   --------------------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.pill--neutral { background: var(--hover);       color: var(--text-muted); }
.pill--info    { background: var(--info-bg);     color: var(--info); }
.pill--success { background: var(--success-bg);  color: var(--success); }
.pill--warning { background: var(--warning-bg);  color: var(--warning); }
.pill--danger  { background: var(--danger-bg);   color: var(--danger); }
.pill--purple  { background: var(--purple-bg);   color: var(--purple-fg); }

.badge {
  display: inline-block;
  min-width: 18px; padding: 1px 6px;
  border-radius: 9px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; text-align: center;
}
.badge--muted { background: var(--border-strong); color: var(--text); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 11.5px;
}
.chip__remove { cursor: pointer; color: var(--text-subtle); font-weight: 700; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-navy); color: #fff;
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar--lg { width: 44px; height: 44px; font-size: 15px; }

/* Inline alerts */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  border-left: 3px solid;
  font-size: 12.5px;
  margin-bottom: 14px;
  display: flex; gap: 10px; align-items: flex-start;
}
.alert__body { flex: 1; }
.alert strong { font-weight: 600; }
.alert--info    { background: var(--info-bg);    border-color: var(--info); }
.alert--success { background: var(--success-bg); border-color: var(--success); }
.alert--warning { background: var(--warning-bg); border-color: #c19c00; }
.alert--danger  { background: var(--danger-bg);  border-color: var(--danger); }

/* ---------------------------------------------------------------------------
   8  BUTTONS
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  min-height: 32px;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn.is-disabled { opacity: .45; pointer-events: none; }

.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--primary:active { background: var(--accent-pressed); }

.btn--default { border-color: var(--input-border); }
.btn--default:hover { background: var(--hover); }

.btn--danger { border-color: var(--input-border); color: var(--danger); }
.btn--danger:hover { background: var(--danger-bg); }

.btn--success { background: var(--success); color: #fff; border-color: var(--success); }
.btn--success:hover { filter: brightness(1.08); }

.btn--subtle { color: var(--accent); padding: 5px 10px; background: none; min-height: 28px; }
.btn--subtle:hover { background: var(--hover); }

.btn--sm { padding: 4px 10px; font-size: 11.5px; min-height: 26px; }
.btn--block { width: 100%; }

/* Ribbon command buttons */
.cmd {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 12px; font-weight: 600;
  background: none; border: none;
  cursor: pointer; font-family: inherit;
}
.cmd:hover { background: var(--hover); text-decoration: none; }
.cmd--muted { color: var(--text-muted); }

/* ---------------------------------------------------------------------------
   9  FORMS & WIZARD
   --------------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 20px;
}
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

.field { margin-bottom: 16px; }
.field__label {
  display: block;
  font-size: 12px; font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}
.field__label .req { color: var(--danger); margin-left: 2px; }
.field__hint { font-size: 11px; color: var(--text-subtle); margin-top: 4px; }
.field__error { font-size: 11.5px; color: var(--danger); margin-top: 4px; font-weight: 600; }

.field__input,
.field__select,
.field__textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  min-height: 32px;
}
.field__textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.field__input:hover, .field__select:hover, .field__textarea:hover { border-color: var(--text); }
.field__input:focus, .field__select:focus, .field__textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.field__input:disabled, .field__select:disabled, .field__textarea:disabled,
.field__input[readonly] {
  background: var(--hover);
  color: var(--text-muted);
  border-color: var(--border);
  cursor: not-allowed;
}
.field.has-error .field__input,
.field.has-error .field__select,
.field.has-error .field__textarea { border-color: var(--danger); }

.field__select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23605e5c' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 13px;
  padding-right: 28px;
}

.field__static {
  padding: 7px 0;
  font-size: 13px;
  min-height: 32px;
}

/* Checkbox / radio */
.check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px;
  margin-bottom: 8px;
  cursor: pointer;
}
.check input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0; }
.check__text { line-height: 1.5; }

.field-inline { display: flex; gap: 8px; align-items: center; }

/* Multi-select category picker */
.checkgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 4px 16px;
}

/* File upload dropzone */
.dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  background: #fdfdfd;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-light); }
.dropzone__icon { color: var(--text-subtle); margin-bottom: 6px; }
.dropzone__title { font-size: 12.5px; font-weight: 600; }
.dropzone__hint { font-size: 11px; color: var(--text-subtle); margin-top: 3px; }
.dropzone input[type="file"] { display: block; margin: 10px auto 0; font-size: 12px; }

/* Wizard stepper */
.stepper {
  display: flex;
  gap: 0;
  margin-bottom: 22px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.stepper__step {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 12px;
  font-size: 12px; font-weight: 600;
  color: var(--text-subtle);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}
.stepper__step:hover { text-decoration: none; }
.stepper__num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--divider); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.stepper__step.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.stepper__step.is-active .stepper__num { background: var(--accent); color: #fff; }
.stepper__step.is-done { color: var(--success); }
.stepper__step.is-done .stepper__num { background: var(--success-bg); color: var(--success); }

/* Form action bar */
.form-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  flex-wrap: wrap;
}
.form-actions--split { justify-content: space-between; }

/* Repeatable line-item editor */
.lines-editor .table input,
.lines-editor .table select {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 12.5px;
  min-height: 28px;
}
.lines-editor .table input:focus { border-color: var(--accent); outline: none; }
.lines-editor .table input.num { text-align: right; }

/* Totals block */
.totals { margin-left: auto; width: 280px; max-width: 100%; }
.totals__row {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: 12.5px;
}
.totals__row--grand {
  border-top: 1px solid var(--border-strong);
  margin-top: 4px; padding-top: 10px;
  font-size: 15px; font-weight: 600;
}

/* ---------------------------------------------------------------------------
   10  MODALS, DRAWERS, TOASTS
   --------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--surface);
  width: 560px; max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-64);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.modal--lg { width: 820px; }
.modal--sm { width: 420px; }
.modal__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.modal__title { font-size: 15px; font-weight: 600; }
.modal__close {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--hover);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none;
  font-size: 13px; color: var(--text-muted);
}
.modal__close:hover { background: var(--border); }
.modal__body { padding: 18px 20px; overflow-y: auto; }
.modal__foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  flex-wrap: wrap;
}

/* Toast */
.toast-host {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 400;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 380px;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-16);
  font-size: 12.5px; font-weight: 500;
  display: flex; gap: 10px; align-items: center;
  animation: toast-in .18s ease-out;
}
.toast--success { background: #0b5c0b; }
.toast--danger  { background: #8b1f24; }
.toast--warning { background: #715014; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Page loader */
.loader-host {
  position: fixed; inset: 0;
  background: rgba(250,249,248,.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
}
.loader-host[hidden] { display: none; }
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--accent-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Idle-timeout warning */
.idle-warning {
  position: fixed; bottom: 24px; left: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #c19c00;
  box-shadow: var(--shadow-16);
  border-radius: var(--radius);
  padding: 14px 18px;
  z-index: 400;
  max-width: 340px;
}
.idle-warning[hidden] { display: none; }
.idle-warning__title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.idle-warning__text { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }

/* ---------------------------------------------------------------------------
   11  TIMELINE, EMPTY STATES, MISC
   --------------------------------------------------------------------------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: '';
  position: absolute; left: 6px; top: 4px; bottom: 4px;
  width: 1px; background: var(--border);
}
.timeline__item { position: relative; padding-bottom: 18px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
  position: absolute; left: -22px; top: 3px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--border-strong);
}
.timeline__dot--done    { border-color: var(--success); }
.timeline__dot--active  { border-color: var(--accent); }
.timeline__dot--danger  { border-color: var(--danger); }
.timeline__title { font-size: 12.5px; font-weight: 600; }
.timeline__meta { font-size: 11px; color: var(--text-subtle); margin-top: 2px; }
.timeline__body { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; line-height: 1.55; }

/* Approval flow strip (registration workflow) */
.flow { display: flex; align-items: center; gap: 0; flex-wrap: wrap; margin-bottom: 18px; }
.flow__node {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px; font-weight: 600;
}
.flow__node.is-done   { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.flow__node.is-active { border-color: var(--accent);  color: var(--accent);  background: var(--accent-light); }
.flow__node.is-rejected { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.flow__arrow { color: var(--text-subtle); padding: 0 8px; }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty__icon { color: var(--border-strong); margin-bottom: 10px; }
.empty__title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty__text { font-size: 12.5px; max-width: 420px; margin: 0 auto 14px; }

/* File attachment list */
.filelist { display: flex; flex-direction: column; gap: 6px; }
.fileitem {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12.5px;
}
.fileitem__icon { color: var(--danger); flex-shrink: 0; }
.fileitem__name { font-weight: 600; }
.fileitem__meta { font-size: 11px; color: var(--text-subtle); }
.fileitem__spacer { flex: 1; }

/* Comparison table highlight (RFQ evaluation) */
.is-best { background: var(--success-bg) !important; font-weight: 600; }
.is-worst { color: var(--danger); }

/* Print */
@media print {
  .shell-bar, .ribbon, .rail, .form-actions, .toast-host, .loader-host { display: none !important; }
  .content { padding: 0; }
  .card { border-color: #ccc; box-shadow: none; }
  body { background: #fff; }
}

/* ---------------------------------------------------------------------------
   12  LOGIN & PUBLIC PAGES
   ---------------------------------------------------------------------------
   Matches the supplied sign-in design: full-bleed backdrop, centred frosted
   card, Microsoft SSO above a local username/password form.

   The backdrop image is optional. Drop a file at public/img/login-bg.jpg and
   it is used automatically; if it is missing the CSS gradient below shows
   through unchanged, so the page never renders broken.
   --------------------------------------------------------------------------- */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
  background:
    radial-gradient(ellipse at 50% 15%, rgba(56,128,220,.55) 0%, rgba(10,32,72,0) 60%),
    linear-gradient(160deg, #071a3d 0%, #0b2e63 42%, #0a1c3f 100%);
  background-size: cover;
  background-position: center;
}
.auth-page::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url('/img/login-bg.jpg');
  background-size: cover;
  background-position: center;
  opacity: 1;
  z-index: 0;
}
/* Subtle vignette so the card always has contrast, whatever the artwork. */
.auth-page::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(4,16,38,.15) 0%, rgba(4,16,38,.55) 100%);
  z-index: 1;
}

.auth-card {
  position: relative;
  z-index: 2;
  width: 380px; max-width: 100%;
  background: rgba(238, 243, 250, .94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  padding: 30px 32px 22px;
}

.auth-card__brand {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; margin-bottom: 4px;
}
.auth-card__logo { height: 34px; width: auto; object-fit: contain; }
.auth-card__wordmark {
  display: flex; align-items: center; gap: 9px;
  font-size: 21px; font-weight: 300; letter-spacing: .2px;
  color: #1b2a4a;
}
.auth-card__wordmark b { font-weight: 600; }
.auth-card__infinity { color: var(--accent); font-size: 26px; line-height: 1; }
.auth-card__context {
  font-size: 11px; color: #5d6b83;
  text-align: center; margin-bottom: 20px;
}

.auth-card__title {
  font-size: 22px; font-weight: 600;
  text-align: center; color: #16223c;
}
.auth-card__sub {
  font-size: 12.5px; color: #5d6b83;
  text-align: center; margin: 4px 0 20px;
}

/* Microsoft SSO button */
.btn-ms {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 16px;
  background: #ffffff;
  border: 1px solid #d7dde8;
  border-radius: 6px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  color: #2f3d57;
  cursor: pointer;
  text-decoration: none;
}
.btn-ms:hover { background: #f7f9fc; border-color: #b9c4d6; text-decoration: none; }
.ms-logo { width: 17px; height: 17px; flex-shrink: 0; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0;
  font-size: 11.5px; color: #6b7890;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(0,0,0,.12);
}

.auth-field { margin-bottom: 14px; }
.auth-field__label {
  display: block;
  font-size: 12px; font-weight: 500;
  color: #46536e; margin-bottom: 6px;
}
.auth-field__input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #dfe5ee;
  border-radius: 6px;
  background: #f2f5f9;
  font-family: inherit; font-size: 13.5px;
  color: #16223c;
}
.auth-field__input:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,120,212,.16);
}
.auth-field__input::placeholder { color: #97a2b6; }

.btn-signin {
  width: 100%;
  margin-top: 6px;
  padding: 12px 16px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(95deg, #4a63e7 0%, #7a5cf0 100%);
  color: #fff;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.btn-signin:hover { filter: brightness(1.07); }
.btn-signin:active { filter: brightness(.95); }

.auth-link {
  display: block; text-align: center;
  margin-top: 16px;
  font-size: 12.5px; color: #3b6bd4; font-weight: 500;
}

.auth-secured {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 20px; padding-top: 6px;
  font-size: 11px; color: #6b7890;
}
.auth-secured__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 14px;
  background: rgba(255,255,255,.6);
}

.auth-alert {
  padding: 10px 13px;
  border-radius: 6px;
  font-size: 12.5px;
  margin-bottom: 16px;
  border-left: 3px solid;
}
.auth-alert--danger  { background: #fde7e9; color: #8b1f24; border-color: #a4262c; }
.auth-alert--success { background: #dff6dd; color: #0b5c0b; border-color: #107c10; }
.auth-alert--info    { background: #eff6fc; color: #1b4d80; border-color: #0078d4; }

.auth-note {
  margin-top: 18px;
  padding: 12px 14px;
  background: rgba(255,255,255,.55);
  border: 1px dashed rgba(0,0,0,.14);
  border-radius: 6px;
  font-size: 11px; color: #4d5b75; line-height: 1.6;
}
.auth-note b { color: #16223c; }

/* Wide card variant for vendor self-registration */
.auth-card--wide { width: 720px; }
.auth-card--wide .auth-card__title { text-align: left; }
.auth-card--wide .auth-card__sub { text-align: left; }

/* ---------------------------------------------------------------------------
   13  RESPONSIVE
   --------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid-2, .grid-2-even { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .form-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .shell-bar__search { display: none; }
  .shell-bar__brand-text { display: none; }
  .content { padding: 16px 14px 60px; }
  .grid-3 { grid-template-columns: 1fr; }
  .form-grid, .form-grid--2, .form-grid--3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .deflist--2col { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .totals { width: 100%; }
  .hero { height: auto; padding: 18px; }
  .hero__title { font-size: 18px; }
  .modal { max-height: 94vh; }
  .card__head { padding: 12px 14px; }
  .card__body { padding: 14px; }
  .filterbar { padding: 12px 14px; }
}

@media (max-width: 560px) {
  .rail {
    position: fixed; bottom: 0; left: 0; right: 0;
    width: 100%; min-height: 0;
    flex-direction: row; justify-content: space-around;
    border-right: none; border-top: 1px solid var(--border);
    padding: 0; z-index: 180;
    box-shadow: 0 -2px 8px rgba(0,0,0,.08);
  }
  .rail__toggle { display: none; }
  .rail__link { border-left: none; border-top: 3px solid transparent; padding: 8px 2px; }
  .rail__link.is-active { border-left-color: transparent; border-top-color: var(--accent); }
  .rail__flyout { left: 0; right: 0; bottom: 100%; top: auto; width: auto; }
  .content { padding-bottom: 80px; }
  .page-head__actions { width: 100%; margin-left: 0; }
  .auth-card { padding: 24px 20px 18px; }
  .table th, .table td { padding: 9px 6px; font-size: 12px; }
}
