/* --- Design tokens --- */
:root {
  --font-sans: 'DM Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-text-muted-2: #94a3b8;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-success: #059669;
  --color-error: #dc2626;
  --color-danger: #b91c1c;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --touch-min: 44px;
  --container-max: 800px;
  --header-safe: env(safe-area-inset-top, 0);
  --bottom-safe: env(safe-area-inset-bottom, 0);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  min-height: calc(100vh + env(safe-area-inset-bottom, 0));
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: calc(var(--space-4) + var(--header-safe));
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- App layout (sidebar + main) --- */
.app-layout {
  display: flex;
  height: 100vh;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.sidebar {
  flex: 0 0 auto;
  width: 220px;
  min-width: 200px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-2);
  padding-top: calc(var(--space-4) + var(--header-safe));
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.sidebar-radar-svg { display: block; }

.sidebar-sweep {
  transform-origin: 12px 12px;
  animation: sidebar-radar-spin 4s linear infinite;
}

@keyframes sidebar-radar-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.sidebar-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.sidebar-logo:hover {
  color: var(--color-primary);
}

.sidebar-upload-wrap {
  margin-bottom: var(--space-5);
}

.sidebar-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-min);
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.sidebar-upload-btn:hover {
  background: var(--color-primary-hover);
}

.sidebar-upload-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.sidebar-upload-icon {
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 400;
}

.sidebar-tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: inherit;
}

.sidebar-tab-icon svg {
  width: 100%;
  height: 100%;
}

.sidebar-close {
  display: none;
  width: var(--touch-min);
  height: var(--touch-min);
  padding: 0;
  border: none;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--color-text-muted);
}

.sidebar-close::after {
  content: '×';
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

.sidebar-nav .tab {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-min);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  width: 100%;
}

.sidebar-nav .tab:hover {
  color: var(--color-text);
  background: var(--color-bg);
}

.sidebar-nav .tab.active {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.sidebar-footer {
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.sidebar-footer .user-pill {
  display: inline-block;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: calc(var(--space-3) + var(--header-safe));
  left: calc(var(--space-3) + env(safe-area-inset-left, 0));
  z-index: 50;
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: 0;
  border: none;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--color-text);
}

.sidebar-toggle::before {
  content: '☰';
}

.app-center {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.main-content {
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: var(--space-6) var(--space-2);
  padding-top: calc(var(--space-6) + var(--header-safe));
  padding-bottom: var(--space-6);
  position: relative;
  overflow-x: hidden;
}

@media (max-width: 430px) {
  .main-content {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}

@media (max-width: 320px) {
  .main-content {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }
}

/* --- Settings page (card layout) --- */
.settings-page {
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-bottom: var(--space-8);
}

.settings-page-title {
  margin-bottom: var(--space-4);
}

.settings-subnav-wrap {
  margin-bottom: var(--space-6);
}

.settings-subtab-label {
  display: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.settings-subtab-select {
  display: none;
  width: 100%;
  max-width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  margin-bottom: var(--space-4);
}

.settings-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-1);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.settings-subnav-btn {
  flex: 1 1 auto;
  min-height: var(--touch-min);
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.settings-subnav-btn:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.6);
}

.settings-subnav-btn.active {
  color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.settings-panels {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.settings-panel.hidden {
  display: none !important;
}

.settings-subheading {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.settings-subheading:first-child {
  margin-top: 0;
}

.settings-toggle {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 0.9375rem;
  color: var(--color-text);
  cursor: pointer;
  margin-bottom: var(--space-2);
}

.settings-toggle input {
  margin-top: 0.35em;
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
}

.settings-helper-indented {
  margin: calc(var(--space-2) * -1) 0 var(--space-3);
  padding-left: calc(1.125rem + var(--space-3));
  max-width: 42rem;
}

.settings-field-narrow {
  max-width: 22rem;
  margin-top: var(--space-3);
}

.settings-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.settings-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.settings-card-title {
  margin: 0 0 var(--space-4);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.settings-card-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.settings-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}

.settings-field input {
  padding: var(--space-2) var(--space-3);
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  max-width: 100%;
}

.settings-field input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.settings-field-readonly {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: 1rem;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  min-height: 2.5rem;
}

.settings-helper {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.settings-status {
  margin-top: var(--space-2);
}

.settings-provider-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.settings-provider-status.hidden {
  display: none !important;
}

.settings-provider-label {
  font-size: 0.875rem;
  color: var(--color-text);
}

.settings-provider-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-success);
  background: rgba(5, 150, 105, 0.1);
  border-radius: var(--radius-sm);
}

.settings-provider-check {
  font-size: 0.875rem;
}

.settings-actions-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.settings-action-btn {
  align-self: flex-start;
}

.settings-action-danger {
  color: var(--color-error);
  border-color: var(--color-error);
}

.settings-action-danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

/* Danger zone card */
.settings-card-danger {
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.02);
}

.settings-card-title-danger {
  color: var(--color-error);
}

.settings-danger-desc {
  margin: 0 0 var(--space-4);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.settings-trust-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.5;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 767px) {
  .settings-page {
    padding-bottom: var(--space-6);
  }

  .settings-card {
    padding: var(--space-4);
  }

  .settings-subtab-label,
  .settings-subtab-select {
    display: block;
  }

  .settings-subnav {
    display: none;
  }

  .settings-card .settings-action-btn,
  .settings-card .btn-primary,
  .settings-card .btn-secondary,
  .settings-card .btn-delete-account {
    width: 100%;
    justify-content: center;
    min-height: var(--touch-min);
  }

  .settings-actions-stack {
    display: flex;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .settings-page-title {
    margin-bottom: var(--space-4);
  }

  .settings-cards {
    gap: var(--space-4);
  }
}

.upload-input-hidden {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Sidebar backdrop (mobile): visible when sidebar is open, tap to close */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(15, 23, 42, 0.4);
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    width: min(280px, 85vw);
    max-width: 100%;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
    padding-bottom: calc(var(--space-4) + var(--bottom-safe));
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .app-layout:has(.sidebar.sidebar-open) .sidebar-backdrop {
    display: block;
  }

  .sidebar-close {
    display: flex;
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    padding-bottom: 320px;
  }
}

@media (max-width: 768px) and (max-height: 500px) {
  .main-content {
    padding-bottom: 280px;
  }
}

@media (min-width: 769px) {
  .sidebar-toggle {
    display: none;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .main-content {
    padding-bottom: 340px;
  }
}

@media (min-width: 1024px) {
  .main-content {
    padding-bottom: var(--space-6);
  }
}

/* --- Layout (legacy container for any remaining uses) --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
  padding-top: calc(var(--space-6) + var(--header-safe));
  padding-bottom: 320px;
}

@media (max-width: 480px) {
  .container {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}

/* --- Header --- */
header {
  text-align: center;
  margin-bottom: var(--space-6);
}

header h1 {
  margin: 0 0 var(--space-1);
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.user-bar {
  margin: var(--space-3) 0 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.user-pill {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.8125rem;
}

.user-pill:empty {
  display: none;
}

/* --- Tabs (responsive) --- */
.tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-min);
  min-width: 4rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab:hover {
  color: var(--color-text);
}

.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-panel {
  animation: tabIn 0.2s ease-out;
}

.tab-panel.hidden {
  display: none;
}

@keyframes tabIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* --- Page titles (all panels, same size) --- */
.page-title,
.card .page-title {
  margin: 0 0 var(--space-2);
  font-size: clamp(1.125rem, 4vw, 1.25rem);
  font-weight: 700;
  color: var(--color-text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* --- Sidebar tab labels (same size for all tabs) --- */
.sidebar-tab-label {
  font-size: 0.9375rem;
  font-weight: 500;
}

/* --- Home overview --- */
.home-section {
  margin-bottom: 0;
}

.home-section .page-title {
  margin-bottom: var(--space-4);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

/* Savings banner (CTA on home) */
.home-savings-banner-wrap {
  margin-bottom: var(--space-6);
}

.home-savings-banner-wrap.hidden {
  display: none;
}

.home-savings-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.08) 0%, rgba(37, 99, 235, 0.06) 100%);
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: var(--radius-lg);
}

@media (max-width: 430px) {
  .home-savings-banner {
    padding: var(--space-3) var(--space-4);
  }

  .home-savings-banner-cta {
    width: 100%;
    justify-content: center;
    min-height: var(--touch-min);
  }
}

.home-savings-banner-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.home-savings-banner-cta {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-success);
  background: rgba(5, 150, 105, 0.12);
  border: 1px solid rgba(5, 150, 105, 0.3);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.home-savings-banner-cta:hover {
  background: rgba(5, 150, 105, 0.2);
  border-color: var(--color-success);
}

/* Section separation */
.home-subsection-card {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}

.home-subsection-card:first-of-type {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
}

.home-overview {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

@media (min-width: 480px) {
  .home-overview {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.home-card {
  display: block;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.home-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.home-card-title {
  margin: 0 0 var(--space-3);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.home-card-row {
  display: flex;
  gap: var(--space-2);
  font-size: 0.875rem;
  margin-bottom: var(--space-1);
}

.home-card-row:last-child {
  margin-bottom: 0;
}

.home-card-label {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.home-card-value {
  color: var(--color-text);
  min-width: 0;
}

.home-card-muted {
  color: var(--color-text-muted-2);
  font-style: italic;
}

/* --- Reminder banner (important deadlines) — fixed overlay --- */
.reminder-banner-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-3) var(--space-4);
  padding-top: calc(var(--space-3) + var(--header-safe));
  pointer-events: none;
}

.reminder-banner-wrap.hidden {
  display: none;
}

.reminder-banner {
  pointer-events: auto;
  padding: var(--space-4) var(--space-5);
  max-width: var(--container-max);
  margin: 0 auto;
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(245, 158, 11, 0.25);
  border: 1px solid var(--color-reminder-border, #f59e0b);
}

.reminder-banner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.reminder-banner-message {
  font-weight: 600;
  font-size: 0.9375rem;
  flex: 1;
  min-width: 0;
  color: var(--color-reminder-text, #92400e);
}

.reminder-banner-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.reminder-banner-expand-btn {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-reminder-text, #92400e);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2) 0;
  text-decoration: underline;
}

.reminder-banner-expand-btn:hover {
  color: var(--color-primary);
}

.reminder-banner-expand-btn.hidden {
  display: none;
}

.reminder-banner-list {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
}

.reminder-banner-list.hidden {
  display: none;
}

.reminder-banner-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.reminder-banner-list-item:last-child {
  border-bottom: none;
}

.reminder-banner-list-item-name {
  font-weight: 500;
  font-size: 0.875rem;
  min-width: 0;
}

.reminder-banner-list-item .reminder-banner-btn {
  flex-shrink: 0;
}

.reminder-banner-btn {
  padding: var(--space-2) var(--space-3);
  min-height: var(--touch-min);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  border: 1px solid var(--color-reminder-border, #f59e0b);
  background: var(--color-surface);
  color: var(--color-reminder-text, #92400e);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.reminder-banner-btn:hover {
  background: var(--color-reminder-border, #f59e0b);
  color: var(--color-surface);
}

.reminder-banner-dismiss {
  padding: 0 var(--space-2);
  font-size: 1.25rem;
  line-height: 1;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
}

.reminder-banner-never {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0 var(--space-1);
}

.reminder-banner-never:hover {
  color: var(--color-text);
}

/* Per-deadline list (when "don't show again" is set) */
.reminder-deadlines-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-3) var(--space-4);
  padding-top: calc(var(--space-3) + var(--header-safe));
  pointer-events: none;
}

.reminder-deadlines-wrap.hidden {
  display: none;
}

.reminder-deadlines-card {
  pointer-events: auto;
  max-width: var(--container-max);
  margin: 0 auto;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(245, 158, 11, 0.2);
  border: 1px solid var(--color-reminder-border, #f59e0b);
  overflow: hidden;
}

.reminder-deadlines-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-reminder-bg, #fef3c7);
  color: var(--color-reminder-text, #92400e);
  font-weight: 600;
  font-size: 0.9375rem;
}

.reminder-deadlines-close {
  padding: 0 var(--space-2);
  font-size: 1.25rem;
  line-height: 1;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

.reminder-deadlines-list {
  max-height: 60vh;
  overflow: auto;
}

.reminder-deadline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.15s ease;
}

.reminder-deadline-item:last-child {
  border-bottom: none;
}

.reminder-deadline-item:hover {
  background: var(--color-bg);
}

.reminder-deadline-info {
  min-width: 0;
}

.reminder-deadline-name {
  font-weight: 500;
  display: block;
}

.reminder-deadline-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.reminder-deadline-view {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-reminder-border, #f59e0b);
  background: var(--color-surface);
  color: var(--color-reminder-text, #92400e);
  cursor: pointer;
}

.reminder-deadline-view:hover {
  background: var(--color-reminder-border, #f59e0b);
  color: var(--color-surface);
}

/* --- Reminders list (tab) --- */
.reminders-section .home-title {
  margin: 0 0 var(--space-1);
}

.reminders-list {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

@media (min-width: 640px) {
  .reminders-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.reminder-card {
  display: block;
}

.reminder-card-meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.reminder-card-actions {
  margin-top: var(--space-2);
}

.reminder-card-row.reminder-card-action .reminder-card-date {
  font-weight: 500;
}

.reminders-empty {
  text-align: center;
  padding: var(--space-6) var(--space-4);
}

.reminders-empty .reminders-empty-text {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
}

/* --- Overview: summary row & subsections --- */
.home-summary-row {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: var(--space-2);
}

@media (max-width: 767px) {
  .home-summary-row {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .home-summary-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.summary-card {
  padding: var(--space-4) var(--space-5);
  padding-right: calc(var(--space-5) + 2.1rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  min-height: 0;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.summary-card-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 750;
  color: var(--color-text);
  margin: 0 0 var(--space-1);
  letter-spacing: -0.025em;
  line-height: 1.3;
  overflow-wrap: anywhere;
  min-width: 0;
}

.summary-card-value-amount {
  display: block;
}

.summary-card-value-unit {
  display: block;
  font-size: clamp(0.95rem, 0.6vw + 0.82rem, 1.05rem);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.summary-card-label {
  font-size: 0.875rem;
  color: var(--color-text-muted-2);
  margin: 0;
  font-weight: 550;
  letter-spacing: -0.005em;
  line-height: 1.3;
  min-height: calc(1.3em * 2);
  overflow-wrap: anywhere;
}

.summary-card-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}

.summary-card--active {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.26);
}
.summary-card--active .summary-card-icon {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.13);
  border-color: rgba(59, 130, 246, 0.28);
}

.summary-card--monthly {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.3);
}
.summary-card--monthly .summary-card-icon {
  color: #b45309;
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.34);
}

.summary-card--yearly {
  background: rgba(139, 92, 246, 0.10);
  border-color: rgba(139, 92, 246, 0.3);
}
.summary-card--yearly .summary-card-icon {
  color: #6d28d9;
  background: rgba(139, 92, 246, 0.16);
  border-color: rgba(139, 92, 246, 0.34);
}

.summary-card--deadline-calm {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.26);
}
.summary-card--deadline-calm .summary-card-icon {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.13);
  border-color: rgba(59, 130, 246, 0.28);
}

.summary-card--deadline-warning {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.3);
}
.summary-card--deadline-warning .summary-card-icon {
  color: #b45309;
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.34);
}

.summary-card--deadline-urgent {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.3);
}
.summary-card--deadline-urgent .summary-card-icon {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.34);
}

.home-subsection {
  margin-top: 0;
}

.home-subsection-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 var(--space-4);
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.home-section .home-subsection-title:first-of-type {
  margin-top: 0;
}

.home-empty-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 22px 20px;
  margin: 16px 0 0;
  max-width: 520px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: #f5f8ff;
}

/* In the KPI grid, let the zero-contract card span full row width. */
.home-summary-row > .home-empty-card {
  grid-column: 1 / -1;
  justify-self: start;
  width: min(520px, 100%);
}

.home-empty-head {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
}

.home-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 24px;
  line-height: 1;
}

.home-empty-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text);
}

.home-empty-desc {
  margin: 0 0 8px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.home-empty-cta {
  margin-top: 0;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-primary);
  background: var(--color-surface);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}

.home-empty-cta:hover {
  background: var(--color-primary-light);
}

@media (max-width: 767px) {
  .home-empty-card {
    width: 100%;
    max-width: 100%;
    padding: 20px 16px;
  }
}

/* --- Reminder card: Upcoming Reminders mini-cards --- */

.home-reminders-inline {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.home-reminder-inline-item {
  display: block;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  font-size: 0.9375rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}

.home-reminder-inline-item:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06);
  transform: translateY(-2px);
  background: #f8faff;
}

.home-reminder-inline-item:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.home-reminder-inline-item strong {
  font-weight: 600;
}

/* --- Urgency accent variants --- */

.home-reminder--urgent {
  border-left-color: #ef4444;
}
.home-reminder--urgent:hover {
  border-color: #ef4444;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.12), 0 1px 3px rgba(15, 23, 42, 0.06);
}
.home-reminder--urgent .home-reminder-date-block {
  background: #fef2f2;
  border-color: #fecaca;
}
.home-reminder--urgent .home-reminder-date-month {
  color: #ef4444;
}
.home-reminder--urgent .home-reminder-date-day {
  color: #b91c1c;
}
.home-reminder--urgent .home-reminder-action-keyword {
  color: #ef4444;
}

.home-reminder--warning {
  border-left-color: #f59e0b;
}
.home-reminder--warning:hover {
  border-color: #f59e0b;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.12), 0 1px 3px rgba(15, 23, 42, 0.06);
}
.home-reminder--warning .home-reminder-date-block {
  background: #fffbeb;
  border-color: #fde68a;
}
.home-reminder--warning .home-reminder-date-month {
  color: #f59e0b;
}
.home-reminder--warning .home-reminder-date-day {
  color: #92400e;
}
.home-reminder--warning .home-reminder-action-keyword {
  color: #d97706;
}

.home-reminder--normal {
  border-left-color: var(--color-primary);
}
.home-reminder--normal .home-reminder-date-block {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.home-reminder--normal .home-reminder-date-month {
  color: var(--color-primary);
}
.home-reminder--normal .home-reminder-date-day {
  color: #1e40af;
}
.home-reminder--normal .home-reminder-action-keyword {
  color: var(--color-primary);
}

/* --- Calendar-style date block --- */

.home-reminder-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--space-4);
  align-items: center;
}

@media (max-width: 320px) {
  .home-reminder-layout {
    column-gap: var(--space-3);
  }
}

.home-reminder-date-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  min-height: 3.25rem;
  border-radius: var(--radius-md);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 0.25rem 0;
  flex-shrink: 0;
}

.home-reminder-date-month {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--color-primary);
}

.home-reminder-date-day {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.15;
  color: #1e40af;
}

/* --- Content section --- */

.home-reminder-content {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

.home-reminder-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.35;
}

.home-reminder-action-text {
  display: inline;
}

.home-reminder-days {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.home-reminder--urgent .home-reminder-days {
  color: #dc2626;
}

.home-reminder-cta {
  align-self: flex-start;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.home-reminder-cta:hover {
  background: var(--color-primary-light);
}

.home-reminder-action-keyword {
  font-weight: 700;
  color: var(--color-primary);
}

.home-reminder-main-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.home-reminder-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.home-reminder-text-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.home-reminder-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.home-reminder-description {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--color-text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  line-height: 1.3;
}

/* --- Example / empty state --- */

.example-tag {
  position: absolute;
  top: var(--space-2);
  right: var(--space-3);
  padding: 2px var(--space-2);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted-2);
  background: var(--color-border);
  border-radius: 999px;
}

.home-reminder-example {
  cursor: default;
  opacity: 0.75;
}

.home-reminder-example:hover {
  border-color: var(--color-border);
  box-shadow: none;
  transform: none;
  background: var(--color-surface);
}

.home-reminders-extra {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.home-reminders-extra.hidden {
  display: none;
}

.expand-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.expand-collapse-btn:hover {
  background: var(--color-primary-light);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.expand-collapse-btn:active {
  transform: scale(0.98);
}

.expand-collapse-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.home-savings-example {
  cursor: default;
  opacity: 0.95;
}

.home-savings-example:hover {
  border-color: var(--color-border);
  box-shadow: none;
}

.home-savings-teasers {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.home-savings-teaser {
  display: block;
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--color-primary-light) 0%, #fff 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.home-savings-teaser:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.home-savings-teaser-title {
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 0 0 var(--space-1);
  color: var(--color-text);
}

.home-savings-teaser-saving {
  font-size: 0.875rem;
  color: var(--color-success);
  font-weight: 500;
  margin: 0;
}

/* Savings opportunities */
.home-savings-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.home-savings-item:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.home-savings-item-content {
  flex: 1;
  min-width: 0;
}

.home-smart-recommendations {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.home-smart-item {
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-lg);
}

.home-smart-item-text {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text);
}

.home-savings-item-name {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 var(--space-1);
  overflow-wrap: anywhere;
}

.home-savings-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.home-savings-item-price {
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.home-savings-item-saving {
  font-weight: 600;
  color: var(--color-success);
  overflow-wrap: anywhere;
}

.home-savings-item-cta {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  margin-top: auto;
}

.home-savings-item-cta:hover {
  background: var(--color-primary-light);
}

.home-savings-item:not(.home-savings-example) {
  cursor: pointer;
}

.home-savings-example {
  cursor: default;
}

.home-savings-example:hover {
  border-color: var(--color-border);
  box-shadow: none;
}

/* Recent contracts */
.home-recent-contracts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.home-recent-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.home-recent-item:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.home-recent-item-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text);
}

.home-recent-item-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.home-recent-empty {
  margin: 0;
  padding: var(--space-4);
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-radius: var(--radius-md);
}

.home-reminders-empty,
.home-savings-empty {
  margin: 0 0 var(--space-3);
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.home-overview-empty .home-summary-row + .home-subsection,
.home-overview-empty .home-subsection {
  display: none;
}

.hidden {
  display: none !important;
}

/* --- Savings tab --- */
.savings-section .page-title {
  margin-bottom: var(--space-2);
}

.savings-card-contract-type {
  position: static;

  display: inline-flex;
  align-items: center;
  gap: 0.35rem;

  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #065f46;
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.16), rgba(5, 150, 105, 0.06));
  padding: 0.22rem 0.48rem;
  border-radius: 999px;
  border: 1px solid rgba(5, 150, 105, 0.28);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(5, 150, 105, 0.10) inset;

  white-space: nowrap;
  max-width: min(100%, 14rem);
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.savings-card-contract-type::before {
  content: '∞';
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #064e3b;
  background: rgba(5, 150, 105, 0.18);
  border: 1px solid rgba(5, 150, 105, 0.22);
  font-weight: 900;
  line-height: 1;
  font-size: 0.7rem;
}

/* Deal card styles */
.deal-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-3) 0;
}

.deal-list-extra {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.deal-list-extra.hidden {
  display: none;
}

.deal-card {
  padding: var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.deal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  opacity: 0;
  transition: opacity 0.15s ease;
}

.deal-card:hover {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-bg) 100%);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.deal-card:hover::before {
  opacity: 1;
}

.deal-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.deal-card-provider {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
  flex: 1 1 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.deal-card-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-success);
  background: rgba(34, 197, 94, 0.1);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  border: 1px solid rgba(34, 197, 94, 0.2);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.deal-card-badge-ai {
  color: #7c3aed; /* purple */
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.deal-card-badge-best {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.deal-card-top-tag {
  display: inline-block;
  margin: 0 0 var(--space-2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

.deal-card-top-tag-current {
  color: #075985;
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.28);
}

.deal-card-current-plan {
  border-style: dashed;
  border-color: rgba(14, 165, 233, 0.35);
}

.deal-card-why-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  border-radius: 0;
  border: 0;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  background: transparent;
  padding: 0 2px;
  text-decoration: underline;
  text-underline-offset: 2px;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  flex: 0 1 auto;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.deal-card-why-btn:hover {
  color: var(--color-text-muted);
}

button.deal-card-why-btn:hover:not(:disabled),
button.deal-card-why-btn:focus-visible {
  background: transparent;
  box-shadow: none;
}

.deal-why-popover {
  position: fixed;
  z-index: 2000;
  min-width: 220px;
  width: min(300px, calc(100vw - 20px));
  max-width: calc(100vw - 20px);
  max-height: min(60vh, 360px);
  overflow: auto;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: var(--shadow-md);
}

.deal-why-popover.hidden {
  display: none;
}

.deal-why-popover-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.deal-why-popover-list {
  margin: 0;
  padding-left: 16px;
  font-size: 0.78rem;
  line-height: 1.35;
}

.deal-why-popover-list li {
  margin: 0;
  word-break: break-word;
}

.deal-why-popover-close {
  position: absolute;
  top: 2px;
  right: 4px;
  border: 0;
  background: transparent;
  color: #cbd5e1;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 480px) {
  .deal-why-popover {
    min-width: 0;
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }
}

.deal-card-price {
  display: block;
  width: 100%;
  font-size: clamp(0.95rem, 1.15vw + 0.72rem, 1.2rem);
  color: var(--color-text);
  margin-bottom: var(--space-2);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.deal-card-benefits {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-4);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-wrap: anywhere;
}

.deal-card-benefit-contract-unlimited {
  font-weight: 700;
  color: #075985;
}

.deal-card-benefit-contract-unlimited::before {
  content: none;
}

.deal-contract-unlimited-label {
  font-weight: 800;
  color: #0369a1;
}

.deal-card-link {
  display: inline-block;
  font-size: 0.875rem;
  padding: var(--space-2) var(--space-3);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s ease;
  margin-top: auto;
  align-self: flex-start;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.deal-card-link:hover {
  background: var(--color-primary-hover);
}

.savings-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--color-text-muted);
}

.savings-no-deals-message {
  margin-top: var(--space-6);
  padding: var(--space-4);
  background: rgba(59, 130, 246, 0.05);
  border-left: 3px solid var(--color-info, #3b82f6);
  border-radius: var(--radius-sm);
  text-align: center;
}

.savings-no-deals-message p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

/* --- Savings: compact dashboard layout --- */

.savings-list {
  display: block;
  margin-top: var(--space-4);
}

.savings-summary-banner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(37, 99, 235, 0.06) 50%, #fff 100%);
  border: 1px solid rgba(34, 197, 94, 0.2);
  box-shadow: var(--shadow-sm);
}

.savings-summary-banner:has(.savings-summary-main--no-savings) {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.06) 0%, #fff 100%);
  border-color: var(--color-border);
}

.savings-summary-main--no-savings ~ .savings-summary-main,
.savings-summary-banner:has(.savings-summary-main--no-savings) {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.06) 0%, #fff 100%);
  border-color: var(--color-border);
}

.savings-summary-main {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.savings-summary-main--no-savings {
  background: transparent;
}

.savings-summary-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--color-primary-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

.savings-summary-icon-glyph {
  font-weight: 700;
}

.savings-summary-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.savings-summary-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.savings-summary-subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

@media (max-width: 640px) {
  .savings-summary-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.savings-filter-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
}

.savings-filter-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.savings-filter-bar::-webkit-scrollbar {
  display: none;
}

.savings-filter-chip {
  padding: var(--space-2) var(--space-3);
  min-height: var(--touch-min);
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-radius: 999px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.savings-filter-chip:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.savings-filter-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4);
}

.savings-filter-chip-active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.savings-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

@media (min-width: 1200px) {
  .savings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .savings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .savings-grid {
    grid-template-columns: 1fr;
  }
}

.savings-compact-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.savings-card-fixed {
  min-height: 200px;
}

.savings-compact-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.savings-compact-card-no-deals {
  background: var(--color-bg);
  opacity: 0.95;
}

.savings-compact-header {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-right: 0;
  position: relative;
}

.savings-compact-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);

  flex: 1;
  min-width: 0;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.savings-compact-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--space-3);
}

.savings-compact-provider {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.savings-compact-provider-label {
  margin: var(--space-1) 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted-2);
}

.savings-compact-current-price {
  margin: 0;
  display: block;
  width: 100%;
  font-size: clamp(1rem, 1.5vw + 0.78rem, 1.25rem);
  font-weight: 700;
  color: var(--color-primary);
  overflow-wrap: anywhere;
}

@media (max-width: 360px) {
  .savings-compact-header {
    padding-right: 0;
  }
}

@media (max-width: 767px) {
  .home-savings-item {
    grid-template-columns: 1fr;
  }

  .home-savings-item-cta {
    width: 100%;
    text-align: center;
  }

  .savings-compact-title {
    display: block;
    -webkit-line-clamp: unset;
  }
}

.savings-indicator {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border-left: 3px solid transparent;
  background: var(--color-bg);
}

.savings-indicator-positive {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14) 0%, rgba(34, 197, 94, 0.03) 100%);
  border-color: var(--color-success);
}

.savings-indicator-neutral {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.12) 0%, rgba(148, 163, 184, 0.03) 100%);
  border-color: var(--color-border-strong);
}

.savings-indicator-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.savings-indicator-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.savings-compact-best-deal {
  margin: var(--space-3) 0 0;
  font-size: 0.875rem;
  color: var(--color-text);
}

.savings-compact-best-deal-name {
  font-weight: 600;
}

.savings-compact-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-3);
  flex-wrap: wrap;
}

.savings-compact-footer .btn-primary {
  flex: 1;
  min-width: 0;
}

.savings-compact-footer .btn-secondary {
  font-size: 0.8125rem;
  padding-inline: var(--space-3);
}

@media (max-width: 480px) {
  .savings-compact-footer > .btn-primary,
  .savings-compact-footer > .btn-secondary,
  .savings-compact-footer > .view-contract-link {
    flex: 1 1 100%;
    width: 100%;
  }
}

.savings-detail-panel {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  animation: tabIn 0.2s ease-out;
}

.savings-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.savings-detail-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.savings-detail-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.savings-detail-deals .deal-card {
  background: var(--color-bg);
}

.savings-detail-footer {
  margin-top: var(--space-3);
}

.savings-general-deals {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* --- Savings deal panel: right-side sliding drawer (matches chat panel) --- */
.savings-deal-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

/* Defensive visibility gate: prevents partially visible close button on some mobile Safari builds. */
.savings-deal-panel[aria-hidden="true"] {
  display: none;
}

.savings-deal-panel[aria-hidden="false"] {
  display: block;
}

.savings-deal-panel-closed {
  pointer-events: none;
}

.savings-deal-panel-closed .savings-deal-panel-content {
  transform: translateX(100%);
}

.savings-deal-panel-open {
  pointer-events: auto;
}

.savings-deal-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.savings-deal-panel-open .savings-deal-panel-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.savings-deal-panel-content {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  min-width: 320px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: -4px 0 24px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(100%);
}

.savings-deal-panel-open .savings-deal-panel-content {
  transform: translateX(0);
}

@media (max-width: 767px) {
  .savings-deal-panel-content {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
}

.savings-deal-panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.savings-deal-panel-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
}

.savings-deal-panel-close {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.savings-deal-panel-close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.savings-deal-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4);
}

.savings-deal-panel-current,
.savings-deal-panel-best {
  padding: var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.savings-deal-panel-label {
  margin: 0 0 var(--space-1);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.savings-deal-panel-price {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}

.savings-deal-panel-provider {
  margin: var(--space-1) 0 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

.savings-deal-panel-savings {
  margin: var(--space-2) 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-success);
}

.savings-deal-panel-current-meta {
  margin: var(--space-1) 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.35;
}

.savings-deal-panel-reason {
  margin: var(--space-1) 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.35;
}

.savings-deal-panel-deals-title {
  margin: 0 0 var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.savings-deal-panel-deals .deal-card {
  margin-bottom: var(--space-2);
}

.savings-deal-panel-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-4);
  margin-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.savings-deal-switch-provider:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

body.savings-deal-panel-open-body {
  overflow: hidden;
}

@media (max-width: 480px) {
  .savings-deal-panel-content {
    max-width: 100%;
    min-width: 0;
  }
}

/* --- Empty states --- */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.home-overview-empty {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
  opacity: 0.8;
}

.empty-state-title {
  margin: 0 0 var(--space-2);
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text);
}

.empty-state-desc {
  margin: 0 0 var(--space-5);
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.empty-state-cta {
  margin: 0;
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

@media (max-width: 430px) {
  .card {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
  }
}

@media (max-width: 320px) {
  .card {
    padding: var(--space-3);
    margin-bottom: var(--space-3);
  }
}

.card h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.125rem;
  font-weight: 600;
}

/* --- Coming Soon (Savings, Reminders) --- */
.coming-soon-section {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  align-items: center;
  padding: var(--space-6);
}

.coming-soon-content {
  flex: 1 1 280px;
  min-width: 0;
}

.coming-soon-title {
  margin: 0 0 var(--space-1);
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.coming-soon-subtitle {
  margin: 0 0 var(--space-4);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.coming-soon-desc {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

.coming-soon-illustration {
  flex: 1 1 240px;
  min-width: 200px;
  max-width: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.coming-soon-svg {
  width: 100%;
  height: auto;
  max-height: 200px;
}

.hint {
  margin: 0 0 var(--space-4);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.optional {
  font-weight: 400;
  color: var(--color-text-muted);
}

/* --- Forms (global) --- */
form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  max-width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  min-height: var(--touch-min);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted-2);
}

input[type="file"] {
  padding: var(--space-3);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  font-size: 0.9rem;
  min-height: var(--touch-min);
}

.upload-form .upload-zone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: var(--space-6);
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 0;
}

.upload-form .upload-zone:hover,
.upload-form .upload-zone:focus-within {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.upload-form .upload-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.upload-form .upload-zone-text {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  pointer-events: none;
}

.upload-form .upload-zone:hover .upload-zone-text,
.upload-form .upload-zone:focus-within .upload-zone-text {
  color: var(--color-primary);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

textarea:disabled,
input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

button {
  padding: var(--space-3) var(--space-5);
  min-height: var(--touch-min);
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s;
}

button:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

button:disabled {
  background: var(--color-text-muted-2);
  cursor: not-allowed;
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

button.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

button.btn-secondary:hover:not(:disabled) {
  background: var(--color-primary-light);
}

.status {
  margin-top: var(--space-2);
  font-size: 0.9rem;
  min-height: 1.25rem;
}

.status.success {
  color: var(--color-success);
}

.status.error {
  color: var(--color-error);
}

.status.loading {
  color: var(--color-text-muted);
}

.status.info {
  color: var(--color-primary);
}

/* --- Toasts --- */
.toast-container {
  position: fixed;
  bottom: calc(var(--space-4) + var(--bottom-safe) + 60px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: calc(100vw - var(--space-8));
  width: min(var(--container-max), calc(100vw - var(--space-4)));
  pointer-events: none;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  box-sizing: border-box;
}

.toast {
  padding: var(--space-4) var(--space-5);
  background: var(--color-text);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.25s ease-out;
}

.toast.toast-error {
  background: var(--color-error);
}

.toast.toast-success {
  background: var(--color-success);
}

.toast.toast-info {
  background: var(--color-primary);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Skeleton loaders --- */
.skeleton {
  background: linear-gradient(90deg, var(--color-border) 25%, var(--color-border-strong) 50%, var(--color-border) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
  to {
    background-position: 200% 0;
  }
}

.documents-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.documents-skeleton .skeleton-item {
  height: 56px;
}

/* --- Auth screen --- */
.auth-screen {
  min-height: 100vh;
  min-height: calc(100vh - var(--header-safe) - var(--bottom-safe));
  display: flex;
  flex-direction: column;
  padding: var(--space-3) var(--space-4);
  padding-left: calc(var(--space-4) + env(safe-area-inset-left, 0));
  padding-right: calc(var(--space-4) + env(safe-area-inset-right, 0));
}

/* Stack above app chrome (upload overlay, chat, savings drawer) if anything fixed leaks above a hidden #appScreen */
.auth-screen:not(.hidden) {
  position: relative;
  z-index: 500;
  isolation: isolate;
}

@media (min-width: 769px) {
  .auth-screen {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }
}
.auth-screen-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 0;
}

@media (max-width: 768px) {
  .auth-screen-center {
    padding: var(--space-2) 0;
  }
}

.auth-main {
  width: 100%;
  max-width: 600px;
  display: flex;
  justify-content: center;
}

.auth-screen.hidden {
  display: none;
}

.app-screen.hidden {
  display: none;
}

.auth-card {
  max-width: 400px;
  width: 100%;
}

.auth-card h1 {
  margin: 0 0 var(--space-2);
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  font-weight: 700;
}

/* --- Auth card: premium, ~580–590px desktop, lighter shell --- */
.auth-card-new {
  width: 100%;
  max-width: calc(100vw - var(--space-8));
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  border-top: 2px solid var(--color-primary);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 28px rgba(15, 23, 42, 0.06);
}

@media (min-width: 769px) {
  .auth-card-new {
    max-width: min(580px, calc(100vw - var(--space-8)));
    padding: var(--space-4) var(--space-6);
  }
}

@media (max-width: 430px) {
  .auth-card-new {
    padding: var(--space-4) var(--space-4);
    max-width: calc(100% - var(--space-4));
  }
}

@media (max-width: 390px) {
  .auth-card-new {
    padding: var(--space-4) var(--space-3);
  }
}

@media (max-width: 320px) {
  .auth-card-new {
    padding: var(--space-3) var(--space-3);
    max-width: 100%;
  }
}

/* --- Auth radar branding --- */
.auth-brand-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.auth-radar-icon {
  flex-shrink: 0;
}

.auth-radar-svg {
  display: block;
}

.radar-sweep-line {
  transform-origin: 24px 24px;
  animation: radar-sweep 3s linear infinite;
}

.radar-blip {
  opacity: 0;
}

.radar-blip-1 { animation: radar-blip 3s ease-out 0.3s infinite; }
.radar-blip-2 { animation: radar-blip 3s ease-out 1.1s infinite; }
.radar-blip-3 { animation: radar-blip 3s ease-out 2.0s infinite; }

@keyframes radar-sweep {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes radar-blip {
  0%, 15% { opacity: 0; }
  20%     { opacity: 0.9; }
  60%     { opacity: 0.3; }
  100%    { opacity: 0; }
}

.auth-card-new .auth-brand {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--color-text);
}

.auth-tagline-main {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.auth-tagline-sub {
  margin: var(--space-2) 0 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* Trust row – extra breathing room after supporting sentence; tighter before Google */
.auth-trust-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px var(--space-2);
  margin: var(--space-3) 0 var(--space-2);
  padding: 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.2;
}

@media (min-width: 769px) {
  .auth-trust-row {
    flex-wrap: nowrap;
    gap: var(--space-2);
    margin: var(--space-3) 0 var(--space-2);
  }
}

.auth-trust-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(241, 245, 249, 0.55);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.auth-trust-icon {
  flex-shrink: 0;
  display: block;
}

.auth-trust-icon-shield {
  color: #0d9488;
  opacity: 0.88;
}

.auth-trust-icon-globe {
  color: #3b82f6;
  opacity: 0.88;
}

.auth-trust-icon-lock {
  color: #64748b;
  opacity: 0.8;
}

/* Auth divider – keep space above; pull email field closer (less margin below) */
.auth-divider {
  margin: var(--space-4) 0 var(--space-2) 0;
}

.auth-divider.hidden {
  display: none !important;
}

.auth-divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted-2);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.auth-divider-text::before,
.auth-divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border) 12%, var(--color-border) 88%, transparent);
  opacity: 0.9;
}

/* Forgot password link – mt-2 (0.5rem) below password input */
.auth-forgot-link {
  display: block;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* Secondary link below Login / Create account */
.auth-mode-toggle-wrap {
  margin: var(--space-3) 0 var(--space-2);
  text-align: center;
}

.auth-mode-toggle-wrap.hidden {
  display: none !important;
}

.auth-mode-toggle-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  color: var(--color-primary);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.auth-mode-toggle-btn:hover {
  text-decoration: underline;
}

/* Legal text below form */
.auth-legal-text {
  margin: var(--space-3) 0 0;
  font-size: 0.6875rem;
  color: var(--color-text-muted-2);
  line-height: 1.5;
  max-width: 52ch;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.auth-legal-text a {
  color: var(--color-primary);
  text-decoration: underline;
}

.auth-legal-text a:hover {
  text-decoration: none;
}

/* Minimal auth footer – compact, visually secondary */
.auth-footer {
  margin-top: auto;
  padding: var(--space-2) var(--space-4);
  padding-left: calc(var(--space-4) + env(safe-area-inset-left, 0));
  padding-right: calc(var(--space-4) + env(safe-area-inset-right, 0));
  padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-3);
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

@media (max-width: 430px) {
  .auth-footer {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}

.auth-footer-copy {
  margin: 0;
}

.auth-footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

.auth-footer-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.auth-footer-nav a:hover {
  color: var(--color-text);
}

.auth-footer-sep {
  color: var(--color-text-muted);
  opacity: 0.6;
  user-select: none;
}

/* Auth responsive: mobile stacks, trust pills wrap cleanly */
@media (max-width: 480px) {
  .auth-card-new {
    display: flex;
    flex-direction: column;
  }
  .auth-brand-wrap { order: 1; }
  .auth-tagline-main { order: 2; }
  .auth-tagline-sub { order: 3; }
  .auth-trust-row {
    order: 4;
    flex-wrap: wrap;
    gap: 6px var(--space-2);
    margin: var(--space-3) 0 var(--space-2);
  }
  .auth-oauth { order: 5; margin-top: 0; }
  .auth-divider { order: 6; margin: var(--space-4) 0 var(--space-2) 0; }
  .auth-form-wrap { order: 7; }
}

.auth-toggle {
  display: inline-flex;
  margin-top: var(--space-4);
  padding: 2px;
  border-radius: 999px;
  background: var(--color-border);
}

.auth-toggle-btn {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  padding: var(--space-2) var(--space-4);
  min-height: var(--touch-min);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s ease-out;
}

.auth-toggle-btn:hover {
  color: var(--color-text);
}

.auth-toggle-btn.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.auth-form-wrap {
  margin-top: 0;
  padding-top: 0;
}

.auth-form-wrap > .auth-error {
  margin-bottom: var(--space-2);
}

/* Auth field stack: tight gaps between Email / Password / Confirm and before CTA */
.auth-form-single {
  gap: 0.5rem;
}

.auth-form-register {
  gap: 0.5rem;
}

/* Label → input: mb-1 (0.25rem); font size unchanged */
.auth-form-single label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

/* h-11: 44px min-height, comfortable padding (not h-12 / 48px) */
.auth-form-single input {
  width: 100%;
  margin-bottom: 0;
  padding: 0.5rem 0.875rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  min-height: 2.75rem;
  box-sizing: border-box;
}

.auth-form-single input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.auth-form-single input.auth-input-invalid {
  border-color: var(--color-error);
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
}

.auth-grid-single {
  grid-template-columns: 1fr;
}

.auth-grid .auth-field label {
  margin-bottom: 4px;
}

.auth-field {
  margin-bottom: 0;
}

.auth-terms-field {
  margin-top: 4px;
}

.auth-checkbox-label {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--color-text);
  margin-bottom: 0 !important;
}

.auth-checkbox-label input[type='checkbox'] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.auth-checkbox-label span {
  display: inline;
  line-height: 1.4;
}

.auth-checkbox-label a {
  color: var(--color-primary);
  text-decoration: underline;
}

/* Legal / policy pages — light marketing-aligned (with landing.css lp-shell + nav) */
.legal-body {
  min-height: 100vh;
}

.legal-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  padding: clamp(16px, 3vw, 28px) 0 clamp(32px, 5vw, 48px);
}

.legal-card {
  width: 100%;
  max-width: 720px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: clamp(24px, 4vw, 36px) clamp(20px, 3vw, 32px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

.legal-card h1 {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.legal-card h2 {
  font-size: 1rem;
  margin-top: 1.25rem;
  margin-bottom: 6px;
  color: var(--color-text);
}

.legal-card p {
  font-size: 0.9375rem;
  line-height: 1.55;
  margin: 0 0 6px;
  color: var(--color-text);
}

.legal-card a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-card a:hover {
  color: var(--color-primary-hover);
}

.legal-updated {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.legal-card ul {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 10px;
  padding-left: 1.25rem;
}

.legal-card ul li {
  margin-bottom: 4px;
}

.legal-card .legal-address {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 10px;
  font-style: normal;
  color: inherit;
}

@media (max-width: 600px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }
}

.auth-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: 0;
  gap: var(--space-2);
}

.auth-form-single .auth-primary-btn {
  width: 100%;
  margin-top: 0;
  padding: 10px 16px;
  min-height: 44px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.auth-form-single .auth-primary-btn:hover:not(:disabled) {
  background: var(--color-primary-hover);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.auth-form-single .auth-primary-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.auth-form-single .auth-verify-actions {
  margin-top: 0.75rem;
  text-align: center;
}
.auth-form-single .auth-verify-actions.hidden {
  display: none;
}
.auth-form-single .auth-resend-verify-btn {
  width: 100%;
  max-width: 100%;
}

.auth-form-single .auth-link-btn {
  display: inline-block;
  margin-top: 0;
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 0.875rem;
  padding: var(--space-2) 0;
  min-height: var(--touch-min);
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
}

.auth-form-single .auth-link-btn:hover {
  text-decoration: underline;
}

.auth-error.status {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: #fef2f2;
  color: var(--color-error);
  font-size: 0.78rem;
  border: 1px solid #fecaca;
}

.auth-error.status.info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.auth-error.status:empty {
  display: none;
}

.auth-tagline {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.auth-oauth {
  margin-top: 0;
}

.auth-oauth.hidden {
  display: none !important;
}

/* Google sign-in – py-2.5 equivalent, full width, still prominent */
.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: 10px var(--space-4);
  min-height: 44px;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  color: #1f2937;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.auth-google-btn:hover {
  background: #fafafa;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.auth-google-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.auth-google-icon {
  flex-shrink: 0;
}

.auth-oauth .oauth-btn {
  display: block;
  width: 100%;
  margin-bottom: var(--space-2);
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-min);
  font-size: 0.9375rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  text-decoration: none;
  color: var(--color-text);
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.auth-oauth .oauth-btn-google {
  background: #ffffff;
  border-color: #d0d7e2;
}

.auth-oauth .oauth-btn-google:hover {
  background: #f9fafb;
  border-color: #c0c9d8;
}

.auth-oauth .oauth-btn-facebook {
  background: #1877f2;
  border-color: #1877f2;
  color: #ffffff;
}

.auth-oauth .oauth-btn-facebook:hover {
  background: #145fbe;
  border-color: #145fbe;
}


.auth-form label {
  margin-bottom: var(--space-1);
}

.auth-form input {
  margin-bottom: var(--space-3);
}

/* --- Logout / account --- */
.logout-btn {
  padding: var(--space-3) var(--space-5);
  min-height: var(--touch-min);
  font-size: 0.9375rem;
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.logout-btn:hover {
  background: var(--color-primary-light);
}

.account-email-readonly {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  min-height: 2.5rem;
}

.account-email-row {
  margin-bottom: var(--space-4);
}

.account-section .account-details {
  margin-bottom: 0;
}

.account-section .account-form {
  margin-bottom: var(--space-6);
}

.account-section .account-form:last-of-type {
  margin-bottom: 0;
}

.account-section .account-form input {
  max-width: 100%;
}

@media (min-width: 400px) {
  .account-section .account-form input {
    max-width: 280px;
  }
}

.account-section .account-form button[type="submit"] {
  margin-right: var(--space-2);
}

.account-section .account-signout {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  padding: var(--space-6);
  margin-left: calc(-1 * var(--space-6));
  margin-right: calc(-1 * var(--space-6));
  margin-bottom: calc(-1 * var(--space-6));
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--color-bg);
}

@media (max-width: 430px) {
  .account-section .account-signout {
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    margin-bottom: calc(-1 * var(--space-4));
    padding: var(--space-4);
  }
}

@media (max-width: 320px) {
  .account-section .account-signout {
    margin-left: calc(-1 * var(--space-3));
    margin-right: calc(-1 * var(--space-3));
    margin-bottom: calc(-1 * var(--space-3));
    padding: var(--space-3);
  }
}

.account-signout-title {
  margin: 0 0 var(--space-1);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

.account-signout-desc {
  margin: 0 0 var(--space-4);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.account-signout .logout-btn {
  margin: 0;
}

.account-delete {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}

.account-delete-title {
  margin: 0 0 var(--space-1);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

.account-delete-desc {
  margin: 0 0 var(--space-4);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.btn-delete-account {
  margin: 0;
  padding: var(--space-3) var(--space-5);
  min-height: var(--touch-min);
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-error);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-delete-account:hover {
  background: var(--color-danger);
}

.account-delete .status {
  margin-top: var(--space-2);
}

/* --- Upload --- */
.upload-section {
  position: relative;
}

#contractDeleteConfirmOverlay {
  z-index: 110;
}

.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  overflow-y: auto;
  padding: var(--space-4);
  padding-left: calc(var(--space-4) + env(safe-area-inset-left, 0));
  padding-right: calc(var(--space-4) + env(safe-area-inset-right, 0));
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0));
  -webkit-overflow-scrolling: touch;
}

.upload-overlay.hidden {
  display: none;
}

.upload-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.9375rem;
  color: var(--color-primary);
  font-weight: 500;
}

.upload-spinner::before {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.upload-dialog {
  background: var(--color-surface);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
}

.extraction-background-dialog-title {
  margin: 0 0 var(--space-3);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
}

.extraction-background-dialog-body {
  margin: 0 0 var(--space-4);
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.extraction-background-dialog-ok {
  width: 100%;
  min-height: var(--touch-min);
}

.contract-dialog {
  max-width: 480px;
  width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  transition: max-width 0.15s ease;
}

@media (max-width: 430px) {
  .contract-dialog {
    width: calc(100vw - var(--space-4));
    max-width: none;
  }
}

@media (max-width: 320px) {
  .contract-dialog {
    width: calc(100vw - var(--space-2));
    max-height: 85vh;
  }
}

.contract-dialog:has(#contractDialogForm:not(.hidden)),
.contract-dialog.contract-dialog-wide {
  max-width: 1024px;
}

.contract-dialog-panel.hidden {
  display: none;
}

.contract-details-header-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.contract-details-header-wrap .contract-details-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.contract-details-toolbar {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  flex-shrink: 0;
}

.contract-details-content {
  max-height: 60vh;
  overflow-y: auto;
}

.contract-details-content .document-detail-inner {
  padding: 0;
}

.missing-fields-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: var(--space-4);
  padding-left: calc(var(--space-4) + env(safe-area-inset-left, 0));
  padding-right: calc(var(--space-4) + env(safe-area-inset-right, 0));
  padding-top: calc(var(--space-4) + env(safe-area-inset-top, 0));
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.missing-fields-overlay.hidden {
  display: none;
}

.missing-fields-dialog {
  background: var(--color-surface);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-lg, 0 10px 40px rgba(0, 0, 0, 0.2));
  padding: var(--space-6, 1.75rem) var(--space-5, 1.5rem);
  max-width: 360px;
  width: 90vw;
  text-align: center;
  animation: missingFieldsIn 0.15s ease-out;
  margin: auto;
  flex-shrink: 0;
}

@keyframes missingFieldsIn {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.missing-fields-dialog-icon {
  font-size: 2rem;
  margin-bottom: var(--space-3);
}

.missing-fields-dialog-text {
  margin: 0 0 var(--space-4);
  color: var(--color-text);
  font-weight: 500;
  line-height: 1.5;
  font-size: 0.9375rem;
}

.missing-fields-dialog-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
}

.missing-fields-dialog-actions .btn-primary {
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md, 8px);
  font-weight: 600;
  cursor: pointer;
}

.missing-fields-dialog-actions .btn-primary:hover {
  background: var(--color-primary-hover);
}

.missing-fields-dialog-actions .btn-secondary {
  padding: var(--space-2) var(--space-4);
}

.contract-details-actions {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.contract-details-actions .btn-primary {
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
}

.contract-details-actions .btn-primary:hover {
  background: var(--color-primary-hover);
}

.contract-details-actions .btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.add-contract-hint {
  margin: 0 0 var(--space-4);
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.add-contract-extraction-failed {
  padding: var(--space-3);
  margin: 0 0 var(--space-4);
  background: rgba(220, 38, 38, 0.08);
  color: var(--color-error);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.5;
  border-radius: var(--radius-md);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.add-contract-extraction-failed.hidden {
  display: none;
}

.add-contract-choice-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.add-contract-choice-actions button {
  width: 100%;
  min-height: var(--touch-min);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
}

#addContractUploadBtn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

#addContractUploadBtn:hover {
  background: var(--color-primary-hover);
}

#addContractManualBtn {
  background: transparent;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
}

#addContractChoiceCancel {
  margin-top: var(--space-3);
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding-inline: var(--space-4);
  margin-left: auto;
}

.field-hint {
  margin-top: var(--space-1);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.sidebar-upload-btn-secondary {
  margin-top: var(--space-2);
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

.sidebar-upload-btn-secondary:hover {
  background: var(--color-surface-subtle);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Chat bar: modern AI-native design --- */
.chat-bar {
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  padding: 0;
  flex: 0 0 420px;
  width: 420px;
  min-width: 360px;
  max-width: 460px;
  min-height: 0;
  max-height: 100vh;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

@media (max-width: 1023px) {
  .chat-bar {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    z-index: 150;
    border-left: none;
    border-top: none;
    box-shadow: none;
    max-height: 100vh;
    max-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }

  .chat-bar.chat-bar-expanded {
    max-height: 100vh;
    max-height: 100dvh;
    height: 100vh;
    height: 100dvh;
  }

  .chat-bar.chat-bar-collapsed {
    max-height: 0;
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }
}

@media (min-width: 1024px) {
  .chat-toggle,
  .chat-expand-btn {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .main-content {
    padding-bottom: 280px;
  }
}

.chat-bar .chat-bar-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* --- Chat header --- */
.chat-header {
  flex-shrink: 0;
  padding: var(--space-4) var(--space-4) var(--space-3);
  padding-right: calc(var(--space-4) + 44px);
  position: relative;
  border-bottom: 1px solid var(--color-border);
}

.chat-header-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text);
}

.chat-header-subtitle {
  margin: var(--space-1) 0 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.chat-header-actions {
  position: absolute;
  top: var(--space-3);
  right: var(--space-2);
}

.chat-menu-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.chat-menu-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.chat-menu-btn.hidden {
  display: none !important;
}

.chat-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-1);
  min-width: 160px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  z-index: 50;
}

.chat-menu.hidden {
  display: none !important;
}

.chat-menu-item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
  font-family: inherit;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s;
}

.chat-menu-item:hover {
  background: var(--color-bg);
}

.chat-toggle {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-toggle:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.chat-bar .chat-bar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-3);
  -webkit-overflow-scrolling: touch;
}

/* --- Empty state: large prompt cards --- */
.chat-empty-state {
  padding: var(--space-6) 0;
}

/* Mobile: show max 2 suggested question cards */
@media (max-width: 1023px) {
  .chat-suggestion-card:nth-child(n+3) {
    display: none;
  }
}

.chat-empty-state.hidden {
  display: none !important;
}

.chat-empty-desc {
  margin: 0 0 var(--space-5);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.chat-suggestions-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.chat-suggestion-card {
  display: block;
  width: 100%;
  padding: var(--space-4) var(--space-4);
  font-size: 0.9375rem;
  font-family: inherit;
  text-align: left;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.chat-suggestion-card:hover {
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.chat-suggestion-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

/* --- Follow-up chips (persistent, above input) --- */
.chat-input-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  padding-bottom: calc(var(--space-3) + var(--bottom-safe));
  padding-right: calc(var(--space-3) + env(safe-area-inset-right, 0));
  padding-left: calc(var(--space-3) + env(safe-area-inset-left, 0));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

/* Suggestions: single row only, 1–2 chips. No wrapping. */
.chat-follow-up-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
  min-height: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chat-follow-up-chips::-webkit-scrollbar {
  display: none;
}

.chat-follow-up-chips.hidden {
  display: none !important;
}

@media (max-width: 1023px) {
  .chat-follow-up-chip {
    min-height: 40px;
    padding: var(--space-2) var(--space-3);
  }
}

.chat-follow-up-chip {
  flex-shrink: 0;
  padding: 6px var(--space-2);
  min-height: 28px;
  font-size: 0.8125rem;
  font-family: inherit;
  line-height: 1.3;
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  box-sizing: border-box;
}

.chat-follow-up-chip:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--color-primary);
}

.chat-follow-up-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

/* --- Composer: single cohesive container, compact --- */
.chat-form {
  display: block;
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding: 6px 8px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-composer:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.chat-composer textarea {
  flex: 1;
  min-height: 40px;
  max-height: 140px;
  min-width: 0;
  margin: 0;
  padding: 8px 10px 8px 12px;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.4;
  background: transparent;
  border: none;
  color: var(--color-text);
  resize: none;
}

.chat-composer textarea::placeholder {
  color: var(--color-text-muted);
}

.chat-composer textarea:focus {
  outline: none;
}

.chat-send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.chat-send-btn:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-status {
  margin: var(--space-1) 0 0;
  min-height: 1.25rem;
  font-size: 0.75rem;
}

.chat-load-older-wrap {
  flex-shrink: 0;
  text-align: center;
  padding: var(--space-2) 0;
}

.chat-load-older-wrap.hidden {
  display: none !important;
}

.chat-expand-btn {
  position: fixed;
  bottom: calc(var(--space-4) + var(--bottom-safe));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - var(--space-8));
  max-width: var(--container-max);
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-min);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  z-index: 20;
  box-sizing: border-box;
}

@media (max-width: 375px) {
  .chat-expand-btn {
    width: calc(100% - var(--space-4));
  }
}

.chat-expand-btn:hover {
  background: var(--color-primary-light);
}

.chat-expand-btn.hidden {
  display: none !important;
}

/* --- Chat messages --- */
.chat-bar .chat-history {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  -webkit-overflow-scrolling: touch;
}

.chat-msg {
  padding: var(--space-4) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  line-height: 1.6;
  max-width: 100%;
}

.chat-msg-user {
  background: var(--color-primary-light);
  border: 1px solid rgba(37, 99, 235, 0.15);
  margin-left: 0;
  margin-right: var(--space-8);
  align-self: flex-start;
}

.chat-msg-assistant {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  margin-left: var(--space-8);
  margin-right: 0;
  align-self: flex-start;
}

@media (max-width: 480px) {
  .chat-msg-user {
    margin-right: var(--space-4);
  }
  .chat-msg-assistant {
    margin-left: var(--space-4);
  }
}

.chat-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.chat-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-highlight {
  font-weight: 600;
  padding: 0 2px;
}

.chat-highlight-price {
  color: var(--color-primary);
}

.chat-highlight-date {
  color: var(--color-success);
}

.chat-msg-loading .chat-content {
  white-space: normal;
}

.chat-loading-content {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
}

.chat-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.chat-feedback {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  align-items: center;
}

.chat-feedback-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: var(--space-1) var(--space-2);
  transition: background 0.15s, border-color 0.15s;
}

.chat-feedback-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.chat-feedback-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.chat-feedback-thanks {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* --- Contracts page (redesigned) --- */
.contracts-page {
  padding: var(--space-6);
}

.contracts-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.contracts-page-header-text {
  flex: 1;
  min-width: 0;
}

.contracts-page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.contracts-page-subtitle {
  margin: var(--space-1) 0 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.contracts-add-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  min-height: var(--touch-min);
  font-size: 0.9375rem;
  font-weight: 600;
}

.contracts-add-btn-icon {
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1;
}

.contracts-search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.contracts-search-wrap {
  flex: 1;
  min-width: 200px;
}

.contracts-search-input {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-size: 0.9375rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.contracts-search-input::placeholder {
  color: var(--color-text-muted-2);
}

.contracts-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.contracts-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.contracts-filter-select {
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  min-width: 140px;
}

.contracts-filter-price {
  width: 80px;
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.contracts-filter-sep {
  color: var(--color-text-muted-2);
  font-size: 0.875rem;
}

.contracts-empty-hint {
  margin: 0;
  padding: var(--space-8);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.contracts-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: var(--space-4);
}

.contract-card {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.contract-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

@media (hover: hover) {
  .contract-card:hover {
    transform: translateY(-1px);
  }
}

.contract-card:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-primary);
}

.contract-card[data-extraction-status="extracting"] {
  cursor: not-allowed;
  opacity: 0.9;
}

.contract-card[data-extraction-status="extracting"]:hover {
  transform: none;
}

.contract-card--pending-confirm {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4 0%, var(--color-surface) 72%);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.28), 0 10px 24px rgba(22, 163, 74, 0.16);
}

.contract-card--pending-confirm:hover {
  border-color: #4ade80;
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.36), 0 12px 28px rgba(22, 163, 74, 0.2);
}

.contract-card-body {
  position: relative;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.contract-card-header-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-2) var(--space-3);
  align-items: start;
}

.contract-card-type-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.contract-card-title-block {
  min-width: 0;
}

.contract-card-toolbar {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  flex-shrink: 0;
}

.contract-card-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.contract-card-status {
  display: inline-block;
  margin-top: var(--space-1);
  padding: 0.125rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
}

.contract-card-status--active {
  background: #d1fae5;
  color: #065f46;
}

.contract-card-status--ends-soon {
  background: #fef3c7;
  color: #92400e;
}

.contract-card-status--expired {
  background: #f3f4f6;
  color: #4b5563;
}

.contract-card-status--processing {
  background: #e0e7ff;
  color: #3730a3;
}

.contract-card-status--failed {
  background: #fee2e2;
  color: #991b1b;
}

.contract-card-type-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-primary);
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.contract-card-provider {
  margin: var(--space-3) 0 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.contract-card-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  margin: var(--space-3) 0 0;
  padding: 0;
  font-size: 0.8125rem;
}

.contract-card-meta dt {
  margin: 0;
  color: var(--color-text-muted);
  font-weight: 500;
}

.contract-card-meta dd {
  margin: 0;
  color: var(--color-text);
  text-align: end;
}

.contract-card-savings {
  margin: var(--space-3) 0 0;
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #065f46;
  background: #ecfdf5;
  border-radius: var(--radius-md);
  border: 1px solid #a7f3d0;
}

.contract-card-extracting-hint {
  margin: var(--space-3) 0 0;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.contract-card-pending-confirm-hint {
  margin: var(--space-3) 0 0;
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #065f46;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: var(--radius-md);
}

.contract-card-cost {
  margin: var(--space-2) 0 var(--space-1);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
}

.contract-card-deadline {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.contract-delete-dialog {
  max-width: 400px;
}

.contract-delete-dialog-title {
  margin: 0 0 var(--space-3);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
}

.contract-delete-dialog-body {
  margin: 0 0 var(--space-4);
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.contract-delete-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.contract-delete-dialog-actions .btn-secondary,
.contract-delete-dialog-actions .contract-delete-dialog-delete {
  min-height: var(--touch-min);
}

.contract-delete-dialog-delete {
  background: var(--color-error);
  border-color: var(--color-error);
  color: #fff;
}

.contract-delete-dialog-delete:hover:not(:disabled) {
  filter: brightness(0.95);
}

.contract-card-btn {
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.contract-card-btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.contract-card-btn-primary:hover {
  background: var(--color-primary-hover);
}

.contract-card-btn-secondary {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.contract-card-btn-secondary:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.contract-card-menu {
  position: relative;
  margin-left: auto;
}

.contract-card-menu-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: 0.02em;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.contract-card-menu-trigger:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.contract-card-menu-dropdown {
  display: none;
  position: absolute;
  /* Open to the left of the ⋮ so the menu stays inside the card (card uses overflow: hidden). */
  right: calc(100% + var(--space-1));
  left: auto;
  top: 0;
  margin-top: 0;
  min-width: 120px;
  padding: var(--space-1);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 20;
}

.contract-card-menu-open .contract-card-menu-dropdown {
  display: block;
}

/* Element + class beats global `button` shorthand (`background`) which otherwise leaves a tinted block */
button.contract-card-delete {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
  min-height: 0;
  align-self: stretch;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.15s, color 0.15s;
}

button.contract-card-delete:hover:not(:disabled),
button.contract-card-delete:focus-visible {
  background-color: rgba(220, 38, 38, 0.1);
  color: var(--color-error);
}

button.contract-card-delete:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25);
}

button.contract-card-delete:disabled {
  background: transparent;
  color: var(--color-text-muted);
  opacity: 0.75;
  cursor: not-allowed;
}

.contract-card-spinner {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
}

@media (max-width: 767px) {
  .contracts-page {
    padding: var(--space-4);
  }

  .contracts-card-grid {
    grid-template-columns: 1fr;
  }

  .contracts-page-header {
    flex-direction: column;
    gap: var(--space-3);
  }

  .contracts-add-btn {
    width: 100%;
    justify-content: center;
    min-height: var(--touch-min);
  }

  .contracts-search-filters {
    flex-direction: column;
  }

  .contracts-search-wrap {
    min-width: 0;
  }

  .contracts-filters {
    flex-wrap: wrap;
  }

  .contracts-filter-select,
  .contracts-filter-price {
    min-height: var(--touch-min);
  }
}

@media (max-width: 430px) {
  .contracts-page {
    padding: var(--space-3);
  }

  .contracts-filter-price {
    width: 100%;
    min-width: 0;
  }

  .contract-details-toolbar {
    width: 100%;
    justify-content: flex-end;
  }

  #contractDetailsViewEditBtn {
    min-height: var(--touch-min);
  }

  .contract-details-toolbar .contract-card-menu-trigger {
    min-height: var(--touch-min);
    min-width: var(--touch-min);
  }
}

/* --- Documents: single-column expandable list (legacy) --- */
.documents-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.documents-list--expandable {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.document-detail-hidden {
  display: none !important;
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  pointer-events: none;
  visibility: hidden;
}

.document-detail {
  min-height: 260px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: var(--space-4);
}

.document-detail-empty {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.document-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.document-detail-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.document-detail-subtitle {
  margin: var(--space-1) 0 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.document-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.document-detail-grid .field-row {
  margin: 0;
}

.document-detail-grid .field-row.full-width {
  grid-column: 1;
}

.contract-details-grid {
  grid-template-columns: repeat(2, 1fr);
}

.contract-pricing-details {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.contract-pricing-details-title {
  margin: 0 0 var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.contract-pricing-details-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-3);
  margin: 0;
  font-size: 0.875rem;
}

.contract-pricing-details-dl dt {
  color: var(--color-text-muted);
  margin: 0;
}

.contract-pricing-details-dl dd {
  margin: 0;
}

.contract-details-grid .field-row.full-width {
  grid-column: 1 / -1;
}

@media (max-width: 540px) {
  .contract-details-grid {
    grid-template-columns: 1fr;
  }
  .contract-details-grid .field-row.full-width {
    grid-column: 1;
  }
}

.add-field-row {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--color-border);
}

.contract-details-grid .add-field-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.add-field-label {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.document-detail-grid .field-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.document-detail .form-actions {
  margin-top: var(--space-3);
}

/* Expandable contract card */
.doc-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.doc-item:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

.doc-item.doc-item-expanded {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary), var(--shadow-md);
}

.documents-list--expandable .doc-item {
  cursor: pointer;
}

.doc-item-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4);
  min-height: var(--touch-min);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.doc-item-head:hover {
  background: var(--color-bg);
}

.doc-item.doc-item-expanded .doc-item-head {
  background: var(--color-primary-light);
  border-bottom: 1px solid var(--color-border);
}

.doc-item-chevron {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.doc-item-head:hover .doc-item-chevron,
.doc-item.doc-item-expanded .doc-item-chevron {
  color: var(--color-primary);
}

.doc-item.doc-item-expanded .doc-item-chevron {
  transform: rotate(90deg);
}

.doc-item-head-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.doc-item-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 375px) {
  .doc-item-name {
    white-space: normal;
    word-break: break-word;
  }
}

.doc-item-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-item-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.doc-item-body {
  display: none;
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.doc-item.doc-item-expanded .doc-item-body {
  display: block;
}

.doc-item-body .document-detail-inner {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
}

.doc-item-body .form-actions {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.doc-item.doc-item-selected {
  border-left: 3px solid var(--color-primary);
}

.doc-item-selected .doc-item-head {
  background: var(--color-primary-light);
}

.doc-item-selected .doc-item-head:hover {
  background: var(--color-primary-light);
}

.doc-item-head-no-expand {
  cursor: default;
}

.doc-item-head-no-expand:hover {
  background: transparent;
}

.doc-item-failed-inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.doc-extraction-error-inline {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--color-error);
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-item-failed-inline .btn-retry-extraction {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-primary);
  background: transparent;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.doc-item-failed-inline .btn-retry-extraction:hover:not(:disabled) {
  background: var(--color-primary-light);
}

.doc-item-failed-inline .btn-retry-extraction:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.doc-item[data-extraction-status="extracting"] .doc-item-head {
  cursor: not-allowed;
}
.doc-item[data-extraction-status="extracting"]:hover {
  border-color: var(--color-border);
  box-shadow: none;
}
.doc-item[data-extraction-status="extracting"] .doc-item-head:hover {
  background: transparent;
}

.doc-item-spinner {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.doc-name {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

/* Legacy list (non-expandable) still uses .doc-name */
.doc-item-head .doc-name {
  font-size: 1rem;
  font-weight: 600;
}

.doc-confirm-hint {
  margin: 0 0 var(--space-3);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.07);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-primary);
}

.doc-extraction-error {
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: rgba(220, 38, 38, 0.08);
  color: var(--color-error);
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.doc-extraction-actions {
  margin-bottom: var(--space-3);
}

.doc-extraction-actions .btn-retry-extraction {
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-primary);
  background: transparent;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.doc-extraction-actions .btn-retry-extraction:hover:not(:disabled) {
  background: var(--color-primary-light);
}

.doc-extraction-actions .btn-retry-extraction:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.doc-item-head .btn-delete-doc {
  flex-shrink: 0;
}

.btn-delete-doc {
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
  background: var(--color-text-muted);
  color: #fff;
}

.btn-delete-doc:hover:not(:disabled) {
  background: var(--color-danger);
}

.doc-fields-section {
  padding: var(--space-4) var(--space-4) var(--space-4);
  border-top: 1px solid var(--color-border);
}

.doc-fields-section.hidden {
  display: none;
}

.btn-view-doc {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
  min-height: var(--touch-min);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  background: transparent;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.btn-view-doc:hover {
  background: var(--color-primary-light);
}

.doc-fields-form {
  padding-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.doc-fields-form .field-form-status {
  margin-top: var(--space-1);
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.field-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: inherit;
}

.field-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* ── Combo-box (input + dropdown suggestions) ── */
.combo-box {
  position: relative;
  display: flex;
}
.combo-box .field-input {
  padding-right: 2rem;
}
.combo-toggle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.combo-toggle:hover {
  color: var(--color-text);
}
.combo-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 12rem;
  overflow-y: auto;
  margin-top: 2px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.combo-dropdown.open {
  display: block;
}
.combo-option {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-size: 0.9375rem;
}
.combo-option:hover,
.combo-option.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

/* --- App footer (logged-in, minimal) --- */
.app-footer {
  padding: var(--space-2) var(--space-4);
  padding-left: calc(var(--space-4) + env(safe-area-inset-left, 0));
  padding-right: calc(var(--space-4) + env(safe-area-inset-right, 0));
  padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0));
  font-size: 0.75rem;
  color: var(--color-text-muted-2);
  flex-shrink: 0;
}

@media (max-width: 430px) {
  .app-footer {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}

.app-footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  min-height: 44px;
}
.app-footer-copy {
  flex-shrink: 0;
}
.app-footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.app-footer-nav a {
  color: var(--color-text-muted-2);
  text-decoration: none;
  transition: color 0.15s ease;
  padding: var(--space-1) 0;
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
}
.app-footer-nav a:hover {
  color: var(--color-text-muted);
}
.app-footer-nav a + a::before {
  content: '\00B7';
  margin-right: var(--space-3);
  color: var(--color-text-muted-2);
  pointer-events: none;
}
@media (min-width: 640px) {
  .app-footer-nav a {
    min-height: 0;
  }
}

/* --- Marketing footer (logged-out, auth + legal + landing) --- */
.site-footer {
  padding: var(--space-4) var(--space-4);
  padding-left: calc(var(--space-4) + env(safe-area-inset-left, 0));
  padding-right: calc(var(--space-4) + env(safe-area-inset-right, 0));
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: 0.875rem;
}
.site-footer-inner {
  max-width: 72rem;
  margin: 0 auto;
}
.site-footer-grid {
  display: grid;
  gap: 0;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .site-footer-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4) var(--space-8);
  }
}
.site-footer-column {
  border-bottom: 1px solid var(--color-border);
}
@media (min-width: 640px) {
  .site-footer-column {
    border-bottom: none;
  }
}
.site-footer-column-header {
  margin: 0;
  padding: var(--space-2) 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch-min);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
@media (min-width: 640px) {
  .site-footer-column-header {
    cursor: default;
    padding: 0 0 var(--space-2);
    min-height: 0;
    pointer-events: none;
  }
}
.site-footer-column-header::after {
  content: '';
  width: 12px;
  height: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: var(--space-2);
  transition: transform 0.2s ease;
}
.site-footer-column.expanded .site-footer-column-header::after {
  transform: rotate(-135deg);
}
@media (min-width: 640px) {
  .site-footer-column-header::after {
    display: none;
  }
}
.site-footer-column-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.site-footer-column.expanded .site-footer-column-content {
  max-height: 200px;
}
@media (min-width: 640px) {
  .site-footer-column-content {
    max-height: none;
    overflow: visible;
  }
}
.site-footer-column ul {
  margin: 0;
  padding: 0 0 var(--space-2);
  list-style: none;
}
@media (min-width: 640px) {
  .site-footer-column ul {
    padding: 0;
  }
}
.site-footer-column li {
  min-height: var(--touch-min);
  display: flex;
  align-items: center;
}
@media (min-width: 640px) {
  .site-footer-column li {
    min-height: 0;
  }
}
.site-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
  padding: var(--space-2) 0;
  display: block;
  width: 100%;
  line-height: 1.4;
}
.site-footer a:hover {
  color: var(--color-text);
}
@media (min-width: 640px) {
  .site-footer a {
    padding: var(--space-1) 0;
  }
}
.site-footer-bottom {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}
.site-footer-bottom p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}
