/* Procurement Suite - SHARED standard theme
   ---------------------------------------------------------------
   This is the standard UI every module (PO Portal, Asset
   Maintenance, and anything added later) is built on. It started
   as an exact copy of PO Portal's own proven assets/style.css
   (visual language modeled after the SAP B1 Report Builder
   reference: flat, light, generous whitespace, thin borders instead
   of heavy shadows, small SVG-icon buttons, pill badges) so nothing
   already shipped changes by even one pixel.

   Rules:
   - Everything above the "SHARED ADDITIONS" marker below is the
     original PO Portal CSS, unchanged, byte-for-byte. Purchase
     Requisition (the old PO Portal, modules/po_portal) now links
     this file like every other module; its own assets/style.css
     only holds module-specific rules.
   - Everything below the marker is new, added for the multi-module
     suite: the hub/launcher module cards, tab switcher, stat cards,
     and generic semantic pill/dot classes any new module can use
     instead of inventing its own status-color CSS.
   - A future module should link this file, not copy it - one place
     to change the brand colors (the :root block) for every app at
     once. New CSS that's specific to one module belongs in that
     module's own assets/style.css, loaded AFTER this file so it can
     override/extend it. See docs/README.md "Adding a new module".
   --------------------------------------------------------------- */

:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e2e6ec;
  --border-strong: #cfd6e0;
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-faint: #9aa4b2;

  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-bg: #eaf0fe;

  --success: #16a34a;
  --success-dark: #128038;
  --success-bg: #e9f8ef;

  --danger: #dc2626;
  --danger-bg: #fdecec;

  --warning: #d97706;
  --warning-bg: #fef3e0;

  --info: #0891b2;
  --info-bg: #e5f7fb;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button, input, select, textarea { font: inherit; color: inherit; }

svg { display: block; flex-shrink: 0; }

/* ── Top nav ─────────────────────────────────────────────────────────── */

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Shared top bar parts (lib/TopBar.php) */
.topnav-brand { min-width: 0; }
.topnav-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--primary-bg); color: var(--primary-dark); }
.topnav-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav-title-link { color: inherit; text-decoration: none; }
.topnav-title-link:hover { color: var(--primary); }
.topnav-sub { font-weight: 400; font-size: 12.5px; color: var(--text-muted); margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .topnav-sub { display: none; } }

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  margin-right: 4px;
}
.user-chip:hover { border-color: var(--border-strong); color: var(--text); }

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn-ghost, .btn-primary, .btn-success, .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

.btn-ghost {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--border-strong); background: var(--bg); }

.btn-ghost.sm, .btn-primary.sm, .btn-success.sm, .btn-danger.sm {
  padding: 5px 10px;
  font-size: 12px;
}

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

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dark); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Layout ──────────────────────────────────────────────────────────── */

.layout {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 56px);
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  border: 2px solid var(--panel);
}

.sidebar-search { padding: 0 12px 10px; }
.sidebar-search input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.sidebar-search input:focus { outline: none; border-color: var(--primary); background: var(--panel); }

.col-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
}

.loading-hint {
  padding: 20px 12px;
  color: var(--text-faint);
  font-size: 12.5px;
  text-align: center;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 2px;
  color: var(--text);
}
.status-row:hover { background: var(--bg); }
.status-row.active { background: var(--primary-bg); color: var(--primary-dark); font-weight: 700; }
.status-row .dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; flex-shrink: 0; }
.status-row .label { display: flex; align-items: center; flex: 1; }
.status-row .count { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.status-row.active .count { color: var(--primary-dark); }

.dot.dot-open { background: #94a3b8; }
.dot.dot-awaiting { background: var(--warning); }
.dot.dot-approved { background: var(--info); }
.dot.dot-posted { background: var(--success); }
.dot.dot-all { background: var(--text-muted); }

/* ── Canvas ──────────────────────────────────────────────────────────── */

.canvas {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

.filter-bar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.filter-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 160px;
}

.no-filters { color: var(--text-faint); font-size: 12.5px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
}
.chip .chip-x {
  cursor: pointer;
  opacity: 0.7;
  font-weight: 700;
}
.chip .chip-x:hover { opacity: 1; }

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ctrl-select, .ctrl-input, .ctrl-textarea {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
}
.ctrl-select:focus, .ctrl-input:focus, .ctrl-textarea:focus { outline: none; border-color: var(--primary); }
.ctrl-textarea { width: 100%; resize: vertical; }

/* ── Results table ───────────────────────────────────────────────────── */

.results-wrap {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.results-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  gap: 8px;
  padding: 40px;
}
.results-empty svg { color: var(--border-strong); }
.results-empty p { margin: 0; font-size: 13px; }

.results-table-wrap { overflow: auto; flex: 1; }

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table thead th {
  position: sticky;
  top: 0;
  background: #5a6268;
  color: #fff;
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.results-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.results-table tbody tr:hover { background: #fafbfc; }

.amount_td { text-align: right; }

.po-id-cell { font-weight: 700; color: var(--text); }

.type-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}
.type-pill.stock { border-color: var(--primary); color: var(--primary-dark); }
.type-pill.misc { border-color: var(--text-faint); color: var(--text-muted); }

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.status-pill.open { background: #eef1f5; color: #475569; }
.status-pill.awaiting { background: var(--warning-bg); color: var(--warning); }
.status-pill.approved { background: var(--info-bg); color: var(--info); }
.status-pill.posted { background: var(--success-bg); color: var(--success-dark); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Status bar ──────────────────────────────────────────────────────── */

.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.status-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
}
.status-badge.ready { background: #eef1f5; color: #475569; }
.status-badge.loading { background: var(--primary-bg); color: var(--primary-dark); }
.status-badge.success { background: var(--success-bg); color: var(--success-dark); }
.status-badge.error { background: var(--danger-bg); color: var(--danger); }

#status-right { margin-left: auto; font-weight: 600; color: var(--text); }

/* ── Modal ───────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
  z-index: 100;
  overflow-y: auto;
}

.modal {
  background: var(--panel);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal.modal-lg { max-width: 860px; }
.modal.modal-sm { max-width: 420px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* ── Form (inside modal) ─────────────────────────────────────────────── */

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.form-field { display: flex; flex-direction: column; }
.form-field input, .form-field select, .form-field textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--primary);
}
.form-field input:disabled, .form-field select:disabled, .form-field textarea:disabled {
  background: var(--bg); color: var(--text-muted);
}

.vendor-contact-line { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.rfq-vendor-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 160px;
  overflow-y: auto;
  background: #fff;
}
.rfq-vendor-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.rfq-vendor-option:last-child { border-bottom: none; }
.rfq-vendor-option:hover { background: var(--bg); }
.rfq-vendor-option input[type="checkbox"] { width: auto; flex-shrink: 0; }

.lines-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-bottom: 8px;
}
.lines-table th {
  background: var(--bg);
  text-align: left;
  padding: 7px 8px;
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.lines-table td {
  padding: 5px 6px;
  border: 1px solid var(--border);
}
.lines-table input, .lines-table select {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12.5px;
}
.lines-table .amount-cell { text-align: right; font-weight: 700; white-space: nowrap; }
.lines-table tfoot td { font-weight: 700; text-align: right; border: none; padding-top: 8px; }

.remove-line-btn {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px;
}
.remove-line-btn:hover { opacity: 0.7; }

.stock-col, .misc-col { }

.history-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 12px;
  color: var(--text-muted);
}
.history-list li { padding: 4px 0; border-top: 1px solid var(--border); }
.history-list li:first-child { border-top: none; }

.alert-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}
.alert-banner.error { background: var(--danger-bg); color: var(--danger); }
.alert-banner.warning { background: var(--warning-bg); color: var(--warning); }
.alert-banner.success { background: var(--success-bg); color: var(--success-dark); }

.hide { display: none !important; }
.text-center { text-align: center; }

/* ── Quotations panel (inside PO modal) ─────────────────────────────── */

.quotations-panel {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.quotations-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.quotations-panel-head h4 {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.quote-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg);
}
.quote-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.quote-card-title { font-weight: 700; }
.quote-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}
.quote-card-body { margin-top: 10px; }
.quote-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.quote-status-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.quote-status-pill.draft { background: #eef1f5; color: #475569; }
.quote-status-pill.sent { background: var(--info-bg); color: var(--info); }
.quote-status-pill.unsent { background: var(--danger-bg); color: var(--danger); }
.quote-status-pill.replied { background: var(--success-bg); color: var(--success-dark); }
.quote-reply-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 6px;
}
.quote-reply-lines th, .quote-reply-lines td {
  border: 1px solid var(--border);
  padding: 5px 7px;
  text-align: left;
}
.quote-reply-lines td.amount-cell, .quote-reply-lines th.amount-th { text-align: right; }
.attachment-link {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.attachment-link:hover { color: var(--primary-dark); }

.rfq-attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-top: 5px;
  background: var(--bg);
}
.rfq-attachment-row span { overflow-wrap: anywhere; }
.rfq-attachment-row-error {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}
.rfq-attachment-row button.btn-ghost.sm { padding: 2px 6px; flex-shrink: 0; }
.quote-pending-banner {
  border: 1px solid var(--warning);
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.quote-no-items { color: var(--text-faint); font-size: 12.5px; }

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .col-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px; }
  .status-row { flex: 1 0 auto; }
}

@media (max-width: 560px) {
  .topnav-actions .btn-ghost span, .topnav-actions .btn-primary span { display: none; }
  .results-table thead { display: none; }
  .results-table, .results-table tbody, .results-table tr, .results-table td { display: block; width: 100%; }
  .results-table tr { border-bottom: 2px solid var(--border); padding: 8px 0; }
}

/* ══════════════════════════════════════════════════════════════════════
   SHARED ADDITIONS (suite-wide, added for the multi-module hub) - see
   the header comment above for the ground rules.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Generic semantic pill / dot (any module's status colors) ──────────
   PO Portal keeps its own named classes (.status-pill.open etc., defined
   above) unchanged. A NEW module should reach for these generic
   pill-* / dot-* modifiers instead of inventing its own per-status CSS -
   pick whichever of the 5 semantic tones fits the status's meaning. */

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.pill-neutral  { background: #eef1f5;          color: #475569; }
.pill-info     { background: var(--info-bg);    color: var(--info); }
.pill-warning  { background: var(--warning-bg); color: var(--warning); }
.pill-success  { background: var(--success-bg); color: var(--success-dark); }
.pill-danger   { background: var(--danger-bg);  color: var(--danger); }

.dot-generic-neutral  { background: #94a3b8; }
.dot-generic-info     { background: var(--info); }
.dot-generic-warning  { background: var(--warning); }
.dot-generic-success  { background: var(--success); }
.dot-generic-danger   { background: var(--danger); }

/* ── Topnav "back to hub" link (used by module apps, optional) ────────── */

.hub-home-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12.5px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  margin-right: 2px;
}
.hub-home-link:hover { background: var(--bg); color: var(--text); }

/* ── Tabs (e.g. General / Meters & Components / Statistics inside a
   record modal) ─────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Stat cards (asset/record statistics summary) ──────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 10px 12px;
}
.stat-card .stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.stat-card .stat-value { font-size: 18px; font-weight: 700; color: var(--text); }
.stat-card .stat-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* ── Hub / launcher module cards ────────────────────────────────────────── */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.module-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.module-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.module-card.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.module-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.module-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.module-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  flex: 1;
  line-height: 1.5;
}

.module-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--primary-dark);
  font-weight: 700;
}

.module-card-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-faint);
}

.empty-hub-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}

/* ── Print (used by print_mo.php and similar printable forms) ─────────── */

@media print {
  .topnav, .sidebar, .status-bar, .no-print { display: none !important; }
  body { background: #fff; }
  .print-sheet { box-shadow: none !important; border: none !important; }
}

/* ── DARK MODE ───────────────────────────────────────────────────────────
   Switched on by assets/theme/darkmode.js, which sets
   <html data-theme="dark"> (saved per browser, defaults to the OS
   setting) and adds the sun/moon button to .topnav-actions.

   Most of the suite only uses the :root variables, so swapping them
   is enough. The rules after the variables cover the few places
   (here and in module style.css files) that hard-code a light colour;
   the :root[data-theme] prefix out-ranks the module rules even though
   module CSS loads later. Screen only - printing always comes out
   light. A module adding new hard-coded colours should add its dark
   override here too. */

@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0f141b;
    --panel: #171d26;
    --border: #2a323e;
    --border-strong: #3b4555;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --text-faint: #6b7585;

    --primary: #3b82f6;
    --primary-dark: #93b4fd;   /* used as TEXT on --primary-bg, so lighter in dark mode */
    --primary-bg: #172440;

    --success: #16a34a;
    --success-dark: #4ade80;
    --success-bg: #11281b;

    --danger: #ef4444;
    --danger-bg: #3a1b1d;

    --warning: #f59e0b;
    --warning-bg: #33260e;

    --info: #22d3ee;
    --info-bg: #0f2a31;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.55);

    /* vendor_registration/assets/vendor.css */
    --vr-primary: #3b82f6;
    --vr-primary-dark: #60a5fa;
    --vr-danger: #f87171;
  }

  /* --primary-dark / --success-dark became text colours above; keep the
     button hovers a darker shade of the button instead. */
  :root[data-theme="dark"] .btn-primary:hover { background: #2563eb; }
  :root[data-theme="dark"] .btn-success:hover { background: #15803d; }

  /* theme.css */
  :root[data-theme="dark"] .results-table thead th { background: #232b37; color: var(--text); }
  :root[data-theme="dark"] .results-table tbody tr:hover,
  :root[data-theme="dark"] .vr-table tr:hover { background: #1c2430; }
  :root[data-theme="dark"] .status-pill.open,
  :root[data-theme="dark"] .status-badge.ready,
  :root[data-theme="dark"] .quote-status-pill.draft,
  :root[data-theme="dark"] .pill-neutral,
  :root[data-theme="dark"] .ref-tag { background: #252d39; color: #cbd5e1; }
  :root[data-theme="dark"] .dot.dot-open,
  :root[data-theme="dark"] .dot-generic-neutral { background: #64748b; }
  :root[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.6); }
  :root[data-theme="dark"] .rfq-vendor-list { background: var(--panel); }
  :root[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="color"]):not([type="file"]),
  :root[data-theme="dark"] select,
  :root[data-theme="dark"] textarea { background-color: var(--bg); border-color: var(--border-strong); }

  /* system_log */
  :root[data-theme="dark"] .pill-debug { background: #2e1a47; color: #d8b4fe; }
  :root[data-theme="dark"] .sl-stats .stat-card.support .stat-value { color: #a78bfa; }
  :root[data-theme="dark"] .sl-message.bad { border-color: #7f1d1d; color: #fca5a5; }
  :root[data-theme="dark"] .sl-json .k { color: #93c5fd; }
  :root[data-theme="dark"] .sl-json .s { color: #86efac; }
  :root[data-theme="dark"] .sl-json .n { color: #fcd34d; }
  :root[data-theme="dark"] .sl-json .b { color: #d8b4fe; }

  /* barcode_generator: the label sheet preview is paper - keep it white */
  :root[data-theme="dark"] .bg-page-wrap { background: #0b0f14; }

  /* vendor_registration admin */
  :root[data-theme="dark"] .vr-btn-ghost,
  :root[data-theme="dark"] .vr-btn-danger,
  :root[data-theme="dark"] .vr-filter-chip,
  :root[data-theme="dark"] .vr-file-input { background: var(--panel); }
  :root[data-theme="dark"] .vr-filter-chip.active { background: var(--vr-primary); }
  :root[data-theme="dark"] .vr-errors { background: var(--danger-bg); border-color: #7f1d1d; color: #fca5a5; }
  :root[data-theme="dark"] .vr-success-box { background: var(--success-bg); border-color: #166534; color: #86efac; }
  :root[data-theme="dark"] .vr-pill-pending  { background: #3a2a0c; color: #fcd34d; }
  :root[data-theme="dark"] .vr-pill-approved { background: #11281b; color: #86efac; }
  :root[data-theme="dark"] .vr-pill-rejected,
  :root[data-theme="dark"] .vr-pill-failed   { background: #3a1b1d; color: #fca5a5; }
  :root[data-theme="dark"] .vr-pill-pushed   { background: #172440; color: #93c5fd; }
  :root[data-theme="dark"] .vr-pill-notpushed{ background: #252d39; color: #cbd5e1; }
  :root[data-theme="dark"] .vr-pill-invited  { background: #1e1b4b; color: #a5b4fc; }
  :root[data-theme="dark"] .vr-pill-emailcaptured { background: #3b0f3f; color: #f0abfc; }
  :root[data-theme="dark"] .vr-body pre,
  :root[data-theme="dark"] .vr-body input[style*="f9fafb"] { background: var(--bg) !important; }
}

.theme-toggle { padding: 5px 8px; }

/* Appearance menu (darkmode.js) - mode + look per user, "Default" = System Settings > Look */
.ap-wrap { position: relative; display: inline-flex; }
.ap-pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 300px; padding: 12px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); font-size: 12.5px; font-weight: 400; }
.ap-pop[hidden] { display: none; }
.ap-head { font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.ap-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-faint); margin: 10px 0 5px; }
.ap-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-opt { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ap-opt small { font-size: 10.5px; font-weight: 400; color: var(--text-faint); }
.ap-opt:hover { border-color: var(--border-strong); }
.ap-opt.on { border-color: var(--primary); background: var(--primary-bg); color: var(--primary-dark); }
.ap-opt.on small { color: var(--primary-dark); }
.ap-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); line-height: 1.45; }
.ap-note { margin-top: 6px; color: var(--danger); font-size: 11.5px; }

/* ── One look for every entry field and drop-down, in every module ──────
   (UNIMELSVR 29-30 Oct: "standard all entry fields" - System Settings first,
   then e.g. the Budget "Next year budget" Title box). Text boxes, drop-downs
   and text areas in a form field, the ctrl-* controls, and a box placed
   straight in a pop-up share height, font, border, arrow and focus ring.
   Compact grids (PRF item lines, budget amount cells) keep their own classes. */
.form-field input:not([type]), .form-field input[type=text], .form-field input[type=password], .form-field input[type=search],
.form-field input[type=email], .form-field input[type=url], .form-field input[type=number], .form-field input[type=date], .form-field input[type=tel],
.form-field select, .form-field textarea,
.ctrl-select, .ctrl-input,
.modal-body > input:not([type]), .modal-body > input[type=text], .modal-body > input[type=number], .modal-body > input[type=date],
.modal-body > input[type=email], .modal-body > select, .modal-body > textarea {
  box-sizing: border-box; height: 38px; padding: 0 12px; margin: 0;
  font-family: inherit; font-size: 13.5px; line-height: 1.4; color: var(--text);
  background-color: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.modal-body > input:not([type]), .modal-body > input[type=text], .modal-body > input[type=number], .modal-body > input[type=date],
.modal-body > input[type=email], .modal-body > select, .modal-body > textarea { width: 100%; }
.form-field textarea, .ctrl-textarea, .modal-body > textarea { height: auto; min-height: 64px; padding: 8px 12px; font-family: inherit; font-size: 13.5px; }
.form-field select, .ctrl-select, .modal-body > select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 14px;
}
.form-field select[multiple], .ctrl-select[multiple] { height: auto; padding: 6px 8px; background-image: none; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus,
.ctrl-select:focus, .ctrl-input:focus, .ctrl-textarea:focus,
.modal-body > input:focus, .modal-body > select:focus, .modal-body > textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg);
}
.form-field input::placeholder, .form-field textarea::placeholder, .ctrl-input::placeholder { color: var(--text-muted); }
