/* v3 layout rules */

body.ui-v3.app-shell,
body.ui-v3 .app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

body.ui-v3 .app-main {
  min-height: 100vh;
  min-width: 0;
}

body.ui-v3 .sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  transition:
    width 160ms ease,
    min-width 160ms ease,
    flex-basis 160ms ease;
  will-change: width;
}

body.ui-v3 .app-header {
  position: sticky;
  top: 0;
  z-index: 1300;
}

body.ui-v3 .sidebar-nav {
  flex: 1 1 auto;
}

body.ui-v3 .sidebar-toggle-btn {
  display: inline-flex !important;
}

body.ui-v3 .app-content {
  padding: 20px;
  display: grid;
  gap: 0;
}

body.ui-v3.sidebar-collapsed .sidebar {
  width: 64px;
  min-width: 64px;
  flex-basis: 64px;
  padding-inline: 10px;
}

body.ui-v3.sidebar-collapsed .sidebar .logo {
  justify-content: center;
}

body.ui-v3.sidebar-collapsed .sidebar .logo span,
body.ui-v3.sidebar-collapsed .sidebar-nav a span {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
}

body.ui-v3.sidebar-collapsed .sidebar .sidebar-rail-toggle {
  min-height: 40px;
  padding-inline: 0;
}

body.ui-v3.sidebar-collapsed .sidebar .sidebar-rail-toggle .sidebar-rail-toggle__label {
  width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

body.ui-v3.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  padding-inline: 8px;
}

body.ui-v3.sidebar-collapsed .sidebar-nav a i {
  margin-right: 0;
}

body.ui-v3.sidebar-collapsed .sidebar-nav a .sidebar-nav-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: auto;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 0.64rem;
}

body.ui-v3 #report-calendar-panel .table-responsive {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
}

body.ui-v3 .usage-panel .usage-card {
  min-height: 106px;
}

body.ui-v3 .forecast-kpi-strip,
body.ui-v3 .forecast-real-kpi-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.ui-v3 .report-drilldown-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 1280px) {
  body.ui-v3 .report-command-grid {
    grid-template-columns: 1fr 1fr;
  }

  body.ui-v3 .report-command-field--category {
    grid-column: 1 / -1;
  }

  body.ui-v3 .report-command-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  body.ui-v3 .report-category-layout {
    grid-template-columns: 1fr;
  }

  body.ui-v3 .report-category-cards-wrap {
    max-height: none;
    overflow: visible;
  }

  body.ui-v3 .report-category-cards-scroll {
    overflow: visible;
  }
}

@media (max-width: 1200px) {
  body.ui-v3 .app-shell {
    flex-direction: row;
  }

  body.ui-v3 .sidebar {
    width: 250px;
    min-width: 250px;
    flex-basis: 250px;
    border-bottom: none;
    border-right: 1px solid var(--v3-border-soft, rgba(255, 255, 255, 0.06));
    flex-direction: column;
    flex-wrap: nowrap;
  }

  body.ui-v3.sidebar-collapsed .sidebar {
    width: 64px;
    min-width: 64px;
    flex-basis: 64px;
  }

  body.ui-v3 .report-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.ui-v3 .forecast-kpi-strip,
  body.ui-v3 .forecast-real-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  body.ui-v3.app-shell,
  body.ui-v3 .app-shell {
    flex-direction: column;
  }

  body.ui-v3 .sidebar {
    display: none !important;
  }

  body.ui-v3 .app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1300;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  body.ui-v3 .app-header .sidebar-toggle-btn {
    display: inline-flex !important;
  }

  body.ui-v3 .header-left {
    width: 100%;
    min-width: 0;
    align-items: flex-start;
    gap: 12px;
  }

  body.ui-v3 .header-left > div {
    max-width: none;
    min-width: 0;
    flex: 1 1 auto;
  }

  body.ui-v3 .header-left h1,
  body.ui-v3 .header-left p {
    overflow-wrap: anywhere;
  }

  body.ui-v3 .nav-compact {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  body.ui-v3 .nav-compact .dropdown > button,
  body.ui-v3 .nav-compact [data-currency-select],
  body.ui-v3 .nav-compact #header-container .btn,
  body.ui-v3 .nav-compact #header-container .form-select {
    flex: 1 1 auto;
    min-width: 136px;
  }

  body.ui-v3 .report-command-head {
    flex-direction: column;
    align-items: flex-start;
  }

  body.ui-v3 .report-command-grid {
    grid-template-columns: 1fr;
  }

  body.ui-v3 .report-command-actions .btn {
    flex: 1 1 calc(50% - 8px);
  }

  body.ui-v3 .report-kpi-strip {
    grid-template-columns: 1fr;
  }

  body.ui-v3 .forecast-kpi-strip,
  body.ui-v3 .forecast-real-kpi-strip {
    grid-template-columns: 1fr;
  }

  body.ui-v3 .report-focus-header {
    flex-direction: column;
    align-items: flex-start;
  }

  body.ui-v3 .report-focus-stats {
    width: 100%;
  }

  body.ui-v3 .report-focus-stat {
    flex: 1 1 110px;
  }

  body.ui-v3 .report-gap-cards {
    grid-template-columns: 1fr;
  }

  body.ui-v3 .report-category-detail__metrics {
    grid-template-columns: 1fr;
  }

  body.ui-v3 .mobile-nav {
    width: min(320px, 82vw);
    background: linear-gradient(180deg, rgba(7, 13, 27, 0.98), rgba(4, 10, 23, 0.98));
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 10px;
  }

  body.ui-v3.sidebar-collapsed .sidebar {
    display: none !important;
  }

  body.ui-v3 .mobile-nav .sidebar-nav {
    gap: 8px;
  }

  body.ui-v3 .mobile-nav {
    width: min(360px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    overflow-x: hidden;
    z-index: 1400;
  }

  body.ui-v3 .mobile-nav .sidebar-mobile-slot {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    padding-bottom: 12px;
  }

  body.ui-v3 .mobile-nav .sidebar-mobile-slot .nav-compact {
    display: grid !important;
    grid-template-columns: 1fr;
    align-items: stretch;
    justify-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 10px;
  }

  body.ui-v3 .mobile-nav .sidebar-mobile-slot .nav-compact > *,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot .nav-compact .dropdown,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #header-container,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #accountBlock,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #authBlock,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #accountSelectPopover,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #account-select-dropdown,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #accountSelect,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot .header-account-select,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #btn-add-account,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #btn-logout-header,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #header-current-user,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot .btn,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot .form-select,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot .btn-theme {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  body.ui-v3 .mobile-nav .sidebar-mobile-slot #header-container,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #accountBlock,
  body.ui-v3 .mobile-nav .sidebar-mobile-slot #authBlock {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    flex-wrap: nowrap;
  }

  body.ui-v3 .mobile-nav .sidebar-mobile-slot #header-current-user {
    white-space: normal !important;
    text-overflow: initial !important;
    overflow: hidden;
    text-align: left;
    line-height: 1.35;
    justify-content: flex-start;
  }

  body.ui-v3 .mobile-nav .sidebar-mobile-slot #accountSelectPopover {
    display: flex;
  }

  body.ui-v3 .mobile-nav .sidebar-mobile-slot #accountSelectPopover .btn {
    justify-content: space-between;
  }

  :root:not([data-theme="dark"]) body.ui-v3 .mobile-nav {
    background: linear-gradient(180deg, rgba(251, 253, 255, 0.98), rgba(242, 248, 255, 0.98));
    border-right-color: rgba(24, 37, 63, 0.14);
  }
}

@media (max-width: 640px) {
  body.ui-v3 .app-content {
    padding: 12px;
  }

  body.ui-v3 .panel,
  body.ui-v3 .summary-card,
  body.ui-v3 .usage-card,
  body.ui-v3 .ai-metric {
    border-radius: 14px;
  }

  body.ui-v3 .report-command-actions .btn {
    flex-basis: 100%;
  }

  body.ui-v3 .report-focus-stat {
    min-width: 0;
  }

  body.ui-v3 .report-chart-wrap--line {
    min-height: 280px;
  }

  body.ui-v3 .report-category-chart .report-chart-wrap--categories {
    min-height: 250px;
  }

  body.ui-v3 .category-operations {
    max-height: 320px;
  }
}

/* Global fallback: header controls must stay flat even before premium overrides load. */
body.ui-v3 .app-header button,
body.ui-v3 .app-header .btn,
body.ui-v3 .app-header .header-btn,
body.ui-v3 .app-header .topbar-btn,
body.ui-v3 .app-header .header-control,
body.ui-v3 .app-header .language-switcher,
body.ui-v3 .app-header .currency-switcher,
body.ui-v3 .app-header .account-selector,
body.ui-v3 .app-header .account-scope-trigger,
body.ui-v3 .app-header .theme-toggle,
body.ui-v3 .topbar button,
body.ui-v3 .topbar .btn,
body.ui-v3 .topbar .header-btn,
body.ui-v3 .topbar .topbar-btn,
body.ui-v3 .topbar .header-control,
body.ui-v3 .topbar .language-switcher,
body.ui-v3 .topbar .currency-switcher,
body.ui-v3 .topbar .account-selector,
body.ui-v3 .topbar .account-scope-trigger,
body.ui-v3 .topbar .theme-toggle {
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
}
body.ui-v3.theme-light select,
body.ui-v3.theme-light .form-select,
body.ui-v3[data-theme="light"] select,
body.ui-v3[data-theme="light"] .form-select,
html[data-theme="light"] body.ui-v3 select,
html[data-theme="light"] body.ui-v3 .form-select {
  color-scheme: light;
}

body.ui-v3.theme-light select option,
body.ui-v3.theme-light .form-select option,
body.ui-v3[data-theme="light"] select option,
body.ui-v3[data-theme="light"] .form-select option,
html[data-theme="light"] body.ui-v3 select option,
html[data-theme="light"] body.ui-v3 .form-select option {
  background: #ffffff !important;
  color: #172033 !important;
}

body.ui-v3.theme-light select option:checked,
body.ui-v3.theme-light .form-select option:checked,
body.ui-v3[data-theme="light"] select option:checked,
body.ui-v3[data-theme="light"] .form-select option:checked,
html[data-theme="light"] body.ui-v3 select option:checked,
html[data-theme="light"] body.ui-v3 .form-select option:checked {
  background: #dbeafe !important;
  color: #0f172a !important;
}

body.ui-v3.theme-light select optgroup,
body.ui-v3.theme-light .form-select optgroup,
body.ui-v3[data-theme="light"] select optgroup,
body.ui-v3[data-theme="light"] .form-select optgroup,
html[data-theme="light"] body.ui-v3 select optgroup,
html[data-theme="light"] body.ui-v3 .form-select optgroup {
  background: #f8fafc !important;
  color: #5b21b6 !important;
}

body.ui-v3.theme-light select,
body.ui-v3.theme-light .form-select,
body.ui-v3[data-theme="light"] select,
body.ui-v3[data-theme="light"] .form-select,
html[data-theme="light"] body.ui-v3 select,
html[data-theme="light"] body.ui-v3 .form-select {
  color-scheme: light !important;
}

body.ui-v3.theme-light .header-account-popover > .btn,
body.ui-v3[data-theme="light"] .header-account-popover > .btn,
html[data-theme="light"] body.ui-v3 .header-account-popover > .btn,
body.ui-v3 .header-account-popover > .btn {
  color: var(--text-color, #172033) !important;
}

body.ui-v3 .header-account-popover > .btn #account-select-label {
  color: inherit !important;
  opacity: 1 !important;
  font-weight: 600;
}
/* Final light-theme native select palette. Keep at the end so imported UI kits do not leave dark option popups in light mode. */
body.ui-v3.theme-light select,
body.ui-v3.theme-light .form-select,
body.ui-v3[data-theme="light"] select,
body.ui-v3[data-theme="light"] .form-select,
html[data-theme="light"] body.ui-v3 select,
html[data-theme="light"] body.ui-v3 .form-select {
  color-scheme: light;
}

body.ui-v3.theme-light select option,
body.ui-v3.theme-light .form-select option,
body.ui-v3[data-theme="light"] select option,
body.ui-v3[data-theme="light"] .form-select option,
html[data-theme="light"] body.ui-v3 select option,
html[data-theme="light"] body.ui-v3 .form-select option {
  background: #ffffff !important;
  color: #172033 !important;
}

body.ui-v3.theme-light select option:checked,
body.ui-v3.theme-light .form-select option:checked,
body.ui-v3[data-theme="light"] select option:checked,
body.ui-v3[data-theme="light"] .form-select option:checked,
html[data-theme="light"] body.ui-v3 select option:checked,
html[data-theme="light"] body.ui-v3 .form-select option:checked {
  background: #dbeafe !important;
  color: #0f172a !important;
}

body.ui-v3.theme-light select optgroup,
body.ui-v3.theme-light .form-select optgroup,
body.ui-v3[data-theme="light"] select optgroup,
body.ui-v3[data-theme="light"] .form-select optgroup,
html[data-theme="light"] body.ui-v3 select optgroup,
html[data-theme="light"] body.ui-v3 .form-select optgroup {
  background: #f8fafc !important;
  color: #5b21b6 !important;
}

/* Mobile production pass: authenticated app spacing and narrow viewport ergonomics. */
@media (max-width: 992px) {
  :root {
    --mobile-header-height: 76px;
  }

  body.ui-v3 {
    overflow-x: hidden;
  }

  body.ui-v3 .app-header {
    min-height: var(--mobile-header-height);
    height: auto;
    align-items: center;
  }

  body.ui-v3 .app-main {
    margin-top: var(--mobile-header-height);
    min-width: 0;
    width: 100%;
  }

  body.ui-v3 .app-content {
    width: 100%;
    max-width: 100%;
    padding-top: clamp(1.25rem, 4vw, 2rem);
    overflow-x: clip;
  }

  body.ui-v3 .panel,
  body.ui-v3 .summary-card,
  body.ui-v3 .card,
  body.ui-v3 .table-wrap,
  body.ui-v3 .tariff-sheet,
  body.ui-v3 .import-form-panel,
  body.ui-v3 .category-workspace,
  body.ui-v3 .categories-sidebar {
    max-width: 100%;
  }

  body.ui-v3 .row {
    --bs-gutter-x: 1rem;
  }

  body.ui-v3 .btn,
  body.ui-v3 button,
  body.ui-v3 .form-control,
  body.ui-v3 .form-select {
    min-height: 42px;
  }

  body.ui-v3 .table-wrap,
  body.ui-v3 .table-responsive,
  body.ui-v3 .exchange-rate-policy__table-wrap,
  body.ui-v3 .currency-rates-table-wrap,
  body.ui-v3 .tariff-sheet__scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body[data-page="reports"] .report-command-head,
  body[data-page="scenarios"] .d-flex.justify-content-between,
  body[data-page="categories"] .categories-header,
  body[data-page="categories"] .category-header {
    flex-direction: column;
    align-items: stretch !important;
  }

  body[data-page="reports"] .report-command-badges,
  body[data-page="reports"] .report-focus-stats,
  body[data-page="categories"] .category-actions,
  body[data-page="settings"] .currency-engine-actions,
  body[data-page="plans"] [data-donation-submit],
  body[data-page="plans"] [data-promo-activate] {
    width: 100%;
  }

  body[data-page="reports"] .report-command-badges,
  body[data-page="reports"] .report-focus-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.6rem;
  }

  body[data-page="reports"] .report-command-actions,
  body[data-page="import"] .import-form-section--actions .d-flex,
  body[data-page="settings"] .currency-engine-actions,
  body[data-page="plans"] .d-flex.flex-wrap.gap-2 {
    display: grid !important;
    grid-template-columns: 1fr;
    width: 100%;
  }

  body[data-page="reports"] .report-command-actions .btn,
  body[data-page="reports"] #report-export-png,
  body[data-page="plans"] .btn,
  body[data-page="settings"] .btn,
  body[data-page="profile"] .btn,
  body[data-page="import"] .btn {
    width: 100%;
    justify-content: center;
  }

  body[data-page="scenarios"] .scenario-highlights,
  body[data-page="categories"] .category-kpis {
    grid-template-columns: 1fr;
  }

  body[data-page="scenarios"] .empty-state,
  body[data-page="categories"] .empty-state {
    display: grid;
    gap: 0.75rem;
    justify-items: stretch;
  }

  body[data-page="scenarios"] .empty-state .btn,
  body[data-page="categories"] .empty-state .btn {
    width: 100%;
  }

  body[data-page="categories"] .category-workspace {
    grid-template-columns: 1fr;
  }

  body[data-page="categories"] .categories-sidebar {
    position: static;
    width: 100%;
  }

  body[data-page="categories"] .sidebar-header,
  body[data-page="categories"] .category-filters,
  body[data-page="categories"] .bulkbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  body[data-page="categories"] .category-list {
    max-height: 42vh;
  }

  body[data-page="import"] .import-page-shell,
  body[data-page="import"] .import-form-grid,
  body[data-page="import"] .mapping-container,
  body[data-page="settings"] .currency-engine-grid {
    grid-template-columns: 1fr !important;
  }

  body[data-page="settings"] .app-content,
  body[data-page="settings"] .settings-page,
  body[data-page="settings"] .settings-container,
  body[data-page="settings"] .settings-content,
  body[data-page="settings"] .settings-panel,
  body[data-page="settings"] .settings-tab-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  body[data-page="settings"] .currency-engine-grid,
  body[data-page="settings"] .currency-auto-toolbar,
  body[data-page="settings"] .currency-engine-actions,
  body[data-page="settings"] .settings-tabs {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  body[data-page="import"] .import-form-section__head,
  body[data-page="settings"] .currency-auto-toolbar {
    align-items: stretch;
  }

  body[data-page="settings"] .currency-auto-toolbar {
    display: flex;
    flex-direction: column;
  }

  body[data-page="settings"] .currency-engine-grid {
    grid-template-columns: 1fr !important;
  }

  body[data-page="settings"] .currency-engine-grid label,
  body[data-page="settings"] .currency-engine-toggle,
  body[data-page="settings"] .currency-engine-actions .btn,
  body[data-page="settings"] .currency-engine-actions .form-control,
  body[data-page="settings"] .currency-engine-actions .form-select {
    min-width: 0;
  }

  body[data-page="settings"] .currency-engine-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
  }

  body[data-page="settings"] .settings-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
  }

  body[data-page="settings"] .settings-tab-button {
    min-width: 0;
    width: 100%;
    white-space: normal;
  }

  body[data-page="settings"] .settings-tab-button {
    min-width: 0;
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    white-space: normal;
    line-height: 1.2;
    padding: 0.65rem 0.7rem;
  }

  body[data-page="plans"] #plans-grid > .col-12:first-child .panel,
  body[data-page="plans"] .tariff-sheet,
  body[data-page="plans"] .tariff-sheet + section,
  body[data-page="plans"] .panel {
    padding: 1rem !important;
  }

  body[data-page="plans"] .tariff-sheet__scroll {
    border-radius: 12px;
    max-height: none;
    margin-inline: -0.25rem;
  }

  body[data-page="plans"] .tariff-sheet-table {
    min-width: 760px;
    font-size: 0.84rem;
  }

  body[data-page="plans"] .tariff-feature-cell {
    width: 170px;
    min-width: 170px;
  }

  body[data-page="plans"] .tariff-plan-head {
    min-width: 135px;
  }
}

@media (max-width: 575.98px) {
  :root {
    --mobile-header-height: 72px;
  }

  body.ui-v3 .app-header {
    padding: 0.55rem 0.75rem;
  }

  body.ui-v3 .header-left {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.6rem;
  }

  body.ui-v3 .header-left h1 {
    font-size: 1rem;
    line-height: 1.15;
  }

  body.ui-v3 .header-left p {
    font-size: 0.78rem;
    line-height: 1.25;
  }

  body.ui-v3 .app-content {
    padding: 1rem 0.75rem 1.25rem;
  }

  body[data-page="settings"] .settings-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
  }

  body[data-page="settings"] .settings-tab-button {
    min-width: 0;
    width: 100%;
    white-space: normal;
  }

  body[data-page="reports"] .report-command-title,
  body[data-page="import"] .import-hero-panel h2,
  body[data-page="plans"] #plans-grid h1,
  body[data-page="scenarios"] .panel h2,
  body[data-page="categories"] .categories-header h1 {
    font-size: 1.25rem;
    line-height: 1.25;
  }

  body[data-page="categories"] .table-wrap,
  body[data-page="scenarios"] .table-responsive,
  body[data-page="scenarios"] .panel:has(table),
  body[data-page="reports"] .report-panel-wide {
    margin-inline: 0;
  }
}

/* Plans page: mobile tariff matrix aligned with landing behavior. */
@media (max-width: 760px) {
  body[data-page="plans"] .app-content {
    overflow-x: clip;
  }

  body[data-page="plans"] .tariff-sheet {
    padding: 1rem !important;
    overflow: hidden;
  }

  body[data-page="plans"] .tariff-mobile-hint {
    display: block;
    margin: 0 0 0.65rem;
    color: rgba(148, 163, 184, 0.95);
    font-size: 0.78rem;
    line-height: 1.3;
  }

  body[data-page="plans"] .tariff-sheet__scroll {
    width: 100%;
    max-width: 100%;
    max-height: none;
    margin-inline: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.34);
  }

  body[data-page="plans"] .tariff-sheet-table {
    min-width: 640px;
    width: 640px;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.74rem;
  }

  body[data-page="plans"] .tariff-sheet-table th,
  body[data-page="plans"] .tariff-sheet-table td {
    padding: 0.48rem 0.42rem;
    font-size: 0.74rem;
    line-height: 1.18;
    vertical-align: middle;
  }

  body[data-page="plans"] .tariff-feature-cell,
  body[data-page="plans"] .tariff-sheet-table thead th:first-child,
  body[data-page="plans"] .tariff-sheet-table tbody th:first-child,
  body[data-page="plans"] .tariff-sheet-table tbody td:first-child {
    width: 118px;
    min-width: 118px;
    max-width: 118px;
  }

  body[data-page="plans"] .tariff-feature-cell {
    left: 0;
    z-index: 5;
    padding-left: 0.55rem;
    padding-right: 0.45rem;
    overflow-wrap: anywhere;
    box-shadow: 1px 0 0 rgba(148, 163, 184, 0.14);
  }

  body[data-page="plans"] .tariff-sheet-table thead th {
    position: static;
    top: auto;
    z-index: 1;
  }

  body[data-page="plans"] .tariff-sheet-table thead .tariff-feature-cell,
  body[data-page="plans"] .tariff-sheet-table tbody .tariff-feature-cell,
  body[data-page="plans"] .tariff-cta-row .tariff-feature-cell {
    position: sticky;
    left: 0;
  }

  body[data-page="plans"] .tariff-sheet-table thead .tariff-feature-cell {
    z-index: 7;
    overflow: hidden;
  }

  body[data-page="plans"] .tariff-sheet-table tbody .tariff-feature-cell {
    z-index: 6;
    color: #f8fafc;
    font-weight: 750;
  }

  body[data-page="plans"] .tariff-plan-head {
    min-width: 0;
    width: 130px;
    padding: 0.38rem 0.34rem !important;
    text-align: center;
  }

  body[data-page="plans"] .tariff-plan-head > .fw-bold {
    font-size: 0.78rem;
    line-height: 1.05;
  }

  body[data-page="plans"] .tariff-plan-head > div:not(.fw-bold) {
    margin-top: 0.12rem;
    color: #b7f7d5;
    font-size: 0.64rem;
    line-height: 1.05;
    font-weight: 800;
    text-transform: uppercase;
  }

  body[data-page="plans"] .tariff-plan-head small {
    margin-top: 0.16rem;
    font-size: 0.55rem;
    line-height: 1.05;
    color: rgba(226, 232, 240, 0.78);
  }

  body[data-page="plans"] .tariff-section-row th {
    padding: 0.52rem 0.55rem;
    font-size: 0.68rem;
    line-height: 1.1;
    font-weight: 800;
    text-transform: uppercase;
  }

  body[data-page="plans"] .tariff-sheet-table .badge {
    min-height: 22px;
    max-width: 92px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 0.62rem;
    line-height: 1.05;
    white-space: normal;
  }

  body[data-page="plans"] .tariff-cta-row th,
  body[data-page="plans"] .tariff-cta-row td {
    position: static;
    bottom: auto;
    z-index: 1;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  body[data-page="plans"] .tariff-cta-row .tariff-feature-cell {
    position: sticky;
    left: 0;
    z-index: 6;
  }

  body[data-page="plans"] .tariff-cta-button {
    min-height: 34px;
    width: 100%;
    max-width: 96px;
    padding: 0.35rem 0.48rem;
    border-radius: 10px;
    font-size: 0.72rem;
    line-height: 1.08;
    white-space: normal;
  }
}

@media (max-width: 420px) {
  body[data-page="plans"] .tariff-sheet-table {
    min-width: 600px;
    width: 600px;
  }

  body[data-page="plans"] .tariff-feature-cell,
  body[data-page="plans"] .tariff-sheet-table thead th:first-child,
  body[data-page="plans"] .tariff-sheet-table tbody th:first-child,
  body[data-page="plans"] .tariff-sheet-table tbody td:first-child {
    width: 112px;
    min-width: 112px;
    max-width: 112px;
  }

  body[data-page="plans"] .tariff-plan-head {
    width: 122px;
  }
}

@media (max-width: 760px) {
  body[data-page="plans"] .tariff-cta-row td {
    text-align: center;
  }

  body[data-page="plans"] .tariff-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-inline: auto;
  }
}

/* Plans matrix status symbols and mobile containment polish. */
body[data-page="plans"] .tariff-value {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  color: #e5e7eb;
  font-weight: 800;
  line-height: 1.32;
  overflow-wrap: anywhere;
  white-space: normal;
}

body[data-page="plans"] .tariff-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border-radius: 999px;
  font-weight: 900;
  line-height: 1;
}

body[data-page="plans"] .tariff-status--yes {
  color: #86efac;
  border: 1px solid rgba(74, 222, 128, 0.58);
  background: rgba(34, 197, 94, 0.14);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.28), inset 0 0 14px rgba(34, 197, 94, 0.10);
}

body[data-page="plans"] .tariff-status--no {
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(51, 65, 85, 0.20);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.08), inset 0 0 12px rgba(148, 163, 184, 0.06);
}

body[data-page="plans"] .tariff-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  max-width: 100%;
  margin: 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.05;
  white-space: normal;
}

body[data-page="plans"] .tariff-badge--basic {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.32);
}

body[data-page="plans"] .tariff-badge--limited,
body[data-page="plans"] .tariff-badge--preview,
body[data-page="plans"] .tariff-badge--partial {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.34);
}

body[data-page="plans"] .tariff-badge--addon,
body[data-page="plans"] .tariff-badge--advanced {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(45, 212, 191, 0.30);
}

@media (max-width: 760px) {
  body[data-page="plans"] .app-content,
  body[data-page="plans"] #plans-grid,
  body[data-page="plans"] #plans-grid > .col-12 {
    min-width: 0;
    max-width: 100%;
  }

  body[data-page="plans"] .tariff-sheet__scroll {
    overscroll-behavior-x: contain;
  }

  body[data-page="plans"] .tariff-sheet-table {
    min-width: 620px;
    width: 620px;
  }

  body[data-page="plans"] .tariff-feature-cell,
  body[data-page="plans"] .tariff-sheet-table thead th:first-child,
  body[data-page="plans"] .tariff-sheet-table tbody th:first-child,
  body[data-page="plans"] .tariff-sheet-table tbody td:first-child {
    width: 126px;
    min-width: 126px;
    max-width: 126px;
  }

  body[data-page="plans"] .tariff-plan-head {
    width: 123px;
  }

  body[data-page="plans"] .tariff-status {
    width: 24px;
    height: 24px;
    font-size: 0.95rem;
  }

  body[data-page="plans"] .tariff-badge {
    min-height: 22px;
    max-width: 92px;
    padding: 3px 7px;
    font-size: 0.62rem;
  }

  body[data-page="plans"] .tariff-value {
    font-size: 0.78rem;
    line-height: 1.16;
  }

  body[data-page="plans"] .tariff-sheet + section .row,
  body[data-page="plans"] .tariff-sheet + section .col-12,
  body[data-page="plans"] .tariff-sheet + section .panel {
    min-width: 0;
  }

  body[data-page="plans"] .tariff-sheet + section .d-flex.align-items-center.justify-content-between {
    display: grid !important;
    grid-template-columns: 1fr;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  body[data-page="plans"] .tariff-sheet + section .fw-bold,
  body[data-page="plans"] .tariff-sheet + section .text-muted {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  body[data-page="plans"] .tariff-sheet + section .btn {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
}

@media (max-width: 420px) {
  body[data-page="plans"] .tariff-sheet-table {
    min-width: 604px;
    width: 604px;
  }

  body[data-page="plans"] .tariff-feature-cell,
  body[data-page="plans"] .tariff-sheet-table thead th:first-child,
  body[data-page="plans"] .tariff-sheet-table tbody th:first-child,
  body[data-page="plans"] .tariff-sheet-table tbody td:first-child {
    width: 124px;
    min-width: 124px;
    max-width: 124px;
  }

  body[data-page="plans"] .tariff-plan-head {
    width: 120px;
  }
}

/* Current plan metadata and stricter sticky plans matrix alignment. */
body[data-page="plans"] .plan-current-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

body[data-page="plans"] .plan-current-meta__item {
  min-width: min(220px, 100%);
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.42);
}

body[data-page="plans"] .plan-current-meta__item span {
  display: block;
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.76rem;
  line-height: 1.15;
  text-transform: uppercase;
}

body[data-page="plans"] .plan-current-meta__item strong {
  display: block;
  margin-top: 0.24rem;
  color: #f8fafc;
  font-size: 0.92rem;
  line-height: 1.2;
}

html[data-theme="light"] body[data-page="plans"] .plan-current-meta__item,
body.light-theme[data-page="plans"] .plan-current-meta__item {
  background: rgba(255, 255, 255, 0.78);
}

html[data-theme="light"] body[data-page="plans"] .plan-current-meta__item span,
body.light-theme[data-page="plans"] .plan-current-meta__item span {
  color: rgba(71, 85, 105, 0.78);
}

html[data-theme="light"] body[data-page="plans"] .plan-current-meta__item strong,
body.light-theme[data-page="plans"] .plan-current-meta__item strong {
  color: #172033;
}

body[data-page="plans"] .tariff-sheet-table td {
  text-align: center;
}

body[data-page="plans"] .tariff-feature-cell {
  text-align: left;
}

@media (max-width: 760px) {
  body[data-page="plans"] .plan-current-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  body[data-page="plans"] .plan-current-meta__item {
    min-width: 0;
  }

  body[data-page="plans"] .tariff-sheet__scroll {
    position: relative;
    isolation: isolate;
  }

  body[data-page="plans"] .tariff-sheet-table thead .tariff-feature-cell,
  body[data-page="plans"] .tariff-sheet-table tbody .tariff-feature-cell,
  body[data-page="plans"] .tariff-section-row .tariff-feature-cell,
  body[data-page="plans"] .tariff-cta-row .tariff-feature-cell {
    position: sticky !important;
    left: 0 !important;
    z-index: 8;
    background: rgba(15, 23, 42, 0.99);
  }

  body[data-page="plans"] .tariff-sheet-table thead .tariff-feature-cell {
    z-index: 10;
  }

  body[data-page="plans"] .tariff-section-row .tariff-feature-cell {
    z-index: 9;
    font-size: 0.72rem;
  }

  body[data-page="plans"] .tariff-cta-row .tariff-feature-cell {
    z-index: 9;
  }

  html[data-theme="light"] body[data-page="plans"] .tariff-sheet-table thead .tariff-feature-cell,
  html[data-theme="light"] body[data-page="plans"] .tariff-sheet-table tbody .tariff-feature-cell,
  html[data-theme="light"] body[data-page="plans"] .tariff-section-row .tariff-feature-cell,
  html[data-theme="light"] body[data-page="plans"] .tariff-cta-row .tariff-feature-cell,
  body.light-theme[data-page="plans"] .tariff-sheet-table thead .tariff-feature-cell,
  body.light-theme[data-page="plans"] .tariff-sheet-table tbody .tariff-feature-cell,
  body.light-theme[data-page="plans"] .tariff-section-row .tariff-feature-cell,
  body.light-theme[data-page="plans"] .tariff-cta-row .tariff-feature-cell {
    background: rgba(255, 255, 255, 0.99);
  }
}
