:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #697586;
  --line: #dce3ee;
  --blue: #2f6fed;
  --green: #168a5b;
  --orange: #e88b23;
  --red: #cf3d3d;
  --purple: #7a58d6;
  --teal: #0e9f9a;
  --yellow: #f0b429;
  --shadow: 0 14px 40px rgba(34, 48, 73, 0.10);
}

/* V41 visual redesign layer */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d8dee8;
  --blue: #2563eb;
  --green: #0f8a5f;
  --orange: #d97706;
  --red: #dc2626;
  --purple: #6d5bd0;
  --teal: #0f9f9a;
  --yellow: #d8a21d;
  --primary-color: var(--blue);
  --success-color: var(--green);
  --danger-color: var(--red);
  --warning-color: var(--orange);
  --app-bg: #f4f6f8;
  --surface-soft: #f8fafc;
  --surface-strong: #eef2f7;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.05);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

html[data-theme="dark"] {
  --bg: #0f131a;
  --panel: #171c24;
  --ink: #eef2f7;
  --muted: #a0a8b5;
  --line: #2c3440;
  --app-bg: #10151d;
  --surface-soft: #1d2430;
  --surface-strong: #222b38;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 12px 32px rgba(0, 0, 0, 0.26);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.25);
}

html {
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif;
  letter-spacing: 0;
}

body:not(.locked) {
  min-height: 100vh;
}

@media (min-width: 981px) {
  .app-shell {
    grid-template-columns: 276px minmax(0, 1fr);
    background: var(--bg);
  }
}

.content {
  width: 100%;
  max-width: 1480px;
  padding: 24px 28px 40px;
  margin: 0 auto;
}

.sidebar {
  background: #111827;
  padding: 18px;
  gap: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .sidebar {
  background: #0c1118;
}

.brand {
  padding: 8px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand h1 {
  font-size: 19px;
  font-weight: 800;
}

.brand p {
  margin-top: 2px;
  font-size: 12px;
}

.mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: #f4c430;
  color: #111827;
  box-shadow: inset 0 -1px 0 rgba(17, 24, 39, 0.16);
}

.nav {
  gap: 10px;
}

.nav-section {
  gap: 6px;
}

.nav-heading,
.nav-section-toggle {
  padding-inline: 8px;
  color: #9aa4b2;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.nav-section-toggle {
  min-height: 32px;
  border-radius: var(--radius-md);
}

.nav-section-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-group {
  gap: 5px;
}

.nav-item {
  min-height: 38px;
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: #d8dee8;
  font-size: 14px;
  font-weight: 650;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  background: #ffffff;
  color: #111827;
}

.logout-item {
  margin-top: auto;
  color: #fecaca;
}

.sync-panel {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.topbar {
  align-items: flex-start;
  padding: 0 0 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  font-size: 30px;
  font-weight: 820;
  letter-spacing: 0;
}

.eyebrow,
.field-help,
.metric small,
.analytics-summary-card small,
.panel-head span {
  color: var(--muted);
}

.global-month-scope,
.app-version-badge,
.app-version-text {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.sheet-link,
.ghost-btn,
.primary-btn,
.mini-btn,
.icon-btn,
.nav-section-toggle,
button {
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.sheet-link,
.ghost-btn,
.primary-btn,
.mini-btn,
.icon-btn {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.ghost-btn,
.sheet-link,
.mini-btn,
.icon-btn {
  background: var(--panel);
  border-color: var(--line);
}

.ghost-btn:hover,
.sheet-link:hover,
.mini-btn:hover,
.icon-btn:hover {
  border-color: #b8c3d4;
  background: var(--surface-soft);
}

.primary-btn {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: none;
}

.primary-btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.success-theme-btn {
  background: var(--green) !important;
}

.danger-theme-btn,
.primary-btn.danger-btn {
  background: var(--red) !important;
  border-color: var(--red) !important;
}

.panel,
.metric,
.analytics-summary-card,
.budget-box,
.assist-grid article,
.table-wrap,
.modal-card,
.login-card,
.category-row,
.advisor-box,
.goal-card,
.month-score-card,
.recommendation-card,
.open-card,
.income-profile-split article,
.income-profile-status {
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 18px;
}

.panel-head {
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3,
.panel-head h4 {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.metrics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 104px;
  padding: 14px;
  gap: 6px;
}

.metric span,
.assist-grid span,
.analytics-summary-card span,
.income-profile-split span,
.income-profile-status span,
.mini-metrics span {
  font-size: 12px;
  color: var(--muted);
}

.metric strong {
  font-size: 25px;
  line-height: 1.1;
}

.home-action-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-action {
  min-height: 126px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--panel) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow-soft);
}

.home-action:hover {
  transform: translateY(-1px);
  border-color: #b8c3d4 !important;
  box-shadow: var(--shadow);
}

.home-action span {
  color: var(--muted) !important;
}

.home-action strong {
  font-size: 24px;
}

.home-action.expense {
  border-right: 4px solid var(--orange) !important;
}

.home-action.work {
  border-right: 4px solid var(--blue) !important;
}

.income-profile-panel,
.external-income-panel,
.recurring-expenses-panel {
  border-top: 0 !important;
}

.dashboard-income-profile {
  padding: 16px;
}

.income-profile-dashboard-head {
  margin-bottom: 12px;
}

.income-profile-dashboard-head h3 {
  font-size: 18px;
}

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

.income-profile-split article,
.income-profile-status {
  background: var(--surface-soft);
}

.income-profile-split strong,
.income-profile-status strong {
  font-size: 20px;
}

.sidebar-status-badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
}

input,
select,
textarea {
  min-height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}

label {
  color: var(--ink);
  font-weight: 650;
}

label > span,
.field-help {
  font-weight: 500;
}

.filters-grid,
.compact-filters,
.settings-form-group {
  gap: 12px;
}

.inline-form-row,
.recurring-form-inline {
  background: var(--surface-soft);
  border-color: var(--line);
  border-radius: var(--radius-lg);
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-lg);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

td {
  border-bottom-color: var(--line);
}

tbody tr:hover td {
  background: var(--surface-soft);
}

.mini-btn.danger,
.job-delete-btn {
  color: var(--red);
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.06);
}

.login-screen {
  background: var(--bg);
}

.auth-panel,
.login-card {
  border-radius: 14px !important;
  box-shadow: var(--shadow);
}

.modal {
  backdrop-filter: blur(10px);
}

.modal-card {
  box-shadow: var(--shadow);
}

.toast,
.toast-notification,
#toast {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow) !important;
}

canvas {
  border-radius: var(--radius-md);
}

@media (max-width: 1180px) {
  .metrics-grid,
  .income-profile-split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .content {
    padding: 18px 16px 36px;
  }

  .topbar {
    gap: 12px;
  }
}

@media (max-width: 640px) {
  .metrics-grid,
  .home-action-panel,
  .income-profile-split,
  .income-profile-layout {
    grid-template-columns: 1fr !important;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .metric strong,
  .home-action strong {
    font-size: 22px;
  }

  .panel {
    padding: 14px;
  }
}

/* Final responsive guard: prevent compact cards and form controls from overflowing. */
.metric,
.metric-card,
.pulse-card,
.home-action,
.expense-impact-metric,
.analytics-summary-card,
.income-profile-split article,
.income-profile-status,
.mini-metrics > *,
.form-group-grid > *,
.filters-grid > *,
.compact-filters > *,
.settings-form-group > *,
.input-field-wrap,
label {
  min-width: 0;
  max-width: 100%;
}

.metric strong,
.metric-card-value,
.pulse-card strong,
.home-action strong,
.expense-impact-metric strong,
.analytics-summary-card strong,
.income-profile-split strong,
.income-profile-status strong,
.mini-metrics strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.form-panel input,
.form-panel select,
.form-panel textarea,
.form-panel button,
.filters-grid input,
.filters-grid select,
.filters-grid textarea,
.filters-grid button,
.compact-filters input,
.compact-filters select,
.compact-filters textarea,
.compact-filters button,
.settings-form-group input,
.settings-form-group select,
.settings-form-group textarea,
.settings-form-group button,
.nlp-command-inline-row input,
.nlp-command-inline-row button {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

.form-panel input[type="date"],
.form-panel input[type="time"],
.filters-grid input[type="date"],
.filters-grid input[type="time"],
.compact-filters input[type="date"],
.compact-filters input[type="time"],
.settings-form-group input[type="date"],
.settings-form-group input[type="time"] {
  width: 100%;
}

@media (max-width: 760px) {
  .form-group-grid,
  .form-group-grid.time-grid,
  .filters-grid,
  .compact-filters,
  .settings-form-group,
  .nlp-command-inline-row,
  .recurring-form-inline,
  .inline-form-row {
    grid-template-columns: 1fr !important;
  }

  .form-panel .mini-btn,
  .nlp-command-inline-row .mini-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .metric strong,
  .metric-card-value,
  .pulse-card strong,
  .home-action strong,
  .expense-impact-metric strong,
  .analytics-summary-card strong,
  .income-profile-split strong,
  .income-profile-status strong,
  .mini-metrics strong {
    font-size: clamp(1.05rem, 6vw, 1.45rem);
    line-height: 1.15;
  }
}

/* Final cascade guard for v46 mobile layout. This block must remain last. */
@media (max-width: 980px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 18px 14px 36px !important;
    box-sizing: border-box;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 0 0 auto !important;
    width: min(84vw, 320px) !important;
    max-width: 320px !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto;
    transform: translateX(108%) !important;
    transition: transform 180ms ease;
    z-index: 30 !important;
    box-sizing: border-box;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0) !important;
    pointer-events: auto;
  }

  body:not(.sidebar-open) .sidebar {
    pointer-events: none;
  }

  .sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 29 !important;
  }

  .sidebar-overlay[hidden] {
    display: none !important;
  }
}

/* Final cascade guard for v46 mobile layout. This block must remain last. */
@media (max-width: 980px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 18px 14px 36px !important;
    box-sizing: border-box;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 0 0 auto !important;
    width: min(84vw, 320px) !important;
    max-width: 320px !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto;
    transform: translateX(108%) !important;
    transition: transform 180ms ease;
    z-index: 30 !important;
    box-sizing: border-box;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0) !important;
    pointer-events: auto;
  }

  body:not(.sidebar-open) .sidebar {
    pointer-events: none;
  }

  .sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 29 !important;
  }

  .sidebar-overlay[hidden] {
    display: none !important;
  }
}

/* Final cascade guard for v46 mobile layout. This block must remain last. */
@media (max-width: 980px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 18px 14px 36px !important;
    box-sizing: border-box;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 0 0 auto !important;
    width: min(84vw, 320px) !important;
    max-width: 320px !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto;
    transform: translateX(108%) !important;
    transition: transform 180ms ease;
    z-index: 30 !important;
    box-sizing: border-box;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0) !important;
    pointer-events: auto;
  }

  body:not(.sidebar-open) .sidebar {
    pointer-events: none;
  }

  .sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 29 !important;
  }

  .sidebar-overlay[hidden] {
    display: none !important;
  }
}

/* Final v46 mobile shell correction: keep content full width and slide sidebar above it. */
@media (max-width: 980px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 18px 14px 36px !important;
    box-sizing: border-box;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 0 0 auto !important;
    width: min(84vw, 320px) !important;
    max-width: 320px !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto;
    transform: translateX(108%) !important;
    transition: transform 180ms ease;
    z-index: 30 !important;
    box-sizing: border-box;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0) !important;
    pointer-events: auto;
  }

  body:not(.sidebar-open) .sidebar {
    pointer-events: none;
  }

  .sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 29 !important;
  }

  .sidebar-overlay[hidden] {
    display: none !important;
  }
}

/* v46 mobile shell correction: sidebar is an overlay, never a reserved grid column. */
@media (max-width: 980px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 18px 14px 36px !important;
    box-sizing: border-box;
  }

  .sidebar {
    position: fixed !important;
    inset: 0 0 0 auto !important;
    width: min(84vw, 320px) !important;
    max-width: 320px !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto;
    transform: translateX(108%) !important;
    transition: transform 180ms ease;
    z-index: 30 !important;
    box-sizing: border-box;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0) !important;
    pointer-events: auto;
  }

  body:not(.sidebar-open) .sidebar {
    pointer-events: none;
  }

  .sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 29 !important;
  }

  .sidebar-overlay[hidden] {
    display: none !important;
  }
}

/* V41 readability fixes for financial pulse cards */
.pulse-card,
.smart-summary article,
.recommendation-card,
.month-score-card {
  align-items: stretch !important;
  text-align: right !important;
  justify-content: start !important;
  background: var(--panel) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
  border-right: 4px solid var(--line) !important;
}

.pulse-card strong,
.smart-summary strong,
.recommendation-card strong,
.month-score-card strong {
  color: var(--ink) !important;
}

.pulse-card span,
.pulse-card small,
.smart-summary span,
.smart-summary small,
.recommendation-card span,
.recommendation-card small,
.month-score-card span,
.month-score-card small {
  color: var(--muted) !important;
}

.pulse-card.green,
.recommendation-card.green {
  border-right-color: var(--green) !important;
}

.pulse-card.blue,
.recommendation-card.blue {
  border-right-color: var(--blue) !important;
}

.pulse-card.orange,
.recommendation-card.orange {
  border-right-color: var(--orange) !important;
}

.pulse-card.purple,
.recommendation-card.purple {
  border-right-color: var(--purple) !important;
}

.pulse-card.teal,
.recommendation-card.teal {
  border-right-color: var(--teal) !important;
}

.pulse-card.red,
.recommendation-card.red {
  border-right-color: var(--red) !important;
}

.mobile-prompt-banner {
  border-radius: var(--radius-lg) !important;
  background: var(--panel) !important;
}

.mobile-prompt-banner .prompt-content {
  align-items: flex-start;
}

.mobile-prompt-banner .prompt-icon {
  font-size: 20px;
  line-height: 1.2;
}

.mobile-prompt-banner p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 640px) {
  .mobile-prompt-banner {
    right: 10px;
    left: 10px;
    bottom: 10px;
    padding: 14px;
    gap: 12px;
  }

  .mobile-prompt-banner .prompt-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .mobile-prompt-banner .prompt-actions .mini-btn {
    width: 100%;
  }

  .top-actions {
    width: 100%;
    justify-content: center;
  }

  .home-action {
    min-height: 118px;
  }
}

html[data-theme="dark"] {
  --bg: #0e1420;
  --panel: #151d2b;
  --ink: #eef4ff;
  --muted: #9ba8bc;
  --line: #2b3548;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .assist-grid article,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .analytics-summary-card,
html[data-theme="dark"] .budget-box,
html[data-theme="dark"] .category-row,
html[data-theme="dark"] .advisor-box,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] th {
  background: #1f2a3d;
  color: var(--ink);
}

html[data-theme="dark"] .ghost-btn,
html[data-theme="dark"] .sheet-link,
html[data-theme="dark"] .mini-btn,
html[data-theme="dark"] .icon-btn {
  background: #182235;
  color: var(--ink);
  border-color: var(--line);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  width: 100%;
  overflow-x: hidden;
}

body.locked {
  overflow: hidden;
}

body.sidebar-open {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}

body.sidebar-open .sidebar {
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.app-version-badge,
.app-version-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.app-version-badge {
  margin: 0 auto 12px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(105, 117, 134, 0.12);
}

.app-version-text {
  margin-top: 6px;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
}

.app-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.mobile-menu-btn {
  display: none;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 18;
}

.sidebar {
  background: #111827;
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--yellow);
  color: #111827;
  font-weight: 800;
  font-size: 24px;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel span {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
}

.brand p,
.sync-panel p {
  color: #b8c0cc;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 12px;
}

.nav-section {
  display: grid;
  gap: 7px;
}

.nav-heading,
.nav-section-toggle {
  color: #91a0b7;
  font-size: 12px;
  font-weight: 800;
  padding: 0 10px 3px;
}

.nav-section-toggle {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #c8d2e1;
  cursor: pointer;
  text-align: right;
}

.nav-section-toggle:hover {
  background: #1b2536;
  color: #fff;
}

.nav-arrow {
  font-size: 17px;
  line-height: 1;
  transition: transform 160ms ease;
}

.nav-section.open .nav-arrow {
  transform: rotate(180deg);
}

.nav-group {
  display: grid;
  gap: 7px;
}

.nav-collapsible {
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-item {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d4dae4;
  text-align: right;
  padding: 12px 14px;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: #253044;
  color: #fff;
}

.sync-panel {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  align-items: start;
  gap: 10px;
}

.sync-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin-top: 4px;
  background: var(--orange);
  flex: 0 0 auto;
}

.sync-dot.live {
  background: var(--green);
}

.sync-dot.offline {
  background: var(--red);
}

.content {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.topbar h2 {
  font-size: 32px;
}

.top-actions,
.button-row,
.row-actions,
.quick-actions,
.table-actions,
.preset-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sheet-link,
.ghost-btn,
.primary-btn,
.mini-btn,
.icon-btn {
  border-radius: 8px;
  padding: 10px 13px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.primary-btn {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 700;
}

.ghost-btn:disabled,
.primary-btn:disabled,
.mini-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.primary-btn.danger-btn {
  background: var(--red);
  border-color: var(--red);
}

.primary-btn.compact,
.mini-btn {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 13px;
}

.mini-btn {
  background: #eef3fb;
}

.mini-btn.danger {
  color: #9b1c1c;
  border-color: #f1b8b8;
  background: #fff3f3;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.view,
.hidden,
[hidden] {
  display: none !important;
}

.view.active {
  display: block !important;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.metric {
  padding: 16px;
  min-height: 116px;
  display: grid;
  gap: 8px;
  overflow: hidden;
}

.metric span,
.assist-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  font-size: 29px;
}

.metric small {
  color: var(--muted);
}

.global-month-scope {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 6px 0 0;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(47, 111, 237, 0.22);
  background: rgba(47, 111, 237, 0.08);
  color: var(--primary-color);
  font-size: 12px;
  font-weight: 800;
}

.split-grid,
.charts-grid,
.work-layout {
  display: grid;
  gap: 14px;
}

.split-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  margin-bottom: 14px;
}

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

.work-layout {
  grid-template-columns: minmax(330px, 420px) minmax(0, 1fr);
}

.panel {
  padding: 16px;
  min-width: 0;
}

.home-action-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 14px;
  margin-bottom: 14px;
}

.home-action {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 148px;
  padding: 18px;
  text-align: right;
  display: grid;
  align-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.home-action:hover {
  transform: translateY(-2px);
  border-color: #b8c9e8;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.11);
}

.home-action span {
  font-size: 13px;
  font-weight: 900;
}

.home-action strong {
  font-size: 28px;
  line-height: 1.1;
}

.home-action small {
  font-size: 14px;
  line-height: 1.35;
}

.home-action.expense {
  background: linear-gradient(135deg, #fff8eb 0%, #f0f5ff 100%);
  border-color: #f2d29f;
  color: #17202a;
}

.home-action.expense span {
  color: #9a5b06;
}

.home-action.work {
  background: linear-gradient(135deg, #eefaf4 0%, #effcfb 100%);
  border-color: #bce7d2;
}

.home-action.work span {
  color: #146b44;
}

.home-action.work.active-shift {
  background: linear-gradient(135deg, #fff3d6 0%, #fff8eb 100%);
  border-color: #f0b429;
  animation: activeShiftPulse 1.6s ease-in-out infinite;
}

@keyframes activeShiftPulse {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: 0 0 0 4px rgba(240, 180, 41, 0.18), var(--shadow); }
}

.command-panel {
  margin-bottom: 14px;
}

.quick-actions .primary-btn,
.quick-actions .ghost-btn {
  min-width: 132px;
}

.shift-entry-card {
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f0f5ff 55%, #eefaf4 100%);
}

.shift-entry-card span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.shift-entry-card h3,
.shift-entry-card p {
  margin: 0;
}

.shift-entry-card h3 {
  margin-top: 5px;
  font-size: 22px;
}

.shift-entry-card p {
  margin-top: 7px;
  color: var(--muted);
  max-width: 680px;
}

.shift-entry-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-head h3 {
  font-size: 18px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.form-panel {
  display: grid;
  gap: 12px;
  align-self: start;
}

label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  border: 1px solid #cfd7e6;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  min-width: 0;
  min-height: 42px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
}

input:focus,
select:focus {
  outline: 2px solid rgba(47, 111, 237, 0.22);
  border-color: var(--blue);
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 8px;
  align-items: end;
}

.field-help {
  color: var(--muted);
  font-size: 13px;
  margin: -4px 0 2px;
}

.preset-row {
  gap: 8px;
}

.preset-row .mini-btn {
  flex: 1 1 96px;
}

.preview-box,
.budget-box {
  background: #f0f5ff;
  border: 1px solid #c8d9ff;
  border-radius: 8px;
  padding: 12px;
  color: #22416f;
  font-size: 14px;
}

.assist-grid,
.mini-metrics,
.forecast-grid,
.goal-strip,
.pulse-grid,
.smart-summary,
.month-score-grid,
.recommendation-list {
  display: grid;
  gap: 10px;
}

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

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

.pulse-card,
.smart-summary article,
.month-score-card,
.recommendation-card,
.advisor-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 13px;
  display: grid;
  gap: 6px;
}

.pulse-card span,
.smart-summary span,
.month-score-card span,
.advisor-box span,
.recommendation-card span {
  color: var(--muted);
  font-size: 13px;
}

.pulse-card strong,
.month-score-card strong,
.smart-summary strong {
  font-size: 22px;
}

.pulse-card.green,
.recommendation-card.green {
  border-color: #bce7d2;
  background: #eefaf4;
}

.pulse-card.blue,
.recommendation-card.blue {
  border-color: #c8d9ff;
  background: #f0f5ff;
}

.pulse-card.orange,
.recommendation-card.orange {
  border-color: #f2d29f;
  background: #fff8eb;
}

.pulse-card.purple,
.recommendation-card.purple {
  border-color: #dccfff;
  background: #f7f3ff;
}

.pulse-card.teal,
.recommendation-card.teal {
  border-color: #b9ece8;
  background: #effcfb;
}

.pulse-card.red,
.recommendation-card.red {
  border-color: #f1b8b8;
  background: #fff3f3;
}

.automation-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.automation-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 13px;
  display: grid;
  gap: 11px;
  min-width: 0;
}

.automation-card.ready {
  border-color: #bce7d2;
  background: #eefaf4;
}

.automation-card.needs-work {
  border-color: #f2d29f;
  background: #fff8eb;
}

.automation-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.automation-card strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
}

.automation-checks {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.automation-checks b {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
}

.automation-checks b.ok {
  background: #dcfce7;
  color: #0f5f3e;
}

.automation-checks b.warn {
  background: #fff3d6;
  color: #8a4b05;
}

.advisor-box {
  margin-top: 12px;
  background: #f8fbff;
}

.advisor-box strong {
  font-size: 15px;
}

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

.goal-card,
.forecast-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 13px;
  display: grid;
  gap: 7px;
}

.goal-card span,
.forecast-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.goal-card strong,
.forecast-grid strong {
  font-size: 24px;
}

.progress {
  height: 9px;
  border-radius: 999px;
  background: #e7edf6;
  overflow: hidden;
}

.progress div {
  height: 100%;
  width: min(var(--pct), 100%);
  border-radius: inherit;
  background: var(--blue);
}

.progress.green div {
  background: var(--green);
}

.progress.orange div {
  background: var(--orange);
}

.progress.purple div {
  background: var(--purple);
}

.progress.teal div {
  background: var(--teal);
}

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

.single-filter {
  grid-template-columns: minmax(220px, 320px);
  margin-bottom: 12px;
}

.goal-type-control {
  display: grid;
  gap: 10px;
}

.goal-type-control .ghost-btn {
  justify-self: start;
}

.goal-type-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.goal-type-panel strong {
  font-size: 14px;
}

.goal-type-panel small {
  color: var(--muted);
}

.goal-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.goal-type-grid label {
  grid-template-columns: auto 1fr;
  align-items: center;
  border: 1px solid #d6dfec;
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
  font-size: 13px;
}

.goal-type-grid input {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
}

.goal-field-inactive {
  opacity: 0.54;
}

.goal-field-inactive input {
  background: #f1f5f9;
}

.goal-field-inactive::after {
  content: "לא פעיל החודש";
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.goal-scoreboard {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.goal-progress-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
}

.goal-progress-row strong {
  display: block;
  font-size: 16px;
}

.goal-progress-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.goal-progress-row .progress {
  grid-column: 1 / -1;
}

.goal-progress-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.goal-progress-meta b {
  font-size: 18px;
}

.goal-status {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.goal-status.done {
  color: #0f5f3e;
  background: #dcfce7;
}

.goal-status.open {
  color: #8a4b05;
  background: #fff3d6;
}

.goal-history-panel {
  margin-top: 14px;
}

.assist-grid article,
.mini-metrics span,
.open-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.assist-grid article {
  padding: 14px;
  display: grid;
  gap: 6px;
}

.assist-grid strong {
  font-size: 20px;
}

.mini-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0;
}

.smart-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0;
}

.smart-summary article {
  text-align: center;
}

.month-score-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.recommendation-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.recommendation-card strong {
  font-size: 16px;
}

.mini-metrics span {
  padding: 10px;
  font-weight: 800;
  text-align: center;
}

.stack {
  display: grid;
  gap: 10px;
}

.insight-list,
.health-list {
  display: grid;
  gap: 10px;
}

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

.insight-card,
.health-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 13px;
  display: grid;
  gap: 6px;
}

.insight-card span,
.health-item span {
  color: var(--muted);
  font-size: 13px;
}

.insight-card strong {
  font-size: 22px;
}

.insight-card.green {
  border-color: #bce7d2;
  background: #eefaf4;
}

.insight-card.orange {
  border-color: #f2d29f;
  background: #fff8eb;
}

.insight-card.red,
.health-item.warn,
.health-item.open {
  border-color: #f1b8b8;
  background: #fff3f3;
}

.insight-card.blue {
  border-color: #c8d9ff;
  background: #f0f5ff;
}

.insight-card.purple {
  border-color: #dccfff;
  background: #f7f3ff;
}

.insight-card.teal {
  border-color: #b9ece8;
  background: #effcfb;
}

.table-actions {
  margin: 12px 0;
  justify-content: flex-start;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.calendar-cell {
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.calendar-cell.muted {
  border-style: dashed;
  background: transparent;
}

.calendar-cell.worked {
  border-color: #bdd4ff;
  background: #f4f8ff;
}

.calendar-cell.shabbat {
  border-color: #f2d29f;
  background: #fff8eb;
}

.calendar-cell.today {
  outline: 2px solid rgba(47, 111, 237, 0.35);
}

.calendar-day {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-day strong {
  font-size: 20px;
}

.calendar-day span,
.calendar-stats small,
.empty-day {
  color: var(--muted);
  font-size: 12px;
}

.calendar-stats {
  display: grid;
  gap: 4px;
}

.calendar-stats b {
  font-size: 16px;
}

.open-card {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.open-card strong,
.open-card span {
  display: block;
}

.open-card span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.empty-state {
  padding: 16px;
  color: var(--muted);
}

.filters-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  align-items: end;
}

.filters-grid .ghost-btn {
  align-self: end;
}

.compact-filters {
  grid-template-columns: minmax(180px, 260px) minmax(160px, 220px) auto;
  margin-bottom: 14px;
}

.month-charts {
  margin-top: 14px;
}

.analytics-control-panel {
  margin-bottom: 14px;
}

.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.analytics-summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 13px;
  display: grid;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.analytics-summary-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.analytics-summary-card strong {
  font-size: 22px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.analytics-summary-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.analytics-grid {
  align-items: stretch;
}

.chart-wide {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-wrap.tall {
  max-height: 68vh;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  background: #eef3fb;
  color: #334155;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #f8fbff;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
  padding: 22px;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  background: #e8eef9;
}

.pill.food {
  background: #e9f8ef;
  color: #146b44;
}

.pill.lunch {
  background: #fff0d8;
  color: #87540a;
}

.status.open {
  background: #fff6df;
  color: #87540a;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  margin: 2px;
  font-size: 12px;
  font-weight: 800;
  background: #e8eef9;
  color: #334155;
}

.risk-badge.ok {
  color: #0f5f3e;
  background: #dcfce7;
}

.risk-badge.warn {
  color: #8a4b05;
  background: #fff3d6;
}

.risk-badge.bad {
  color: #991b1b;
  background: #fee2e2;
}

.budget-meter {
  height: 14px;
  border-radius: 999px;
  background: #e7edf6;
  overflow: hidden;
  margin-top: 10px;
}

.budget-meter div {
  height: 100%;
  width: var(--pct);
  background: linear-gradient(90deg, #168a5b, #f0b429, #cf3d3d);
}

.budget-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.budget-facts span {
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.category-stack {
  display: grid;
  gap: 10px;
}

.category-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.category-row > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.category-row span:last-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.expense-control-toolbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  padding: 12px 16px;
  margin-bottom: 16px;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(10px);
}

.expense-control-toolbar.save-banner-active {
  display: flex;
}

.expense-control-toolbar strong,
.expense-control-toolbar span {
  display: block;
}

.expense-control-toolbar span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.expense-control-toolbar span.dirty {
  color: var(--orange);
  font-weight: 800;
}

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

.action-history-controls {
  margin-bottom: 14px;
}

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

.control-summary-grid .analytics-summary-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  min-height: 98px;
}

.control-summary-grid .analytics-summary-card strong {
  font-size: 20px;
}

.option-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fbfdff;
  color: #334155;
}

.option-check span {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.control-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.control-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
  display: grid;
  grid-template-columns: 82px minmax(150px, 1.3fr) 88px minmax(96px, 0.65fr) minmax(88px, 0.6fr) minmax(150px, 1fr) 74px;
  gap: 10px;
  align-items: end;
  overflow: hidden;
}

.control-row.is-inactive {
  background: #f6f8fb;
  opacity: 0.72;
}

.control-list.compact .control-row,
.payment-control-row {
  grid-template-columns: 82px minmax(220px, 1fr) 74px;
}

.control-row label {
  min-width: 0;
}

.control-row input[type="color"] {
  width: 100%;
  padding: 4px;
  cursor: pointer;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
  white-space: nowrap;
  color: #334155;
}

.inline-check input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  min-height: 0;
}

.control-delete {
  width: 100%;
  align-self: end;
}

@media (max-width: 1180px) {
  .control-summary-grid {
    grid-template-columns: 1fr;
  }
}

.onboarding-validation-message {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  font-size: 0.9rem;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.54);
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-card {
  width: min(520px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 12px;
}

.confirm-card {
  width: min(430px, calc(100vw - 36px));
}

.confirm-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.month-setup-card {
  width: min(760px, 100%);
}

.month-setup-hero {
  border: 1px solid #c8d9ff;
  border-radius: 8px;
  background: linear-gradient(135deg, #f0f5ff 0%, #effcfb 100%);
  padding: 15px;
  display: grid;
  gap: 6px;
}

.month-setup-hero span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.month-setup-hero strong {
  color: var(--ink);
  font-size: 26px;
  line-height: 1.1;
}

.month-setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.month-setup-grid .option-check {
  align-items: start;
}

.month-setup-preview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.toast {
  position: fixed;
  left: 22px;
  bottom: 22px;
  background: #111827;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 390px;
  z-index: 30;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #111827, #253044);
  padding: 18px;
}

.login-card {
  width: min(420px, calc(100vw - 64px));
  background: #fff;
  border-radius: 8px;
  padding: 22px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: right;
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-card p,
.login-card small {
  color: var(--muted);
}

.login-card small {
  min-height: 18px;
  color: var(--red);
}

canvas {
  width: 100%;
  min-height: 220px;
}

@media (max-width: 1180px) {
  .filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metrics-grid,
  .goal-strip,
  .pulse-grid,
  .analytics-summary-grid,
  .income-profile-split,
  .month-setup-preview,
  .month-score-grid,
  .recommendation-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 980px) {
  body {
    direction: ltr;
  }

  .sidebar,
  .modal,
  .login-card {
    direction: rtl;
  }

  .login-screen {
    direction: ltr;
  }

  .content {
    direction: ltr;
  }

  .topbar,
  .view {
    direction: rtl;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: min(84vw, 320px);
    height: 100vh;
    transform: translateX(105%);
    transition: transform 180ms ease;
    z-index: 19;
  }

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

  .mobile-menu-btn {
    display: grid;
    position: fixed;
    right: 14px;
    top: 14px;
    z-index: 17;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    box-shadow: var(--shadow);
  }

  .content {
    padding-top: 72px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .split-grid,
  .charts-grid,
  .work-layout,
  .automation-panel,
  .budget-facts,
  .month-setup-grid,
  .home-action-panel {
    grid-template-columns: 1fr;
  }

  .insight-list.large {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
    padding-right: 58px;
  }

  .shift-entry-card {
    align-items: stretch;
    flex-direction: column;
  }

  .home-action {
    min-height: 126px;
  }

  .shift-entry-actions .primary-btn,
  .shift-entry-actions .ghost-btn {
    flex: 1 1 150px;
  }
}

@media (max-width: 640px) {
  .content,
  .sidebar {
    padding: 16px;
  }

  .topbar h2 {
    font-size: 26px;
  }

  .home-action {
    padding: 16px;
  }

  .home-action strong {
    font-size: 24px;
  }

  .home-action small {
    font-size: 13px;
  }

  .metric strong {
    font-size: 24px;
  }

  .metrics-grid,
  .assist-grid,
    .mini-metrics,
    .filters-grid,
    .forecast-grid,
    .goal-strip,
    .pulse-grid,
    .analytics-summary-grid,
    .income-profile-split,
    .income-profile-layout,
    .month-setup-preview,
    .smart-summary,
    .month-score-grid,
    .recommendation-list {
    grid-template-columns: 1fr;
  }

  .income-profile-dashboard-head {
    flex-direction: column;
  }

  .goal-progress-row {
    grid-template-columns: 1fr;
  }

  .goal-type-grid {
    grid-template-columns: 1fr;
  }

  .goal-progress-meta {
    justify-content: space-between;
  }

  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .time-row {
    grid-template-columns: 1fr;
  }

  .open-card {
    align-items: stretch;
    flex-direction: column;
  }

  .control-row,
  .control-list.compact .control-row,
  .payment-control-row {
    grid-template-columns: 1fr;
  }

  .quick-actions .primary-btn,
  .quick-actions .ghost-btn,
  .shift-entry-actions .primary-btn,
  .shift-entry-actions .ghost-btn,
  .table-actions .ghost-btn {
    width: 100%;
  }
}

.icon-only-btn {
  width: 42px;
  padding: 0;
}

.form-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.form-group-grid.time-grid {
  grid-template-columns: minmax(0, 1fr) 82px minmax(0, 1fr) 82px minmax(0, 1fr);
}

.input-field-wrap {
  display: grid;
  gap: 6px;
}

#workForm .form-group-grid,
#expenseForm .form-group-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

#workForm .form-group-grid.time-grid {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
}

#workForm .input-field-wrap,
#expenseForm .input-field-wrap {
  overflow: hidden;
}

#workForm input,
#workForm select,
#workForm textarea,
#expenseForm input,
#expenseForm select,
#expenseForm textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#workForm input[type="date"],
#expenseForm input[type="date"] {
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
  appearance: none;
  -webkit-appearance: none;
}

@media (max-width: 760px) {
  #workForm .form-group-grid,
  #workForm .form-group-grid.time-grid,
  #expenseForm .form-group-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #workForm .form-group-grid.time-grid .mini-btn {
    width: 100%;
  }
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.nlp-command-panel,
.receipt-scanner-panel {
  margin-bottom: 14px;
}

.nlp-command-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.tag {
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef3fb;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.receipt-dropzone {
  border: 2px dashed #b8c7dd;
  border-radius: 8px;
  padding: 22px;
  background: #f8fbff;
  text-align: center;
  cursor: pointer;
}

.receipt-dropzone.drag-active {
  background: #eefaf4;
  border-color: var(--green);
}

.dropzone-content {
  display: grid;
  gap: 6px;
}

.scanner-progress {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.scanner-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #e7edf6;
  overflow: hidden;
}

#scannerProgressBarFill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 220ms ease;
}

.batch-actions-bar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px;
  margin: 10px 0;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.batch-summary-inline {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.batch-inline-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 16px;
}

.calendar-weekday-header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  padding: 6px;
}

.calendar-day-padding {
  min-height: 120px;
}

.calendar-day-cell {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 120px;
  background: var(--panel);
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.calendar-day-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.calendar-day-cell.today {
  outline: 2px solid rgba(47, 111, 237, 0.35);
}

.calendar-day-cell.worked {
  background: #f8fbff;
}

.calendar-day-cell.spent {
  border-color: #f1b8b8;
}

.calendar-day-cell.shabbat {
  background: var(--shabbat-bg-neutral, #f8fafc);
}

.cell-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 6px;
}

.cell-top small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.day-number {
  font-weight: 900;
}

.cell-shifts-container {
  display: grid;
  gap: 5px;
}

.cell-shift-badge {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  min-height: 0;
  padding: 6px 7px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-shift-badge strong,
.cell-shift-badge span,
.cell-shift-badge em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.cell-shift-badge.food { background: var(--green); }
.cell-shift-badge.lunch { background: var(--orange); }

.cell-shift-badge.is-pending-sync {
  opacity: 0.68;
  border: 1px dashed var(--orange);
  animation: pulse-sync 1.5s infinite ease-in-out;
}

@keyframes pulse-sync {
  0% { opacity: 0.5; }
  50% { opacity: 0.85; }
  100% { opacity: 0.5; }
}

.cell-financials {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  font-weight: 900;
  margin-top: auto;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.cell-financials .income,
.cell-financials .expense {
  direction: ltr;
  text-align: right;
}

.cell-financials .income { color: var(--green); }
.cell-financials .expense { color: var(--red); }
.cell-financials .hours { color: var(--muted); }

.danger-text-btn {
  color: var(--red);
  border-color: rgba(207, 61, 61, 0.28);
}

.warning-theme-btn {
  color: var(--orange);
  border-color: rgba(232, 139, 35, 0.32);
}

.toast.toast-error {
  background: #b42318;
}

.toast.toast-success {
  background: #168a5b;
}

.toast.toast-warning {
  background: #b76e00;
}

.input-flash-success {
  animation: input-flash-success 1.2s ease;
}

@keyframes input-flash-success {
  0% { box-shadow: 0 0 0 0 rgba(22, 138, 91, 0.45); border-color: var(--green); }
  100% { box-shadow: 0 0 0 12px rgba(22, 138, 91, 0); }
}

.receipt-dropzone.scan-error {
  animation: scan-shake 0.42s ease;
  border-color: var(--red);
}

@keyframes scan-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.skeleton-card {
  background: linear-gradient(90deg, #eceff1 25%, #f6f7f8 50%, #eceff1 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 8px;
  height: 100px;
  width: 100%;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sidebar-divider {
  border-top: 1px solid rgba(255,255,255,0.12);
  margin: 8px 0;
}

.sidebar-control-widget {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  color: rgba(255,255,255,0.8);
  font-size: 12px;
}

.sidebar-mini-select {
  width: 100%;
  min-height: 34px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.16);
}

.sidebar-status-badge {
  border-radius: 999px;
  padding: 5px 8px;
  font-weight: 900;
  color: #fff;
  background: var(--blue);
}

.sidebar-status-badge.purple { background: var(--purple); }

.micro-btn {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 12px;
}

.danger-text {
  color: #fecaca;
}

.notification-status-box,
.status-indicator-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.settings-section {
  display: grid;
  gap: 10px;
}

.mobile-prompt-banner {
  position: fixed;
  right: 18px;
  left: 18px;
  bottom: 18px;
  z-index: 29;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow);
}

.prompt-content,
.prompt-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sync-dot.syncing {
  animation: syncPulse 900ms ease-in-out infinite;
}

@keyframes syncPulse {
  0%, 100% { transform: scale(1); opacity: 0.65; }
  50% { transform: scale(1.35); opacity: 1; }
}

@media (max-width: 760px) {
  .form-group-grid,
  .form-group-grid.time-grid,
  .nlp-command-row {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .calendar-weekday-header,
  .calendar-day-padding {
    display: none;
  }

  .calendar-day-cell {
    min-height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
  }

  .calendar-day-cell.is-empty {
    opacity: 0.62;
  }

  .calendar-day-cell .cell-top {
    min-width: 52px;
    display: grid;
    gap: 2px;
  }

  .cell-shifts-container {
    flex: 1;
    min-width: 0;
  }

  .cell-financials {
    min-width: 90px;
    border-top: 0;
    border-inline-start: 1px solid var(--line);
    padding-top: 0;
    padding-inline-start: 10px;
  }

  .mobile-prompt-banner,
  .notification-status-box {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Round 13-20 UX, contrast, dashboard and ticker upgrades */
:root {
  --app-bg: #f8fafc;
  --view-bg: #ffffff;
  --card-bg: #ffffff;
  --sidebar-bg: #0f172a;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-on-dark: #ffffff;
  --border-color: #cbd5e1;
  --input-bg: #ffffff;
  --input-text: #0f172a;
  --input-focus-border: #3b82f6;
  --primary-color: #2563eb;
  --success-color: #16a34a;
  --danger-color: #dc2626;
  --warning-color: #d97706;
  --icon-filter: none;
  --bg: var(--app-bg);
  --panel: var(--card-bg);
  --ink: var(--text-main);
  --muted: var(--text-muted);
  --line: var(--border-color);
  --blue: var(--primary-color);
  --green: var(--success-color);
  --orange: var(--warning-color);
  --red: var(--danger-color);
}

html[data-theme="dark"] {
  --app-bg: #0f172a;
  --view-bg: #1e293b;
  --card-bg: #1e293b;
  --sidebar-bg: #020617;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --input-bg: #0f172a;
  --input-text: #f8fafc;
  --input-focus-border: #60a5fa;
  --primary-color: #3b82f6;
  --success-color: #22c55e;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --icon-filter: invert(1);
}

input,
select,
textarea {
  background-color: var(--input-bg) !important;
  color: var(--input-text) !important;
  border: 1px solid var(--border-color) !important;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--input-focus-border) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: var(--icon-filter);
  cursor: pointer;
}

label {
  color: var(--text-main);
}

.field-help,
.eyebrow,
small,
p.eyebrow {
  color: var(--text-muted) !important;
}

.sidebar-overlay {
  z-index: 999;
}

.sidebar {
  z-index: 1000;
  background-color: var(--sidebar-bg) !important;
  color: var(--text-on-dark) !important;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.modal {
  z-index: 900;
}

.nav-heading {
  color: #94a3b8 !important;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.nav-item {
  background-color: rgba(255, 255, 255, 0.03) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 6px;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  transform: translateX(-4px);
}

.nav-item.active {
  background: linear-gradient(90deg, #3b82f6, #2563eb) !important;
  color: #ffffff !important;
  font-weight: 700;
  border-color: #2563eb !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.nav-section-toggle {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 6px;
  font-weight: 600;
}

.panel,
.modal-card,
.login-card {
  background-color: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main);
}

.panel-head h3,
.panel-head h4,
h1,
h2,
h3 {
  color: var(--text-main) !important;
}

table {
  color: var(--text-main);
}

th {
  background-color: var(--app-bg);
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}

td {
  border-bottom: 1px solid var(--border-color);
}

tr:nth-child(even) td {
  background-color: rgba(0, 0, 0, 0.015);
}

html[data-theme="dark"] tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, 0.015);
}

tr:hover td {
  background-color: rgba(59, 130, 246, 0.05) !important;
}

.text-success,
.income,
.status-active,
.sidebar-status-badge.success {
  color: var(--success-color) !important;
  font-weight: 700;
}

.text-danger,
.expense,
.danger-text,
.danger-action-btn,
.sidebar-status-badge.danger {
  color: var(--danger-color) !important;
  font-weight: 700;
}

.text-warning,
.is-pending-sync,
.sidebar-status-badge.warning {
  color: var(--warning-color) !important;
  font-weight: 700;
}

.charts-grid canvas,
.split-grid canvas {
  background-color: var(--card-bg) !important;
  border-radius: 12px;
  padding: 16px;
  box-shadow: inset 0 0 0 1px var(--border-color), 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: 100% !important;
}

.charts-grid .panel:hover {
  border-color: var(--primary-color) !important;
  box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.metrics-grid,
.pulse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}

.metric,
.metric-card,
.pulse-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.metric strong,
.pulse-card strong,
.metric-card-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.metric span,
.pulse-card span,
.metric-card-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.goal-progress-container {
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

.goal-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text-main);
}

.goal-progress-bar-track {
  background-color: var(--app-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  height: 10px;
  width: 100%;
  overflow: hidden;
}

.goal-progress-bar-fill {
  background: linear-gradient(90deg, var(--primary-color), #60a5fa);
  height: 100%;
  border-radius: 20px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.goal-progress-container.over-budget .goal-progress-bar-fill {
  background: linear-gradient(90deg, var(--danger-color), #f87171) !important;
}

.compact-nlp-bar {
  padding: 8px 12px !important;
  margin-bottom: 12px !important;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.nlp-command-inline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.nlp-command-inline-row input {
  flex-grow: 1;
  height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
}

.work-index-advisor {
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: fadeInFast 0.2s ease-in-out;
  border: 1px solid var(--border-color);
  background-color: var(--app-bg);
}

.work-index-advisor.minor-purchase {
  color: var(--text-muted);
  border-right: 4px solid var(--primary-color);
}

.work-index-advisor.moderate-purchase {
  color: var(--warning-color);
  border-right: 4px solid var(--warning-color);
}

.work-index-advisor.heavy-purchase {
  color: var(--danger-color);
  border-right: 4px solid var(--danger-color);
  background-color: rgba(220, 38, 38, 0.03);
}

html[data-theme="dark"] .work-index-advisor.heavy-purchase {
  background-color: rgba(239, 68, 68, 0.05);
}

@keyframes fadeInFast {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.recurring-expenses-panel,
.external-income-panel {
  margin-top: 24px;
}

.recurring-form-inline,
.inline-form-row {
  background-color: var(--app-bg);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.external-income-panel {
  border-top: 2px solid var(--success-color) !important;
}

.income-profile-panel {
  border-top: 2px solid var(--green) !important;
  margin-bottom: 18px;
}

.dashboard-income-profile {
  padding: 18px;
}

.income-profile-dashboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.income-profile-dashboard-head h3 {
  margin: 8px 0 4px;
  font-size: 20px;
}

.income-profile-dashboard-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.income-profile-split,
.income-profile-mini-grid {
  display: grid;
  gap: 10px;
}

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

.income-profile-split article {
  background: var(--app-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.income-profile-split span,
.income-profile-status span,
.income-profile-mini-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.income-profile-split strong,
.income-profile-status strong {
  display: block;
  margin: 5px 0;
  font-size: 22px;
}

.income-profile-split small,
.income-profile-status small {
  color: var(--muted);
  line-height: 1.45;
}

.income-profile-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 2fr);
  gap: 16px;
  align-items: stretch;
}

.income-profile-status,
.income-profile-form {
  min-width: 0;
}

.income-profile-status {
  background: var(--app-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.income-profile-mini-grid {
  margin-top: 12px;
}

.income-profile-checkbox {
  align-self: end;
}

.success-theme-btn {
  background: linear-gradient(90deg, var(--success-color), #22c55e) !important;
  color: #ffffff !important;
  border: none !important;
}

.danger-theme-btn {
  background: linear-gradient(90deg, var(--danger-color), #ef4444) !important;
  color: #ffffff !important;
  border: none !important;
}

.recurring-status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
}

.recurring-status-badge.infinite {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
}

.recurring-status-badge.limited {
  background-color: rgba(217, 119, 6, 0.1);
  color: var(--warning-color);
}

tr.recurring-type-income td {
  border-right: 4px solid var(--success-color) !important;
}

tr.recurring-type-expense td {
  border-right: 4px solid var(--danger-color) !important;
}

.recurring-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.recurring-injection-preview,
.recent-changes-feed,
.data-fix-center {
  display: grid;
  gap: 10px;
}

.recurring-injection-preview {
  max-height: 240px;
  overflow: auto;
  margin: 12px 0;
}

.recurring-preview-item,
.recent-change-item,
.data-fix-item {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.recent-change-item strong,
.data-fix-item strong,
.recurring-preview-item strong {
  color: var(--ink);
}

.recent-change-item small,
.data-fix-item small,
.recurring-preview-item small {
  color: var(--muted);
}

.data-fix-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.data-fix-item .fix-copy {
  display: grid;
  gap: 4px;
}

.monthly-report-preview {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  direction: rtl;
  font: 500 13px/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-height: 320px;
  overflow: auto;
}

.report-preview-panel {
  margin: 14px 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.compact-head {
  margin-bottom: 8px;
}

.justify-center {
  justify-content: center;
}

.text-center {
  text-align: center;
}

.ticker-panel {
  max-width: 520px;
  margin: 40px auto;
  padding: 32px 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.ticker-badge {
  display: inline-block;
  background-color: rgba(220, 38, 38, 0.1);
  color: var(--danger-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
  animation: pulseBlink 2s infinite;
}

.ticker-muted-badge {
  color: var(--text-muted);
  animation: none;
}

.ticker-amount-wrap {
  font-size: 4rem;
  font-weight: 900;
  color: var(--success-color);
  margin: 24px 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px rgba(22, 163, 74, 0.2);
}

.ticker-empty-amount {
  color: var(--text-muted);
  text-shadow: none;
  font-size: 3rem;
}

.ticker-currency {
  font-size: 2.5rem;
  margin-left: 4px;
  vertical-align: super;
}

.ticker-progress-container {
  margin-top: 16px;
  text-align: right;
}

.ticker-actions {
  margin-top: 20px;
}

.live-tips-wrapper {
  margin-top: 16px;
}

.live-tip-row {
  max-width: 340px;
  margin: 0 auto;
}

.live-tips-wrapper input {
  text-align: center;
  font-weight: 700;
}

.live-tips-badge {
  margin-top: 6px;
  font-weight: 700;
}

.ticker-empty-insight {
  border: 1px solid var(--danger-color);
  background-color: rgba(220, 38, 38, 0.02);
  margin-bottom: 24px;
  padding: 14px;
  border-radius: 8px;
  font-weight: 700;
  display: grid;
  gap: 6px;
}

.ticker-empty-insight span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

.ticker-amount-wrap.pulse-trigger {
  animation: moneyPulse 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes moneyPulse {
  0% { transform: scale(1); text-shadow: 0 0 20px rgba(22, 163, 74, 0.2); }
  50% { transform: scale(1.05); text-shadow: 0 0 35px var(--success-color); }
  100% { transform: scale(1); text-shadow: 0 0 20px rgba(22, 163, 74, 0.2); }
}

@keyframes pulseBlink {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

@media (max-width: 768px) {
  .chart-wide {
    grid-column: span 1 !important;
  }

  .charts-grid canvas,
  .split-grid canvas {
    height: 220px !important;
    padding: 10px;
  }

  .nlp-command-inline-row {
    gap: 8px;
  }

  .nlp-command-inline-row .mini-btn {
    flex: 0 0 auto;
  }

  .ticker-amount-wrap {
    font-size: 3rem;
  }
}

/* Round 21 focused UX fixes */
.sidebar {
  background-color: #020617 !important;
  color: #f8fafc !important;
}

.sidebar-overlay {
  background: rgba(2, 6, 23, 0.62) !important;
}

.nav-item {
  color: #e2e8f0 !important;
  padding: 14px 16px !important;
  line-height: 1.25;
}

.nav-item.active {
  background: linear-gradient(90deg, #22c55e, #2563eb) !important;
  color: #ffffff !important;
}

.nav-item .nav-icon,
.nav-section-toggle .nav-icon {
  margin-left: 8px;
}

.confirm-card p,
#confirmText {
  white-space: pre-line;
  line-height: 1.55;
}

/**
 * ====================================================================
 * MULTI-USER AUTHENTICATION, ADMIN & SESSION UI
 * ====================================================================
 */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  padding: 16px;
}

.auth-panel {
  max-width: 420px;
  width: 100%;
  padding: 36px 28px;
  border-radius: 16px;
  text-align: center;
}

.auth-panel h2 {
  margin: 0 0 8px;
  font-weight: 800;
}

.auth-badge,
.admin-badge {
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary-color, #3b82f6);
  animation: none;
  margin: 0 auto 16px;
  display: inline-block;
}

.admin-badge {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger-color, #ef4444);
}

.form-panel-inside {
  display: grid;
  gap: 16px;
  text-align: right;
  margin-top: 24px;
}

.auth-submit-btn {
  width: 100%;
  min-height: 48px;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.login-error-msg {
  color: var(--danger-color, #ef4444);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.22);
  padding: 10px;
  border-radius: 6px;
  margin-top: 16px;
  font-weight: 700;
  font-size: 0.85rem;
}

.spinner-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.animate-fade-in {
  animation: authFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.logout-item {
  color: #fecaca !important;
  border-color: rgba(239, 68, 68, 0.28) !important;
  margin-top: auto;
}

.logout-item:hover {
  color: #fff !important;
  background: rgba(239, 68, 68, 0.2) !important;
}

.admin-user-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  align-items: end;
}

.admin-user-form .wide {
  grid-column: span 2;
}

.admin-users-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-users-toolbar label {
  display: grid;
  gap: 6px;
  min-width: min(100%, 360px);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-users-toolbar input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel);
  color: var(--ink);
}

.admin-users-toolbar span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.view-header {
  margin-bottom: 16px;
}

.view-header h2,
.view-header p {
  margin: 0 0 8px;
}

.mono-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--primary-color, #3b82f6);
  font-weight: 700;
}

.truncate-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-lockdown-screen {
  background: #0f172a;
  color: #ef4444;
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100vw;
  text-align: center;
  padding: 20px;
}

.security-lockdown-screen h1 {
  font-size: 3rem;
  margin: 0 0 10px;
}

.security-lockdown-screen p {
  color: #94a3b8;
  font-size: 1.1rem;
  max-width: 620px;
}

.security-lockdown-screen button {
  margin-top: 24px;
  background: #3b82f6;
  color: white;
  border: 0;
  padding: 12px 24px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
}

.jobs-settings-panel {
  margin-top: 18px;
}

.jobs-settings-form {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(140px, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  margin: 14px 0 18px;
}

.jobs-settings-form input {
  min-width: 0;
}

.jobs-settings-table-wrap {
  background: var(--app-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.jobs-settings-table th:last-child,
.jobs-settings-table td:last-child {
  text-align: center;
  width: 150px;
}

.job-rate-cell {
  color: var(--success-color);
  font-weight: 800;
}

.compact-table-input {
  width: 100%;
  min-width: 110px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--text-color);
  padding: 8px 10px;
  box-sizing: border-box;
}

.month-management-panel {
  margin: 14px 0;
}

.job-delete-btn {
  background: transparent;
  border: 0;
  color: var(--danger-color);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 6px 8px;
}

.job-delete-btn:hover {
  transform: translateY(-1px);
}

.expense-impact-container {
  margin: 12px 0 18px;
  padding: 18px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  direction: rtl;
}

.expense-impact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #1e293b;
}

.expense-impact-title {
  color: #ef4444;
  font-size: 0.95rem;
  font-weight: 800;
}

.expense-severity-badge {
  flex-shrink: 0;
  color: #94a3b8;
  background: #334155;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  transition: background 0.2s ease, color 0.2s ease;
}

.expense-impact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.expense-impact-metric {
  min-width: 0;
  text-align: center;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 8px;
}

.expense-impact-metric span {
  display: block;
  margin-bottom: 5px;
  color: #94a3b8;
  font-size: 0.76rem;
  font-weight: 700;
}

.expense-impact-metric strong {
  color: #f8fafc;
  font-size: 1.24rem;
  font-weight: 900;
}

.expense-psychological-insight {
  color: #cbd5e1;
  background: #1e293b;
  border-right: 4px solid #475569;
  border-radius: 4px 8px 8px 4px;
  padding: 12px 15px;
  line-height: 1.6;
  font-size: 0.88rem;
  transition: border-color 0.2s ease;
}

.admin-dashboard-section {
  margin-top: 24px;
  padding: 24px;
  background: #0b0f19;
  border: 1px solid #1e293b;
  border-radius: 16px;
  direction: rtl;
}

.admin-dashboard-section[hidden] {
  display: none !important;
}

.admin-dashboard-header,
.admin-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-dashboard-header {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid #1e293b;
}

.admin-dashboard-header h2,
.admin-log-head h3,
.admin-chart-card h3 {
  margin: 0;
  color: #f8fafc;
  font-weight: 850;
}

.admin-dashboard-header h2 {
  font-size: 1.45rem;
}

.admin-dashboard-header p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 0.86rem;
}

.live-monitor-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.live-monitor-badge span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: adminPulse 2s infinite;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.admin-kpi-card {
  min-width: 0;
  background: #111827;
  border: 1px solid #1e293b;
  border-right: 4px solid #3b82f6;
  border-radius: 12px;
  padding: 16px;
}

.admin-kpi-card.green {
  border-right-color: #10b981;
}

.admin-kpi-card.red {
  border-right-color: #ef4444;
}

.admin-kpi-card.yellow {
  border-right-color: #eab308;
}

.admin-kpi-card.purple {
  border-right-color: #8b5cf6;
}

.admin-kpi-card.teal {
  border-right-color: #14b8a6;
}

.admin-kpi-card.orange {
  border-right-color: #f97316;
}

.admin-kpi-card.slate {
  border-right-color: #94a3b8;
}

.admin-kpi-card span {
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 900;
}

.admin-kpi-card strong {
  display: block;
  margin-top: 5px;
  color: #f8fafc;
  font-size: 1.75rem;
  font-weight: 900;
}

.admin-kpi-card.red strong {
  color: #ef4444;
}

.admin-filter-panel {
  margin-bottom: 22px;
  padding: 18px;
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 12px;
}

.admin-filter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.admin-filter-head h3 {
  margin: 0;
  color: #f8fafc;
  font-size: 1rem;
}

.admin-filter-head p,
.admin-log-head p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 0.82rem;
}

.admin-sync-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: #cbd5e1;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 800;
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.admin-filter-grid label {
  display: grid;
  gap: 6px;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 850;
}

.admin-filter-grid select,
.admin-filter-grid input {
  width: 100%;
  min-height: 38px;
  color: #f8fafc;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
}

.admin-filter-search {
  grid-column: span 2;
}

.admin-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.admin-chart-card,
.admin-log-card {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 18px;
}

.admin-chart-card h3 {
  margin-bottom: 12px;
  font-size: 0.92rem;
}

.admin-chart-box {
  position: relative;
  width: 100%;
  height: 260px;
}

.admin-chart-box.compact {
  height: 220px;
}

.admin-log-table-wrap {
  max-height: 430px;
  margin-top: 16px;
  border: 1px solid #1e293b;
}

.admin-log-table th,
.admin-log-table td {
  border-color: #1e293b;
}

.audit-action-badge {
  display: inline-block;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.35;
  white-space: normal;
  max-width: 190px;
}

.audit-severity-badge {
  display: inline-block;
  min-width: 58px;
  text-align: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 900;
}

.audit-severity-badge.critical {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.18);
}

.audit-severity-badge.warning {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.18);
}

.audit-severity-badge.success {
  color: #bbf7d0;
  background: rgba(16, 185, 129, 0.18);
}

.audit-severity-badge.info {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.18);
}

.audit-deep-title,
.audit-deep-text {
  display: block;
}

.audit-rich-row td {
  vertical-align: top;
}

.audit-rich-row small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
}

.audit-detail-card,
.audit-device-card {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.audit-detail-card {
  max-width: 560px;
}

.audit-deep-title {
  color: #f8fafc;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.audit-deep-text {
  color: #94a3b8;
  line-height: 1.55;
  max-width: 520px;
}

.audit-detail-meta {
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.45;
}

.audit-device-card {
  min-width: 170px;
}

.audit-device-card strong {
  color: #f8fafc;
  font-size: 0.78rem;
}

.audit-device-card span {
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1.35;
}

@keyframes adminPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

body.modal-open {
  overflow: hidden;
  height: 100vh;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  direction: rtl;
}

.onboarding-overlay[hidden] {
  display: none !important;
}

.onboarding-card {
  width: min(100%, 550px);
  max-height: 90vh;
  overflow-y: auto;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: wizardFadeIn 0.3s ease-out forwards;
}

.onboarding-header {
  text-align: center;
  margin-bottom: 22px;
}

.onboarding-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.onboarding-header h2 {
  margin: 0 0 8px;
  color: #3b82f6;
  font-size: 1.8rem;
  font-weight: 800;
}

.onboarding-header p,
.onboarding-section p {
  color: #94a3b8;
  font-size: 0.92rem;
  line-height: 1.5;
}

.onboarding-section {
  border-top: 1px solid #334155;
  padding-top: 18px;
  margin-top: 18px;
}

.onboarding-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: #f1f5f9;
  font-size: 1.12rem;
}

.onboarding-section h3 b {
  color: #ef4444;
  font-size: 0.8rem;
}

.onboarding-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
}

.onboarding-chip-row span {
  background: #1e293b;
  border: 1px solid #475569;
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
}

.onboarding-section label {
  display: block;
  margin-top: 12px;
  color: #94a3b8;
  font-size: 0.86rem;
  font-weight: 700;
}

.onboarding-section input {
  margin-top: 6px;
  width: 100%;
  background: #0f172a !important;
  border: 1px solid #475569 !important;
  border-radius: 8px;
  padding: 12px;
  color: #fff !important;
  box-sizing: border-box;
}

.onboarding-submit-btn {
  width: 100%;
  padding: 14px;
  font-size: 1.02rem;
  font-weight: 800;
}

.onboarding-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.onboarding-logout-btn {
  width: 100%;
  justify-content: center;
}

.admin-actions-cell {
  white-space: nowrap;
}

.admin-actions-cell .mini-btn {
  margin-inline: 3px;
}

@keyframes wizardFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 760px) {
  .sidebar {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .expense-control-toolbar.save-banner-active {
    right: 0;
    border-radius: 0;
  }

  .jobs-settings-form {
    grid-template-columns: 1fr;
  }

  .expense-impact-head,
  .admin-filter-head,
  .admin-dashboard-header,
  .admin-log-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .expense-impact-grid,
  .admin-kpi-grid,
  .admin-filter-grid,
  .admin-chart-grid {
    grid-template-columns: 1fr;
  }

  .admin-filter-search {
    grid-column: span 1;
  }

  .onboarding-card {
    padding: 20px 15px;
  }

  .onboarding-header h2 {
    font-size: 1.5rem;
  }
}

/* V41 final design overrides */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d8dee8;
  --blue: #2563eb;
  --green: #0f8a5f;
  --orange: #d97706;
  --red: #dc2626;
  --purple: #6d5bd0;
  --teal: #0f9f9a;
  --yellow: #d8a21d;
  --primary-color: var(--blue);
  --success-color: var(--green);
  --danger-color: var(--red);
  --warning-color: var(--orange);
  --app-bg: #f4f6f8;
  --surface-soft: #f8fafc;
  --surface-strong: #eef2f7;
  --radius-md: 8px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.05);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

html[data-theme="dark"] {
  --bg: #0f131a;
  --panel: #171c24;
  --ink: #eef2f7;
  --muted: #a0a8b5;
  --line: #2c3440;
  --app-bg: #10151d;
  --surface-soft: #1d2430;
  --surface-strong: #222b38;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 12px 32px rgba(0, 0, 0, 0.26);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.25);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif;
}

@media (min-width: 981px) {
  .app-shell {
    grid-template-columns: 276px minmax(0, 1fr);
    background: var(--bg);
  }
}

.content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 28px 40px;
}

.sidebar {
  background: #111827;
  padding: 18px;
  gap: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .sidebar {
  background: #0c1118;
}

.brand {
  padding: 8px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand h1 {
  font-size: 19px;
  font-weight: 800;
}

.brand p,
.sync-panel p {
  color: #b8c0cc;
}

.mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: #f4c430;
  color: #111827;
  box-shadow: inset 0 -1px 0 rgba(17, 24, 39, 0.16);
}

.nav,
.nav-section,
.nav-group {
  gap: 6px;
}

.nav-heading,
.nav-section-toggle {
  padding-inline: 8px;
  color: #9aa4b2;
  font-size: 11px;
}

.nav-item {
  min-height: 38px;
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: #d8dee8;
  font-size: 14px;
  font-weight: 650;
}

.nav-item:hover,
.nav-section-toggle:hover {
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  background: #ffffff;
  color: #111827;
}

.logout-item {
  margin-top: auto;
  color: #fecaca;
}

.sync-panel {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.topbar {
  align-items: flex-start;
  padding: 0 0 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  font-size: 30px;
  font-weight: 820;
}

.eyebrow,
.field-help,
.metric small,
.analytics-summary-card small,
.panel-head span {
  color: var(--muted);
}

.global-month-scope,
.app-version-badge,
.app-version-text {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.panel,
.metric,
.analytics-summary-card,
.budget-box,
.assist-grid article,
.table-wrap,
.modal-card,
.login-card,
.auth-panel,
.category-row,
.advisor-box,
.goal-card,
.month-score-card,
.recommendation-card,
.open-card,
.income-profile-split article,
.income-profile-status {
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 18px;
}

.panel-head {
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3,
.panel-head h4 {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.metrics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 104px;
  padding: 14px;
  gap: 6px;
}

.metric span,
.assist-grid span,
.analytics-summary-card span,
.income-profile-split span,
.income-profile-status span,
.mini-metrics span {
  font-size: 12px;
  color: var(--muted);
}

.metric strong {
  font-size: 25px;
  line-height: 1.1;
}

.home-action-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-action {
  min-height: 126px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--panel) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow-soft);
}

.home-action:hover {
  transform: translateY(-1px);
  border-color: #b8c3d4 !important;
  box-shadow: var(--shadow);
}

.home-action span {
  color: var(--muted) !important;
}

.home-action strong {
  font-size: 24px;
}

.home-action.expense {
  border-right: 4px solid var(--orange) !important;
}

.home-action.work {
  border-right: 4px solid var(--blue) !important;
}

.income-profile-panel,
.external-income-panel,
.recurring-expenses-panel {
  border-top: 0 !important;
}

.income-profile-split article,
.income-profile-status,
.inline-form-row,
.recurring-form-inline {
  background: var(--surface-soft);
}

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

.income-profile-split strong,
.income-profile-status strong {
  font-size: 20px;
}

.sheet-link,
.ghost-btn,
.primary-btn,
.mini-btn,
.icon-btn {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.ghost-btn,
.sheet-link,
.mini-btn,
.icon-btn {
  background: var(--panel);
  border-color: var(--line);
}

.ghost-btn:hover,
.sheet-link:hover,
.mini-btn:hover,
.icon-btn:hover {
  border-color: #b8c3d4;
  background: var(--surface-soft);
}

.primary-btn {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: none;
}

.primary-btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.success-theme-btn {
  background: var(--green) !important;
}

.danger-theme-btn,
.primary-btn.danger-btn {
  background: var(--red) !important;
  border-color: var(--red) !important;
}

.sidebar-status-badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
}

input,
select,
textarea {
  min-height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}

label {
  color: var(--ink);
  font-weight: 650;
}

.filters-grid,
.compact-filters,
.settings-form-group {
  gap: 12px;
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-lg);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

td {
  border-bottom-color: var(--line);
}

tbody tr:hover td {
  background: var(--surface-soft);
}

.mini-btn.danger,
.job-delete-btn {
  color: var(--red);
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.06);
}

.login-screen {
  background: var(--bg);
}

.auth-panel,
.login-card {
  border-radius: 14px !important;
  box-shadow: var(--shadow);
}

.modal {
  backdrop-filter: blur(10px);
}

.modal-card {
  box-shadow: var(--shadow);
}

canvas {
  border-radius: var(--radius-md);
}

@media (max-width: 1180px) {
  .metrics-grid,
  .income-profile-split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .content {
    padding: 18px 16px 36px;
  }

  .topbar {
    gap: 12px;
  }
}

@media (max-width: 640px) {
  .metrics-grid,
  .home-action-panel,
  .income-profile-split,
  .income-profile-layout {
    grid-template-columns: 1fr !important;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .metric strong,
  .home-action strong {
    font-size: 22px;
  }

  .panel {
    padding: 14px;
  }
}
