.d-cloak { display: none; }

:root {
  --canvas: #fdfcfc;
  --ink: #201d1d;
  --ink-deep: #0f0000;
  --charcoal: #302c2c;
  --body: #424245;
  --mute: #646262;
  --stone: #6e6e73;
  --ash: #9a9898;
  --surface-soft: #f8f7f7;
  --surface-card: #f1eeee;
  --surface-dark: #201d1d;
  --surface-dark-elevated: #302c2c;
  --hairline: rgba(15, 0, 0, 0.12);
  --hairline-strong: #646262;
  --on-dark: #fdfcfc;
  --on-dark-mute: #9a9898;
  --accent: #007aff;
  --danger: #ff3b30;
  --warning: #ff9f0a;
  --success: #30d158;
  --primary: var(--ink);
  --primary-dark: var(--ink-deep);
  --primary-light: var(--surface-card);
  --header-bg: #1D4ED8;
  --header-text: #ffffff;
  --sidebar-bg: var(--canvas);
  --sidebar-text: var(--body);
  --sidebar-hover: var(--surface-soft);
  --sidebar-active-bg: var(--surface-card);
  --sidebar-active: var(--ink);
  --sidebar-width: 240px;
  --header-height: 56px;
  --surface: var(--canvas);
  --surface-alt: var(--surface-soft);
  --border: var(--hairline);
  --text: var(--ink);
  --text-muted: var(--mute);
  --highlight: var(--accent);
  --radius: 4px;
}

body.dark {
  --canvas: #201d1d;
  --ink: #fdfcfc;
  --ink-deep: #e7e3e3;
  --charcoal: #f1eeee;
  --body: #c8c6c6;
  --mute: #9a9898;
  --stone: #9a9898;
  --ash: #6e6e73;
  --surface-soft: #302c2c;
  --surface-card: #3a3636;
  --surface-dark: #201d1d;
  --surface-dark-elevated: #302c2c;
  --hairline: rgba(255, 255, 255, 0.12);
  --hairline-strong: #c8c6c6;
  --on-dark: #fdfcfc;
  --on-dark-mute: #9a9898;
  --primary: var(--ink);
  --primary-dark: #ffffff;
  --primary-light: var(--surface-card);
  --header-bg: #1D4ED8;
  --header-text: #ffffff;
  --sidebar-bg: var(--canvas);
  --sidebar-text: var(--body);
  --sidebar-hover: var(--surface-soft);
  --sidebar-active-bg: var(--surface-card);
  --sidebar-active: var(--ink);
  --surface: var(--canvas);
  --surface-alt: var(--surface-soft);
  --border: var(--hairline);
  --text: var(--ink);
  --text-muted: var(--mute);
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--canvas);
}

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

a {
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

a:hover {
  text-decoration: underline;
}

body.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--canvas);
}

body.layout #app-content {
  background: var(--canvas);
}

body.layout:not(.dark) #app-content:has(.auth-page),
body.layout:not(.dark) #app-content:has(.lp) {
  background: var(--canvas);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-height);
  padding: 8px 24px;
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
  position: relative;
  z-index: 500;
}

.app-header--unauth {
  background: var(--header-bg);
  color: var(--header-text);
}

.hamburger-btn,
.app-header__ctrl-btn,
.app-header__signout,
.app-header__nav-link,
.app-header__user,
.app-header__brand {
  color: var(--header-text);
}

.hamburger-btn,
.app-header__ctrl-btn,
.app-header__signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
}

.hamburger-btn {
  cursor: pointer;
}

.hamburger-btn:hover,
.app-header__ctrl-btn:hover,
.app-header__signout:hover,
.app-header__nav-link:hover,
.app-header__user:hover {
  background: rgba(255, 255, 255, 0.25);
  text-decoration: none;
}

.app-header__brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.app-header__spacer {
  flex: 1;
}

.app-header__nav-link,
.app-header__user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  white-space: nowrap;
}

.app-header__user {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__cta {
  margin-left: 4px;
}

.app-header__tenant-btn {
  gap: 6px;
  font-size: .82rem;
  max-width: 180px;
  overflow: hidden;
}

.app-header__tenant-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
  min-width: 160px;
  z-index: 600;
  padding: .25rem;
}

.tenant-dropdown__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: .5rem .75rem;
  border: none;
  background: none;
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .875rem;
  white-space: nowrap;
}

.tenant-dropdown__item:hover {
  background: var(--surface-alt);
}

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

d-sidebar {
  display: contents;
}

#app-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: var(--header-height) 0 0 0;
  background: rgba(15, 0, 0, 0.24);
  z-index: 149;
}

.sidebar {
  width: 0;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--hairline);
}

.sidebar--open {
  width: var(--sidebar-width);
  overflow-y: auto;
}

.sidebar__nav {
  list-style: none;
  margin: 0;
  padding: 4px 0 16px;
  flex: 1;
}

.sidebar__nav li {
  margin: 0;
}

.sidebar__section {
  padding: 10px 16px 6px;
  color: var(--mute);
  font-size: 13px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

/* Clickable section headers */
.sidebar__section--toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.sidebar__section-chevron {
  font-size: 12px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* Group items container */
.sidebar__group-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Collapsed state: hide items and flip chevron */
.sidebar__group--collapsed .sidebar__group-items {
  display: none;
}

.sidebar__group--collapsed .sidebar__section-chevron {
  transform: rotate(180deg);
}

/* Sidebar search box */
.sidebar__search {
  padding: 6px 10px;
  border-bottom: 1px solid var(--hairline);
}

.sidebar__search-wrap {
  position: relative;
}

.sidebar__search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mute);
  font-size: 13px;
  pointer-events: none;
}

.sidebar__search-input {
  width: 100%;
  padding: 6px 8px 6px 28px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--ink);
  font-size: 13px;
  box-sizing: border-box;
}

.sidebar__search-input:focus {
  outline: none;
  border-color: var(--brand);
}

.sidebar__search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  color: var(--sidebar-text);
  border-left: 1px solid transparent;
}

.sidebar__link:hover,
.sidebar__link--active {
  background: var(--sidebar-hover);
  color: var(--ink);
  text-decoration: none;
  border-left-color: var(--hairline-strong);
}

.sidebar__icon,
.sidebar__marker {
  width: 18px;
  text-align: center;
  color: var(--mute);
  flex-shrink: 0;
}

.sidebar__link:hover .sidebar__icon,
.sidebar__link--active .sidebar__icon,
.sidebar__link:hover .sidebar__marker,
.sidebar__link--active .sidebar__marker {
  color: var(--ink);
}

.sidebar__brand,
.sidebar__footer,
.form-card,
.stat-card,
.step,
.empty-state,
.info-card,
.filter-bar,
.budget-card,
.rec-card,
.report-list-card,
.onboarding-card,
.provider-card,
.wizard-provider-card,
.wizard-instructions,
.wizard-form,
.wizard-confirm-card,
.card,
.builder-panel,
.section-card,
.widget-card,
.metric-card,
.table-wrapper,
.layout-item,
.panel-hint {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 0;
}

.sidebar__brand,
.sidebar__footer {
  padding: 16px;
}

.sidebar__brand {
  border-left: 0;
  border-right: 0;
  border-top: 0;
}

.sidebar__footer {
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}

.sidebar__title,
.sidebar__email {
  color: var(--ink);
}

.sidebar__logout,
.sidebar__setting-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--ink);
}

.sidebar__logout:hover,
.sidebar__setting-btn:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

.page,
.page-content,
.container-fluid {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.page-header,
.page__header {
  margin-bottom: 32px;
}

.page__header-row,
.section-header,
.report-list-header,
.card__header,
.card-header,
.layout-item__actions,
.widget-item__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page__title,
.page-title,
.page__header h1,
.page h1,
.card__title,
.card-title,
.panel-title,
.metric-big,
.lp-footer__brand-name {
  margin: 0;
  color: var(--ink);
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.35;
}

.page__subtitle,
.page-subtitle,
.card-subtitle,
.panel-hint,
.metric-trend,
.lp-footer__brand-sub {
  color: var(--mute);
  font-size: 14px;
}

.page__section {
  margin-top: 48px;
}

.page__section h2,
.form-card h2,
.onboarding-step h2,
.wizard-instructions h3,
.lp-section-title,
.lp-plan__name,
.lp-feature-card h3,
.lp-contact__success h3 {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.stats-grid,
.summary-cards,
.cards-grid,
.widget-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card,
.card--metric,
.metric-card,
.widget-card,
.budget-card,
.rec-card,
.info-card,
.empty-state,
.form-card,
.onboarding-card,
.report-list-card,
.section-card {
  padding: 16px;
}

.stat-card__icon,
.metric-unit,
.widget-card__add,
.budget-card__scope,
.sku-badge,
.badge,
.lp-plan__badge,
.auth-card__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
}

.stat-card__label,
.metric__label,
.widget-card__label,
.budget-card__meta,
.sku-compare-slot__label,
.wizard-confirm-label,
.form-label,
.lp-contact__label,
.auth-card__header p,
.lp-section-sub,
.lp-stat__label,
.lp-plan__desc,
.lp-feature-card p,
.lp-footer__copy,
.sidebar__section,
.breadcrumb,
.breadcrumb__sep,
.text-muted {
  color: var(--mute);
  font-size: 14px;
}

.stat-card__value,
.metric__value,
.budget-card__amount,
.savings-banner__value,
.lp-stat__value,
.lp-plan__price {
  margin-top: 8px;
  color: var(--ink);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  line-height: 1.2;
}

.stat-card__sub,
.metric-trend,
.budget-card__meta,
.rec-card__desc,
.empty-state p,
.onboarding-step p,
.wizard-provider-card__desc,
.wizard-steps-list li,
.lp-hero__subtitle,
.lp-contact__success p,
.lp-footer__copy,
.card-subtitle,
.text-dark,
.text-white,
.text-primary {
  color: var(--body);
}

.steps,
.layout-list,
.cards,
.list-group,
.tabs,
.tab-content,
.widget-palette {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tabs.tabs--compact {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 1px solid var(--hairline);
}

.tabs.tabs--compact .tab {
  font-size: 13px;
  padding: 5px 12px;
  min-height: 0;
}

.step,
.layout-item,
.widget-item,
.list-group-item,
.card-body,
.card__body {
  padding: 16px;
}

.step {
  gap: 16px;
  display: flex;
  align-items: flex-start;
}

.step__num,
.step__circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  flex-shrink: 0;
}

.step--active .step__circle,
.step--active .step__label,
.step--active {
  color: var(--ink);
}

.step__label,
.step__content p,
.widget-item__data,
.widget-item__title,
.layout-item__label {
  color: var(--body);
}

.stepper,
.sku-provider-tabs,
.btn-group,
.nav,
.nav-tabs,
.tab-bar,
.lp-hero__ctas,
.lp-hero__providers,
.lp-footer__links,
.onboarding-step__actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.step__connector {
  flex: 1;
  min-width: 40px;
  height: 1px;
  background: var(--hairline);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.breadcrumb__link,
.wizard-steps-list a,
.lp-footer__links a {
  color: var(--ink);
}

.breadcrumb__current {
  color: var(--ink);
  font-weight: 500;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-warning,
.btn-danger,
.btn-outline-danger,
.btn-outline-secondary,
.btn-outline-success,
.btn--primary,
.btn--secondary,
.btn--danger,
.btn--ghost,
.btn--outline,
.lp-btn,
.nav-link,
.tab-btn,
.sku-provider-tab,
.provider-card,
.wizard-provider-card,
.sidebar__logout,
.sidebar__setting-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 20px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  line-height: 2;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-success:hover,
.btn-warning:hover,
.btn-danger:hover,
.btn-outline-danger:hover,
.btn-outline-secondary:hover,
.btn-outline-success:hover,
.btn--secondary:hover,
.btn--danger:hover,
.btn--ghost:hover,
.btn--outline:hover,
.lp-btn:hover,
.nav-link:hover,
.sku-provider-tab:hover,
.provider-card:hover,
.wizard-provider-card:hover,
.tab-btn:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

.btn-primary,
.btn--primary,
.lp-btn--primary,
.sku-provider-tab--active,
.step--active .step__circle,
.bg-dark,
.bg-primary {
  background: var(--ink);
  color: var(--canvas);
  border-color: var(--ink);
}

.btn-primary:hover,
.btn--primary:hover,
.lp-btn--primary:hover,
.sku-provider-tab--active:hover {
  background: var(--ink-deep);
  color: var(--canvas);
}

.btn-secondary,
.btn--secondary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn--outline,
.lp-btn--outline,
.lp-btn--ghost,
.lp-btn--ghost-light,
.nav-link,
.tab-btn,
.sku-provider-tab {
  background: transparent;
  color: var(--ink);
}

.btn--danger,
.btn-danger,
.btn-outline-danger,
.badge--danger,
.alert--danger,
.bg-danger {
  color: var(--danger);
  border-color: rgba(255, 59, 48, 0.35);
  background: rgba(255, 59, 48, 0.08);
}

.btn-success,
.badge--success,
.diff-better,
.bg-success {
  color: var(--success);
  border-color: rgba(48, 209, 88, 0.35);
  background: rgba(48, 209, 88, 0.08);
}

.btn-warning,
.badge--warning,
.bg-warning {
  color: var(--warning);
  border-color: rgba(255, 159, 10, 0.35);
  background: rgba(255, 159, 10, 0.1);
}

.badge--info,
.alert--info,
.diff-equal,
.bg-info,
.border-primary,
.text-primary {
  color: var(--accent);
  border-color: rgba(0, 122, 255, 0.35);
  background: rgba(0, 122, 255, 0.08);
}

.badge--secondary,
.diff-worse,
.bg-secondary,
.bg-light {
  color: var(--mute);
  border-color: var(--hairline);
  background: var(--surface-soft);
}

.badge::before {
  content: '[+]';
}

.badge--danger::before {
  content: '[x]';
}

.badge--warning::before {
  content: '[!]';
}

.badge--info::before {
  content: '[i]';
}

.btn--sm,
.btn-sm,
.lp-btn--lg,
.app-header__cta {
  min-height: 36px;
}

.btn--sm,
.btn-sm,
.btn--xs {
  padding: 4px 12px;
  font-size: 14px;
}

.btn--icon {
  padding: 4px 8px;
  min-height: 30px;
  min-width: 30px;
  font-size: 14px;
  gap: 0;
}

.btn--full,
.w-100,
.lp-btn--full {
  width: 100%;
}

.form-group,
.lp-contact__field {
  margin-bottom: 16px;
}

.form-label,
.form-group label,
.auth-card .form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.form-control,
.form-control-sm,
.form-select,
.form-group input,
.form-group select,
.form-group textarea,
input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
select,
textarea,
.lp-contact__input,
.lp-contact__textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  outline: none;
}

textarea,
.lp-contact__textarea {
  min-height: 112px;
  resize: vertical;
}

.form-control:focus,
.form-control-sm:focus,
.form-select:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
input[type='text']:focus,
input[type='email']:focus,
input[type='password']:focus,
input[type='number']:focus,
select:focus,
textarea:focus,
.lp-contact__input:focus,
.lp-contact__textarea:focus {
  background: var(--canvas);
  border-color: var(--ink);
}

input[readonly] {
  color: var(--mute);
  background: var(--surface-card);
}

.form-error,
.alert {
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: transparent;
  color: var(--danger);
  font-size: 14px;
}

.form-error--hidden,
.fade:not(.show),
.tab-pane:not(.show) {
  display: none;
}

.form-required {
  color: var(--danger);
}

.form-row,
.builder-grid,
.report-layout,
.carbons-layout,
.carb-layout,
.provider-grid,
.wizard-layout,
.sku-compare-panel,
.lp-contact__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.provider-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-layout {
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: start;
}

.wizard-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.provider-card,
.wizard-provider-card {
  flex-direction: column;
  padding: 16px;
  min-height: 0;
  text-align: center;
}

.provider-card__icon,
.wizard-provider-card__logo,
.onboarding-step__icon,
.empty-state__icon,
.savings-banner__icon,
.lp-contact__success-icon {
  font-size: 24px;
  color: var(--ink);
}

.provider-card__name,
.wizard-provider-card__name,
.budget-card__name,
.rec-card__title,
.widget-item__title,
.layout-item__label,
.card-title,
.card__title,
.savings-banner__label {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.onboarding-page,
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height));
  padding: 32px 16px;
  background: var(--canvas);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: 24px;
  background: var(--surface-dark);
  color: var(--on-dark);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
}

.auth-card--wide {
  max-width: 560px;
}

.auth-card__header {
  margin-bottom: 24px;
}

.auth-card__logo {
  margin-bottom: 16px;
  background: var(--surface-dark-elevated);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--on-dark-mute);
}

.auth-card__header h1,
.auth-card__header p,
.auth-card__footer,
.auth-card__meta,
.auth-card__footer a {
  color: var(--on-dark);
}

.auth-card__header h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
}

.auth-card__header p,
.auth-card__footer,
.auth-card__meta,
.auth-card__footer a {
  color: var(--on-dark-mute);
  font-size: 14px;
}

.auth-card__meta,
.auth-card__footer {
  margin-top: 16px;
  text-align: center;
}

.auth-card .form-group label {
  color: var(--on-dark);
}

.auth-card .form-group input,
.auth-card .form-group select,
.auth-card .form-group textarea {
  background: var(--surface-dark-elevated);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--on-dark);
}

.auth-card .form-group input::placeholder,
.auth-card .form-group textarea::placeholder,
.auth-card .form-group select::placeholder {
  color: var(--on-dark-mute);
}

.auth-card .form-group input:focus,
.auth-card .form-group select:focus,
.auth-card .form-group textarea:focus {
  background: var(--surface-dark);
  border-color: var(--on-dark);
}

.auth-card .btn--primary,
.auth-card .btn-primary,
.auth-card .btn--full {
  background: var(--on-dark);
  color: var(--surface-dark);
  border-color: var(--on-dark);
}

.auth-card .btn--primary:hover,
.auth-card .btn-primary:hover,
.auth-card .btn--full:hover {
  background: #e7e3e3;
}

.auth-card .form-error {
  border-color: var(--danger);
  color: #ff8d87;
}

.tab-btn,
.tab,
.nav-link,
.sku-provider-tab {
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 8px 16px;
}

.tab-btn--active,
.tab--active,
.nav-link.active,
.sku-provider-tab--active {
  color: var(--ink);
  border-bottom-color: var(--hairline-strong);
}

.progress-track {
  height: 4px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: 0;
  margin: 8px 0;
}

.progress-bar {
  height: 100%;
  min-width: 2px;
  background: var(--success);
}

/* Hide any <option> that Drapo left unprocessed — when a d-for option list binds to
   an empty array, Drapo leaves the template option in place with its literal mustache
   value (value="{{...}}" or d-value="{{...}}"), which would otherwise show as a junk
   dropdown entry (#562). The cloned options for real data have resolved values, so
   they are unaffected. */
select option[value^="{{"],
select option[d-value^="{{"] {
  display: none;
}

.data-table,
.table,
.sku-compare-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

/* Let wide tables (e.g. the reports list with its timestamp + actions columns)
   scroll horizontally inside their card instead of spilling the right-most
   columns outside it. */
.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.data-table th,
.data-table td,
.table th,
.table td,
.sku-compare-table th,
.sku-compare-table td {
  padding: 12px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: top;
}

.data-table th,
.table th,
.sku-compare-table th,
.table-light th {
  color: var(--mute);
  font-size: 14px;
  font-weight: 700;
  background: var(--surface-soft);
}

.data-table tr.drillable,
.table-hover tbody tr {
  cursor: pointer;
}

.data-table tr.drillable:hover,
.table-hover tbody tr:hover,
.list-group-item-action:hover,
.widget-item:hover,
.layout-item:hover {
  background: var(--surface-soft);
}

.card,
.card-body,
.card-footer,
.card-header,
.report-form-card,
.table-wrapper,
.builder-panel,
.metric-card,
.widget-card,
.widget-item,
.layout-item,
.section-card {
  padding: 16px;
}

.card-footer,
.card-header,
.table-wrapper,
.section-header,
.lp-footer__copy {
  border-top: 1px solid var(--hairline);
}

.card-header,
.report-list-header,
.section-header {
  border-top: 0;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.savings-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 0;
}

.savings-banner__sub,
.budget-card__meta,
.report-form-card,
.report-list-header,
.lp-footer__links a,
.lp-section-sub {
  color: var(--mute);
}

.sku-badge--azure {
  color: var(--accent);
}

.sku-badge--aws {
  color: #b16d00;
}

.sku-badge--gcp {
  color: #228848;
}

.sku-badge--oracle {
  color: #b33b2e;
}

.sku-compare-slot,
.wizard-confirm-row {
  border: 1px solid var(--hairline);
  border-radius: 0;
  background: var(--canvas);
  padding: 12px;
}

.sku-compare-slot--filled {
  border-color: var(--hairline-strong);
}

.wizard-instructions,
.wizard-form,
.wizard-confirm-card {
  padding: 16px;
}

.wizard-steps-list {
  margin: 0;
  padding-left: 20px;
}

.wizard-steps-list code {
  padding: 2px 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.report-form-card {
  position: sticky;
  top: 16px;
}

.loading-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--mute);
}

.loading-screen__spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--hairline);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.lp {
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
}

.lp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
}

.lp-nav__brand,
.lp-footer__brand,
.lp-footer__inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lp-nav__name {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.lp-hero,
.lp-features,
.lp-pricing,
.lp-footer {
  padding: 96px 24px;
}

.lp-hero {
  background: var(--surface-dark);
  color: var(--on-dark);
}

.lp-hero__content,
.lp-features__grid,
.lp-pricing__grid,
.lp-contact,
.lp-footer__inner,
.lp-section-header {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.lp-hero__eyebrow,
.lp-footer__copy,
.lp-footer__brand-sub {
  color: var(--on-dark-mute);
  font-size: 14px;
}

.lp-hero__title {
  margin: 16px 0;
  color: var(--on-dark);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 700;
  line-height: 1.25;
}

.lp-hero__subtitle {
  max-width: 760px;
  margin: 0 0 32px;
  color: var(--on-dark-mute);
}

.lp-hero__providers {
  margin-bottom: 32px;
}

.lp-cloud-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 2px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  color: var(--on-dark);
  background: transparent;
  font-size: 14px;
}

.lp-cloud-badge--azure,
.lp-cloud-badge--aws,
.lp-cloud-badge--gcp,
.lp-cloud-badge--oracle {
  color: var(--on-dark);
}

.lp-hero__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.lp-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lp-stat__value,
.lp-stat__label {
  color: var(--on-dark);
}

.lp-stat__label {
  color: var(--on-dark-mute);
}

.lp-section-header {
  margin-bottom: 32px;
}

.lp-section-title,
.lp-section-sub {
  max-width: 720px;
}

.lp-section-sub {
  margin: 0;
  color: var(--body);
}

.lp-features,
.lp-pricing,
.lp-footer,
.lp-pricing#contact {
  background: var(--canvas) !important;
}

.lp-features__grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lp-feature-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 16px;
  align-items: start;
  padding: 16px 0;
  border-top: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
}

.lp-feature-card:last-child {
  border-bottom: 1px solid var(--hairline);
}

.lp-feature-card__icon {
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  justify-content: flex-start;
}

.lp-feature-card h3,
.lp-feature-card p {
  margin: 0;
}

.lp-feature-card h3 {
  margin-bottom: 4px;
}

.lp-plan {
  position: relative;
  padding: 24px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 0;
}

.lp-plan--pro {
  border-color: var(--ink);
}

.lp-plan__badge {
  position: static;
  margin-bottom: 16px;
  background: var(--canvas);
}

.lp-plan__price span {
  color: var(--mute);
  font-size: 16px;
  font-weight: 400;
}

.lp-plan__features {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lp-plan__features li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--body);
}

.lp-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  color: var(--ink);
}

.lp-contact {
  max-width: 720px;
}

.lp-contact__card {
  padding: 24px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 0;
}

.lp-contact__success {
  text-align: left;
}

.lp-contact__success-icon {
  margin-bottom: 16px;
}

.lp-footer {
  border-top: 1px solid var(--hairline);
}

.lp-footer__inner {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.lp-footer__brand {
  align-items: flex-start;
}

.lp-footer__links {
  gap: 16px;
}

.lp-footer__copy {
  width: 100%;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  color: var(--mute);
}

.row,
.d-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.col-12,
.col-6,
.col-md-2,
.col-md-3,
.col-md-4,
.col-md-5,
.col-md-6,
.col-md-7,
.col-md-8,
.col-md-9 {
  flex: 1 1 100%;
}

.col-6 {
  flex-basis: calc(50% - 8px);
}

.col-md-2 { flex-basis: calc(16.666% - 16px); }
.col-md-3 { flex-basis: calc(25% - 16px); }
.col-md-4 { flex-basis: calc(33.333% - 16px); }
.col-md-5 { flex-basis: calc(41.666% - 16px); }
.col-md-6 { flex-basis: calc(50% - 16px); }
.col-md-7 { flex-basis: calc(58.333% - 16px); }
.col-md-8 { flex-basis: calc(66.666% - 16px); }
.col-md-9 { flex-basis: calc(75% - 16px); }

.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.flex-grow-1 { flex: 1 1 auto; }
.flex-wrap { flex-wrap: wrap; }
.text-center { text-align: center; }
.text-end { text-align: end; }
.overflow-auto { overflow: auto; }
.h-100 { height: 100%; }
.rounded { border-radius: var(--radius); }
.shadow-sm { border: 1px solid var(--hairline); }
.gap-2, .g-2 { gap: 8px; }
.g-3 { gap: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 24px; }
.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.px-3 { padding-left: 16px; padding-right: 16px; }
.py-4 { padding-top: 24px; padding-bottom: 24px; }
.py-5 { padding-top: 32px; padding-bottom: 32px; }
.fs-1 { font-size: 32px; }
.fs-6 { font-size: 14px; }
.fw-bold { font-weight: 700; }
.bg-light { background: var(--surface-soft); }
.bg-dark { background: var(--surface-dark); }
.text-dark { color: var(--ink); }
.text-white { color: var(--on-dark); }

@media (max-width: 1024px) {
  .stats-grid,
  .summary-cards,
  .cards-grid,
  .widget-grid,
  .lp-hero__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .provider-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .app-header {
    padding-left: 16px;
    padding-right: 16px;
    gap: 8px;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width) !important;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

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

  .sidebar-overlay--open {
    display: block;
  }

  .page,
  .page-content,
  .container-fluid,
  .lp-hero,
  .lp-features,
  .lp-pricing,
  .lp-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .stats-grid,
  .summary-cards,
  .cards-grid,
  .widget-grid,
  .form-row,
  .report-layout,
  .provider-grid,
  .wizard-layout,
  .sku-compare-panel,
  .lp-contact__row,
  .lp-hero__stats {
    grid-template-columns: 1fr;
  }

  .lp-feature-card {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .col-6,
  .col-md-2,
  .col-md-3,
  .col-md-4,
  .col-md-5,
  .col-md-6,
  .col-md-7,
  .col-md-8,
  .col-md-9 {
    flex-basis: 100%;
  }
}

@media (max-width: 640px) {
  .app-header__user span {
    display: none;
  }

  .lp-hero,
  .lp-features,
  .lp-pricing,
  .lp-footer {
    padding-top: 64px;
    padding-bottom: 64px;
  }

  .lp-hero__title {
    font-size: 32px;
  }
}

/* ========== Cash Flow Page ========== */
.cf-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.cf-card {
  background: var(--surface-card);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--hairline-strong);
}
.cf-card--income  { border-left-color: #22c55e; }
.cf-card--cloud   { border-left-color: #3b82f6; }
.cf-card--expense { border-left-color: #f59e0b; }
.cf-card--net     { border-left-color: var(--ink); }
.cf-card__label {
  font-size: .75rem;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .4rem;
}
.cf-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}
.cf-card--net .cf-card__value { color: var(--accent); }

.cf-entry-card {
  background: var(--surface-card);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
}
.cf-entry-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}
.cf-entry-card__left {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.cf-entry-card__right {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.cf-entry-card__badge {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
}
.cf-entry-card__badge--income {
  background: #dcfce7;
  color: #166534;
}
.cf-entry-card__name  { font-weight: 600; color: var(--ink); }
.cf-entry-card__category { font-size: .8rem; color: var(--stone); }
.cf-entry-card__amount { font-weight: 700; color: var(--ink); }
.cf-entry-card__currency { font-size: .8rem; color: var(--stone); }
.cf-entry-card__recurrence { font-size: .78rem; color: var(--stone); }
.cf-entry-card__date { font-size: .8rem; color: var(--stone); }
.cf-entry-card__notes {
  margin-top: .5rem;
  font-size: .82rem;
  color: var(--stone);
  font-style: italic;
}


/* ── Mobile: touch targets ── */
@media (max-width: 768px) {
  .btn--icon,
  .hamburger-btn,
  .app-header__ctrl-btn,
  .app-header__signout,
  .app-header__nav-link,
  .app-header__cta {
    min-width: 44px;
    min-height: 44px;
  }
}

/* ── Mobile: header overflow ── */
@media (max-width: 640px) {
  .app-header__tenant-btn span {
    display: block;
    max-width: 80px;
  }
  .app-header__tenant-btn .bi-chevron-down {
    display: none;
  }
}

/* ── Mobile: unauth header — hide secondary controls to expose Sign In + Start Free ── */
@media (max-width: 480px) {
  .app-header--unauth .app-header__ctrl-btn {
    display: none;
  }
  /* Keep the language toggle reachable on mobile (theme stays hidden to save space). */
  .app-header--unauth .app-header__ctrl-btn:has(.bi-globe2) {
    display: inline-flex;
  }
  .app-header__contact {
    display: none;
  }
  .app-header--unauth {
    padding-left: 8px;
    padding-right: 8px;
    gap: 4px;
  }
  .app-header--unauth .app-header__brand {
    font-size: 13px;
  }
  .app-header--unauth .app-header__nav-link {
    padding-left: 6px;
    padding-right: 6px;
    font-size: 14px;
  }
  .app-header__cta {
    white-space: nowrap;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 14px;
  }
}

/* ── Table scroll: applies to cards containing tables ── */
@media (max-width: 768px) {
  .card__body,
  .card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Table scroll: explicit wrapper for bare tables ── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Prevent tables from collapsing below readable width ── */
@media (max-width: 768px) {
  .data-table,
  .table,
  .sku-compare-table {
    min-width: 480px;
  }
}

/* ── Finance startup pages (#581): moved out of per-page <style> blocks, which were
      dropped by Drapo sector injection. Namespaced by page prefix. ───────────── */

/* AI Token Expenses (#564) */
.ai-exp-tabs { display:flex; gap:.5rem; margin:1.25rem 0 .5rem; flex-wrap:wrap; }
.ai-exp-tab { padding:.45rem .9rem; border-radius:9999px; border:1px solid var(--border,#e5e7eb); background:transparent; cursor:pointer; font-weight:600; font-size:.85rem; }
.ai-exp-tab--active { background:var(--primary,#2563eb); color:#fff; border-color:var(--primary,#2563eb); }
.ai-exp-total { font-size:1.35rem; font-weight:700; margin:.5rem 0 1rem; }
.ai-exp-source { font-size:.7rem; font-weight:600; padding:.15rem .5rem; border-radius:9999px; background:rgba(37,99,235,.12); color:#2563eb; text-transform:capitalize; }

/* Cloud Credits (#571) */
.cc-tabs { display:flex; gap:.5rem; margin:1.25rem 0 .75rem; flex-wrap:wrap; }
.cc-tab { padding:.45rem .9rem; border-radius:9999px; border:1px solid var(--border,#e5e7eb); background:transparent; cursor:pointer; font-weight:600; font-size:.85rem; }
.cc-tab--active { background:var(--primary,#2563eb); color:#fff; border-color:var(--primary,#2563eb); }
.cc-bar { background:rgba(0,0,0,.08); border-radius:9999px; height:8px; width:120px; overflow:hidden; }
.cc-bar__fill { height:100%; background:#2563eb; }
.cc-badge { font-size:.7rem; font-weight:600; padding:.15rem .5rem; border-radius:9999px; background:rgba(100,116,139,.15); color:#475569; }
.cc-badge--warn { background:rgba(245,158,11,.15); color:#b45309; }
.cc-badge--info { background:rgba(37,99,235,.12); color:#2563eb; }
.cc-badge--danger { background:rgba(239,68,68,.15); color:#dc2626; }
.cc-summary-cards { display:flex; gap:1rem; flex-wrap:wrap; margin-bottom:1rem; }
.cc-summary-card { border:1px solid var(--border,#e5e7eb); border-radius:12px; padding:1rem 1.25rem; min-width:200px; }
.cc-summary-card__value { font-size:1.5rem; font-weight:700; }
.cc-warning { padding:.5rem .75rem; border-left:3px solid #f59e0b; background:rgba(245,158,11,.08); border-radius:4px; margin-bottom:.5rem; }

/* Burn Rate & Runway (#576) */
.rw-grid { display:flex; gap:1rem; flex-wrap:wrap; margin:1rem 0; }
.rw-card { border:1px solid var(--border,#e5e7eb); border-radius:12px; padding:1rem 1.25rem; min-width:200px; flex:1; }
.rw-card__label { font-size:.8rem; color:var(--text-muted,#64748b); }
.rw-card__value { font-size:1.6rem; font-weight:700; margin-top:.25rem; }
.rw-card__sub { font-size:.75rem; color:var(--text-muted,#64748b); }
.rw-badge { font-size:.8rem; font-weight:700; padding:.25rem .7rem; border-radius:9999px; }
.rw-badge--healthy { background:rgba(34,197,94,.15); color:#16a34a; }
.rw-badge--caution { background:rgba(245,158,11,.15); color:#b45309; }
.rw-badge--critical { background:rgba(239,68,68,.15); color:#dc2626; }
.rw-badge--unlimited { background:rgba(37,99,235,.12); color:#2563eb; }
.rw-warning { padding:.6rem .9rem; border-left:3px solid #ef4444; background:rgba(239,68,68,.08); border-radius:4px; margin:.5rem 0 1rem; font-weight:600; }
.rw-scenario { border:1px dashed var(--border,#e5e7eb); border-radius:12px; padding:1rem 1.25rem; margin-top:1.5rem; }

/* Startup Snapshot (#578) */
.sn-head { display:flex; align-items:center; gap:1rem; flex-wrap:wrap; margin-top:.5rem; }
.sn-badge { font-size:.85rem; font-weight:700; padding:.3rem .8rem; border-radius:9999px; }
.sn-badge--healthy { background:rgba(34,197,94,.15); color:#16a34a; }
.sn-badge--caution { background:rgba(245,158,11,.15); color:#b45309; }
.sn-badge--critical { background:rgba(239,68,68,.15); color:#dc2626; }
.sn-grid { display:flex; gap:1rem; flex-wrap:wrap; margin:1.25rem 0; }
.sn-card { border:1px solid var(--border,#e5e7eb); border-radius:12px; padding:1rem 1.25rem; min-width:200px; flex:1; }
.sn-card__label { font-size:.8rem; color:var(--text-muted,#64748b); }
.sn-card__value { font-size:1.5rem; font-weight:700; margin-top:.25rem; }
.sn-notset { font-size:1.1rem; font-weight:600; color:var(--text-muted,#94a3b8); }
.sn-notset__hint { font-size:.72rem; color:var(--text-muted,#94a3b8); font-weight:400; }
.sn-attention { padding:.6rem .9rem; border-left:3px solid #f59e0b; background:rgba(245,158,11,.08); border-radius:4px; margin-bottom:.5rem; }
.sn-copied { color:#16a34a; font-weight:600; font-size:.85rem; margin-left:.75rem; }

/* Shared form-error style for inline validation feedback (#580) */
.form-error { color:#dc2626; background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.25); border-radius:6px; padding:.5rem .75rem; margin:.5rem 0; font-size:.85rem; font-weight:600; }
