/* ============================================================
   NRG Purchase Requests — design system
   Ported from the HTML prototype (.claude/purchase_request_prototype).
   Layout chrome (nav, topbar, cards, badges, etc.) lives here;
   data controls (grids, dropdowns, etc.) use Telerik UI for Blazor.
   ============================================================ */

:root {
  --bg:        #F5F4F0;
  --surface:   #FFFFFF;
  --border:    #E2E0D8;
  --border-md: #C8C5BA;
  --text:      #1A1916;
  --muted:     #6B6860;
  --accent:    #1A4A3C;
  --accent-lt: #EAF2EE;
  --accent-md: #2D7A60;
  --danger:    #C0392B;
  --danger-lt: #FDECEA;
  --warn:      #B45309;
  --warn-lt:   #FEF3C7;
  --info:      #1D4ED8;
  --info-lt:   #EFF6FF;
  --radius:    10px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,.07), 0 12px 40px rgba(0,0,0,.12);
  --font:      'DM Sans', sans-serif;
  --mono:      'DM Mono', monospace;
  --nav-w:     240px;
  --transition: 180ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── NAV ─────────────────────────────────────────────── */
.nav {
  width: var(--nav-w);
  min-height: 100vh;
  background: var(--accent);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.nav-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.nav-logo-mark {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin-bottom: 4px;
}
.nav-logo-name {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.nav-section {
  padding: 16px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 8px;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
  color: rgba(255,255,255,.7);
  font-size: 13.5px;
  font-weight: 400;
  transition: background var(--transition), color var(--transition);
  user-select: none;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 500; }
.nav-item .icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.nav-badge {
  margin-left: auto;
  background: #E63946;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.nav-user {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.nav-user-name { font-size: 13px; color: rgba(255,255,255,.85); font-weight: 500; }
.nav-user-role { font-size: 11px; color: rgba(255,255,255,.4); }

/* ── MAIN ────────────────────────────────────────────── */
.main {
  margin-left: var(--nav-w);
  flex: 1;
  min-height: 100vh;
  display: block;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.content { padding: 32px; width: 100%; box-sizing: border-box; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #153d31; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-md); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger-lt); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--accent-lt); color: var(--accent); }
.btn-success:hover { background: var(--accent); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* ── CARDS ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 24px; }

/* ── FORM ────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span2 { grid-column: span 2; }
.form-group.span3 { grid-column: span 3; }
label { font-size: 12.5px; font-weight: 700; color: var(--text); }
label .req { color: var(--danger); margin-left: 2px; }

.form-hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.form-section { margin-bottom: 28px; }
.form-section-title {
  font-size: 13px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--text);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 18px;
}

/* ── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-submitted  { background: #EFF6FF; color: #1D4ED8; } .badge-submitted::before  { background: #1D4ED8; }
.badge-approved   { background: #EAF2EE; color: #1A4A3C; } .badge-approved::before   { background: #1A4A3C; }
.badge-rejected   { background: #FDECEA; color: #C0392B; } .badge-rejected::before   { background: #C0392B; }
.badge-po-created { background: #F0FDF4; color: #166534; } .badge-po-created::before { background: #166534; }
.badge-shipment   { background: #FEF3C7; color: #92400E; } .badge-shipment::before   { background: #B45309; }
.badge-invoiced   { background: #F5F3FF; color: #5B21B6; } .badge-invoiced::before   { background: #5B21B6; }
.badge-paid       { background: #F0FDF4; color: #065F46; } .badge-paid::before       { background: #065F46; }
.badge-pending    { background: #FEF3C7; color: #92400E; } .badge-pending::before    { background: #B45309; }

.pr-number { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 500; }
.amount { font-family: var(--mono); font-size: 13px; }

/* ── FILTERS ─────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ── STATS ROW ───────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1; }
.stat-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat-green { color: var(--accent); }
.stat-blue  { color: var(--info); }
.stat-amber { color: var(--warn); }
.stat-red   { color: var(--danger); }

/* ── APPROVAL CARD ───────────────────────────────────── */
.approval-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.approval-card:hover { box-shadow: var(--shadow-lg); }
.approval-header {
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.approval-meta { display: flex; flex-direction: column; gap: 3px; }
.approval-pr { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 500; }
.approval-desc { font-size: 14px; font-weight: 600; }
.approval-info { font-size: 12px; color: var(--muted); }
.approval-amount { font-size: 20px; font-weight: 600; font-family: var(--mono); white-space: nowrap; }
.approval-body {
  padding: 0 20px 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.approval-detail-label { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.approval-detail-value { font-size: 13px; font-weight: 500; margin-top: 2px; }
.approval-actions {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── ALERT ───────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-warn { background: var(--warn-lt); color: var(--warn); border: 1px solid #FCD34D; }
.alert-info { background: var(--info-lt); color: var(--info); border: 1px solid #BFDBFE; }
.alert-success { background: var(--accent-lt); color: var(--accent); border: 1px solid #A7D7C5; }
.alert-danger { background: var(--danger-lt); color: var(--danger); border: 1px solid #FECACA; }

/* ── DETAIL VIEW ─────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.detail-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.detail-value { font-size: 14px; }

/* ── EMPTY STATE ─────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-sub { font-size: 13px; }

/* ── ROLE SWITCHER ───────────────────────────────────── */
.role-switcher {
  display: flex;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}
.role-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--transition);
}
.role-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ── PURCHASING TABS ─────────────────────────────────── */
.purch-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}
.purch-tab:hover { color: var(--text); }
.purch-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── MISC ────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.font-mono { font-family: var(--mono); }

/* ── Telerik theme bridge ────────────────────────────── */
/* Map Telerik components onto the prototype's palette/typography so every
   control is Telerik while still matching the prototype look. */
.k-grid, .k-button, .k-input, .k-picker, .k-dropdownlist, .k-textbox,
.k-numerictextbox, .k-datepicker, .k-combobox, .k-window, .k-dialog,
.k-tabstrip, .k-stepper, .k-notification { font-family: var(--font); }

/* Brand the primary (solid-primary) buttons green; keep the prototype's radius. */
.k-button-solid-primary {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.k-button-solid-primary:hover {
    background-color: #153d31;
    border-color: #153d31;
}
.k-button { border-radius: 7px; font-weight: 500; }

/* Inputs: focus ring in the accent color. */
.k-input:focus-within,
.k-picker:focus-within {
    border-color: var(--accent-md);
    box-shadow: 0 0 0 3px rgba(45,122,96,.12);
}

/* Grid: lighter chrome to match the prototype's minimalist tables. */
.k-grid { border-radius: var(--radius); border-color: var(--border); }
.k-grid .k-table-th { text-transform: uppercase; font-size: 11px; letter-spacing: .06em; color: var(--muted); }
.k-grid td { font-size: 13.5px; }

/* Segmented role switcher built from a TelerikButtonGroup. */
.role-switcher .k-button-group .k-button.k-selected {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
