/* HGTC IT Procurement — Brand Stylesheet
   Fonts: Gotham / Poppins with Arial fallback
   Primary Blue:  #00426A
   Primary Green: #5EA369
*/

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

:root {
  /* HGTC Primary */
  --hgtc-blue:      #00426A;
  --hgtc-blue-dark: #003556;
  --hgtc-green:     #5EA369;
  --hgtc-green-dark:#4B8C55;
  /* HGTC Secondary */
  --hgtc-gray:      #9899AB;
  --hgtc-warmgray:  #E6DED4;
  --hgtc-lightgrn:  #B2CA92;
  --hgtc-paleveg:   #E5EBD5;
  /* Cool accents */
  --hgtc-teal:      #95D5D5;
  --hgtc-cyan:      #00ABCD;
  --hgtc-coolblue:  #5E8AB4;
  /* Warm accents */
  --hgtc-red:       #BA5953;
  --hgtc-red-dark:  #9E4742;
  --hgtc-orange:    #F7AF73;
  --hgtc-yellow:    #FCE277;

  --ink:            #2E3638;
  --ink-soft:       #3F4746;
  --muted:          #6D6D6D;
  --bg:             #F4F5F3;
  --surface:        #FFFFFF;
  --surface-2:      #FAFAF8;
  --border:         #E4E4E1;
  --border-strong:  #CFCFCB;

  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      14px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
  --shadow-md:      0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:      0 10px 40px rgba(0,0,0,.15);

  --font-brand:     "Gotham", "Poppins", "Arial", sans-serif;
  --font-body:      "Poppins", "Arial", sans-serif;

  --sidebar-w:      260px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-brand);
  color: var(--hgtc-blue);
  margin: 0 0 .5em 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

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

:focus-visible {
  outline: 3px solid var(--hgtc-green);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible, a:focus-visible, .btn:focus-visible { outline-offset: 3px; }

.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;
}
.skip-link {
  position: absolute; top: -40px; left: 8px; z-index: 3000;
  background: var(--hgtc-blue); color: #fff; padding: 8px 14px;
  border-radius: var(--radius); font-weight: 600;
}
.skip-link:focus { top: 8px; }

/* ==================== LAYOUT ==================== */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--hgtc-blue);
  color: #fff;
  padding: 22px 0 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  padding: 0 20px 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.15);
  margin-bottom: 12px;
}
.sidebar .brand img {
  max-width: 180px;
  height: auto;
  display: block;
}
.sidebar .brand .sub {
  font-size: .7rem;
  color: rgba(255,255,255,.65);
  margin-top: 8px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
}
.sidebar .nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  flex: 1;
}
.sidebar .nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,.85);
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 500;
  min-height: 42px;
}
.sidebar .nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .85;
}
.sidebar .nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
}
.sidebar .nav a:hover svg { opacity: 1; }
.sidebar .nav a.active {
  background: var(--hgtc-green);
  color: #fff;
  font-weight: 600;
}
.sidebar .nav a.active svg { opacity: 1; }
.sidebar .nav-section {
  color: rgba(255,255,255,.5);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 16px 16px 6px;
  font-weight: 700;
}
.sidebar .user {
  padding: 14px 18px 4px;
  border-top: 1px solid rgba(255,255,255,.15);
  font-size: .85rem;
  margin-top: 8px;
}
.sidebar .user .avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--hgtc-green);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  margin-right: 10px;
  vertical-align: middle;
}
.sidebar .user .name { font-weight: 600; display: inline-block; vertical-align: middle; }
.sidebar .user .role {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--hgtc-green);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}
.sidebar .user a {
  color: rgba(255,255,255,.78);
  font-size: .8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sidebar .user a:hover { color: #fff; }

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  width: 42px; height: 42px;
  background: var(--hgtc-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  z-index: 1100;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1050;
}

/* Main */
.main {
  padding: 24px 32px 48px;
  overflow-x: auto;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.topbar .titleblock { min-width: 0; }
.topbar .fy-badge {
  background: var(--hgtc-green);
  color: #fff;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: help;
}
.topbar .topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar .icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--hgtc-blue);
  transition: background .15s;
}
.topbar .icon-btn:hover { background: var(--hgtc-warmgray); }

/* Breadcrumb */
.breadcrumb {
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 4px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb svg { width: 12px; height: 12px; opacity: .6; }

/* ==================== CARDS ==================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.card h2 { margin-top: 0; }
.card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card .card-head h2 { margin: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* KPI tiles */
.kpi {
  background: var(--surface);
  border-left: 4px solid var(--hgtc-blue);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}
.kpi.green { border-left-color: var(--hgtc-green); }
.kpi.orange { border-left-color: var(--hgtc-orange); }
.kpi.red { border-left-color: var(--hgtc-red); }
.kpi .label {
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi .value {
  font-family: var(--font-brand);
  font-size: 1.8rem;
  color: var(--hgtc-blue);
  font-weight: 700;
  margin-top: 2px;
}
.kpi .sub { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.kpi .kpi-icon {
  position: absolute;
  top: 16px; right: 16px;
  opacity: .15;
}
.kpi .kpi-icon svg { width: 28px; height: 28px; }

/* Quick action tiles */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.quick-action {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.quick-action:hover {
  text-decoration: none;
  border-color: var(--hgtc-green);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.quick-action .qa-icon {
  width: 44px; height: 44px;
  background: var(--hgtc-paleveg);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hgtc-green);
  flex-shrink: 0;
}
.quick-action .qa-icon svg { width: 22px; height: 22px; }
.quick-action .qa-title { font-weight: 600; color: var(--hgtc-blue); font-size: .98rem; }
.quick-action .qa-sub { color: var(--muted); font-size: .82rem; margin-top: 2px; }

/* ==================== TABLES ==================== */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: .9rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  background: var(--hgtc-warmgray);
  color: var(--hgtc-blue);
  font-weight: 700;
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .06em;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data tr:hover td { background: var(--surface-2); }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .row-actions {
  display: inline-flex;
  gap: 6px;
  white-space: nowrap;
}

/* Responsive: stack tables into cards on small screens via data-label */
@media (max-width: 760px) {
  table.data.responsive, table.data.responsive thead, table.data.responsive tbody,
  table.data.responsive th, table.data.responsive td, table.data.responsive tr {
    display: block;
  }
  table.data.responsive thead { display: none; }
  table.data.responsive tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 6px 4px;
    box-shadow: var(--shadow-sm);
  }
  table.data.responsive td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px dashed var(--border);
    text-align: right;
  }
  table.data.responsive td:last-child { border-bottom: none; }
  table.data.responsive td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--hgtc-blue);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    flex: 1;
    text-align: left;
  }
  table.data.responsive td.num { text-align: right; }
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--font-body);
  transition: all .15s ease;
  text-decoration: none;
  min-height: 40px;
  line-height: 1.2;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--hgtc-blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--hgtc-blue-dark); text-decoration: none; }
.btn-success { background: var(--hgtc-green); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--hgtc-green-dark); }
.btn-danger { background: var(--hgtc-red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--hgtc-red-dark); }
.btn-secondary {
  background: var(--surface);
  color: var(--hgtc-blue);
  border-color: var(--hgtc-blue);
}
.btn-secondary:hover:not(:disabled) { background: var(--hgtc-warmgray); }
.btn-ghost {
  background: transparent;
  color: var(--hgtc-blue);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--hgtc-warmgray); }
.btn-sm { padding: 6px 12px; font-size: .82rem; min-height: 32px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 13px 22px; font-size: 1rem; min-height: 48px; }
.btn-block { display: flex; width: 100%; }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 16px; }
.form-group.span-2 { grid-column: span 2; }
label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: .85rem;
  color: var(--ink);
  margin-bottom: 6px;
}
label .req { color: var(--hgtc-red); }
label .help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  cursor: help;
  line-height: 1;
}
.field-hint {
  color: var(--muted);
  font-size: .78rem;
  margin-top: 4px;
}
.field-error {
  color: var(--hgtc-red);
  font-size: .78rem;
  margin-top: 4px;
  display: none;
  align-items: center;
  gap: 4px;
}
.field-error.show { display: flex; }
.field-error svg { width: 12px; height: 12px; }

input[type=text], input[type=number], input[type=date], input[type=email],
input[type=password], input[type=search], input[type=tel], input[type=url],
textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .95rem;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--hgtc-green);
  box-shadow: 0 0 0 3px rgba(94, 163, 105, .18);
}
input.has-error, textarea.has-error, select.has-error {
  border-color: var(--hgtc-red);
}
input.has-error:focus, textarea.has-error:focus, select.has-error:focus {
  box-shadow: 0 0 0 3px rgba(186, 89, 83, .2);
}
textarea { min-height: 88px; resize: vertical; }

input[type=file] {
  padding: 8px 10px;
  background: var(--surface-2);
}

/* Search input with icon */
.search-input {
  position: relative;
  display: inline-block;
}
.search-input input { padding-left: 34px; }
.search-input svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}

/* ==================== STATUS CHIPS ==================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--hgtc-warmgray);
  color: var(--ink);
}
.chip::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
}
.chip.pending  { background: #FFF0D6; color: #7A4A1C; }
.chip.submitted, .chip.open { background: #E0ECF5; color: #003556; }
.chip.approved, .chip.cio-approved, .chip.received { background: #E1F0E3; color: #2E6A3D; }
.chip.denied, .chip.cio-denied, .chip.rejected, .chip.cancelled { background: #F7DEDB; color: #7A2A25; }
.chip.paid { background: #D6EEF1; color: #00587C; }
.chip.draft { background: var(--hgtc-warmgray); color: var(--ink); }
.chip.converted-to-po, .chip.converted-to-req, .chip.closed { background: #EBE6F2; color: #3E2F6E; }
.chip.expired, .chip.partially-received { background: #FFE9C7; color: #7A4A1C; }
.chip.admin { background: var(--hgtc-blue); color: #fff; }
.chip.contributor { background: var(--hgtc-green); color: #fff; }

/* ==================== APPROVE / DENY TOGGLE ==================== */
.approval-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.approval-toggle button {
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
}
.approval-toggle button svg { width: 14px; height: 14px; }
.approval-toggle button.active.approve {
  background: var(--hgtc-green);
  color: #fff;
}
.approval-toggle button.active.deny {
  background: var(--hgtc-red);
  color: #fff;
}
.approval-toggle button:hover:not(.active) {
  background: var(--hgtc-warmgray);
  color: var(--ink);
}

/* ==================== FISCAL YEAR BAR CHART ==================== */
.fy-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 12px;
  align-items: end;
  height: 260px;
  padding: 10px 4px;
  border-bottom: 2px solid var(--border);
}
.fy-col { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.fy-col .bar-wrap { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.fy-col .bar {
  width: 100%;
  max-width: 60px;
  background: linear-gradient(180deg, var(--hgtc-green) 0%, var(--hgtc-blue) 100%);
  border-radius: 4px 4px 0 0;
  min-height: 6px;
  transition: transform .2s;
}
.fy-col:hover .bar { transform: scaleY(1.04); transform-origin: bottom; }
.fy-col .fy-label {
  margin-top: 8px;
  font-size: .8rem;
  color: var(--muted);
  font-weight: 600;
}
.fy-col .fy-label.current { color: var(--hgtc-green); font-weight: 700; }
.fy-col .fy-value {
  font-size: .85rem;
  font-weight: 700;
  color: var(--hgtc-blue);
  margin-bottom: 4px;
}

/* ==================== EMPTY STATES ==================== */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 24px;
}
.empty .empty-icon {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  background: var(--hgtc-paleveg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hgtc-green);
}
.empty .empty-icon svg { width: 28px; height: 28px; }
.empty .empty-title { color: var(--hgtc-blue); font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.empty .empty-sub { margin-bottom: 14px; font-size: .9rem; }
.empty .btn { margin: 4px; }

/* ==================== NOTICES ==================== */
.notice {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.notice.info  { background: var(--hgtc-paleveg); color: #2E5A34; border-left: 3px solid var(--hgtc-green); }
.notice.warn  { background: #FFF4E3; color: #7A4A1C; border-left: 3px solid var(--hgtc-orange); }
.notice.error { background: #FBE8E6; color: #7A2A25; border-left: 3px solid var(--hgtc-red); }
.notice.success { background: #E1F0E3; color: #2E6A3D; border-left: 3px solid var(--hgtc-green); }

/* ==================== TOASTS ==================== */
.toast-stack {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}
.toast {
  background: var(--surface);
  color: var(--ink);
  border-left: 4px solid var(--hgtc-blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toast-in .25s ease-out;
  font-size: .9rem;
}
.toast.success { border-left-color: var(--hgtc-green); }
.toast.error   { border-left-color: var(--hgtc-red); }
.toast.warn    { border-left-color: var(--hgtc-orange); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast.success svg { color: var(--hgtc-green); }
.toast.error svg   { color: var(--hgtc-red); }
.toast.warn svg    { color: var(--hgtc-orange); }
.toast.info svg    { color: var(--hgtc-blue); }
.toast .close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 0; margin-left: auto;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ==================== MODAL ==================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1500;
  padding: 16px;
  animation: fade-in .15s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in .2s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal.lg { max-width: 760px; }
.modal h3 { margin-top: 0; }
.modal .modal-sub { color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.modal .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ==================== HELP DRAWER ==================== */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1600;
  animation: fade-in .15s;
}
.drawer {
  position: fixed;
  top: 0; right: 0;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  background: #fff;
  box-shadow: -8px 0 30px rgba(0,0,0,.15);
  z-index: 1700;
  padding: 22px 26px;
  overflow-y: auto;
  animation: drawer-in .22s ease-out;
}
@keyframes drawer-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.drawer h2 { display: flex; justify-content: space-between; align-items: center; }
.drawer .close-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 6px;
  border-radius: 6px;
}
.drawer .close-btn:hover { background: var(--hgtc-warmgray); color: var(--ink); }
.drawer .help-section { margin-bottom: 22px; }
.drawer .help-section h3 { font-size: 1rem; }
.drawer .glossary dt { font-weight: 700; color: var(--hgtc-blue); margin-top: 10px; }
.drawer .glossary dd { margin: 2px 0 0; color: var(--ink-soft); font-size: .92rem; }

/* ==================== WIZARD / STEPPER ==================== */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
  padding: 14px 0;
}
.stepper .step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.stepper .step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
  transition: all .2s;
}
.stepper .step-circle svg { width: 16px; height: 16px; }
.stepper .step-label {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stepper .step.active .step-circle {
  background: var(--hgtc-blue);
  border-color: var(--hgtc-blue);
  color: #fff;
}
.stepper .step.active .step-label { color: var(--hgtc-blue); }
.stepper .step.done .step-circle {
  background: var(--hgtc-green);
  border-color: var(--hgtc-green);
  color: #fff;
}
.stepper .step.done .step-label { color: var(--hgtc-green); }
.stepper .step-line {
  flex: 1;
  height: 2px;
  background: var(--border-strong);
  margin: 0 8px;
  min-width: 20px;
}
.stepper .step.done + .step-line { background: var(--hgtc-green); }

/* ==================== DROPZONE ==================== */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: all .15s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--hgtc-green);
  background: var(--hgtc-paleveg);
}
.dropzone .dz-icon {
  width: 48px; height: 48px;
  margin: 0 auto 10px;
  color: var(--hgtc-green);
}
.dropzone .dz-title { font-weight: 600; color: var(--hgtc-blue); margin-bottom: 2px; }
.dropzone .dz-sub { color: var(--muted); font-size: .85rem; }
.dropzone input[type=file] {
  display: none;
}
.dz-file {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 12px;
}
.dz-file .dz-file-icon {
  width: 38px; height: 38px;
  background: var(--hgtc-paleveg);
  color: var(--hgtc-green);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dz-file .dz-file-name { font-weight: 600; word-break: break-all; }
.dz-file .dz-file-size { color: var(--muted); font-size: .8rem; }
.dz-file .dz-remove {
  background: none; border: none; cursor: pointer;
  color: var(--hgtc-red); margin-left: auto;
}

/* ==================== PROGRESS ==================== */
.progress {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress .bar {
  height: 100%;
  background: linear-gradient(90deg, var(--hgtc-green), var(--hgtc-blue));
  transition: width .3s;
  width: 0;
}

/* ==================== SPINNER / SKELETON ==================== */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(0,66,106,.2);
  border-top-color: var(--hgtc-blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -4px;
}
.spinner.lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, #ECECE8 0%, #F6F5F2 50%, #ECECE8 100%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
  display: inline-block;
  height: 14px;
  min-width: 40px;
}
.skeleton.bar { height: 10px; width: 100%; }
.skeleton.block { height: 60px; width: 100%; border-radius: var(--radius); }
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* ==================== TOOLTIP ==================== */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 260px;
  white-space: normal;
  width: max-content;
  opacity: 0;
  pointer-events: none;
  transition: all .15s;
  z-index: 100;
  box-shadow: var(--shadow-md);
  line-height: 1.3;
  text-align: center;
}
[data-tooltip]:hover::after, [data-tooltip]:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-tooltip-side="bottom"]::after {
  bottom: auto;
  top: calc(100% + 8px);
}

/* ==================== FILTER CHIPS ==================== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-chip {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all .15s;
}
.filter-chip:hover { border-color: var(--hgtc-blue); color: var(--hgtc-blue); }
.filter-chip.active {
  background: var(--hgtc-blue);
  color: #fff;
  border-color: var(--hgtc-blue);
}

/* ==================== UTILITIES ==================== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.flex-center { display: flex; justify-content: center; align-items: center; gap: 10px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1000px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 260px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .sidebar-toggle { display: inline-flex; }
  .main { padding: 70px 18px 36px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .topbar { margin-bottom: 16px; }
  h1 { font-size: 1.45rem; }
  .card { padding: 18px; }
  .stepper .step-label { display: none; }
  .stepper .step { flex: 0 0 auto; }
  .stepper .step-line { flex: 1; }
  .modal { padding: 18px; }
}
@media (max-width: 480px) {
  .btn { padding: 10px 14px; }
  .main { padding: 70px 14px 30px; }
}

/* Print */
@media print {
  .sidebar, .sidebar-toggle, .topbar .topbar-actions, .btn { display: none !important; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
