/* ═══════════════════════════════════════════════════════
   AP ERP Frontend — Microsoft Dynamics 365 Style
   ═══════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --primary: #0078D4;
  --primary-dark: #106EBE;
  --primary-light: #DEECF9;
  --primary-hover: #005A9E;

  --bg: #FAF9F8;
  --surface: #FFFFFF;
  --border: #EDEBE9;
  --border-strong: #C8C6C4;

  --text: #201F1E;
  --text-secondary: #605E5C;
  --text-disabled: #A19F9D;
  --text-inverse: #FFFFFF;

  --nav-bg: #1B1A19;
  --nav-text: #C8C6C4;
  --nav-icon-color: #A19F9D;
  --nav-hover-bg: rgba(255,255,255,0.08);
  --nav-active-bg: rgba(0,120,212,0.15);
  --nav-active-border: #0078D4;
  --nav-active-text: #0078D4;

  /* Status colors */
  --s-draft-bg: #F3F2F1;      --s-draft-text: #605E5C;
  --s-pending-bg: #FFF4CE;    --s-pending-text: #835B00;
  --s-active-bg: #DFF6DD;     --s-active-text: #107C10;
  --s-rejected-bg: #FDE7E9;   --s-rejected-text: #A4262C;
  --s-variance-bg: #FDEDE3;   --s-variance-text: #8A3707;
  --s-matched-bg: #EFF6FC;    --s-matched-text: #0063B1;
  --s-posted-bg: #E6F7E6;     --s-posted-text: #0B5A08;
  --s-sent-bg: #EDE7F6;       --s-sent-text: #4527A0;

  --topbar-height: 48px;
  --sidebar-width: 240px;
  --sidebar-collapsed: 48px;
  --cmd-height: 44px;

  --radius: 2px;
  --radius-md: 4px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.16);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.20);

  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  --mono: 'Cascadia Code', 'Consolas', monospace;

  --transition: 0.18s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App Shell ── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ════════════════════════════════════════
   TOP BAR
════════════════════════════════════════ */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px 0 0;
  gap: 8px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: var(--sidebar-width);
  padding-left: 4px;
}
.topbar-center { flex: 1; display: flex; justify-content: center; padding: 0 16px; }
.topbar-right { display: flex; align-items: center; gap: 4px; }

.topbar-hamburger { color: var(--text-secondary); }
.topbar-hamburger:hover { background: var(--bg); }

.topbar-brand { display: flex; align-items: center; gap: 6px; }
.brand-icon { flex-shrink: 0; }
.brand-app { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; }
.brand-divider { color: var(--text-disabled); font-weight: 300; margin: 0 2px; }
.brand-module { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

/* Global Search */
.global-search-wrap {
  position: relative;
  max-width: 480px;
  width: 100%;
}
.gs-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-secondary);
  pointer-events: none;
}
.global-search {
  width: 100%;
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  padding: 0 12px 0 34px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition);
  outline: none;
}
.global-search:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--primary);
}

/* Avatar */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

/* Notification button & panel */
.topbar-notification-wrap {
  position: relative;
}
.topbar-notification-wrap .icon-btn {
  position: relative;
}
.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #A4262C;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.notification-badge.hidden {
  display: none;
}
.notification-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  max-height: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
.notification-panel.hidden {
  display: none;
}
.notification-panel-head {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.notification-panel-body {
  padding: 8px;
  overflow-y: auto;
  max-height: 320px;
}
.notification-empty {
  padding: 24px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}
.notification-item {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  background: var(--bg);
  border-left: 3px solid var(--primary);
}
.notification-item:last-child {
  margin-bottom: 0;
}
.notification-item-clickable {
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.notification-item-clickable:hover {
  background: var(--primary-light);
  border-left-color: var(--primary-dark);
}
.notification-item-title {
  font-weight: 500;
  margin-bottom: 2px;
}
.notification-item-body {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.notification-item-time {
  font-size: 11px;
  color: var(--text-secondary);
}
.notification-item-action {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
}

/* Icon Buttons */
.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn .material-icons { font-size: 20px; }

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  flex-shrink: 0;
  transition: width var(--transition);
  z-index: 50;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.nav-list { padding: 8px 0; flex: 1; }
.nav-footer { padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.1); margin-top: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--nav-text);
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
  user-select: none;
  position: relative;
}
.nav-item:hover {
  background: var(--nav-hover-bg);
  color: #fff;
}
.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  border-left-color: var(--nav-active-border);
}
.nav-item .nav-icon {
  font-size: 20px;
  color: var(--nav-icon-color);
  flex-shrink: 0;
  transition: color var(--transition);
}
.nav-item:hover .nav-icon { color: #fff; }
.nav-item.active .nav-icon { color: var(--nav-active-text); }
.nav-label { font-size: 13px; transition: opacity var(--transition); }
.sidebar.collapsed .nav-label { opacity: 0; pointer-events: none; }
.sidebar.collapsed .nav-item { padding: 10px 14px; justify-content: center; }

/* Nav group labels (Phase 4+) */
.nav-group-label {
  display: block;
  padding: 16px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  user-select: none;
  list-style: none;
}
.sidebar.collapsed .nav-group-label { display: none; }

/* Badge warning (partially paid) */
.badge-warning {
  background: #FFF4CE;
  color: #835B00;
  border: 1px solid #F7E3A7;
}

/* ════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════ */
.main-content {
  flex: 1;
  overflow: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ── Page Loading ── */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 13px;
}
.page-loading.hidden { display: none; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   PAGE STRUCTURE
════════════════════════════════════════ */

/* Page wrapper - min-height: 0 so flex children (e.g. detail-body) can shrink and scroll */
.page { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.breadcrumb-link {
  cursor: pointer;
  color: var(--primary);
}
.breadcrumb-link:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-disabled); font-size: 10px; }
.breadcrumb-current { color: var(--text-secondary); }

/* Page Header */
.page-header {
  padding: 12px 20px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.page-title-wrap { display: flex; align-items: center; gap: 10px; }
.page-title { font-size: 20px; font-weight: 600; color: var(--text); }
.page-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.record-count {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  align-self: center;
}

/* Command Bar */
.cmd-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.cmd-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font-size: 13px;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.cmd-btn:hover { background: var(--bg); border-color: var(--border); }
.cmd-btn:active { background: var(--border); }
.cmd-btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.cmd-btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.cmd-btn.danger { color: #C50F1F; }
.cmd-btn.danger:hover { background: #FDE7E9; border-color: #F1707B; }
.cmd-btn .material-icons { font-size: 16px; }
.cmd-sep { width: 1px; height: 24px; background: var(--border); margin: 0 6px; flex-shrink: 0; }

/* ════════════════════════════════════════
   FILTER BAR
════════════════════════════════════════ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.filter-search .material-icons {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-secondary);
  pointer-events: none;
}
.filter-input {
  width: 100%;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 8px 0 30px;
  font-size: 13px;
  outline: none;
  background: var(--bg);
}
.filter-input:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.filter-select {
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 24px 0 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23605E5C' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 6px center;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

/* ════════════════════════════════════════
   ENTITY GRID / TABLE
════════════════════════════════════════ */
.grid-wrap {
  flex: 1;
  padding: 0 20px 20px;
  overflow: auto;
}
.entity-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 12px;
}
.entity-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #F3F2F1;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.entity-table th:hover { background: var(--bg); color: var(--text); }
.entity-table th.sorted { color: var(--primary); }
.entity-table th .sort-icon { font-size: 14px; vertical-align: middle; opacity: 0.6; }

.entity-table td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.entity-table tr:last-child td { border-bottom: none; }
.entity-table tbody tr {
  cursor: pointer;
  transition: background var(--transition);
}
.entity-table tbody tr:hover td { background: #F3F2F1; }
.entity-table tbody tr.selected td {
  background: var(--primary-light);
}

/* Empty State */
.empty-state {
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}
.empty-state .material-icons { font-size: 48px; color: var(--text-disabled); }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text); }
.empty-state-sub { font-size: 13px; }

/* ════════════════════════════════════════
   STATUS BADGES
════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-draft     { background: var(--s-draft-bg);    color: var(--s-draft-text); }
.badge-pending   { background: var(--s-pending-bg);  color: var(--s-pending-text); }
.badge-active    { background: var(--s-active-bg);   color: var(--s-active-text); }
.badge-approved  { background: var(--s-active-bg);   color: var(--s-active-text); }
.badge-rejected  { background: var(--s-rejected-bg); color: var(--s-rejected-text); }
.badge-variance  { background: var(--s-variance-bg); color: var(--s-variance-text); }
.badge-matched   { background: var(--s-matched-bg);  color: var(--s-matched-text); }
.badge-posted    { background: var(--s-posted-bg);   color: var(--s-posted-text); }
.badge-sent      { background: var(--s-sent-bg);     color: var(--s-sent-text); }
.badge-open      { background: var(--s-draft-bg);    color: var(--s-draft-text); }
.badge-partial   { background: var(--s-pending-bg);  color: var(--s-pending-text); }
.badge-complete  { background: var(--s-active-bg);   color: var(--s-active-text); }

/* ════════════════════════════════════════
   DETAIL / FORM VIEW
════════════════════════════════════════ */
.detail-page { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.detail-body { flex: 1; min-height: 0; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; }
/* Prevent detail content sections from shrinking so Line Items / Payment History stay visible when scrolling */
.detail-body > * { flex-shrink: 0; }

/* Record Header Card */
.record-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.record-title { font-size: 22px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.record-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 16px; flex-wrap: wrap; }
.record-meta-item { display: flex; align-items: center; gap: 4px; }

/* Field Cards */
.field-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}
.field-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.field-item { display: flex; flex-direction: column; gap: 3px; }
.field-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.field-value { font-size: 13px; color: var(--text); font-weight: 500; word-break: break-word; }
.field-value.empty { color: var(--text-disabled); font-style: italic; }

/* Lines Table Card */
.lines-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.lines-card-head {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: #F3F2F1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lines-table {
  width: 100%;
  border-collapse: collapse;
}
.lines-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #F3F2F1;
  border-bottom: 1px solid var(--border);
}
.lines-table td {
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.lines-table tr:last-child td { border-bottom: none; }
.lines-table tr:hover td { background: var(--bg); }
.lines-total {
  padding: 10px 12px;
  text-align: right;
  font-weight: 600;
  font-size: 14px;
  border-top: 2px solid var(--border);
  background: #F3F2F1;
}

/* ════════════════════════════════════════
   SETTINGS PAGE — Grid layout & sections
════════════════════════════════════════ */
.settings-page-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  flex: 1;
  overflow: auto;
  padding: 20px;
  align-content: start;
}
@media (max-width: 900px) {
  .settings-page-body { grid-template-columns: 1fr; }
}
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.settings-section.full-width { grid-column: 1 / -1; }
.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.settings-section-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: -8px 0 0 0;
}
.settings-row {
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr;
  gap: 12px 20px;
  align-items: center;
}
.settings-row.full { grid-column: 1 / -1; }
.settings-label { font-size: 12px; color: var(--text-secondary); }
.settings-value { font-size: 13px; color: var(--text); }
.settings-value.monospace { font-family: ui-monospace, monospace; font-size: 12px; }
.settings-actions { margin-top: 8px; }

/* ════════════════════════════════════════
   PAYMENT & FINANCE SECTIONS (AP Open Items, Payments, GL, Periods)
════════════════════════════════════════ */
.command-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.cmd-select {
  height: 30px;
  min-width: 140px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 24px 0 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23605E5C' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 8px center;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
}
.cmd-select:focus { border-color: var(--primary); }
.cmd-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 32px;
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  cursor: pointer;
  white-space: nowrap;
}
.cmd-btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.cmd-btn-primary .material-icons { font-size: 16px; }
.cmd-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 32px;
  border-radius: var(--radius);
  font-size: 13px;
  color: #C50F1F;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.cmd-btn-danger:hover { background: #FDE7E9; border-color: #F1707B; }
.cmd-btn-danger .material-icons { font-size: 16px; }

.entity-grid {
  flex: 1;
  padding: 0 20px 20px;
  overflow: auto;
}
.grid-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 12px;
}
.grid-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #F3F2F1;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.grid-table td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.grid-table tbody tr { transition: background var(--transition); }
.grid-table tbody tr:hover td { background: #F3F2F1; }
.grid-table tfoot td {
  padding: 10px 12px;
  font-size: 13px;
  border-top: 2px solid var(--border);
  background: #F3F2F1;
}

.detail-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 0 20px 20px;
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.field-row:last-child { border-bottom: none; }
.field-row .field-label {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field-row .field-value { font-weight: 500; color: var(--text); word-break: break-word; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 8px 20px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  margin: 0 20px 0;
}
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.error-banner {
  margin: 20px;
  padding: 16px 20px;
  background: #FDE7E9;
  border: 1px solid #F1707B;
  border-radius: var(--radius-md);
  color: #A4262C;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.error-banner .material-icons { font-size: 20px; flex-shrink: 0; }

.pay-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
}
.pay-item-row:last-child { border-bottom: none; }
.pay-item-row input[type="checkbox"] { flex-shrink: 0; }
.pay-item-desc { flex: 1; min-width: 0; }
.pay-item-meta { font-size: 11px; color: var(--text-secondary); white-space: nowrap; }
.pay-item-open { color: var(--text-secondary); font-size: 12px; }

/* ════════════════════════════════════════
   MODAL
════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}
.modal-dialog.wide { max-width: 900px; }

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--text); }
.modal-x { color: var(--text-secondary); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ════════════════════════════════════════
   FORM ELEMENTS
════════════════════════════════════════ */
.form-section { margin-bottom: 20px; }
.form-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-label.required::after {
  content: ' *';
  color: #C50F1F;
}
.form-control {
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.form-control:disabled { background: var(--bg); color: var(--text-disabled); cursor: not-allowed; }
textarea.form-control { height: auto; padding: 8px 10px; resize: vertical; min-height: 72px; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23605E5C' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
  -webkit-appearance: none;
  appearance: none;
}
.form-hint { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.form-error { font-size: 11px; color: #C50F1F; margin-top: 2px; }

/* ════════════════════════════════════════
   BUTTONS (standalone)
════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
  font-family: var(--font);
}
.btn .material-icons { font-size: 16px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: #C50F1F; color: #fff; border-color: #C50F1F; }
.btn-danger:hover { background: #A4262C; border-color: #A4262C; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-light); }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ════════════════════════════════════════
   DASHBOARD
════════════════════════════════════════ */
.dashboard-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  overflow-x: auto;
}
.stat-card {
  flex: 1 1 calc(25% - 10px);
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); transform: translateY(-2px); }
.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-card-icon .material-icons { font-size: 20px; }
.stat-card-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-card-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.stat-card-footer { font-size: 11px; color: var(--text-secondary); margin-top: auto; }
.stat-card-accent {
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
}

/* Color themes for stat cards */
.card-blue .stat-card-icon { background: var(--primary-light); color: var(--primary); }
.card-blue .stat-card-accent { background: var(--primary); }
.card-green .stat-card-icon { background: #DFF6DD; color: #107C10; }
.card-green .stat-card-accent { background: #107C10; }
.card-orange .stat-card-icon { background: #FDEDE3; color: #CA5010; }
.card-orange .stat-card-accent { background: #CA5010; }
.card-purple .stat-card-icon { background: #EDE7F6; color: #4527A0; }
.card-purple .stat-card-accent { background: #4527A0; }
.card-teal .stat-card-icon { background: #E0F7FA; color: #006064; }
.card-teal .stat-card-accent { background: #006064; }
.card-red .stat-card-icon { background: #FDE7E9; color: #C50F1F; }
.card-red .stat-card-accent { background: #C50F1F; }

/* Recent activity panel */
.dash-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 20px 20px;
}
.activity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.activity-card-head {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: #F3F2F1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.activity-card-head .material-icons { font-size: 18px; color: var(--text-secondary); }
.activity-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg); }
.activity-item-main { display: flex; flex-direction: column; gap: 2px; }
.activity-item-title { font-size: 13px; font-weight: 500; color: var(--text); }
.activity-item-sub { font-size: 11px; color: var(--text-secondary); }

/* ════════════════════════════════════════
   DYNAMIC LINE ITEM FORM
════════════════════════════════════════ */
.lines-form-wrap { margin-top: 16px; }
.lines-form-table { width: 100%; border-collapse: collapse; }
.lines-form-table th {
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-align: left;
  background: #F3F2F1;
  border-bottom: 1px solid var(--border);
}
.lines-form-table td { padding: 4px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.lines-form-table tr:last-child td { border-bottom: none; }
.line-input {
  width: 100%;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 6px;
  font-size: 12px;
  outline: none;
}
.line-input:focus { border-color: var(--primary); }
.line-input:read-only { background: var(--bg); color: var(--text-secondary); }
.btn-row-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--s-rejected-text);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-row-remove:hover { background: var(--s-rejected-bg); }
.btn-row-remove .material-icons { font-size: 16px; }

.lines-add-row {
  padding: 8px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: none;
}
.lines-add-row:hover { text-decoration: underline; }
.lines-add-row .material-icons { font-size: 16px; }

/* ════════════════════════════════════════
   TOAST NOTIFICATIONS
════════════════════════════════════════ */
.toast-stack {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
}
.toast {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 12px 16px 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 4px solid;
  pointer-events: all;
  animation: toastIn 0.2s ease;
  font-size: 13px;
}
.toast.success { border-color: #107C10; }
.toast.error { border-color: #C50F1F; }
.toast.warning { border-color: #C19C00; }
.toast.info { border-color: var(--primary); }
.toast-icon { flex-shrink: 0; font-size: 18px; margin-top: 1px; }
.toast.success .toast-icon { color: #107C10; }
.toast.error .toast-icon { color: #C50F1F; }
.toast.warning .toast-icon { color: #C19C00; }
.toast.info .toast-icon { color: var(--primary); }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 2px; color: var(--text); }
.toast-msg { color: var(--text-secondary); font-size: 12px; line-height: 1.4; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateX(110%); opacity: 0; } }
.toast.dying { animation: toastOut 0.25s ease forwards; }

/* ════════════════════════════════════════
   CONFIRM DIALOG (simple modal variant)
════════════════════════════════════════ */
.confirm-body { padding: 8px 0 16px; font-size: 14px; color: var(--text); line-height: 1.5; }
.confirm-hint { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }

/* ════════════════════════════════════════
   UTILITIES
════════════════════════════════════════ */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.monospace { font-family: var(--mono); }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--s-rejected-text); }
.text-success { color: var(--s-active-text); }
.text-muted { color: var(--text-secondary); }
.fw-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.p-20 { padding: 20px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-disabled); }

/* ════════════════════════════════════════
   LOGIN PAGE
════════════════════════════════════════ */
.main-content.login-page-active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px;
  background: linear-gradient(160deg, var(--bg) 0%, #E8EEF4 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.login-card-head {
  padding: 28px 24px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.login-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.login-brand-text {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.login-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.login-form {
  padding: 24px;
}

.login-field {
  margin-bottom: 18px;
}

.login-field:last-of-type {
  margin-bottom: 22px;
}

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.login-field .form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-field .form-control::placeholder {
  color: var(--text-disabled);
}

.login-submit {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-inverse);
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.login-submit:hover {
  background: var(--primary-dark);
}

.login-submit:active {
  transform: translateY(1px);
}

/* ════════════════════════════════════════
   MATCH RESULT ALERT
════════════════════════════════════════ */
.match-alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.match-alert.matched { background: #DFF6DD; border-color: #92C353; color: #0B5A08; }
.match-alert.variance { background: #FDEDE3; border-color: #E8A87C; color: #8A3707; }
.match-alert .material-icons { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ════════════════════════════════════════
   RESPONSIVE ADJUSTMENTS
════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .nav-label { display: none; }
  .topbar-left { min-width: auto; }
  .brand-module, .brand-divider { display: none; }
  .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-group.span-2, .form-group.span-3 { grid-column: span 1; }
  .dash-row { grid-template-columns: 1fr; }
  .stat-card { min-width: 140px; }
}
@media (min-width: 769px) and (max-width: 1200px) {
  .stat-card { flex: 1 1 calc(50% - 10px); min-width: 180px; }
}

/* ════════════════════════════════════════
   EMAIL INVOICE PIPELINE
════════════════════════════════════════ */

/* Status badge base */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-failed  { background: var(--s-rejected-bg);  color: var(--s-rejected-text); }
.badge-success { background: #DFF6DD;               color: #0B5A08; }
.badge-neutral { background: #F3F2F1;               color: #605E5C; }

/* Tab bar */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #EDEBE9;
  padding-bottom: 0;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #605E5C;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: #0078D4; }
.tab-btn.active { color: #0078D4; border-bottom-color: #0078D4; }

.tab-badge {
  background: #EDEBE9;
  color: #605E5C;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}
.badge-failed-tab { background: var(--s-rejected-bg); color: var(--s-rejected-text); }
.badge-success-tab { background: #DFF6DD; color: #0B5A08; }

/* Failed row highlight */
tr.row-failed td { background: #FFF4F4; }
tr.row-failed:hover td { background: #FDE7E9; }

/* KPI cards for status panel */
.kpi-card {
  background: #FAF9F8;
  border: 1px solid #EDEBE9;
  border-radius: var(--radius-md);
  padding: 10px 16px;
}
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: #605E5C;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.kpi-value { font-size: 20px; font-weight: 700; color: #201F1E; }

/* Spin animation for poll button */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .8s linear infinite; display: inline-block; }

/* ── Dashboard overdue alert ── */
.dash-alert {
  display: flex; align-items: center; gap: 10px;
  background: #fff5f5; border: 1px solid #f5c6c6;
  border-radius: 6px; padding: 10px 16px; margin-bottom: 12px;
  font-size: 14px; color: #c0392b;
}

/* ── Overdue row highlighting (invoices/AP lists) ── */
tr.row-overdue { background: #fff5f5; }
tr.row-overdue td { color: #c0392b; }
.badge-overdue { background: #c0392b; color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 600; }

/* ── Blocked vendor badge ── */
.badge-blocked { background: #c0392b; color: #fff; border-radius: 10px; padding: 2px 8px; font-size: 11px; font-weight: 600; }

/* ── Email Log Table ── */
.email-log-table { table-layout: fixed; width: 100%; }
.email-log-table th, .email-log-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; padding: 8px 10px; }
.email-log-table td { white-space: normal; }
.email-log-table td:nth-child(1),
.email-log-table td:nth-child(2),
.email-log-table td:nth-child(4),
.email-log-table td:nth-child(5),
.email-log-table td:nth-child(6),
.email-log-table td:nth-child(7) { white-space: nowrap; }

/* ── Workflow Progress Bar ── */
.workflow-progress { display: flex; align-items: center; gap: 0; margin: 12px 0 4px; flex-wrap: nowrap; overflow-x: auto; }
.workflow-step { display: flex; align-items: center; gap: 6px; padding: 5px 14px 5px 20px; font-size: 12px; font-weight: 500; color: #605e5c; background: #f3f2f1; border: 1px solid #e1dfdd; position: relative; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); margin-right: -1px; white-space: nowrap; }
.workflow-step:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.workflow-step.step-done { background: #dff6dd; border-color: #107c10; color: #107c10; }
.workflow-step.step-active { background: #0078d4; border-color: #0078d4; color: #fff; font-weight: 700; }
.workflow-step.step-rejected { background: #fde7e9; border-color: #c0392b; color: #c0392b; }
.workflow-step .step-icon { font-size: 14px; line-height: 1; }

/* ── Attach File display ── */
.file-attachment-link { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); text-decoration: none; font-size: 13px; }
.file-attachment-link:hover { text-decoration: underline; }
