/* ============================================================
   framework.css — Minimal CSS framework for Post-Trade UI
   Single source of truth for tokens, components, and utilities.
   ============================================================ */

/* --- Tokens ------------------------------------------------ */

:root {
  /* Surfaces */
  --bg: hsl(30 8% 98%);
  --card: hsl(30 0% 100%);
  --foreground: hsl(30 0% 10%);
  --muted-fg: hsl(24 3% 35%);
  --border: hsl(30 8% 85%);
  --border-subtle: hsl(30 6% 91%);
  --accent: hsl(20 23% 94%);
  --accent-active: hsl(20 23% 90%);
  --table-header: hsl(30 6% 96%);

  /* Brand */
  --primary: hsl(210 100% 45%);
  --primary-fg: hsl(0 0% 100%);

  /* Status */
  --green: hsl(140 50% 38%);
  --red: hsl(0 62% 53%);
  --yellow: hsl(40 90% 50%);
  --color-status-success: hsl(140 50% 38%);
  --color-status-warning: hsl(40 90% 50%);
  --color-status-danger: hsl(0 62% 53%);
  --color-status-info: hsl(210 100% 45%);
  --color-status-muted: hsl(24 3% 55%);

  /* Semantic aliases */
  --color-surface-page: var(--bg);
  --color-surface-card: var(--card);
  --color-surface-input: var(--card);
  --color-border-default: var(--border);
  --color-border-focus: var(--primary);

  /* Typography scale */
  --text-2xs: 0.625rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Misc */
  --radius: 0.6rem;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
}

.dark {
  color-scheme: dark;
  --bg: hsl(220 5.5% 9%);
  --card: hsl(220 5.5% 10.5%);
  --foreground: hsl(220 2% 97%);
  --muted-fg: hsl(220 4% 67%);
  --border: hsl(220 3% 17%);
  --border-subtle: hsl(220 3% 14%);
  --accent: hsl(220 5% 14%);
  --accent-active: hsl(20 12% 18%);
  --primary: hsl(210 100% 66%);
  --primary-fg: hsl(220 4% 10%);
  --table-header: hsl(220 5% 12%);
  --color-status-success: hsl(140 50% 45%);
  --color-status-warning: hsl(40 90% 55%);
  --color-status-danger: hsl(0 62% 58%);
  --color-status-info: hsl(210 100% 66%);
  --color-status-muted: hsl(220 4% 55%);
}

/* --- Reset ------------------------------------------------- */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: var(--text-sm);
  line-height: 1.5;
  background: var(--bg);
  color: var(--foreground);
}
[x-cloak] { display: none !important; }

/* --- Layout ------------------------------------------------ */

.container { max-width: 1400px; margin: 0 auto; padding: 0 var(--space-5) 3rem; }

/* --- Typography -------------------------------------------- */

.mono { font-family: var(--font-mono); font-size: 0.8rem; }
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.text-2xs { font-size: var(--text-2xs); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.section-title { font-weight: 600; font-size: 0.8125rem; }
.section-label {
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted-fg);
}
.text-label { font-size: 0.6875rem; color: var(--muted-fg); }

/* --- Color utilities --------------------------------------- */

.text-muted { color: var(--muted-fg); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: hsl(35 90% 50%); }
.text-primary { color: var(--primary); }

/* --- Spacing ----------------------------------------------- */

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-5 { padding-left: var(--space-5); padding-right: var(--space-5); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }

/* --- Flex utilities ---------------------------------------- */

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-row { display: flex; align-items: center; gap: var(--space-2); }
.flex-row-xs { display: flex; align-items: center; gap: var(--space-1); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-between-baseline { display: flex; justify-content: space-between; align-items: baseline; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.ml-auto { margin-left: auto; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.whitespace-nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Navbar ------------------------------------------------ */

.navbar {
  display: flex; align-items: center; height: 3.5rem;
  background: var(--card); padding: 0 var(--space-5);
  border: 1px solid var(--border); border-radius: var(--radius); margin: var(--space-4) 0;
}
.navbar .brand { font-weight: 600; font-size: 0.9rem; margin-right: var(--space-6); white-space: nowrap; }
nav { display: flex; gap: var(--space-1); overflow-x: auto; min-width: 0; }
nav button, nav a {
  background: none; border: none; color: var(--muted-fg);
  padding: 0.4rem 0.75rem; font-size: 0.8125rem; font-weight: 500;
  border-radius: calc(var(--radius) - 2px); white-space: nowrap; cursor: pointer;
  text-decoration: none;
}
nav button:hover, nav button.active, nav a:hover, nav a.active { color: var(--foreground); background: var(--accent); }
.navbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }
.user-info { font-size: var(--text-xs); color: var(--muted-fg); }

/* --- Cards ------------------------------------------------- */

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card.card-overflow { overflow: visible; }
.card-header { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--space-3); }
.card-body { padding: var(--space-4) var(--space-5); }

/* --- Tables ------------------------------------------------ */

table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.table-wrap { overflow-x: auto; }
thead { background: none; }
th { padding: 0.6rem 0.75rem; color: var(--muted-fg); font-weight: 500; font-size: var(--text-xs); letter-spacing: 0.02em; text-align: left; }
td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border-subtle); }
tbody > tr:hover > td { background: var(--accent); }

.alloc-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.8125rem; background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.alloc-table th { padding: 0.5rem 0.75rem; color: var(--muted-fg); font-weight: 500; font-size: var(--text-xs); text-align: left; border-bottom: 1px solid var(--border); }
.alloc-table td { padding: 0.45rem 0.75rem; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.alloc-table tbody tr:last-child td { border-bottom: none; }

.split-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.8125rem; table-layout: fixed; }
.split-table th, .split-table td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.split-table th { font-size: 0.6875rem; text-transform: uppercase; color: var(--muted-fg); font-weight: 500; }
.split-table .col-divider { border-right: 2px solid var(--border); }
.split-table .date-row td { background: var(--accent); font-weight: 600; font-size: var(--text-xs); padding: 0.3rem 0.6rem; color: var(--muted-fg); }
.split-table .gray-fill { background: var(--accent); }
.split-table .cell-trunc { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.split-table > tbody.dimmed { color: var(--muted-fg); }
.split-table > tbody.auto-matched { background: repeating-linear-gradient(-45deg, transparent, transparent 4px, hsl(270 50% 60% / 0.07) 4px, hsl(270 50% 60% / 0.07) 8px); }
.split-table > tbody.auto-matched > tr:hover { background-color: hsl(270 50% 60% / 0.04); }

/* State-pending: diagonal stripes for pending/locked/test states */
.state-pending { background: repeating-linear-gradient(-45deg, transparent, transparent 4px, hsl(270 50% 60% / 0.07) 4px, hsl(270 50% 60% / 0.07) 8px) !important; }
tr.state-pending:hover > td { background: hsl(270 50% 60% / 0.04) !important; }
.modal-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,0.12); padding: 1rem; }
.split-table > tbody > tr:hover > td { background: transparent; }
.split-table > tbody > tr:hover { background-color: var(--accent); }

/* --- Badges ------------------------------------------------ */

.badge {
  display: inline-flex; align-items: center; padding: 0.125rem 0.5rem;
  border-radius: 9999px; font-size: 0.6875rem; font-weight: 600;
}
.badge-success { background: hsl(140 50% 38% / 0.12); color: var(--color-status-success); }
.badge-warning { background: hsl(40 90% 50% / 0.12); color: var(--color-status-warning); }
.badge-danger { background: hsl(0 62% 53% / 0.12); color: var(--color-status-danger); }
.badge-info { background: hsl(210 100% 45% / 0.12); color: var(--color-status-info); }
.badge-muted { background: hsl(24 3% 35% / 0.12); color: var(--color-status-muted); }

/* --- Buttons ----------------------------------------------- */

.btn {
  padding: 0.4rem 0.85rem; border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border); background: var(--card);
  font-size: 0.8125rem; font-weight: 500; cursor: pointer;
  color: var(--foreground); text-decoration: none; display: inline-flex; align-items: center; gap: var(--space-2);
}
.btn:hover { background: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { background: none; }
.btn-primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn-primary:hover { background: hsl(210 100% 55%); border-color: hsl(210 100% 55%); }
.btn-secondary { background: transparent; border-color: var(--border); color: var(--foreground); }
.btn-secondary:hover { background: var(--accent); }
.btn-danger { background: var(--color-status-danger); color: #fff; border-color: var(--color-status-danger); }
.btn-danger:hover { background: hsl(0 62% 63%); border-color: hsl(0 62% 63%); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: var(--text-xs); }

/* --- Forms ------------------------------------------------- */

.form-group { margin-bottom: var(--space-3); }
.form-group label { display: block; font-size: var(--text-xs); font-weight: 500; color: var(--muted-fg); margin-bottom: var(--space-1); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.4rem 0.6rem; border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px); background: var(--card);
  font-size: 0.8125rem; color: var(--foreground); line-height: 1.4;
}
.form-group select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.5rem center; padding-right: 1.75rem;
}
.form-group input:focus, .form-group select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.form-row { display: flex; gap: var(--space-3); }
.form-row > .form-group { flex: 1; }
.form-row > .form-actions { padding-top: 1.3rem; margin-bottom: var(--space-3); }

/* --- Stats ------------------------------------------------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.stat-value { font-size: var(--text-2xl); font-weight: 600; }
.stat-label { font-size: 0.6875rem; color: var(--muted-fg); text-transform: uppercase; letter-spacing: 0.05em; }

/* --- KPI cards --------------------------------------------- */

.kpi-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-2) var(--space-3); min-width: 100px; }
.kpi-label { font-size: 0.6875rem; color: var(--muted-fg); font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; }
.kpi-value { font-size: var(--text-lg); font-weight: 600; font-family: var(--font-mono); margin-top: 0.15rem; }

/* --- Progress bars ----------------------------------------- */

.progress-inline { height: 4px; border-radius: 9999px; background: var(--color-border-default); overflow: hidden; }
.progress-inline-fill { height: 100%; border-radius: 9999px; }
.progress-success { background: var(--color-status-success); }
.progress-warning { background: var(--color-status-warning); }
.progress-danger { background: var(--color-status-danger); }

/* --- Row state accents (4px left border) ------------------- */
tr.row-done { border-left: 4px solid var(--color-status-success); }
tr.row-skipped { border-left: 4px solid var(--color-status-warning); }
tr.row-danger { border-left: 4px solid var(--color-status-danger); }

/* --- Match proximity glow ---------------------------------- */
.match-exact { color: var(--color-status-success); text-shadow: 0 0 6px var(--color-status-success); }
.match-close { color: var(--color-status-success); text-shadow: 0 0 4px color-mix(in srgb, var(--color-status-success) 50%, transparent); }
.match-near  { color: var(--color-status-warning); text-shadow: 0 0 3px color-mix(in srgb, var(--color-status-warning) 40%, transparent); }
.highlight-glow { animation: amber-pulse 2s ease-in-out; }
@keyframes amber-pulse {
  0%, 100% { background: transparent; }
  15%, 60% { background: hsl(35 90% 50% / 0.15); box-shadow: inset 0 0 0 1px hsl(35 90% 50% / 0.3); }
}

/* --- Sidebar cards ----------------------------------------- */

.sidebar-card { background: var(--accent); border: 1px solid var(--border); border-radius: 6px; padding: 0.6rem 0.75rem; margin-bottom: var(--space-2); }
.sidebar-card-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-fg); margin-bottom: 0.35rem; }
.sidebar-invoice-card { border: 1px solid var(--border); border-radius: 5px; padding: 0.5rem 0.65rem; margin-bottom: 0.4rem; background: var(--card); }
.sidebar-invoice-card.overdue { border-color: var(--red); }

/* --- Timeline ---------------------------------------------- */

.tl-event { border-left: 3px solid var(--border); padding: 0.4rem 0 0.4rem 0.75rem; }
.tl-event:last-child { padding-bottom: 0; }
.tl-border-trade { border-left-color: var(--primary); }
.tl-border-payment { border-left-color: var(--green); }
.tl-border-adjustment { border-left-color: hsl(35 90% 50%); }
.tl-border-skip { border-left-color: var(--red); }
.tl-border-report { border-left-color: var(--muted-fg); }
.tl-border-credit_invoice { border-left-color: hsl(280 60% 55%); }
.tl-collapsed { cursor: pointer; display: flex; align-items: baseline; gap: 0.4rem; font-size: 0.8125rem; }
.tl-collapsed:hover { background: var(--accent); margin: -0.2rem -0.4rem; padding: 0.2rem 0.4rem; border-radius: 3px; }
.tl-icon { flex-shrink: 0; width: 14px; display: flex; align-items: center; }
.tl-date { font-size: 0.6875rem; color: var(--muted-fg); flex-shrink: 0; }
.tl-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-detail { padding: 0.4rem 0 0.2rem 1.6em; font-size: 0.8125rem; }
.tl-detail-grid { display: grid; grid-template-columns: 5.5rem 1fr; row-gap: 0.15rem; }

/* --- Picker modal ------------------------------------------ */

.picker-overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.35); }
.picker-modal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); width: 750px; max-width: 92vw; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }

/* --- Slide panel ------------------------------------------- */

.slide-panel {
  position: fixed; top: 0; right: 0; width: 560px; max-width: 100vw; height: 100vh;
  background: var(--card); border-left: 1px solid var(--border); z-index: 60;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15); overflow-y: auto; padding: var(--space-6);
}
.slide-backdrop { position: fixed; inset: 0; z-index: 50; }

/* --- Action bar / Filter bar ------------------------------- */

.action-bar { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); display: flex; align-items: center; gap: var(--space-4); }
.filter-bar { padding: var(--space-2) var(--space-5); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--space-2); }
.input-filter { padding: 0.25rem 0.5rem; font-size: var(--text-xs); border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: var(--card); color: var(--foreground); }

/* --- Icon button ------------------------------------------- */

.icon-btn { background: none; border: none; cursor: pointer; color: var(--muted-fg); padding: 0.2rem; line-height: 1; font-size: 1rem; border-radius: 3px; }
.icon-btn:hover { color: var(--foreground); background: var(--accent); }
.add-invoice-btn { color: var(--muted-fg); font-size: var(--text-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px dashed var(--border); }
.add-invoice-btn:hover { color: var(--primary); border-color: var(--primary); }
.add-more-btn { font-size: 0.6875rem; color: var(--muted-fg); cursor: pointer; opacity: 0.6; display: inline-flex; align-items: center; gap: 0.2rem; margin-top: 0.15rem; }
.add-more-btn:hover { opacity: 1; color: var(--primary); }

/* --- Interactive link -------------------------------------- */

.link-primary { cursor: pointer; color: var(--primary); text-decoration: none; }
.link-primary:hover { text-decoration: underline; }

/* --- Dropzone ---------------------------------------------- */

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1); padding: var(--space-4) var(--space-6); border: 2px dashed var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.dropzone > * { pointer-events: none; }
.dropzone > input { pointer-events: auto; }
.dropzone-active { border-color: var(--primary); background: hsl(210 100% 50% / 0.04); }
.dropzone-done { border-color: var(--color-status-success); background: hsl(140 50% 38% / 0.04); }

/* --- Currency tabs ----------------------------------------- */

.ccy-tab { all: unset; display: flex; align-items: center; gap: 0.4rem; padding: 0 var(--space-6); border-left: 1px solid var(--border); cursor: pointer; font-size: 0.8125rem; font-weight: 500; transition: background 0.15s; }
.ccy-tab:hover { background: var(--accent); }
.ccy-tab-active { background: var(--accent-active); }
.ccy-tab-active:hover { background: var(--accent-active); filter: brightness(0.97); }

/* --- Dots / indicators ------------------------------------- */

.dot-red, .dot-amber { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
.dot-red { background: var(--red); }
.dot-amber { background: hsl(35 90% 50%); }

/* --- Expand panel ------------------------------------------ */

.expand-panel { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); background: var(--bg); }
.chevron { width: 1rem; height: 1rem; transition: transform 0.15s; display: inline-block; color: var(--muted-fg); }
.chevron-cell { width: 1.5rem; padding-left: 0.75rem; }
tr.detail-row:hover > td, tr.detail-row:hover { background: transparent !important; }

/* --- Toast ------------------------------------------------- */

.toast-container { position: fixed; bottom: var(--space-4); right: var(--space-4); z-index: 100; display: flex; flex-direction: column-reverse; gap: var(--space-2); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: start; gap: var(--space-2);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  font-size: 0.8125rem; max-width: 360px; animation: toastIn 0.25s ease-out;
}
.toast-msg { flex: 1; }
.toast-close { background: none; border: none; color: var(--muted-fg); cursor: pointer; padding: 0; font-size: 1rem; line-height: 1; }
.toast-close:hover { color: var(--foreground); }
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast.removing { animation: toastOut 0.2s ease-in forwards; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* --- Transitions (Alpine.js) ------------------------------- */

.transition { transition-property: transform; }
.ease-out { transition-timing-function: ease-out; }
.ease-in { transition-timing-function: ease-in; }
.duration-200 { transition-duration: 200ms; }
.duration-150 { transition-duration: 150ms; }
.translate-x-full { transform: translateX(100%); }
.translate-x-0 { transform: translateX(0); }

/* --- Parties layout ---------------------------------------- */

.parties-layout { display: flex; height: calc(100vh - 5.5rem); margin: 0 calc(-1 * var(--space-5)) -3rem; }
.party-list-item { padding: var(--space-2) var(--space-5); cursor: pointer; border-bottom: 1px solid var(--border-subtle); }
.party-list-item:hover { background: var(--accent); }
.party-list-item-active { background: var(--accent); border-left: 3px solid var(--primary); padding-left: calc(var(--space-5) - 3px); }

/* --- Login page -------------------------------------------- */

.login-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 380px; text-align: center; }
.login-card h1 { font-size: var(--text-xl); font-weight: 600; margin-bottom: var(--space-1); }
.login-card p { color: var(--muted-fg); font-size: 0.8125rem; margin-bottom: var(--space-6); }
.btn-google { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.6rem var(--space-5); border-radius: calc(var(--radius) - 2px); border: 1px solid var(--border); background: var(--card); font-size: var(--text-sm); font-weight: 500; cursor: pointer; color: var(--foreground); text-decoration: none; }
.btn-google:hover { background: var(--accent); }
.btn-google svg { width: 1.125rem; height: 1.125rem; }
.error { margin-top: var(--space-4); padding: var(--space-2) var(--space-3); border-radius: calc(var(--radius) - 2px); background: hsl(0 62% 53% / 0.08); color: var(--red); font-size: 0.8125rem; }

/* --- Responsive -------------------------------------------- */

@media (max-width: 768px) {
  .container { padding: 0 var(--space-2) 3rem; }
  .navbar { flex-wrap: wrap; height: auto; padding: var(--space-2) var(--space-3); }
  nav { width: 100%; overflow-x: auto; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  th, td { padding: 0.4rem 0.5rem; }
}

/* Spinner */
.spinner { display: inline-block; width: 0.75rem; height: 0.75rem; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Segmented button group */
.btn-group { position: relative; display: inline-flex; }
.btn-group > .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group > .btn-split { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid var(--border); padding: 0.25rem 0.4rem; }
.btn-group > .btn-split:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-group .dropdown-item { cursor: pointer; }
.btn-group .dropdown-item:hover:not(.disabled) { background: var(--hover-bg, hsl(0 0% 95%)); }
.btn-group .dropdown-item.disabled { opacity: 0.5; cursor: not-allowed; }

/* Inline spinner */
.spinner-sm { display: inline-block; width: 0.75rem; height: 0.75rem; border: 2px solid var(--border); border-top-color: var(--primary, #333); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Reports table: striped test/voided rows */
.reports-table tr.report-test { background: repeating-linear-gradient(-45deg, transparent, transparent 4px, hsl(270 50% 60% / 0.07) 4px, hsl(270 50% 60% / 0.07) 8px); }
.reports-table tr.report-voided { opacity: 0.5; text-decoration: line-through; }

/* Delivery icons */
.delivery-icons { display: flex; gap: 0.25rem; align-items: center; }
.delivery-icon { display: inline-flex; align-items: center; text-decoration: none; border-radius: 3px; padding: 2px; transition: background 0.1s; }
.delivery-icon:hover { background: var(--hover-bg, hsl(0 0% 93%)); }
.delivery-icon.delivered { color: hsl(145 60% 40%); }
.delivery-icon.failed { color: hsl(15 80% 50%); }

/* --- Combobox (filterable dropdown) ------------------------ */
.combobox { position: relative; }
.combobox-input {
  width: 100%; padding: 0.4rem 0.6rem; border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px); background: var(--card);
  font-size: 0.8125rem; color: var(--foreground); line-height: 1.4;
}
.combobox-input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.combobox-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  margin-top: 2px; max-height: 12rem; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.combobox-option {
  padding: 0.35rem 0.6rem; font-size: 0.8125rem; cursor: pointer;
}
.combobox-option:hover, .combobox-option.active { background: var(--accent); }
.combobox-empty { padding: 0.5rem 0.6rem; font-size: 0.75rem; color: var(--muted-fg); }

/* --- Staging environment banner ---------------------------- */
.staging-banner {
  position: sticky; top: 0; z-index: 9999;
  width: 100%; padding: 4px 0; margin: 0;
  background: var(--color-status-warning, #f59e0b);
  color: #000; text-align: center;
  font-weight: 600; font-size: 0.75rem;
}
