/* ── CPA Portal — styles.css ─────────────────────────────────── */
/* RevvFi design system: forest green + blue→teal→green gradient accent   */

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #F1F5F2;
  --surface:      #fcfdfc;
  --card:         #fcfdfc;
  --border:       #e2ebe6;
  --text:         #16241d;
  --text-mid:     #3a4d44;
  --text-muted:   #6B7C8A;
  --green:        #123D2F;
  --green-mid:    #1F5C38;
  --green-bright: #1F5C38;
  --green-accent: #14B8A6;
  --orange:       #F97316;
  --danger:       #e5544b;
  --warning:      #E0A93B;

  /* signature palette */
  --forest:       #123D2F;
  --deep:         #0F2D1C;
  --mid:          #1F5C38;
  --bright-green: #2ECC71;
  --green-soft:   #e8f7ee;
  --blue:         #1E6FD9;
  --teal:         #14B8A6;
  --spark:        #F97316;
  --gold:         #E0A93B;
  --purple:       #8B5CF6;
  --cyan:         #0EA5A0;
  --pink:         #DB6C97;
  --grad:         linear-gradient(115deg,#1E6FD9 0%,#14B8A6 48%,#2ECC71 100%);
  --grad-soft:    linear-gradient(115deg,rgba(30,111,217,.12),rgba(20,184,166,.1),rgba(46,204,113,.12));

  --font-d: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-b: 'DM Sans', system-ui, sans-serif;

  --nav-h:        62px;
  --radius:       16px;
  --radius-lg:    20px;
  --shadow-card:  0 1px 2px rgba(18,61,47,0.04), 0 8px 24px -14px rgba(18,61,47,0.18);
  --shadow-btn:   0 6px 16px -6px rgba(20,184,166,0.4);
}

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: var(--font-b), -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6,
.login-title,
.section-title,
.table-card-title,
.profile-card-title,
.tab-btn {
  font-family: var(--font-d), sans-serif;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, select { font: inherit; }

/* ── Icon Utilities (SVG icon system) ───────────────────────────── */
.ico {
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.ic-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex-shrink: 0;
}
.ic-chip .ico { width: 17px; height: 17px; }

/* ── Loading Overlay ────────────────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.25s;
}
#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

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

/* ── Views ──────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Login View ─────────────────────────────────────────────────── */
#login-view {
  display: none; /* controlled by .active */
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background-image:
    radial-gradient(ellipse 700px 400px at 50% 30%, rgba(20,184,166,0.10) 0%, transparent 70%),
    radial-gradient(circle, rgba(18,61,47,0.05) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0%, #F1F5F2 55%, #e9efeb 100%);
  background-size: auto, 28px 28px, auto;
}
#login-view.active {
  display: flex;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(18,61,47,0.10), 0 2px 8px rgba(18,61,47,0.06);
  padding: 40px 36px 36px;
  width: 100%;
  max-width: 420px;
  margin: 0 16px;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}
.login-logo-img {
  height: 44px;
  border-radius: 10px;
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.15);
}
.form-group input::placeholder { color: var(--text-muted); }

.btn-primary {
  width: 100%;
  padding: 13px 24px;
  background: var(--forest);
  color: #f4faf6;
  border-radius: 11px;
  font-family: var(--font-d), sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-btn);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  margin-top: 4px;
}
.btn-primary:hover:not(:disabled) {
  background: var(--mid);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -6px rgba(20,184,166,0.45);
}
.btn-primary:active:not(:disabled) { transform: none; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.error-msg {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(229,84,75,0.08);
  border: 1px solid rgba(229,84,75,0.25);
  border-radius: 8px;
  color: var(--danger);
  font-size: 13px;
}
.error-msg.visible { display: block; }

.login-footnote {
  margin-top: 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

.auth-toggle {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.auth-toggle a {
  color: var(--mid);
  font-weight: 600;
  text-decoration: none;
}
.auth-toggle a:hover { text-decoration: underline; }

.mfa-alt-link {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.mfa-alt-link a {
  color: var(--mid);
  font-weight: 600;
  text-decoration: none;
}
.mfa-alt-link a:hover { text-decoration: underline; }

/* ── No-Clients View ────────────────────────────────────────────── */
#no-clients-view {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
#no-clients-view.active { display: flex; }

.no-clients-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 48px 40px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  margin: 0 16px;
}
.no-clients-icon {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}
.no-clients-icon svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}
.no-clients-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.no-clients-card p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ── Portal View ────────────────────────────────────────────────── */
#portal-view {
  display: none;
  min-height: 100vh;
  background: var(--bg);
}
#portal-view.active { display: block; }

/* ── Portal Nav ─────────────────────────────────────────────────── */
.portal-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 32px;
  background: rgba(241,245,242,0.88);
  backdrop-filter: blur(22px) saturate(1.6);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  border-bottom: 1px solid var(--border);
}

.nav-logo a {
  display: flex;
  align-items: center;
}
.nav-logo-img {
  height: 36px;
  border-radius: 8px;
  box-shadow: 0 4px 10px -3px rgba(20,184,166,0.4);
}

.nav-spacer { flex: 1; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── Sign Out Button ─────────────────────────────────────────────── */
.btn-signout {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-signout:hover {
  background: rgba(18,61,47,0.06);
  color: var(--forest);
  border-color: rgba(20,184,166,0.3);
}

/* ── Client Switcher ────────────────────────────────────────────── */
.client-switcher {
  position: relative;
  display: flex;
  align-items: center;
}

.client-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}
.client-chip:hover { border-color: var(--teal); box-shadow: var(--shadow-card); }
.client-chip.no-dropdown { cursor: default; pointer-events: none; border-color: transparent; background: transparent; }

.client-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  font-family: var(--font-d), sans-serif;
}

.client-chip-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.client-chip-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  font-family: var(--font-d), sans-serif;
}
.client-chip-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.client-chip-arrow {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.client-chip.open .client-chip-arrow { transform: rotate(180deg); }

.client-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(18,61,47,0.16);
  overflow: hidden;
  display: none;
  z-index: 200;
}
.client-dropdown.open { display: block; }

.client-dropdown-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 16px 8px;
  font-family: var(--font-d), sans-serif;
}

.client-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.12s;
}
.client-dropdown-item:hover { background: var(--bg); }
.client-dropdown-item.active { background: var(--green-soft); }

.item-avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  font-family: var(--font-d), sans-serif;
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.item-industry {
  font-size: 11px;
  color: var(--text-muted);
}
.item-check {
  color: var(--mid);
  opacity: 0;
}
.item-check svg { width: 13px; height: 13px; }
.client-dropdown-item.active .item-check { opacity: 1; }

/* ── Client Banner ──────────────────────────────────────────────── */
.client-banner {
  position: sticky;
  top: var(--nav-h);
  z-index: 90;
  background: var(--forest);
  color: rgba(233,245,238,0.85);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 9px 16px;
  letter-spacing: 0.01em;
}
.client-banner strong {
  color: #fff;
  font-weight: 700;
}
.banner-dot {
  opacity: 0.4;
  margin: 0 4px;
}

/* ── Tab Bar ────────────────────────────────────────────────────── */
.tab-bar {
  position: sticky;
  top: calc(var(--nav-h) + 36px); /* below nav + banner */
  z-index: 80;
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  gap: 0;
  overflow-x: auto;
}

.tab-btn {
  padding: 14px 20px;
  font-family: var(--font-d), sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 2.5px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  background: none;
  position: relative;
}
.tab-btn:hover { color: var(--text-mid); }
.tab-btn.active {
  color: var(--forest);
  border-bottom-color: transparent;
}
.tab-btn.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -2.5px;
  height: 2.5px;
  border-radius: 3px;
  background: var(--grad);
}

/* ── Main Content ───────────────────────────────────────────────── */
.portal-content {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  padding-top: calc(var(--nav-h) + 36px + 48px + 32px);
}

/* ── Tab Panels ─────────────────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Section Title ──────────────────────────────────────────────── */
.section-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
}

/* ── Cards Grid ─────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
}
.summary-card.highlight {
  border: none;
  background: var(--forest);
  color: #e9f5ee;
  position: relative;
  overflow: hidden;
}
.summary-card.highlight::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -40px;
  width: 200px;
  height: 200px;
  background: var(--grad-soft);
  filter: blur(26px);
  border-radius: 50%;
}
.card-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
  position: relative;
}
.summary-card.highlight .card-label { color: rgba(233,245,238,0.62); }
.card-value {
  font-family: var(--font-d), sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  position: relative;
}
.summary-card.highlight .card-value { color: #fff; }
.card-period {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  position: relative;
}
.summary-card.highlight .card-period { color: rgba(233,245,238,0.62); }

/* ── Table Card ─────────────────────────────────────────────────── */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 24px;
}
.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.table-card-title {
  font-family: var(--font-d), sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* ── Data Table ─────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 11px 20px;
  text-align: left;
  background: #eef3f0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-d), sans-serif;
}
.data-table td {
  font-size: 14px;
  color: var(--text-mid);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tfoot td {
  border-top: 1px solid var(--border);
  border-bottom: none;
  background: #eef3f0;
}
.data-table tbody tr:hover { background: rgba(20,184,166,0.03); }
.data-table tbody tr.category-divider,
.data-table tbody tr.category-divider:hover {
  background: rgba(18,61,47,0.04);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.data-table tbody tr.category-divider td { padding: 8px 20px; }

.td-right { text-align: right !important; }
.td-center { text-align: center !important; }

.amount-income { color: var(--bright-green); font-weight: 700; }
.amount-expense { color: var(--text); font-weight: 500; }

.badge-deductible {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--green-soft);
  color: var(--mid);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge-deductible svg { width: 12px; height: 12px; }
.badge-non {
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Profile Card ───────────────────────────────────────────────── */
.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 24px;
}
.profile-card-title {
  font-family: var(--font-d), sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0;
}
.profile-field {
  padding: 16px 20px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.profile-field:last-child { border-right: none; }
.field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.field-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

/* ── Filter Bar ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-input {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  min-width: 220px;
  flex: 1;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.12);
}
.filter-input::placeholder { color: var(--text-muted); }

.filter-select {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.12);
}

/* ── Pagination ─────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.pagination span { flex: 1; }

.page-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.page-btn:hover:not(:disabled) {
  background: var(--bg);
  color: var(--forest);
  border-color: var(--teal);
}
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Receipt Link ───────────────────────────────────────────────── */
.receipt-link {
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s;
  display: inline-flex;
  color: var(--text-mid);
}
.receipt-link svg { width: 17px; height: 17px; }
.receipt-link:hover { opacity: 1; color: var(--mid); }

/* ── Empty State ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-icon {
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
}
.empty-icon svg {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
}
.empty-state h3 {
  font-family: var(--font-d), sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.empty-state p { font-size: 14px; }

/* ── Tax Savings Callout ─────────────────────────────────────────── */
.tax-savings-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--green-soft);
  border: 1px solid rgba(46,204,113,0.3);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.mileage-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fcfdfc;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}
.callout-icon { flex-shrink: 0; }
.callout-text { font-size: 14px; color: var(--text); line-height: 1.5; }
.callout-text strong { color: var(--forest); font-weight: 700; }
.callout-disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Double-count warning flag ───────────────────────────────────── */
.double-count-flag {
  background: #fff8ec;
  border: 1px solid #f1c66b;
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}
.double-count-flag .flag-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}
.double-count-flag .flag-icon {
  flex-shrink: 0;
}
.double-count-flag .flag-text {
  flex: 1;
  min-width: 0;
}
.double-count-flag .flag-title {
  font-weight: 700;
  color: #7a4a00;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.double-count-flag .flag-title svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--gold);
}
.double-count-flag .flag-summary {
  font-size: 12px;
  color: #8a6a2e;
  margin-top: 2px;
}
.double-count-flag .flag-chevron {
  color: #8a6a2e;
  font-size: 14px;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.double-count-flag.open .flag-chevron {
  transform: rotate(180deg);
}
.double-count-flag .flag-body {
  display: none;
  padding: 0 18px 16px;
  border-top: 1px solid rgba(212, 133, 0, 0.25);
}
.double-count-flag.open .flag-body {
  display: block;
}
.double-count-flag .flag-note {
  font-size: 13px;
  color: #5a4a20;
  line-height: 1.5;
  margin: 12px 0 14px;
}
.double-count-flag .data-table {
  background: #fff;
  border: 1px solid rgba(212, 133, 0, 0.25);
  border-radius: 8px;
  overflow: hidden;
}

/* ── Deduction Category ──────────────────────────────────────────── */
.deduction-category {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 12px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.12s;
}
.category-header:hover { background: rgba(18,61,47,0.02); }

.category-icon { flex-shrink: 0; display: flex; align-items: center; }

.category-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.category-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.category-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.category-total {
  font-family: var(--font-d), sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--forest);
}
.category-arrow {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.deduction-category.open .category-arrow { transform: rotate(180deg); }

.category-transactions {
  display: none;
  border-top: 1px solid var(--border);
}
.deduction-category.open .category-transactions { display: block; }

/* ── Reports Tab ─────────────────────────────────────────────────── */
.report-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.year-select {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.year-select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.12);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--forest);
  color: #f4faf6;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-d), sans-serif;
  transition: background 0.15s, transform 0.1s;
}
.btn-download svg, .btn-download-outline svg { width: 14px; height: 14px; }
.btn-download:hover { background: var(--mid); transform: translateY(-1px); }
.btn-download:active { transform: none; }

.btn-download-outline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: transparent;
  color: var(--forest);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-d), sans-serif;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-download-outline:hover {
  background: rgba(18,61,47,0.06);
  border-color: var(--teal);
}

/* ── Skeleton Loaders ───────────────────────────────────────────── */
.skeleton-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.skeleton {
  background: linear-gradient(90deg, #e8ede9 25%, #d8e3de 50%, #e8ede9 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}
.w-50 { width: 50%; }
.w-75 { width: 75%; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Receipt Lightbox ───────────────────────────────────────────── */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15,45,28,0.75);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.lightbox-overlay.open { display: flex; }

.lightbox-inner {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(15,45,28,0.4);
}
#lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
}
.lightbox-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(18,61,47,0.08);
  color: var(--text);
  z-index: 10;
  transition: background 0.15s;
}
.lightbox-close svg { width: 14px; height: 14px; }
.lightbox-close:hover { background: rgba(18,61,47,0.15); }

/* ── Add Client Button (nav) ──────────────────────────────────── */
.btn-add-client {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  background: var(--forest);
  color: #f4faf6;
  border-radius: 10px;
  font-family: var(--font-d), sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.1s;
}
.btn-add-client:hover { background: var(--mid); transform: translateY(-1px); }
.btn-add-client:active { transform: none; }

/* ── Secondary Button ─────────────────────────────────────────── */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-family: var(--font-b), sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: rgba(18,61,47,0.06); border-color: var(--teal); }

/* ── MFA Modal ────────────────────────────────────────────────── */
.mfa-modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15,45,28,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.mfa-modal[hidden] { display: none; }

.mfa-modal-inner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 48px rgba(18,61,47,0.18), 0 2px 8px rgba(18,61,47,0.08);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 420px;
}

.mfa-modal-title {
  font-family: var(--font-d), sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.mfa-modal-body {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ── 9-digit code row ─────────────────────────────────────────── */
.mfa-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 8px;
}

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

.mfa-code-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 4px;
}

.mfa-code-box {
  width: 44px;
  height: 54px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b), monospace;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}
.mfa-code-box::-webkit-outer-spin-button,
.mfa-code-box::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mfa-code-box:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.20);
}

/* ── Modal actions ────────────────────────────────────────────── */
.mfa-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.mfa-modal-actions .btn-primary {
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.mfa-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── Toast notification ───────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--forest);
  color: #f4faf6;
  font-family: var(--font-b), sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 40px;
  box-shadow: 0 4px 18px rgba(18,61,47,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  z-index: 700;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .mfa-code-box { width: 34px; height: 46px; font-size: 18px; border-radius: 8px; border-width: 1.5px; }
  .mfa-code-row { gap: 5px; }
  .mfa-modal-inner { padding: 28px 16px 22px; }
}

/* ── Business Segment Control ───────────────────────────────────── */
.biz-segment {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}
.biz-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
  font-family: inherit;
}
.biz-pill-active {
  background: var(--forest);
  border-color: var(--forest);
  color: #f4faf6;
}
.biz-pill:hover:not(.biz-pill-active) {
  background: rgba(18,61,47,0.06);
  border-color: var(--teal);
  color: var(--text);
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(18,61,47,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(18,61,47,0.35); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .portal-nav { padding: 0 16px; }
  .portal-content { padding: 16px 12px 48px; padding-top: calc(var(--nav-h) + 36px + 46px + 16px); }
  .tab-bar { padding: 0 12px; }
  .cards-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-input { min-width: 0; }
  .login-card { padding: 28px 20px 24px; }
  .data-table th, .data-table td { padding: 10px 12px; }
  .biz-pill { padding: 5px 11px; font-size: 12px; }
}
