:root {
  --bg: #f6f7f8;
  --paper: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f2f4f5;
  --panel-blue: #f2f4f5;
  --text: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0f766e;
  --accent-soft: #e6f4f1;
  --danger: #dc2626;
  --amber: #b45309;
  --success: #0f766e;
  --navy: #111827;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 8px 18px rgba(15, 23, 42, 0.04);
  --motion-fast: 90ms;
  --motion-base: 150ms;
  --motion-slow: 240ms;
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

body.dark {
  --bg: #111827;
  --paper: #182231;
  --panel: #1f2937;
  --panel-soft: #273244;
  --panel-blue: #273244;
  --text: #f9fafb;
  --muted: #a7b0bf;
  --line: #374151;
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --accent: #2dd4bf;
  --accent-soft: #143f3a;
  --danger: #f87171;
  --amber: #fbbf24;
  --success: #2dd4bf;
  --navy: #020617;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.18);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #ffffff;
  color: var(--text);
  border-right: 1px solid var(--line);
  box-shadow: none;
  backdrop-filter: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: var(--panel-soft);
  overflow: hidden;
  box-shadow: none;
  transition: box-shadow var(--motion-base) ease;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand h1,
.topbar h2,
.section-header h3,
.settings-block h4 {
  margin: 0;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: var(--muted);
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab-button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 46px;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: background var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease;
}

.tab-button::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 6px;
  width: 3px;
  border-radius: 999px;
  background: var(--primary);
  opacity: 0;
  transition: opacity var(--motion-fast) ease;
}

.tab-button.active,
.tab-button:hover {
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--text);
  box-shadow: none;
}

.tab-button.active::before,
.tab-button:hover::before {
  opacity: 1;
}

.icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
}

main {
  min-width: 0;
  padding: 24px;
  background: transparent;
}

.topbar,
.section-header,
.mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  position: static;
  margin-bottom: 22px;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
}

.topbar h2 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: none;
}

.topbar-actions,
.button-row,
menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wrap {
  flex-wrap: wrap;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.hidden {
  display: none !important;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.metric,
.safe-card,
.deal-card,
.settings-block,
.list-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  position: relative;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.metric::before,
.settings-block::before {
  display: none;
}

.metric:hover,
.safe-card:hover,
.deal-card:hover,
.settings-block:hover,
.list-item:hover {
  border-color: rgba(37, 99, 235, 0.18);
  box-shadow: var(--shadow-soft);
}

.metric:hover::before,
.settings-block:hover::before {
  opacity: 1;
}

.metric {
  padding: 18px;
  background: var(--panel);
}

.metric span,
.muted,
.list-meta,
.deal-meta,
.pending-line {
  color: var(--muted);
}

.pending-line {
  margin: 8px 0 0;
  font-size: 14px;
}

.pending-line strong {
  color: var(--accent);
}

.pending-out-line strong {
  color: var(--danger);
}

.pending-move-line strong {
  color: var(--primary);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 29px;
  font-weight: 800;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(420px, 1.4fr);
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dashboard-hero h3 {
  margin: 6px 0 8px;
  font-size: 42px;
  letter-spacing: 0;
  line-height: 1;
}

.dashboard-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-hero-stats article,
.focus-card,
.dashboard-panel,
.dashboard-safe-row,
.dashboard-mini-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.dashboard-hero-stats article {
  display: grid;
  align-content: center;
  min-height: 118px;
  padding: 15px;
  background: var(--panel-soft);
  box-shadow: none;
}

.dashboard-hero-stats span,
.focus-card span,
.dashboard-safe-row span,
.dashboard-mini-item span,
.focus-card small {
  color: var(--muted);
}

.dashboard-hero-stats strong {
  margin-top: 8px;
  font-size: 25px;
  letter-spacing: 0;
}

.dashboard-focus {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.focus-card {
  display: grid;
  gap: 6px;
  padding: 15px;
  background: var(--panel);
  box-shadow: none;
}

.focus-card strong {
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: 0;
}

.focus-card.danger strong {
  color: var(--danger);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.dashboard-panel {
  padding: 16px;
  box-shadow: var(--shadow);
  background: var(--panel);
}

.ledger-command-panel {
  margin: 16px 0;
}

.ledger-module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ledger-module-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 148px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.ledger-module-card:hover {
  background: var(--panel-soft);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.ledger-module-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.ledger-module-card strong {
  font-size: 18px;
}

.ledger-module-card b {
  margin-top: 4px;
  color: var(--primary-dark);
  font-size: 24px;
  line-height: 1.1;
}

.ledger-module-card small {
  color: var(--muted);
  line-height: 1.35;
}

.ledger-module-card.teal {
  border-left-color: var(--accent);
}

.ledger-module-card.teal b {
  color: var(--accent);
}

.ledger-module-card.amber {
  border-left-color: var(--amber);
}

.ledger-module-card.amber b {
  color: var(--amber);
}

.ledger-module-card.dark {
  border-left-color: #111318;
}

.ledger-module-card.dark b {
  color: #111318;
}

.ledger-module-card.neutral {
  border-left-color: var(--muted);
}

.ledger-module-card.neutral b {
  color: var(--text);
  font-size: 18px;
}

.dashboard-side {
  display: grid;
  gap: 16px;
}

.dashboard-safe-list {
  display: grid;
  gap: 10px;
}

.dashboard-safe-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) repeat(4, minmax(118px, 1fr));
  gap: 10px;
  align-items: center;
  min-height: 74px;
  padding: 13px;
  border-left: 5px solid var(--safe-color, var(--primary));
  box-shadow: none;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.dashboard-safe-row:hover,
.dashboard-mini-item:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.dashboard-safe-name {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 900;
  letter-spacing: 0;
  text-align: left;
  box-shadow: none;
}

.dashboard-safe-name span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--safe-color, var(--primary));
  flex: 0 0 auto;
}

.dashboard-safe-row > div {
  display: grid;
  gap: 3px;
}

.dashboard-safe-row strong {
  font-size: 16px;
}

.dashboard-short-list {
  gap: 8px;
}

.dashboard-mini-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: center;
  padding: 13px;
  box-shadow: none;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.dashboard-mini-item strong,
.dashboard-mini-item span {
  display: block;
}

.dashboard-mini-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-mini-item b {
  font-size: 15px;
  white-space: nowrap;
}

.projected-hero {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.45fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.projected-hero > div,
.projected-total-card,
.projected-table-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.projected-hero > div {
  padding: 22px;
}

.projected-hero h3 {
  margin: 6px 0 8px;
  font-size: 38px;
  letter-spacing: 0;
  line-height: 1;
}

.projected-total-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 22px;
  background: var(--primary);
  color: #ffffff;
}

.projected-total-card span {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.projected-total-card strong {
  font-size: 32px;
}

.projected-summary-grid {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.projected-table-panel {
  padding: 16px;
}

.projected-safe-table {
  display: grid;
  gap: 12px;
}

.projected-safe-row {
  display: grid;
  grid-template-columns: minmax(230px, 0.7fr) minmax(0, 1.6fr);
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--safe-color, var(--primary));
  border-radius: 14px;
  background: #ffffff;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.projected-safe-row:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.projected-safe-main {
  display: grid;
  gap: 6px;
  align-content: center;
}

.projected-safe-main small,
.projected-safe-breakdown span {
  color: var(--muted);
}

.projected-safe-main > strong {
  font-size: 30px;
  letter-spacing: 0;
  line-height: 1.05;
}

.projected-safe-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.projected-safe-breakdown > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.projected-safe-breakdown strong {
  font-size: 17px;
}

.section-header {
  margin: 22px 0 14px;
}

.section-header.compact {
  margin-top: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(170px, auto);
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: none;
}

.deal-toolbar {
  grid-template-columns: minmax(260px, 1fr) minmax(160px, auto) minmax(170px, auto);
}

.save-status {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  transition: opacity var(--motion-fast) ease;
}

.save-status.visible {
  opacity: 1;
}

.safe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.deal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.safe-card,
.deal-card {
  padding: 18px;
}

.deal-card {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1.4fr) minmax(430px, 2.2fr) minmax(190px, 0.9fr);
  min-width: 1000px;
  gap: 0;
  align-items: stretch;
  overflow: hidden;
  padding: 0;
}

.safe-card {
  border-top: 4px solid var(--safe-color, var(--primary));
  background: var(--panel);
  overflow: hidden;
}

.safe-card::after {
  display: none;
}

.safe-card h4,
.deal-card h4 {
  margin: 0 0 12px;
  font-size: 18px;
  letter-spacing: 0;
}

.deal-card h4 {
  margin: 0;
}

.safe-name-button,
.deal-name-button {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: inherit;
  font-weight: 800;
  text-align: left;
  transition: color var(--motion-fast) ease;
}

.safe-name-button:hover,
.deal-name-button:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.balance {
  color: var(--primary-dark);
  font-size: 29px;
  font-weight: 800;
  letter-spacing: 0;
  transition: color var(--motion-fast) ease;
}

.safe-card:hover .balance {
  color: var(--primary);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

button,
.file-button {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
  position: relative;
  overflow: hidden;
  transition: background var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

button:hover,
.file-button:hover {
  background: var(--panel-soft);
  border-color: #cbd5e1;
}

button:active,
.file-button:active {
  filter: brightness(0.98);
}

.primary-button {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  font-weight: 750;
}

.primary-button:hover {
  background: var(--primary-dark);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
}

.action-center-button {
  min-width: 136px;
  border-radius: 10px;
}

.ghost-button,
.subtle-button {
  border-color: rgba(15, 118, 110, 0.22);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.ghost-button:hover,
.subtle-button:hover {
  border-color: rgba(15, 118, 110, 0.34);
  background: #d9f0eb;
  box-shadow: none;
}

.danger-button {
  border-color: rgba(220, 38, 38, 0.2);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
  font-weight: 750;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.icon-button:hover {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--panel);
  color: var(--text);
}

dialog .icon-button.close-dialog {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 10px;
  border-color: rgba(220, 38, 38, 0.18);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
  font-size: 16px;
}

dialog .icon-button.close-dialog:hover {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.14);
  box-shadow: none;
}

.two-column,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 24px;
}

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

.cashflow-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 16px;
  margin-top: 24px;
}

.marketing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.marketing-panel {
  min-height: 320px;
}

.marketing-item {
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  border-left: 5px solid var(--primary);
}

.marketing-actions {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  justify-content: end;
  margin-top: 0;
}

.marketing-actions button {
  min-width: 72px;
}

.marketing-badge {
  min-width: 68px;
  justify-content: center;
  text-align: center;
}

.marketing-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.task-done {
  opacity: 0.72;
}

.task-done strong {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(15, 118, 110, 0.38);
}

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

.calendar-weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  display: grid;
  align-content: start;
  min-height: 94px;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  position: relative;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.calendar-day:hover {
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.calendar-day.today {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.calendar-day.muted-day {
  opacity: 0.46;
}

.calendar-day.has-items {
  background: var(--panel-soft);
}

.calendar-day.has-items::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 rgba(15, 118, 110, 0.25);
}

.calendar-date {
  width: fit-content;
  min-width: 26px;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.calendar-day.today .calendar-date {
  background: var(--primary);
  color: #ffffff;
}

.calendar-pill {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.calendar-pill.in {
  background: rgba(14, 165, 233, 0.12);
  color: var(--primary);
}

.calendar-pill.out {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.calendar-pill.move {
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
}

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

.list.large {
  gap: 12px;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px 15px;
  background: var(--panel);
}

.list-item strong {
  display: block;
  margin-bottom: 3px;
}

.amount-in {
  color: var(--primary);
  font-weight: 800;
  display: inline-block;
}

.amount-out {
  color: var(--danger);
  font-weight: 800;
  display: inline-block;
}

.pending-item {
  border-left: 5px solid var(--success);
}

.pending-item-out {
  border-left-color: var(--danger);
}

.pending-item-move {
  border-left-color: var(--primary);
}

.deal-meta {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  font-size: 14px;
}

.deal-card-body {
  display: contents;
}

.deal-main-cell,
.deal-numbers-cell,
.deal-actions-cell {
  display: grid;
  gap: 12px;
  padding: 15px;
  border-left: 1px solid var(--line);
}

.deal-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.deal-card-details {
  display: -webkit-box;
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.deal-client {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-badge,
.priority-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.priority-badge.high {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.08);
}

.deal-card-image,
.deal-hero-image {
  display: block;
  width: 100%;
  object-fit: cover;
  background: var(--panel-soft);
  filter: none;
  transition: filter var(--motion-fast) ease;
}

.deal-card-image {
  height: 100%;
  min-height: 126px;
}

.deal-card:hover .deal-card-image,
.deal-hero-image:hover {
  filter: saturate(1.04);
}

.deal-card:hover .status-badge,
.deal-card:hover .priority-badge {
}

.deal-hero-image {
  max-height: 340px;
  border-radius: 12px;
  aspect-ratio: 16 / 7;
}

.deal-image-placeholder {
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--panel-soft);
  font-size: 38px;
  font-weight: 900;
}

.deal-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.deal-stat-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.deal-stat-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.deal-stat-grid strong,
.deal-profit-pill {
  white-space: nowrap;
}

.deal-profit-pill {
  align-self: flex-start;
  padding: 5px 8px;
  border-radius: 10px;
  background: var(--panel-soft);
  font-size: 13px;
  font-weight: 900;
}

.deal-actions-cell {
  align-content: space-between;
}

.deal-actions-cell .card-actions {
  margin-top: 0;
}

.image-picker {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.deal-image-preview {
  display: grid;
  place-items: center;
  height: 100px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  transition: border-color var(--motion-fast) ease;
}

.deal-image-preview:hover {
  border-color: rgba(37, 99, 235, 0.22);
}

.deal-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-file-button {
  margin: 0 8px 8px 0;
}

.safe-detail,
.deal-detail {
  display: grid;
  gap: 18px;
}

.deal-detail-hero {
  border-top-color: var(--accent);
}

.safe-detail-hero {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--safe-color, var(--primary));
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.safe-management-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 12px;
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}

.safe-management-panel h3 {
  margin: 0 0 5px;
}

.safe-management-actions {
  flex: 0 0 auto;
  margin-top: 0;
}

.safe-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.safe-subtab {
  flex: 1 1 140px;
  min-height: 44px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.safe-subtab:hover,
.safe-subtab.active {
  border-color: rgba(37, 99, 235, 0.18);
  background: var(--panel-soft);
  color: var(--text);
  box-shadow: none;
}

.safe-subtab.active {
  background: var(--primary);
  color: #ffffff;
}

.safe-subpanels {
  display: grid;
  gap: 18px;
}

.safe-subpanel {
  display: none;
}

.safe-subpanel.active {
  display: block;
}

.safe-detail-hero h3 {
  margin: 0;
  font-size: 28px;
}

.report-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.report-table table {
  width: 100%;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: var(--panel-blue);
}

.report-table tbody tr {
  transition: background var(--motion-base) ease;
}

.report-table tbody tr:hover {
  background: #f8fbff;
}

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

.profit-positive {
  color: var(--primary);
}

.profit-negative {
  color: var(--danger);
}

.segmented {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.segment {
  min-height: 32px;
  border: 0;
  background: transparent;
}

.segment.active {
  background: var(--panel);
  color: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.settings-block {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 19px;
  background: var(--panel);
}

.data-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-blue);
}

.data-status span,
.settings-note {
  color: var(--muted);
  font-size: 13px;
}

.data-status strong {
  color: var(--accent);
}

.settings-note {
  margin: 0;
  line-height: 1.45;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

::selection {
  background: rgba(37, 99, 235, 0.16);
  color: var(--text);
}

@media print {
  body {
    background: #ffffff;
  }

  .sidebar,
  .topbar-actions,
  .toolbar,
  .card-actions,
  button {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  main {
    padding: 0;
    background: #ffffff;
  }

  .metric,
  .safe-card,
  .deal-card,
  .settings-block,
  .list-item,
  .report-table {
    box-shadow: none;
  }
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--text);
  padding: 11px 12px;
  box-shadow: none;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(14, 165, 233, 0.58);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(14, 165, 233, 0.14);
  border-color: var(--primary);
}

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

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-row input {
  width: 42px;
  height: 22px;
}

.split-inputs,
.source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 40px;
  gap: 8px;
  align-items: end;
}

.split-inputs {
  grid-template-columns: 1fr 1fr;
}

.split-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.profit-preview {
  display: flex;
  justify-content: space-between;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-blue);
}

.file-button {
  display: inline-grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

dialog {
  width: min(620px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.action-dialog {
  width: min(980px, calc(100vw - 32px));
}

.action-dialog header {
  margin-bottom: 8px;
}

.action-center-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.action-group {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.action-group h4 {
  margin: 2px 0 4px;
  font-size: 18px;
  letter-spacing: 0;
}

.action-group button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 58px;
  padding: 12px 13px;
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.action-group button:hover {
  border-color: rgba(37, 99, 235, 0.22);
  background: #f8fafc;
  box-shadow: none;
}

.action-group button span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

dialog form {
  display: grid;
  gap: 14px;
}

dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 4px;
}

dialog h3 {
  margin: 0;
}

menu {
  justify-content: flex-end;
  margin: 0;
  padding: 0;
}

.empty-state {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--panel);
}

.recovery-warning-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.55fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid #2f333a;
  border-left: 5px solid #d4a017;
  border-radius: 12px;
  background: #111318;
  color: #f4f4f5;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14);
}

.recovery-warning-bar .eyebrow {
  color: #aeb4bf;
}

.recovery-warning-bar strong {
  display: block;
  font-size: 18px;
  line-height: 1.35;
}

.recovery-warning-metrics {
  display: grid;
  gap: 8px;
}

.recovery-warning-metrics span {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  position: relative;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #2b3038;
  border-radius: 8px;
  color: #c6cbd3;
  font-size: 13px;
  overflow: hidden;
}

.recovery-warning-metrics span::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--progress, 0%);
  background: rgba(212, 160, 23, 0.18);
}

.recovery-warning-metrics b {
  position: relative;
  color: #f4f4f5;
}

.recovery-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.recovery-tabs {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 16px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.recovery-tab {
  min-height: 42px;
  border-color: transparent;
  border-radius: 10px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.recovery-tab:hover,
.recovery-tab.active {
  border-color: rgba(37, 99, 235, 0.18);
  background: var(--panel-soft);
  color: var(--text);
  box-shadow: none;
}

.recovery-tab.active {
  background: #111318;
  color: #ffffff;
}

.recovery-section {
  display: none;
}

.recovery-section.active {
  display: block;
}

.recovery-wall,
.identity-reset-panel {
  padding: 22px;
  border: 1px solid #252a31;
  border-radius: 12px;
  background: #111318;
  color: #f4f4f5;
  box-shadow: var(--shadow);
}

.recovery-wall p,
.identity-reset-panel p {
  margin: 0 0 12px;
  color: #d7dbe2;
  line-height: 1.55;
}

.recovery-wall p:last-child,
.identity-reset-panel p:last-child {
  margin-bottom: 0;
}

.recovery-wall strong,
.identity-reset-panel h3 {
  color: #ffffff;
}

.recovery-panel {
  border-color: #d8dde5;
  box-shadow: var(--shadow);
}

.recovery-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.recovery-metrics article {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

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

.recovery-metrics strong {
  font-size: 22px;
}

.daily-command-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}

.daily-command-group {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.daily-command-group h4 {
  margin: 0 0 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}

.daily-check,
.firewall-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 38px;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
}

.daily-check input,
.firewall-check input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: #111318;
}

.daily-check span,
.firewall-check span {
  min-width: 0;
}

.recovery-two-column {
  margin: 16px 0;
}

.compact-table {
  max-height: 430px;
}

.compact-table table {
  min-width: 980px;
}

.warning-row {
  background: rgba(180, 83, 9, 0.08);
}

.table-actions {
  white-space: nowrap;
}

.table-actions button {
  min-height: 34px;
  margin: 2px;
}

.firewall-panel {
  margin-top: 0;
}

.firewall-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.vault-message {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  line-height: 1.55;
}

.vault-panel textarea,
.weekly-review-grid textarea {
  min-height: 96px;
}

.weekly-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.weekly-review-records {
  margin-top: 16px;
}

.weekly-record {
  align-items: start;
}

.weekly-record-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.weekly-record-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.weekly-record-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.weekly-record-grid p {
  margin: 0;
  line-height: 1.45;
}

.identity-reset-panel {
  margin-top: 16px;
}

.identity-reset-panel .eyebrow {
  color: #aeb4bf;
}

body.dark .recovery-panel,
body.dark .daily-command-group,
body.dark .recovery-metrics article,
body.dark .firewall-checklist {
  background: var(--panel);
}

body.dark {
  background: var(--bg);
}

body.dark .sidebar {
  background: var(--paper);
}

body.dark .topbar {
  background: transparent;
}

body.dark .tab-button.active,
body.dark .tab-button:hover,
body.dark button:hover,
body.dark .file-button:hover,
body.dark .action-group button:hover,
body.dark .report-table tbody tr:hover {
  background: #172237;
}

body.dark .metric,
body.dark .safe-card,
body.dark .dashboard-panel,
body.dark .dashboard-hero,
body.dark .dashboard-hero-stats article,
body.dark .focus-card,
body.dark .dashboard-safe-row,
body.dark .dashboard-mini-item,
body.dark .projected-hero > div,
body.dark .projected-table-panel,
body.dark .projected-safe-row,
body.dark .settings-block,
body.dark .list-item,
body.dark dialog,
body.dark .action-group button,
body.dark .report-table {
  background: var(--panel);
}

body.dark button,
body.dark .file-button {
  background: var(--panel);
}

body.dark .projected-total-card {
  background: var(--primary);
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .tab-button {
    justify-content: center;
    padding: 10px;
    font-size: 13px;
  }

  .icon {
    display: none;
  }

  .metrics,
  .two-column,
  .settings-grid,
  .cashflow-layout,
  .marketing-grid,
  .dashboard-hero,
  .dashboard-layout,
  .projected-hero,
  .recovery-warning-bar,
  .recovery-grid,
  .toolbar,
  .deal-toolbar {
    grid-template-columns: 1fr;
  }

  .dashboard-hero-stats,
  .dashboard-focus,
  .ledger-module-grid,
  .action-center-grid,
  .daily-command-grid,
  .weekly-review-grid,
  .projected-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .recovery-tab {
    white-space: normal;
  }

  .dashboard-safe-row,
  .projected-safe-row {
    grid-template-columns: minmax(150px, 1fr) repeat(2, minmax(110px, 0.8fr));
  }

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

  .calendar-weekdays,
  .cashflow-calendar {
    gap: 5px;
  }

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

  .calendar-pill {
    max-width: 100%;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
  }

  .deal-card {
    grid-template-columns: 120px minmax(180px, 1fr) minmax(320px, 1.4fr);
    min-width: 720px;
  }

  .deal-actions-cell {
    grid-column: 2 / -1;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  main {
    padding: 16px;
  }

  .topbar,
  .section-header,
  .safe-management-panel,
  .list-item {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .marketing-actions {
    grid-template-columns: repeat(3, minmax(0, auto));
    justify-content: start;
    margin-top: 12px;
  }

  .topbar-actions,
  .card-actions,
  menu {
    flex-wrap: wrap;
  }

  .safe-management-actions {
    justify-content: flex-start;
  }

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

  .split-inputs,
  .source-row,
  .deal-card,
  .deal-stat-grid,
  .dashboard-hero-stats,
  .dashboard-focus,
  .ledger-module-grid,
  .action-center-grid,
  .daily-command-grid,
  .weekly-review-grid,
  .firewall-checklist,
  .dashboard-safe-row,
  .projected-summary-grid,
  .projected-safe-breakdown,
  .image-picker {
    grid-template-columns: 1fr;
  }

  .recovery-tabs {
    grid-template-columns: 1fr 1fr;
  }

  .deal-card {
    min-width: 0;
  }

  .deal-card-image {
    height: 170px;
  }

  .deal-main-cell,
  .deal-numbers-cell,
  .deal-actions-cell {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
