/* --- PAYROLL TAX CALCULATOR — STYLESHEET --- */

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

:root {
  --brand:      #007AFF;
  --brand-dark: #0062CC;
  --blue:       #007AFF;
  --blue-dark:  #0062CC;
  --blue-light: #F0F5FF;
  --blue-bg:    #e8f4f8;
  --green:      #34C759;
  --green-dark: #28A745;
  --green-bg:   #F0FFF4;
  --red:        #FF3B30;
  --red-bg:     #FFF5F5;
  --orange:     #FF9500;
  --orange-bg:  #FFFBF0;
  --amber:      #ffc107;
  --amber-bg:   #fff3cd;
  --gray-50:    #FAFAFA;
  --gray-100:   #F5F5F7;
  --gray-200:   #E8E8ED;
  --gray-400:   #AEAEB2;
  --gray-600:   #86868B;
  --gray-800:   #1D1D1F;
  --xero-blue:  #13B5EA;
  /* MYOB brand tokens (Phase 68) — wordmark-derived primary, white on-primary, Identi-kit accent */
  --myob-brand-primary:    #6100A5; /* Extracted from official wordmark PNG (Phase 68 path-trace) */
  --myob-brand-on-primary: #FFFFFF; /* White text on MYOB brand background */
  --myob-brand-accent:     #FFDC4B; /* MYOB Identi-kit accent yellow */
  /* Employment Hero brand tokens (Phase 70) — Purple Heart primary, white on-primary, lightened accent */
  --eh-brand-primary:    #7622D7; /* Purple Heart — Employment Hero brand (path-traced fallback, 70-RESEARCH.md) */
  --eh-brand-on-primary: #FFFFFF; /* White text on EH purple — WCAG AAA 7.6:1 */
  --eh-brand-accent:     #8E44E8; /* Primary lightened ~10% for hover/focus */
  --shadow:     0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 2px 8px rgba(0,0,0,0.06);
  --radius:     12px;
  --radius-sm:  8px;
  --font:       -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  /* Spacing scale */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   32px;
  /* Type scale */
  --text-sm:      12px;
  --text-base:    14px;
  --text-heading: 17px;
  --text-display: 28px;
  /* Min interactive target */
  --min-target: 44px;
  /* Semantic surface tokens — used by dark mode overrides */
  --surface:           #ffffff;
  --surface-secondary: var(--gray-50);
  --surface-elevated:  #ffffff;
  --text-primary:      var(--gray-800);
  --text-secondary:    var(--gray-600);
  --text-muted:        var(--gray-400);
  --border-color:      var(--gray-200);
  /* Surface & common whites */
  --white:             #ffffff;
  --black:             #000000;
  /* Button hover variants */
  --secondary-hover:   #D8D8DC;
  --danger-hover:      #E0342B;
  --xero-hover:        #0f9dc9;
  /* State badge colors (Australian jurisdictions) */
  --state-vic:   #1B3A5C;
  --state-nt:    #C25700;
  --state-act:   #5A2D82;
  --state-nsw:   #0072CE;
  --state-qld:   #7B003C;
  --state-sa:    #8B5E3C;
  --state-wa:    #1B5E20;
  --state-tas:   #00695C;
  /* Status/badge semantic colors */
  --info-bg:     #E3F2FD;
  --info-text:   #1565C0;
  --source-xero-bg:    #E0F5FD;
  --source-xero-text:  #0B7EA3;
  --source-manual-text: #996300;
  /* OAuth provider colors */
  --oauth-facebook:  #1877f2;
  --oauth-google:    #4285f4;
  --oauth-microsoft: #2f2f2f;
  --oauth-apple:     #000000;
  /* Alert text */
  --alert-amber-text: #6b5900;
  --alert-brown-text: #78350f;
  /* Subtle backgrounds */
  --blue-subtle:  #EBF5FF;
  --amber-subtle: #fffbeb;
  --amber-border:  #f59e0b;
  --alert-brown-dark: #92400e;
  /* OAuth hover variants */
  --oauth-google-text:  #3c4043;
  --oauth-google-border: #dadce0;
  --oauth-google-hover: #f8f9fa;
  --oauth-hover-dark:   #1a1a1a;
  --oauth-facebook-hover: #166fe5;
  /* Diff highlight */
  --diff-changed-bg:  #FFF8E1;
  /* Sandbox dark accents */
  --sandbox-accent: #ffd866;
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accessible focus ring for keyboard navigation */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

:focus:not(:focus-visible) { outline: none; }

/* --- HEADER --- */
.header {
  background: rgba(255,255,255,0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner { max-width: 1200px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; justify-content: space-between; }

.header-right { display: flex; align-items: center; gap: 10px; }

.xero-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-base);
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--gray-100);
  transition: background 0.2s;
}

.xero-status.connected { background: var(--green-bg); color: var(--green-dark); }
.xero-status.disconnected { background: var(--gray-100); color: var(--gray-600); }

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray-400); }
.connected .status-dot { background: var(--green); }

/* --- CONTAINER --- */
.container { max-width: 1200px; margin: 0 auto; padding: 20px 24px; }

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  letter-spacing: -0.01em;
  min-height: 36px;
}

.btn:active { transform: scale(0.97); }

.btn-primary  { background: var(--brand); color: var(--white); }
.btn-primary:hover  { background: var(--brand-dark); }

.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-secondary:hover { background: var(--secondary-hover); }

.btn-danger   { background: var(--red); color: var(--white); }
.btn-danger:hover   { background: var(--danger-hover); }
.btn-danger[disabled], .btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* Phase 72 Wave 2 — small danger button used next to per-provider disconnect */
.btn-danger-sm {
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.btn-danger-sm:hover { background: var(--danger-hover); }

/* Phase 72 Wave 2 — Danger Zone card */
.danger-zone-card {
  border: 1px solid var(--red);
  background: var(--red-bg, #fdecea);
}
.danger-zone-card .retention-notice {
  font-size: 13px;
  color: var(--gray-800);
  background: var(--white);
  border-left: 3px solid var(--red);
  padding: 8px 12px;
  margin: 8px 0;
}

.btn-success  { background: var(--green); color: var(--white); }
.btn-success:hover  { background: var(--green-dark); }

.btn-ghost { background: transparent; color: var(--blue); border: 1px solid var(--gray-200); }
.btn-ghost:hover { background: var(--blue-light); border-color: var(--blue); }

.btn-xero     { background: var(--xero-blue); color: var(--white); display: inline-flex; align-items: center; gap: 6px; }
.btn-xero:hover     { background: var(--xero-hover); }
/* MYOB provider button (Phase 68) — matches .btn-xero dimensions, MYOB brand tokens */
.btn-myob     { background-color: var(--myob-brand-primary); color: var(--myob-brand-on-primary); border: 1px solid var(--myob-brand-primary); display: inline-flex; align-items: center; gap: 6px; }
.btn-myob:hover         { filter: brightness(0.92); }
.btn-myob:focus-visible { outline: 2px solid var(--myob-brand-accent); outline-offset: 2px; }
/* Employment Hero provider button (Phase 70) — matches .btn-myob dimensions, EH brand tokens */
.btn-eh     { background-color: var(--eh-brand-primary); color: var(--eh-brand-on-primary); border: 1px solid var(--eh-brand-primary); display: inline-flex; align-items: center; gap: 6px; }
.btn-eh:hover         { filter: brightness(0.92); }
.btn-eh:focus-visible { outline: 2px solid var(--eh-brand-accent); outline-offset: 2px; }

.btn-outline { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); color: var(--gray-800); border-color: var(--gray-400); }

.btn-lg  { padding: 10px 22px; font-size: var(--text-base); }
.btn-sm  { padding: 6px 12px; font-size: var(--text-sm); min-height: 32px; }

.btn-calculate { background: var(--brand); color: var(--white); font-size: var(--text-base); padding: 10px 24px; font-weight: 600; letter-spacing: -0.01em; }
.btn-calculate:hover { background: var(--brand-dark); }

/* --- CARDS --- */
.card { background: var(--surface); border-radius: var(--radius); border: 0.5px solid var(--border-color); margin-bottom: 16px; }

.card-header { padding: 18px 22px 0; }

.card-header h3 { font-size: var(--text-base); font-weight: 600; margin-bottom: 2px; letter-spacing: -0.01em; }

.card-sub { font-size: var(--text-base); color: var(--gray-600); margin-bottom: 14px; }

.card-footer { padding: 14px 22px; display: flex; justify-content: space-between; align-items: center; border-top: 0.5px solid var(--gray-200); margin-top: 14px; }

/* --- CONNECT PROMPT --- */
.connect-prompt { text-align: center; padding: 60px 40px; max-width: 560px; margin: 60px auto; }

.connect-icon { margin-bottom: 16px; line-height: 1; }

.connect-prompt h2 { font-size: var(--text-display); font-weight: 600; margin-bottom: 10px; letter-spacing: -0.02em; }

.connect-prompt p { color: var(--gray-600); margin-bottom: 20px; line-height: 1.6; font-size: var(--text-base); }

.feature-list { text-align: left; display: inline-block; margin-bottom: 24px; list-style: none; }

.feature-list li { padding: 3px 0; color: var(--gray-600); font-size: var(--text-base); }

/* --- TABS --- */
.tabs { display: flex; background: var(--gray-100); border-radius: var(--radius) var(--radius) 0 0; padding: 4px; gap: 2px; margin-bottom: 0; }

.tab {
  flex: 1;
  padding: 9px 8px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  letter-spacing: -0.01em;
}

.tab:hover { background: rgba(255,255,255,0.6); color: var(--gray-800); }

.tab.active { background: var(--white); color: var(--gray-800); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }

.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content > .card { border-radius: 0 0 var(--radius) var(--radius); padding: 18px 22px 0; }

/* --- TABLES --- */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }

.table th {
  background: var(--gray-50);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-600);
  border-bottom: 0.5px solid var(--gray-200);
}

.table td { padding: 8px 12px; border-bottom: 0.5px solid var(--gray-100); vertical-align: middle; }

.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

.table tfoot td { padding: 9px 12px; font-weight: 600; background: var(--gray-50); border-top: 0.5px solid var(--gray-200); }

.text-right { text-align: right; }
.total-row { font-weight: 600; }

/* --- FORMS --- */
.form-group { margin-bottom: var(--space-md); }
.form-group label { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary, var(--gray-600)); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,122,255,0.12); }

.section-label   { display: block; }

/* Per-state adjustment rows */
.state-adj-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr 1fr 1fr 30px;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  padding: 7px 8px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--gray-200);
}

.state-adj-row select,
.state-adj-row input { font-family: var(--font); font-size: var(--text-sm); padding: 5px 8px; }

.btn-remove { background: none; border: none; color: var(--red); cursor: pointer; font-size: var(--text-base); padding: 2px; }

/* --- RESULTS TAB --- */
.national-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 14px 22px 18px; }

.nat-item { background: var(--gray-50); border: 0.5px solid var(--gray-200); border-radius: var(--radius); padding: 14px 16px; }

.nat-item.highlight { background: var(--blue-light); border-color: rgba(0,122,255,0.15); }

.nat-label { font-size: var(--text-sm); font-weight: 600; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }

.nat-value { font-size: var(--text-heading); font-weight: 600; color: var(--gray-800); letter-spacing: -0.02em; }

.nat-value.deduction { color: var(--red); }
.nat-value.tax-amount { color: var(--blue); }

/* State result cards */
.state-result-card { border: 0.5px solid var(--gray-200); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }

.state-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--white);
  border-bottom: 0.5px solid var(--gray-200);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.state-result-header:hover { background: var(--gray-50); }

.state-name-badge { display: flex; align-items: center; gap: 10px; }

.state-code {
  background: var(--blue);
  color: var(--white);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.state-full-name { font-weight: 600; font-size: var(--text-base); letter-spacing: -0.01em; }

.state-monthly-tax { font-size: var(--text-heading); font-weight: 600; color: var(--blue); letter-spacing: -0.02em; }

.state-monthly-tax.zero { color: var(--gray-400); font-size: var(--text-base); }

.state-result-body { padding: 0 16px 4px; display: none; background: var(--gray-50); }

.state-result-body.open { display: block; }

.state-breakdown-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }

.breakdown-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 0.5px solid var(--gray-200); font-size: var(--text-base); }

.breakdown-row:last-child { border-bottom: none; }
.breakdown-row.total { font-weight: 600; background: var(--white); padding: 7px 8px; border-radius: 6px; margin-top: 4px; }
.breakdown-row.tax-row { font-weight: 600; color: var(--blue); }
.breakdown-label { color: var(--gray-600); }
.breakdown-value { font-weight: 600; text-align: right; }

.divider { width: 0.5px; background: var(--gray-200); margin: 0 16px; }

/* Expand toggle arrow */
.expand-arrow { font-size: var(--text-sm); color: var(--gray-400); margin-left: 8px; }

/* --- CONTRACTORS --- */
.contractors-row td input,
.contractors-row td select { width: 100%; padding: 5px 8px; border: 1px solid var(--gray-200); border-radius: 6px; font-family: var(--font); font-size: var(--text-base); }

/* --- EXPORT TAB --- */
.export-preview { background: var(--gray-50); border: 0.5px solid var(--gray-200); border-radius: var(--radius); padding: 18px 22px; }

.export-preview h4 { margin-bottom: 10px; font-size: var(--text-base); font-weight: 600; }

.sheet-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.sheet-list li {
  font-size: var(--text-base);
  color: var(--gray-600);
  padding: 8px 12px;
  background: var(--white);
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
}

.export-actions { display: flex; gap: 10px; }

/* --- UTILITIES --- */
.hidden { display: none !important; }

/* Phase 68 (D-05/D-06/D-08): "Powered by MYOB" attribution */
.provider-attribution {
  font-size: 0.85em;
  color: var(--text-muted, #666);
}
.provider-attribution[data-provider="myob"] a {
  color: var(--myob-brand-primary);
  text-decoration: none;
}
.provider-attribution[data-provider="myob"] a:hover {
  text-decoration: underline;
}
.provider-attribution[data-provider="eh"] a {
  color: var(--eh-brand-primary);
  text-decoration: none;
}
.provider-attribution[data-provider="eh"] a:hover {
  text-decoration: underline;
}
.app-footer-attribution {
  text-align: center;
  padding: 12px 0;
  margin-top: 24px;
}
.mb-16  { margin-bottom: 16px; }
.mt-16  { margin-top: 16px; }

/* Layout utilities — replace inline styles */
.pad-card          { padding: 0 var(--space-lg) var(--space-md); }
.pad-card-sm       { padding: var(--space-sm) var(--space-lg) var(--space-md); }
.flex-row          { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
.flex-row-between  { display: flex; justify-content: space-between; align-items: center; }
.flex-center       { display: flex; align-items: center; }
.grid-2col         { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-xl); }
.text-muted        { color: var(--gray-600); }
.font-sm           { font-size: var(--text-base); }
.no-display        { display: none; }

/* ── Utility classes — extracted from inline style patterns ── */
.text-meta     { font-size: 12px; color: var(--gray-600); }
.text-meta-sm  { font-size: 12px; color: var(--gray-600); }
.text-meta-md  { font-size: 14px; color: var(--gray-600); }
.section-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.label-bold    { font-weight: 600; color: var(--text-secondary); }
.inline-input  { border: 1px solid var(--border-color); border-radius: 4px; padding: 4px 8px; font-size: 14px; }
.empty-cell    { text-align: center; color: var(--text-muted); padding: var(--space-md); }
.cell-pad      { padding: 8px 12px; }
.success-box   { background: var(--green-bg); border: 1px solid var(--green); border-radius: var(--radius-sm); padding: var(--space-md); text-align: center; }
.code-display  { background: var(--gray-100); padding: 12px; border-radius: 8px; font-family: monospace; font-size: 17px; text-align: center; user-select: all; }
.recovery-code { display: inline-block; padding: 4px 8px; margin: 4px; background: var(--gray-100); border-radius: 4px; font-size: 14px; user-select: all; }
.warning-box   { background: var(--orange-bg); border: 1px solid var(--orange); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 14px; }
.director-badge { font-size: 12px; background: var(--brand); color: var(--white); border-radius: 4px; padding: 2px 4px; }
.director-row  { background: var(--blue-light); }
.btn-row       { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.cell-pad-sm   { padding: 4px 8px; }
.text-muted    { color: var(--text-muted); }
.text-secondary { color: var(--gray-600); }
.text-red      { color: var(--red); }
.text-brand    { color: var(--brand); }

/* ── Spacing utilities ── */
.mb-sm         { margin-bottom: 8px; }
.mb-md         { margin-bottom: 12px; }
.mt-sm         { margin-top: 8px; }
.mt-md         { margin-top: 12px; }

/* ── Text utilities ── */
.fw-semibold   { font-weight: 600; }
.text-xs       { font-size: 10px; }
.text-sm-13    { font-size: 13px; }

/* ── Flex utilities ── */
.flex-center-gap   { display: flex; align-items: center; gap: 8px; }
.flex-wrap-gap     { display: flex; flex-wrap: wrap; gap: 8px; }
.flex-wrap-gap-lg  { display: flex; flex-wrap: wrap; gap: 16px; }

/* ── Component: code/pre blocks in help tab ── */
.code-block    { font-size: 11px; line-height: 1.4; background: var(--gray-50); padding: 12px; border-radius: 8px; overflow-x: auto; }
.code-block-sm { font-size: 12px; line-height: 1.4; background: var(--gray-50); padding: 12px; border-radius: 8px; }

/* ── Component: info and warning banners ── */
.info-banner   { background: var(--blue-bg); border: 1px solid var(--blue); border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; font-size: 0.9em; }
.warning-banner { background: var(--amber-bg); border: 1px solid var(--amber); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; font-size: 0.9em; }
.error-banner   { background: var(--red-bg); border: 1px solid var(--red); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; font-size: 0.9em; color: var(--red); }
.provider-error-banner[hidden] { display: none !important; }
.provider-error-banner .pb-body { flex: 1; }
.provider-error-banner .pb-title { font-weight: 600; margin-bottom: 2px; }
.provider-error-banner .pb-actions { display: inline-flex; gap: 8px; }
.api-health-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.api-health-pill.closed    { background: #e6f6ea; color: #137333; }
.api-health-pill.half-open { background: var(--amber-bg); color: #7a5200; }
.api-health-pill.open      { background: var(--red-bg); color: var(--red); }

/* ── Component: glossary table ── */
.glossary-table    { width: 100%; font-size: 12px; border-collapse: collapse; }
.glossary-table tr { border-bottom: 1px solid var(--gray-100); }
.glossary-table td { padding: 5px 0; }
.glossary-table tr:last-child { border-bottom: none; }
.glossary-label    { padding: 5px 8px 5px 0; font-weight: 600; white-space: nowrap; vertical-align: top; }

/* ── Component: help list indent ── */
.help-list     { margin: 4px 0 0 16px; }

/* ── Component: form layout helpers ── */
.form-flex-2   { flex: 2; }
.form-flex-1   { flex: 1; }

/* ── Component: section padding ── */
.section-border-top { padding: 16px; border-top: 1px solid var(--gray-100); }

/* ── Component: chat close button ── */
.chat-close-btn { color: var(--white); background: none; border: none; font-size: 18px; cursor: pointer; }

/* Org switcher */
.org-switcher { display: none; align-items: center; gap: 6px; }
.org-switcher.visible { display: flex; }
.org-switcher label { font-size: var(--text-sm); color: var(--gray-600); white-space: nowrap; margin-bottom: 0; }
.org-switcher select { height: 36px; font-size: var(--text-base); padding: 0 var(--space-sm); min-width: 180px; }

/* Detect banner */
.detect-banner {
  background: var(--orange-bg);
  border: 0.5px solid rgba(255,149,0,0.3);
  border-radius: var(--radius);
  padding: 10px var(--space-md);
  margin-bottom: 12px;
  font-size: var(--text-base);
  color: var(--alert-brown-text);
}

/* Directors modal layout */
.directors-modal-inner { max-width: 560px; max-height: 80vh; display: flex; flex-direction: column; }
.directors-modal-desc { padding: 12px var(--space-lg) var(--space-xs); font-size: var(--text-base); color: var(--gray-600); border-bottom: 0.5px solid var(--gray-200); }
.directors-modal-body { overflow-y: auto; flex: 1; padding: var(--space-md) var(--space-lg); }
.directors-modal-footer { padding: 12px var(--space-lg); border-top: 0.5px solid var(--gray-200); display: flex; justify-content: flex-end; }

/* Table checkboxes — meet min target size */
.table input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

/* Responsive table wrapper */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Month pill wrapper */
.month-pill-wrap { margin: 0 var(--space-lg) var(--space-md); }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

.row-inline { display: flex; gap: 14px; flex-wrap: wrap; }
.row-inline .form-group { flex: 1; min-width: 180px; }

.loading-msg, .empty-msg { text-align: center; padding: 32px; color: var(--gray-400); font-size: var(--text-base); }

.selection-count { font-size: var(--text-base); color: var(--gray-600); }

.hint { font-size: var(--text-sm); color: var(--gray-400); line-height: 1.6; }

.contractor-warning {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--orange-bg);
  border-left: 3px solid var(--orange);
  border-radius: 4px;
  font-size: var(--text-sm);
  color: var(--alert-amber-text);
  line-height: 1.6;
}

/* --- LOADING OVERLAY --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.loading-spinner { background: var(--white); border-radius: 16px; padding: 28px 44px; text-align: center; box-shadow: var(--shadow-md); }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loadingMsg { font-size: var(--text-base); color: var(--gray-600); font-weight: 600; }

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  background: var(--gray-800);
  color: var(--white);
  padding: 11px 18px;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.25s ease;
}

.toast.success { background: var(--green-dark); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--orange); }

@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; gap: 10px; }
  .national-grid { grid-template-columns: 1fr 1fr; }
  .state-breakdown-grid { grid-template-columns: 1fr; }
  .divider { display: none; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tab { flex: 0 0 auto; min-width: 100px; white-space: nowrap; }
}

/* --- BRAND — dynamic colour applied via JS --- */
.state-code              { background: var(--brand); }
.nat-item.highlight      { background: var(--blue-light); border-color: rgba(0,122,255,0.15); }
.nat-value.tax-amount, .state-monthly-tax, .breakdown-row.tax-row { color: var(--brand); }

.jurisdiction-notes {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--orange-bg);
  border-left: 3px solid var(--orange);
  border-radius: 4px;
  font-size: var(--text-sm);
  color: var(--alert-amber-text);
  line-height: 1.5;
}

/* Confidence badges */
.confidence-badge {
  display: inline-block;
  width: 14px;
  height: 14px;
  text-align: center;
  line-height: 14px;
  font-size: var(--text-sm);
  border-radius: 50%;
  cursor: help;
}
.confidence-green { color: var(--green); }
.confidence-amber { color: var(--orange); }
.confidence-red   { color: var(--red); }

/* State exemptions section */
.exemptions-grid { display: grid; gap: 20px; }
.exemption-item { padding: 16px; background: var(--gray-50); border-radius: 8px; border: 1px solid var(--gray-200); }
.exemption-label { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: var(--text-base); margin-bottom: 4px; }
.exemption-desc { font-size: var(--text-sm); color: var(--gray-600); margin-bottom: 10px; line-height: 1.5; }
.state-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.state-badge.vic { background: var(--state-vic); }
.state-badge.nt  { background: var(--state-nt); }
.state-badge.act { background: var(--state-act); }
.state-badge.nsw { background: var(--state-nsw); }
.state-badge.qld { background: var(--state-qld); }
.state-badge.sa  { background: var(--state-sa); }
.state-badge.wa  { background: var(--state-wa); }
.state-badge.tas { background: var(--state-tas); }
.toggle-label { display: flex; align-items: center; gap: 8px; font-size: var(--text-base); cursor: pointer; }
.toggle-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); }

/* --- LOGIN / SETUP AUTH OVERLAY --- */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.auth-overlay.hidden { display: none !important; }

.auth-box {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  padding: 36px 44px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.auth-logo { margin-bottom: 8px; }
.auth-logo img { max-height: 48px; max-width: 180px; object-fit: contain; }
.auth-logo-text { font-size: var(--text-heading); font-weight: 600; color: var(--brand); display: inline-block; letter-spacing: -0.02em; }

.auth-box h2 { font-size: var(--text-heading); font-weight: 600; margin: 10px 0 5px; color: var(--gray-800); letter-spacing: -0.01em; }

.auth-box p.auth-sub { font-size: var(--text-base); color: var(--gray-600); margin-bottom: 22px; }

.auth-box .form-group { text-align: left; }

.auth-box .btn-full { width: 100%; justify-content: center; padding: 10px; font-size: var(--text-base); margin-top: 4px; }

.auth-error {
  background: var(--red-bg);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: var(--text-base);
  margin-bottom: 12px;
  display: none;
}
.auth-error.visible { display: block; }

/* --- HEADER — brand logo + user pill --- */
.header-logo { display: flex; align-items: center; gap: 10px; }

.header-logo img { max-height: 32px; max-width: 110px; object-fit: contain; }

.header-logo-text { font-size: var(--text-heading); font-weight: 600; color: var(--gray-800); letter-spacing: -0.02em; }

.user-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 4px;
  border-radius: 20px;
  background: var(--gray-100);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-800);
  border: 0.5px solid var(--gray-200);
  transition: background 0.15s;
}

.user-pill:hover { background: var(--gray-200); }
.user-pill:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--white);
  font-size: var(--text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 0.5px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  min-width: 200px;
  z-index: 300;
  display: none;
  overflow: hidden;
}

.user-dropdown.open { display: block; }

.dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 16px;
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--gray-800);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  border-bottom: 0.5px solid var(--gray-100);
  transition: background 0.1s;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--gray-50); }
.dropdown-item.danger { color: var(--red); }

.btn-help {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gray-100);
  border: 0.5px solid var(--gray-200);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.btn-help:hover { background: var(--gray-200); }

/* FY Alert Banner */
.fy-alert {
  background: var(--orange-bg);
  border-bottom: 1px solid rgba(255,149,0,0.2);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-base);
  color: var(--source-manual-text);
  gap: 12px;
}
.fy-alert strong { font-weight: 600; }
.fy-alert .btn-sm { background: var(--orange); color: var(--white); }

/* --- MONTH SELECTOR --- */
.month-selector-pill {
  background: var(--blue-light);
  border: 0.5px solid rgba(0,122,255,0.12);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.month-selector-pill .form-group { margin-bottom: 0; flex: 0 0 auto; min-width: 130px; }

.month-selector-pill .period-label-display { font-size: var(--text-base); font-weight: 600; color: var(--brand); margin-left: auto; letter-spacing: -0.01em; }

/* --- HISTORY TAB --- */
.history-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 22px; border-bottom: 0.5px solid var(--gray-200); }

.history-toolbar .form-group { margin-bottom: 0; min-width: 110px; flex: 0 0 auto; }

.history-toolbar .spacer { flex: 1; }

.badge-source {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-source.xero  { background: var(--source-xero-bg); color: var(--source-xero-text); }
.badge-source.manual { background: var(--orange-bg); color: var(--source-manual-text); }

.history-actions { display: flex; gap: 4px; }
.history-actions .btn-sm { padding: 4px 10px; font-size: var(--text-sm); }

/* Reconciliation grid */
.recon-grid { overflow-x: auto; }
.recon-table { min-width: 900px; }
.recon-table th { font-size: var(--text-sm); white-space: nowrap; }
.recon-table .missing { color: var(--gray-400); font-style: italic; }
.recon-table .has-data { color: var(--green-dark); font-weight: 600; }

/* --- MODAL OVERLAY (shared) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
}
.modal-overlay.hidden { display: none !important; }

.modal-box {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  width: 90%;
  max-width: 720px;
  max-height: 86vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
}

.modal-box.modal-wide { max-width: 960px; }
.modal-box.modal-narrow { max-width: 440px; }

/* ── Confirm modal ── */
.confirm-message { margin-bottom: var(--space-md); line-height: 1.5; }
.confirm-actions { display: flex; gap: var(--space-sm); justify-content: flex-end; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }

.modal-header h3 { font-size: var(--text-heading); font-weight: 600; letter-spacing: -0.02em; }

.btn-modal-close {
  background: none;
  border: none;
  font-size: var(--text-heading);
  cursor: pointer;
  color: var(--gray-400);
  line-height: 1;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.btn-modal-close:hover { color: var(--gray-800); }

/* --- SETTINGS TAB --- */
.settings-section { border: 0.5px solid var(--gray-200); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }

.settings-section-header {
  background: var(--gray-50);
  padding: 12px 18px;
  font-size: var(--text-base);
  font-weight: 600;
  border-bottom: 0.5px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-section-body { padding: 18px; }

.rates-table { font-size: var(--text-base); }
.rates-table td input.form-control { padding: 5px 8px; font-size: var(--text-base); }
.rates-table .fy-col { font-weight: 600; color: var(--brand); }

.ai-research-panel { border: 0.5px solid rgba(0,122,255,0.15); background: var(--blue-light); border-radius: var(--radius); padding: 14px 18px; margin-top: 14px; }

.ai-research-panel h4 { font-size: var(--text-base); font-weight: 600; margin-bottom: 6px; }
.ai-research-panel p { font-size: var(--text-base); color: var(--gray-600); margin-bottom: 10px; }

.comparison-table th { font-size: var(--text-sm); }
.comparison-table td input { width: 110px; padding: 4px 8px; font-size: var(--text-base); }
.comparison-table .changed { background: var(--orange-bg); }

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--green-bg);
  color: var(--green-dark);
}

.audit-entry { display: flex; gap: 12px; padding: 7px 0; border-bottom: 0.5px solid var(--gray-100); font-size: var(--text-base); }
.audit-time { color: var(--gray-400); white-space: nowrap; font-size: var(--text-sm); min-width: 130px; }
.audit-action { font-weight: 600; }
.audit-detail { color: var(--gray-600); font-size: var(--text-sm); }

/* --- DASHBOARD --- */
.dashboard-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi-card {
  background: var(--surface, #fff);
  border: 0.5px solid var(--border-color, var(--gray-200));
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.10); transform: translateY(-1px); }
/* Brand accent top bar */
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--brand); border-radius: var(--radius) var(--radius) 0 0; }
/* KPI card color variants */
.kpi-card.kpi-danger::before  { background: var(--red); }
.kpi-card.kpi-warning::before { background: var(--orange); }
.kpi-card.kpi-success::before { background: var(--green); }
.kpi-label { font-size: var(--text-sm); color: var(--gray-600); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.kpi-value { font-size: var(--text-display); font-weight: 600; color: var(--gray-800); }
.kpi-sub { font-size: var(--text-sm); color: var(--gray-400); margin-top: 2px; }

/* Sparkline */
.kpi-sparkline { margin-top: 8px; display: flex; justify-content: center; opacity: 0.65; }
.kpi-sparkline svg polyline { stroke: var(--brand); }

/* Trend indicator */
.kpi-trend {
  font-size: var(--text-sm);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  justify-content: center;
  font-weight: 600;
}
.kpi-trend.up   { color: var(--green-dark); }
.kpi-trend.down { color: var(--red); }
.kpi-trend.flat { color: var(--gray-400); }

.dashboard-row { display: flex; gap: 12px; margin-bottom: 16px; }
.dashboard-row > .card { flex: 1; }

/* CSS-only bar chart */
.bar-chart-bar { background: var(--brand); border-radius: 3px 3px 0 0; min-width: 16px; flex: 1; position: relative; transition: height 0.3s ease; }
.bar-chart-bar:hover { opacity: 0.8; }
.bar-chart-bar .bar-label { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: var(--text-sm); color: var(--gray-400); white-space: nowrap; }
.bar-chart-bar .bar-value { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: var(--text-sm); color: var(--gray-600); white-space: nowrap; }
.bar-chart-bar.empty { background: var(--gray-100); }

/* Status badges */
.badge-status { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: var(--text-sm); font-weight: 600; }
.badge-status.draft { background: var(--gray-100); color: var(--gray-600); }
.badge-status.locked { background: var(--orange-bg); color: var(--orange); }
.badge-status.approved { background: var(--green-bg); color: var(--green-dark); }

/* Lodgement status */
.badge-lodgement { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: var(--text-sm); font-weight: 600; }
.badge-lodgement.pending { background: var(--gray-100); color: var(--gray-600); }
.badge-lodgement.overdue { background: var(--red-bg); color: var(--red); }
.badge-lodgement.lodged { background: var(--info-bg); color: var(--info-text); }
.badge-lodgement.paid { background: var(--green-bg); color: var(--green-dark); }

/* Dashboard alert */
.dashboard-alert { background: var(--orange-bg); border: 1px solid var(--orange); border-radius: var(--radius); padding: 12px 16px; font-size: var(--text-base); }
.dashboard-alert.error { background: var(--red-bg); border-color: var(--red); }

@media (max-width: 768px) {
  .dashboard-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-row { flex-direction: column; }
}

/* --- DIFF HIGHLIGHTS (Ruleset Candidate Comparison) --- */
.diff-changed { background: var(--diff-changed-bg); }
.diff-added   { background: var(--green-bg); color: var(--green-dark); }
.diff-removed { background: var(--red-bg); color: var(--red); text-decoration: line-through; }
.badge        { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: var(--text-sm); font-weight: 600; background: var(--gray-100); }
.badge-warn   { background: var(--orange-bg); color: var(--orange); }

/* --- RATE MANAGEMENT — Candidate Card (D-02) --- */

.candidate-card {
  background: var(--surface, #fff);
  border: 0.5px solid var(--border-color, var(--gray-200));
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.candidate-card-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid var(--border-color, var(--gray-200));
  background: var(--surface-secondary, var(--gray-50));
}

.candidate-card-header h4 { margin: 0; font-size: var(--text-base); font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary, var(--gray-800)); }

.candidate-card-header .candidate-meta { font-size: var(--text-sm); color: var(--text-secondary, var(--gray-600)); margin-top: 2px; }

.candidate-card-body { padding: 0; }

.candidate-card-footer {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 0.5px solid var(--border-color, var(--gray-200));
  background: var(--surface-secondary, var(--gray-50));
}

.candidate-actions { display: flex; gap: 8px; }

.candidate-hint { font-size: var(--text-sm); color: var(--text-secondary, var(--gray-600)); padding: 8px 16px; font-style: italic; }

/* Drift warning banner */
.drift-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 16px;
  background: var(--orange-bg, #FFFBF0);
  border-bottom: 0.5px solid rgba(255,149,0,0.25);
  font-size: var(--text-base);
  color: var(--text-primary, var(--gray-800));
}
.drift-warning strong { color: var(--orange); }

/* Approval notes input inside candidate card */
.candidate-notes-row { padding: 8px 16px 12px; border-top: 0.5px solid var(--border-color, var(--gray-200)); }
.candidate-notes-row label { font-size: var(--text-sm); color: var(--text-secondary, var(--gray-600)); display: block; margin-bottom: 4px; }

/* Dark mode tint for diff rows */
[data-theme="dark"] .diff-changed { background: rgba(255,204,0,0.12); color: inherit; }
[data-theme="dark"] .diff-added   { background: rgba(52,199,89,0.12); color: var(--green); }
[data-theme="dark"] .diff-removed { background: rgba(255,59,48,0.12); color: var(--red); }

/* --- HELP DRAWER (right-side slide-in) --- */
.help-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 95vw;
  height: 100%;
  background: var(--surface);
  border-left: 0.5px solid var(--border-color);
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
  z-index: 1400;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.help-drawer.open { transform: translateX(0); }

.help-drawer-header {
  padding: 14px 18px;
  border-bottom: 0.5px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--gray-50);
}

.help-drawer-header h3 { font-size: var(--text-base); font-weight: 600; }

.help-drawer-search { padding: 10px 18px; border-bottom: 0.5px solid var(--gray-200); }

.help-drawer-body { flex: 1; overflow-y: auto; padding: 0 18px 20px; }

.help-section { border-bottom: 0.5px solid var(--gray-100); padding: 2px 0; }

.help-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.help-section-title:hover { color: var(--brand); }
.help-section-arrow { font-size: var(--text-sm); color: var(--gray-400); }

.help-section-body { display: none; font-size: var(--text-base); line-height: 1.7; color: var(--gray-600); padding-bottom: 10px; }

.help-section-body.open { display: block; }

.help-section-body h5 { font-size: var(--text-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-800); margin: 12px 0 5px; }

.help-section-body ol,
.help-section-body ul { padding-left: 18px; margin-bottom: 8px; }

.help-section-body li { margin-bottom: 3px; }

.help-section-body code { background: var(--gray-100); padding: 1px 5px; border-radius: 4px; font-size: var(--text-sm); font-family: 'SF Mono', ui-monospace, monospace; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.2); z-index: 1300; }

/* Help drawer: flow diagram */
.help-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 8px 0; }
.help-flow-step {
  background: var(--brand-bg, #eef2ff);
  color: var(--brand, #4f46e5);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}
.help-flow-arrow { color: var(--gray-300); font-size: var(--text-base); }

/* Help drawer: tip callout */
.help-tip {
  background: var(--amber-subtle);
  border-left: 3px solid var(--amber-border);
  padding: 7px 10px;
  margin: 8px 0;
  border-radius: 0 6px 6px 0;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--alert-brown-dark);
}

/* Help drawer: example block */
.help-example {
  background: var(--gray-50);
  border: 0.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: var(--text-sm);
  line-height: 1.6;
}
.help-example-label { font-size: var(--text-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-400); margin-bottom: 3px; }

/* --- SAVE CALCULATION BUTTON (Results tab) --- */
.save-calc-row {
  padding: 10px 22px;
  background: var(--green-bg);
  border: 0.5px solid rgba(52,199,89,0.2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.save-calc-row p { font-size: var(--text-base); color: var(--green-dark); font-weight: 600; margin: 0; }

/* --- COMPLIANCE WARNINGS CARD (Results tab) --- */
.compliance-warnings-card { background: var(--white); border: 0.5px solid var(--gray-200); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }

.compliance-warnings-card.collapsed .compliance-body { display: none; }

.compliance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--orange-bg);
  border-bottom: 0.5px solid rgba(255,149,0,0.15);
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--orange);
  user-select: none;
}

.compliance-body { padding: 12px 18px; }

.compliance-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: var(--text-base);
  line-height: 1.5;
}

.compliance-item:last-child { margin-bottom: 0; }

.compliance-icon { flex-shrink: 0; font-size: var(--text-base); margin-top: 1px; }

.compliance-warning { background: var(--orange-bg); border: 0.5px solid rgba(255,149,0,0.12); color: var(--gray-800); }

.compliance-info { background: var(--blue-light); border: 0.5px solid rgba(0,122,255,0.1); color: var(--gray-800); }

.compliance-error { background: var(--red-bg); border: 0.5px solid rgba(255,59,48,0.15); color: var(--gray-800); font-weight: 600; }

/* --- RESPONSIVE ADDITIONS --- */
.kpi-clickable { cursor: pointer; transition: box-shadow 0.15s; }
.kpi-clickable:hover { box-shadow: 0 0 0 2px var(--brand); }

/* --- LEGISLATION BAR --- */
.legislation-bar {
  padding: 8px 16px;
  background: var(--blue-light, #EBF5FF);
  border-radius: var(--radius-sm, 6px);
  font-size: var(--text-sm);
  margin-bottom: 12px;
  line-height: 1.8;
}
.legislation-bar-title { font-weight: 600; margin-right: 4px; }
.legislation-bar a { color: var(--brand); text-decoration: none; }
.legislation-bar a:hover { text-decoration: underline; }

/* --- HELP SECTION CALLOUTS --- */
.help-legislation { margin-top: 8px; padding: 8px 12px; background: var(--blue-light, #EBF5FF); border-radius: var(--radius-sm, 6px); font-size: var(--text-sm); }
.help-legislation a { color: var(--brand); text-decoration: none; display: block; padding: 2px 0; }
.help-legislation a:hover { text-decoration: underline; }
.help-mistakes { margin-top: 8px; padding: 8px 12px; background: var(--red-bg, #FFF0F0); border-radius: var(--radius-sm, 6px); font-size: var(--text-sm); }

/* --- AI CHAT BUBBLE & PANEL --- */
.chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 80px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md, 0 2px 8px rgba(0,0,0,0.12));
  z-index: 1100;
  transition: transform 0.15s;
}
.chat-bubble:hover { transform: scale(1.08); }
.chat-bubble-icon { font-size: var(--text-heading); }

.chat-panel {
  position: fixed;
  bottom: 80px;
  right: 24px;
  width: 360px;
  max-width: 90vw;
  max-height: 480px;
  background: var(--white);
  border-radius: var(--radius, 8px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel.hidden { display: none; }
.chat-panel-header {
  padding: 12px 16px;
  background: var(--brand);
  color: var(--white);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: var(--text-base);
}
.chat-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
}
.chat-msg { padding: 8px 12px; border-radius: var(--radius-sm, 6px); font-size: var(--text-base); line-height: 1.4; max-width: 85%; }
.chat-msg.user { background: var(--blue-light, #EBF5FF); align-self: flex-end; }
.chat-msg.assistant { background: var(--gray-100, #f5f5f7); align-self: flex-start; }
.chat-panel-input { padding: 10px 12px; border-top: 0.5px solid var(--gray-200, #e5e5e7); display: flex; gap: 8px; }
.chat-panel-input .form-control { flex: 1; }

/* --- RESPONSIVE ADDITIONS --- */
@media (max-width: 600px) {
  .auth-box { padding: 24px 18px; }
  .help-drawer { width: 100vw; }
  .month-selector-pill { flex-direction: column; align-items: flex-start; }
  .history-toolbar { flex-direction: column; align-items: flex-start; }
  .chat-panel { width: 100vw; right: 0; bottom: 0; max-height: 60vh; border-radius: var(--radius) var(--radius) 0 0; }
  .chat-bubble { right: 16px; bottom: 16px; }
}

/* 768px tablet additions */
@media (max-width: 768px) {
  .settings-section-header { flex-wrap: wrap; gap: 8px; }
}

/* --- 375PX BREAKPOINT — Small mobile (iPhone SE width) --- */
@media (max-width: 480px) {
  /* Tab bar — tighter sizing per D-02 */
  .tab { font-size: var(--text-sm); padding: 8px 8px; min-width: 76px; }

  /* Form input rows — stack vertically */
  .row-inline { flex-direction: column; }
  .row-inline .form-group { min-width: unset; width: 100%; }

  /* Release fixed-width inline style overrides on specific inputs */
  #selYear,
  #histFilterYear { width: 100% !important; }
  #nexusOverrideEmpId,
  #nexusOverrideEmpName,
  #nexusOverrideReason,
  #nexusOverrideState { width: 100% !important; }

  /* Settings section header — allow wrap for long titles with buttons */
  .settings-section-header { flex-wrap: wrap; gap: 8px; }

  /* Dashboard KPI — 1 column at 375px (2-col at 768px) */
  .dashboard-kpi-grid { grid-template-columns: 1fr; }

  /* National summary — 1 column at 375px (2-col at 768px) */
  .national-grid { grid-template-columns: 1fr; }

  /* Card padding reduction */
  .pad-card { padding-left: var(--space-sm); padding-right: var(--space-sm); }
  .card-header { padding-left: var(--space-md); padding-right: var(--space-md); }
  .settings-section-body { padding: 12px; }

  /* Modal inner padding */
  .modal-box { padding: 16px 12px; }

  /* History tab header — stack title and action buttons */
  #tab-history .card-header.flex-row-between { flex-direction: column; align-items: flex-start; gap: 8px; }
  #tab-history .card-header .flex-row { flex-wrap: wrap; }

  /* Adjustments — state-adj-row: reduce 6-col to 4-col with 2-row layout */
  .state-adj-row { grid-template-columns: 80px 1fr 1fr 30px; grid-template-rows: auto auto; }

  /* Header — stack and wrap for narrow viewport */
  .header-inner { flex-direction: column; gap: 8px; padding: 8px 12px; }
  .header-right { flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
  .header-right select { max-width: 120px; font-size: var(--text-sm); }
  .xero-status { font-size: var(--text-sm); max-width: 100px; overflow: hidden; text-overflow: ellipsis; }

  /* Dashboard row — stack trend chart and quick actions */
  .dashboard-row { flex-direction: column; }
}

/* --- CONSISTENCY PASS — Apple iCloud/Keynote aesthetic (D-03) --- */

/* Consistent card header weight */
.card-header h3,
.card-header h4 { font-size: var(--text-base); font-weight: 600; letter-spacing: -0.02em; margin: 0; }

/* Section spacing inside cards */
.section-title {
  font-size: var(--text-base);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary, var(--gray-600));
  margin-bottom: var(--space-sm);
}

.table td { padding: 10px 12px; }

/* Minimum touch target on interactive elements */
.btn, input[type="text"], input[type="password"],
input[type="email"], input[type="number"],
select, textarea { min-height: var(--min-target, 44px); }

/* Exception for compact-sized buttons in tables */
.btn.btn-sm { min-height: 32px; }

/* Badge refinement — consistent padding and weight */
.badge-status, .badge-lodgement, .badge-source { font-size: var(--text-sm); font-weight: 600; padding: 3px 10px; border-radius: 6px; letter-spacing: 0.01em; }

/* Tab navigation active state — stronger visual cue */
.tab-btn.active { font-weight: 600; }

/* Reduce orphaned whitespace in empty-state messages */
.empty-state, [class$="-empty"] { padding: var(--space-xl) var(--space-lg); text-align: center; color: var(--text-muted, var(--gray-400)); font-size: var(--text-base); }

/* --- ORG PICKER (Phase 27 — multi-tenant) --- */
.org-picker-heading { font-size: var(--text-heading); font-weight: 600; line-height: 1.2; color: var(--text-primary); margin: 0 0 var(--space-xs) 0; }
.org-picker-subheading { font-size: var(--text-base); color: var(--text-secondary); margin: 0 0 var(--space-lg) 0; }
.org-picker-list { display: flex; flex-direction: column; gap: var(--space-sm); margin-bottom: var(--space-lg); max-height: 320px; overflow-y: auto; }
.org-picker-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border: 0.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  background: var(--surface);
  transition: background 0.15s, border-color 0.15s;
}
.org-picker-card:hover { background: var(--gray-100); }
.org-picker-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.org-picker-card.selected { border: 2px solid var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.org-picker-empty,
.org-picker-error { text-align: center; padding: var(--space-xl) var(--space-md); color: var(--text-secondary); }

/* --- TENANT SWITCHER (Phase 27 — header org dropdown) --- */
.tenant-switcher { position: relative; display: flex; align-items: center; margin: 0 var(--space-md); }
.tenant-switcher-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-base);
  color: var(--text-primary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
}
.tenant-switcher-trigger:hover { background: var(--surface-secondary); }
.tenant-switcher-chevron { color: var(--text-secondary); }
.tenant-switcher-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 240px;
  background: var(--surface);
  border: 0.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: var(--space-xs) 0;
  max-height: 320px;
  overflow-y: auto;
}
.tenant-switcher-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  min-height: 44px;
  color: var(--text-primary);
}
.tenant-switcher-item:hover { background: var(--gray-100); }
.tenant-switcher-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.tenant-switcher-item.active { font-weight: 600; }
.tenant-switcher-item-name { flex: 1; font-size: var(--text-base); }

/* btn-full utility (Phase 27) */
.btn-full { width: 100%; }

/* --- DARK MODE — Apple system dark palette --- */

[data-theme="dark"] {
  /* Surface colours */
  --surface:           #1C1C1E;
  --surface-secondary: #2C2C2E;
  --surface-elevated:  #3A3A3C;
  /* Text */
  --text-primary:      #F2F2F7;
  --text-secondary:    #AEAEB2;
  --text-muted:        #636366;
  /* Borders & shadows */
  --border-color:      #38383A;
  --shadow:            0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:         0 2px 8px rgba(0,0,0,0.4);
  /* Gray scale remapped to dark equivalents */
  --gray-50:    #1C1C1E;
  --gray-100:   #2C2C2E;
  --gray-200:   #38383A;
  --gray-400:   #636366;
  --gray-600:   #AEAEB2;
  --gray-800:   #F2F2F7;
  /* Semantic colours unchanged — keep brand, green, red, orange */
  --white: #1C1C1E;
  --black: #000000;
  --secondary-hover: #48484A;
  --danger-hover: #FF453A;
  --xero-hover: #15C3FC;
  /* Background */
  background: var(--black);
}

[data-theme="dark"] body {
  background: var(--black);
  color: var(--text-primary);
}

/* Tint semantic colour backgrounds for dark mode */
[data-theme="dark"] .green-bg,
[data-theme="dark"] [style*="--green-bg"] { background: rgba(52,199,89,0.15); }
[data-theme="dark"] .red-bg    { background: rgba(255,59,48,0.15); }
[data-theme="dark"] .orange-bg { background: rgba(255,149,0,0.15); }

/* Input fields in dark mode */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* Tables */
[data-theme="dark"] .table th {
  background: var(--surface-secondary);
  color: var(--text-secondary);
}

/* System preference fallback — only applies when no manual override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface:           #1C1C1E;
    --surface-secondary: #2C2C2E;
    --surface-elevated:  #3A3A3C;
    --text-primary:      #F2F2F7;
    --text-secondary:    #AEAEB2;
    --text-muted:        #636366;
    --border-color:      #38383A;
    --shadow:            0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:         0 2px 8px rgba(0,0,0,0.4);
    --gray-50:    #1C1C1E;
    --gray-100:   #2C2C2E;
    --gray-200:   #38383A;
    --gray-400:   #636366;
    --gray-600:   #AEAEB2;
    --gray-800:   #F2F2F7;
    --white: #1C1C1E;
    --black: #000000;
    --secondary-hover: #48484A;
    --danger-hover: #FF453A;
    --xero-hover: #15C3FC;
  }
  :root:not([data-theme="light"]) body {
    background: var(--black);
    color: var(--text-primary);
  }
}

/* --- OAUTH BUTTONS & LOGIN PAGE ENHANCEMENTS --- */

.oauth-error {
  color: var(--danger, #dc2626);
  background: var(--danger-bg, #fef2f2);
  border: 1px solid var(--danger-border, #fecaca);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-top: 0.75rem;
  margin-bottom: 0;
  font-size: 0.85rem;
}

.oauth-divider,
.login-divider { display: flex; align-items: center; margin: 1.25rem 0; color: var(--text-secondary, #6b7280); font-size: 0.85rem; }
.oauth-divider::before, .oauth-divider::after,
.login-divider::before, .login-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color, #e5e7eb); }
.oauth-divider span, .login-divider span { padding: 0 0.75rem; }

.oauth-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.85rem 1rem;
  min-height: 52px;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.1s;
  width: 100%;
}
.btn-oauth:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.btn-oauth:active { transform: translateY(1px); }
.btn-oauth .oauth-icon { width: 22px; height: 22px; }
.btn-oauth-xero { background: #fff; color: #1a1a1a; border-color: var(--border-color, #e5e7eb); }
.btn-oauth-xero:hover { background: #f9fafb; }
@media (max-width: 380px) {
  .oauth-buttons { grid-template-columns: 1fr; }
}

.btn-oauth-google { background: var(--white); color: var(--oauth-google-text); border-color: var(--oauth-google-border); }
.btn-oauth-google:hover { background: var(--oauth-google-hover); }

.btn-oauth-microsoft { background: var(--oauth-microsoft); color: var(--white); border-color: var(--oauth-microsoft); }
.btn-oauth-microsoft:hover { background: var(--oauth-hover-dark); }

.btn-oauth-apple { background: var(--oauth-apple); color: var(--white); border-color: var(--oauth-apple); }
.btn-oauth-apple:hover { background: var(--oauth-hover-dark); }

.btn-oauth-facebook { background: var(--oauth-facebook); color: var(--white); border-color: var(--oauth-facebook); }
.btn-oauth-facebook:hover { background: var(--oauth-facebook-hover); }

.oauth-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* --- AVATAR PHOTO --- */

.user-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* --- PROFILE PHOTO SECTION (Edit Profile modal) --- */

.profile-photo-section { margin-bottom: 1rem; }
.photo-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0.5rem 0;
  background: var(--bg-secondary, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* --- LINKED ACCOUNTS SECTION (Edit Profile modal) --- */

.linked-accounts-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-color, #e5e7eb); }
.linked-account { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; }
.linked-provider { text-transform: capitalize; font-weight: 600; }

/* --- XERO CONNECTION CARDS (Phase 28 -- D-01) --- */
.xero-conn-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border: 0.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  min-height: 44px;
  transition: background 0.15s;
}
.xero-conn-card:hover { background: var(--gray-100); }
.xero-conn-card.active { border-left: 3px solid var(--brand); background: var(--blue-light, rgba(0,122,255,0.06)); }
.xero-conn-card + .xero-conn-card { margin-top: var(--space-sm); }
.xero-conn-card-info { display: flex; flex-direction: column; gap: 2px; }
.xero-conn-card-name { font-weight: 600; color: var(--text-primary); display: inline-flex; align-items: center; gap: 4px; }
.xero-conn-card-name svg { flex-shrink: 0; width: 16px; height: 16px; color: var(--xero-blue); }
.xero-conn-card-actions { display: flex; align-items: center; gap: var(--space-sm); }

/* Empty state */
.xero-conn-empty { text-align: center; padding: var(--space-lg) var(--space-md); }
.xero-conn-empty h4 { font-weight: 600; margin: var(--space-sm) 0 4px; color: var(--text-primary); }
.xero-conn-empty p { color: var(--text-secondary); margin: 0 0 var(--space-md); }

/* --- PLATFORM SELECTION SCREEN (Phase 65) --- */
.platform-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
  max-width: 780px;
}
.platform-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: center;
}
.platform-card:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.platform-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.platform-card-logo {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.platform-card-logo svg { width: 48px; height: 48px; }
.platform-card-name { font-weight: 600; font-size: var(--text-base); color: var(--text-primary); }
.platform-card-desc { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.4; }

/* Platform card tooltip (CSS-only) */
.platform-card-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: var(--white);
  font-size: var(--text-xs);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: 240px;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 200;
  line-height: 1.4;
}
.platform-card-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--gray-900);
}
.platform-card:hover .platform-card-tooltip,
.platform-card:focus-visible .platform-card-tooltip { opacity: 1; }

/* --- SEARCHABLE XERO ORG SWITCHER (Phase 28 -- D-04) --- */
.xero-org-switcher { position: relative; }
.xero-org-switcher-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-base);
  color: var(--text-primary);
}
.xero-org-switcher-btn:hover { background: var(--gray-100); }
.xero-org-switcher-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 280px;
  max-height: 360px;
  background: var(--surface);
  border: 0.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 100;
  overflow: hidden;
}
.xero-org-search {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-bottom: 0.5px solid var(--border-color);
  background: var(--surface);
  font-size: var(--text-base);
  color: var(--text-primary);
  outline: none;
}
.xero-org-search:focus { box-shadow: inset 0 0 0 2px var(--brand); }
.xero-org-list { overflow-y: auto; max-height: 300px; }
.xero-org-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  min-height: 44px;
  cursor: pointer;
  color: var(--text-primary);
}
.xero-org-item:hover { background: var(--gray-100); }
.xero-org-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.xero-org-item.active .xero-org-item-name { font-weight: 600; }
.xero-org-item-check { width: 16px; text-align: center; color: var(--brand); font-size: 14px; }
.xero-org-item-name { flex: 1; }
.xero-org-no-results { padding: var(--space-sm) var(--space-md); color: var(--text-secondary); font-size: var(--text-sm); }

/* Mobile responsive */
@media (max-width: 480px) {
  .xero-conn-card { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
  .xero-conn-card-actions { align-self: flex-end; }
  .xero-org-switcher-dropdown { min-width: 240px; }
}

/* --- PENDING APPROVAL SCREEN (Phase 29) --- */
#pending-approval-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  z-index: 1000;
}
.pending-card {
  max-width: 440px;
  width: 100%;
  padding: var(--space-lg);
  background: var(--surface);
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.pending-icon { margin-bottom: var(--space-md); }
.pending-heading { font-size: var(--text-heading); font-weight: 600; margin-bottom: var(--space-sm); }
.pending-body { font-size: var(--text-base); color: var(--text-secondary); margin-bottom: var(--space-lg); line-height: 1.5; }

/* --- PENDING USERS ADMIN SECTION (Phase 29) --- */
#pendingUsersList .pending-user-row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) 0; border-bottom: 1px solid var(--border-color); }
#pendingUsersList .pending-user-row:last-child { border-bottom: none; }
.pending-user-email { flex: 1; font-size: var(--text-base); }
.pending-provider-badge { font-size: var(--text-sm); padding: 2px 8px; border-radius: 4px; background: var(--gray-100); color: var(--text-secondary); text-transform: capitalize; }

/* Link provider buttons in settings (compact .btn-oauth) */
.linked-account .btn-link-provider { font-size: var(--text-sm); padding: 4px 12px; min-height: 32px; }

/* --- SANDBOX DEMO (Phase 32) --- */
.sandbox-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--warning-bg, #fef3cd);
  color: var(--warning-text, #856404);
  border-bottom: 1px solid var(--warning-border, #ffc107);
  padding: 8px 16px;
  text-align: center;
  font-size: var(--text-sm);
}
.sandbox-banner a { color: inherit; font-weight: 600; text-decoration: underline; }

[data-theme="dark"] .sandbox-banner {
  background: rgba(255, 193, 7, 0.15);
  color: var(--sandbox-accent);
  border-bottom-color: rgba(255, 193, 7, 0.3);
}
[data-theme="dark"] .sandbox-banner a { color: var(--sandbox-accent); }

/* + Add Org dropdown (Phase 54, D-06) */
.add-org-wrapper { position: relative; display: inline-block; }
.add-org-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  z-index: 300;
  padding: 4px 0;
}
.add-org-dropdown .dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  text-align: left;
  background: none;
  border: none;
  font-size: var(--text-base);
  color: var(--text-color);
  cursor: pointer;
}
.add-org-dropdown .dropdown-item:hover { background: var(--bg-stripe, var(--gray-50)); }

/* Data Sources radio labels (Phase 54, D-04) */
#activeSourceSelector label { padding: 6px 0; border-bottom: 1px solid var(--border-light, var(--border-color)); }
#activeSourceSelector label:last-child { border-bottom: none; }

/* 2FA Interstitial & Grace Banner (Phase 63) */
.tfa-qr-section {
  text-align: center;
  margin: var(--space-md) 0;
}
.tfa-manual-key {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  letter-spacing: 2px;
  word-break: break-all;
  user-select: all;
}
.tfa-grace-notice {
  background: var(--yellow-bg, #fef3cd);
  border: 1px solid var(--yellow-border, #ffc107);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  text-align: center;
}
.tfa-grace-notice p {
  margin: 0 0 var(--space-xs);
  font-size: var(--font-sm);
  color: var(--text-primary);
}
.tfa-recovery-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs);
  margin: var(--space-md) 0;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: var(--font-sm);
  text-align: center;
}
.tfa-grace-banner {
  background: var(--yellow-bg, #fef3cd);
  border-bottom: 1px solid var(--yellow-border, #ffc107);
  padding: var(--space-xs) var(--space-md);
  text-align: center;
  font-size: var(--font-sm);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9998;
}
.tfa-grace-banner a { color: var(--brand); font-weight: 600; }
body.has-tfa-banner { padding-top: 36px !important; }
.tfa-exempt-badge { font-size: var(--font-sm); color: var(--text-secondary); font-style: italic; }

/* ============================================================
   Phase 73 — Operational Config tab
   ============================================================ */
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.subtab-btn {
  background: none;
  border: none;
  padding: 8px 12px;
  font: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.subtab-btn.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--brand);
}
.subtab-panel[hidden] { display: none; }
.subtab-panel { padding: 8px 0; }
.opcfg-body { display: flex; flex-direction: column; gap: 12px; }
.opcfg-provider-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px 16px;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.opcfg-provider-group > legend {
  padding: 0 8px;
  font-weight: 600;
  font-size: var(--font-md);
}
.opcfg-plan-row { padding: 12px; border: 1px solid var(--border); border-radius: 6px; }
.opcfg-plan-row h4 { margin: 0 0 8px 0; }
.config-row {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.config-row-head { display: flex; align-items: center; gap: 8px; }
.config-row-head code { font-size: var(--font-sm); }
.config-row-body { display: flex; flex-direction: column; gap: 8px; }
.form-field-inline { flex-direction: row; align-items: center; gap: 6px; }
.opcfg-retention-form { display: flex; flex-direction: column; gap: 12px; }
.modal-confirm-subs { max-width: 480px; }

