:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --panel: #ffffff;
  --panel-soft: #f9fbfa;
  --text: #151918;
  --muted: #66706c;
  --faint: #8c9792;
  --border: #dce4e0;
  --border-strong: #c8d3ce;
  --accent: #0f8f6b;
  --accent-dark: #0a6d52;
  --accent-soft: #e5f5ef;
  --amber: #d58920;
  --amber-soft: #fff2dc;
  --red: #c44949;
  --red-soft: #ffe9e6;
  --ink: #202523;
  --shadow: 0 18px 42px rgba(23, 36, 31, 0.08);
  --radius: 8px;
  --sidebar: 268px;
  --sidebar-compact: 86px;
  font-family:
    Satoshi, "Cabinet Grotesk", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(232, 240, 236, 0.65), transparent 420px),
    var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-compact) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 18px;
  background: #17211d;
  color: #edf5f1;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-toggle {
  position: absolute;
  right: -8px;
  top: 9px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  line-height: 1;
  font-size: 22px;
  font-weight: 850;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.sidebar-toggle:hover {
  transform: translateX(-1px);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.14);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: #eff8f3;
  color: #10201a;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.2;
}

.brand span {
  margin-top: 3px;
  color: rgba(237, 245, 241, 0.64);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(237, 245, 241, 0.78);
  text-align: left;
  font-size: 14px;
  font-weight: 650;
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.app-shell.sidebar-collapsed .sidebar {
  gap: 18px;
  padding: 18px 10px;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
  padding-bottom: 14px;
}

.app-shell.sidebar-collapsed .brand div:not(.brand-mark),
.app-shell.sidebar-collapsed .sidebar-note {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  right: -2px;
}

.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  min-height: 46px;
  padding: 0;
  font-size: 0;
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-note span,
.sidebar-note small {
  display: block;
  color: rgba(237, 245, 241, 0.62);
  font-size: 12px;
}

.sidebar-note strong {
  display: block;
  margin: 5px 0 8px;
  color: #ffffff;
  font-size: 14px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.primary-panel,
.scenario-panel,
.data-panel,
.chart-panel,
.table-wrap {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 18px;
  margin-bottom: 16px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.05;
  font-weight: 800;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

h3 {
  font-size: 15px;
  line-height: 1.2;
}

.topbar p,
.section-head p,
.data-panel > p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

select,
.search-input {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  font-size: 14px;
}

select {
  padding: 0 34px 0 10px;
}

.search-input {
  width: min(360px, 100%);
  padding: 0 12px;
}

.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 750;
}

.ghost-button {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
}

.primary-button {
  border: 1px solid var(--accent-dark);
  background: var(--accent);
  color: #ffffff;
}

.icon-button {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  cursor: pointer;
}

.icon-button.danger {
  border-color: rgba(255, 107, 107, 0.34);
  color: var(--red);
  background: rgba(255, 107, 107, 0.08);
}

.icon-button:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.09);
}

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

.status-strip div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
}

.status-strip span {
  display: block;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}

.status-strip strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.view-section {
  display: none;
}

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

.module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
}

.module-grid > .primary-panel:only-child,
.module-grid > .data-panel:only-child {
  grid-column: 1 / -1;
}

.primary-panel,
.scenario-panel,
.data-panel,
.chart-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.primary-panel,
.scenario-panel,
.data-panel {
  padding: 16px;
}

.section-head,
.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  min-width: 128px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.segmented button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segmented button.active {
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: 0 4px 12px rgba(20, 41, 34, 0.08);
}

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

.kpi-card {
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.kpi-card .label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-card strong {
  display: block;
  margin-top: 16px;
  overflow-wrap: anywhere;
  font-size: clamp(20px, 1.7vw, 27px);
  line-height: 1.05;
}

.kpi-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.tone-good {
  color: var(--accent-dark);
}

.tone-risk {
  color: var(--amber);
}

.tone-bad {
  color: var(--red);
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 10px;
  margin-top: 10px;
}

.chart-panel {
  padding: 14px;
}

.panel-title {
  align-items: center;
  margin-bottom: 12px;
}

.panel-title span {
  color: var(--faint);
  font-size: 12px;
  font-weight: 750;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(8, minmax(34px, 1fr));
  align-items: end;
  gap: 9px;
  min-height: 232px;
  padding-top: 10px;
}

.month-bar {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 7px;
  min-width: 0;
  height: 212px;
}

.bar-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 3px;
  min-height: 164px;
  border-bottom: 1px solid var(--border);
}

.bar {
  min-height: 4px;
  border-radius: 4px 4px 0 0;
}

.bar.income {
  background: var(--accent);
}

.bar.expense {
  background: var(--amber);
}

.month-bar span {
  overflow: hidden;
  color: var(--muted);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 750;
}

.split-layout {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 232px;
}

.donut {
  width: 138px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0 40%, var(--amber) 40% 68%, #7b8f87 68% 82%, #dce4e0 82%);
  position: relative;
}

.donut::after {
  position: absolute;
  inset: 32px;
  border-radius: inherit;
  background: #ffffff;
  content: "";
}

.category-list {
  display: grid;
  gap: 8px;
}

.category-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.category-item strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.category-item span {
  font-weight: 750;
}

.scenario-panel {
  position: sticky;
  top: 24px;
}

.scenario-score {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #edf8f3, #fff9ef);
}

.scenario-score span,
.scenario-score small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.scenario-score strong {
  display: block;
  margin: 8px 0;
  font-size: 30px;
  line-height: 1;
}

.control-stack {
  display: grid;
  gap: 12px;
}

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

.range-control,
.select-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.range-control input,
.select-control select {
  grid-column: 1 / -1;
  width: 100%;
}

.range-control span,
.select-control span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

input[type="range"] {
  accent-color: var(--accent);
}

.quest-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.quest {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}

.quest strong {
  display: block;
  font-size: 13px;
}

.quest small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.table-grid,
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.bookkeeper-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

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

.accountant-summary article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.accountant-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.accountant-summary strong {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.editor-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.editor-tabs button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.editor-tabs button.active {
  border-color: rgba(15, 143, 107, 0.35);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.editor-pane {
  display: none;
}

.editor-pane.active {
  display: block;
}

.month-picker {
  max-width: 260px;
  margin-bottom: 12px;
}

.month-picker label,
.payroll-period-bar label,
.monthly-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.month-picker input,
.payroll-period-bar input,
.payroll-period-bar select,
.monthly-toolbar input,
.monthly-toolbar select {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
}

.payroll-period-bar {
  display: grid;
  grid-template-columns: 220px 260px;
  gap: 10px;
  margin-bottom: 12px;
}

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

.editor-hint {
  max-width: 920px;
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.entry-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.entry-box {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.entry-box h3 {
  margin: 0 0 10px;
}

.entry-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.entry-title h3 {
  margin: 0;
}

.hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.income-entry {
  border-color: rgba(15, 143, 107, 0.25);
}

.expense-entry {
  border-color: rgba(213, 137, 32, 0.3);
}

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

.monthly-toolbar button {
  grid-column: 1 / -1;
}

.expense-button {
  border-color: #a96812;
  background: var(--amber);
}

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

.monthly-summary article {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.monthly-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.monthly-summary strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.data-panel.wide {
  width: 100%;
}

.table-wrap {
  overflow: auto;
  max-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.table-wrap.large {
  max-height: calc(100vh - 248px);
}

.table-wrap.large.payroll-wrap {
  max-height: none;
}

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

.editable-table {
  min-width: 1340px;
}

.payroll-table {
  min-width: 1340px;
  table-layout: fixed;
}

.conditions-table {
  min-width: 1760px;
  table-layout: fixed;
}

.payroll-table th,
.payroll-table td,
.conditions-table th,
.conditions-table td {
  height: 54px;
  white-space: nowrap;
  vertical-align: middle;
}

.payroll-table th,
.conditions-table th {
  line-height: 1.12;
}

.payroll-table th:nth-child(1),
.payroll-table td:nth-child(1) {
  width: 170px;
}

.payroll-table th:nth-child(2),
.payroll-table td:nth-child(2),
.payroll-table th:nth-child(3),
.payroll-table td:nth-child(3),
.payroll-table th:nth-child(10),
.payroll-table td:nth-child(10),
.payroll-table th:nth-child(11),
.payroll-table td:nth-child(11),
.payroll-table th:nth-child(12),
.payroll-table td:nth-child(12) {
  width: 140px;
}

.payroll-table th:nth-child(4),
.payroll-table td:nth-child(4) {
  width: 72px;
}

.payroll-table th:nth-child(5),
.payroll-table td:nth-child(5),
.payroll-table th:nth-child(6),
.payroll-table td:nth-child(6),
.payroll-table th:nth-child(7),
.payroll-table td:nth-child(7),
.payroll-table th:nth-child(8),
.payroll-table td:nth-child(8),
.payroll-table th:nth-child(9),
.payroll-table td:nth-child(9) {
  width: 108px;
}

.payroll-table th:nth-child(13),
.payroll-table td:nth-child(13) {
  width: 150px;
}

.conditions-table th:nth-child(1),
.conditions-table td:nth-child(1) {
  width: 150px;
}

.conditions-table th:nth-child(2),
.conditions-table td:nth-child(2),
.conditions-table th:nth-child(3),
.conditions-table td:nth-child(3) {
  width: 180px;
}

.conditions-table th:nth-child(4),
.conditions-table td:nth-child(4) {
  width: 230px;
}

.conditions-table th:nth-child(5),
.conditions-table td:nth-child(5) {
  width: 130px;
}

.conditions-table th:nth-child(6),
.conditions-table td:nth-child(6),
.conditions-table th:nth-child(8),
.conditions-table td:nth-child(8),
.conditions-table th:nth-child(9),
.conditions-table td:nth-child(9) {
  width: 112px;
}

.conditions-table th:nth-child(7),
.conditions-table td:nth-child(7) {
  width: 72px;
}

.conditions-table th:nth-child(10),
.conditions-table td:nth-child(10) {
  width: 360px;
}

.conditions-table th:nth-child(11),
.conditions-table td:nth-child(11) {
  width: 80px;
  text-align: center;
}

.payroll-conditions {
  margin-bottom: 14px;
}

.conditions-wrap {
  max-height: 320px;
}

.department-row td {
  height: 38px;
  padding: 9px 12px;
  background: rgba(205, 251, 47, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.conditions-department td {
  background: rgba(128, 92, 246, 0.1);
}

.monthly-table {
  min-width: 760px;
}

.monthly-table tr[data-auto-row="true"] input,
.monthly-table tr[data-auto-row="true"] select {
  border-color: rgba(205, 251, 47, 0.18);
  background: rgba(205, 251, 47, 0.07);
  color: var(--text);
}

.monthly-ledgers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.monthly-ledgers > section {
  min-width: 0;
}

.monthly-wrap {
  max-height: 360px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

td {
  color: var(--ink);
}

td input,
td select {
  width: 100%;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

td input:focus,
td select:focus {
  outline: 2px solid rgba(15, 143, 107, 0.18);
  border-color: rgba(15, 143, 107, 0.45);
  background: #ffffff;
}

.computed {
  background: #f2f7f5;
  font-weight: 850;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.pill.expense {
  background: var(--amber-soft);
  color: #8a5510;
}

.pill.risk {
  background: var(--red-soft);
  color: var(--red);
}

.payroll-layout {
  grid-template-columns: minmax(0, 1fr);
}

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

.payroll-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ece8;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.formula-panel {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 12px;
}

.quality-list {
  display: grid;
  gap: 8px;
}

.quality-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.quality-item.warn {
  border-color: rgba(213, 137, 32, 0.35);
  background: var(--amber-soft);
}

.quality-item.bad {
  border-color: rgba(196, 73, 73, 0.35);
  background: var(--red-soft);
}

.quality-item.ok {
  border-color: rgba(15, 143, 107, 0.28);
  background: var(--accent-soft);
}

.quality-item strong,
.quality-item small {
  display: block;
}

.quality-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.formula-preview {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.formula-catalog {
  display: grid;
  gap: 8px;
}

.formula-catalog article {
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.formula-catalog strong,
.formula-catalog small,
.formula-catalog code {
  display: block;
}

.formula-catalog code {
  margin: 6px 0;
  color: var(--accent-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: normal;
}

.formula-catalog small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.simulator-board {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.strategy-shell {
  display: grid;
  gap: 16px;
  color: #ecf3ef;
}

.strategy-hero,
.strategy-scoreboard,
.strategy-explainer,
.company-map,
.action-market,
.forecast-panel,
.event-deck,
.legacy-scenario {
  border: 1px solid rgba(203, 222, 211, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(35, 48, 42, 0.94), rgba(18, 24, 22, 0.98)),
    #151b19;
  box-shadow: 0 24px 60px rgba(14, 21, 18, 0.22);
}

.strategy-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 24px;
  align-items: end;
  min-height: 210px;
  padding: 28px;
  overflow: hidden;
  position: relative;
}

.strategy-hero::before {
  position: absolute;
  inset: 0;
  opacity: 0.38;
  background-image:
    linear-gradient(rgba(190, 255, 64, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(190, 255, 64, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
}

.strategy-copy,
.strategy-command,
.strategy-scoreboard,
.strategy-explainer,
.strategy-layout {
  position: relative;
}

.strategy-copy h1 {
  max-width: 780px;
  color: #ffffff;
  font-size: clamp(34px, 5vw, 72px);
  letter-spacing: 0;
  line-height: 0.96;
}

.strategy-copy p {
  max-width: 620px;
  margin-top: 14px;
  color: rgba(236, 243, 239, 0.66);
  font-size: 16px;
  line-height: 1.55;
}

.strategy-command {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.strategy-command div {
  padding: 12px;
  border-radius: 7px;
  background: rgba(6, 12, 10, 0.34);
}

.strategy-command span,
.strategy-card span,
.forecast-row span,
.game-event-select span {
  display: block;
  color: rgba(236, 243, 239, 0.58);
  font-size: 12px;
  font-weight: 800;
}

.strategy-command strong {
  display: block;
  margin-top: 5px;
  color: #ffffff;
  font-size: 18px;
}

.strategy-primary {
  grid-column: span 1;
  border-color: #c5ff2d;
  background: #c5ff2d;
  color: #152012;
}

.strategy-ghost {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.strategy-scoreboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.strategy-explainer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.strategy-explainer article {
  min-width: 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.strategy-card {
  min-width: 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.strategy-explainer span {
  display: block;
  color: rgba(236, 243, 239, 0.58);
  font-size: 12px;
  font-weight: 850;
}

.strategy-explainer strong {
  display: block;
  margin-top: 7px;
  color: #ffffff;
  font-size: 16px;
}

.strategy-explainer small {
  display: block;
  margin-top: 8px;
  color: rgba(236, 243, 239, 0.58);
  font-size: 12px;
  line-height: 1.45;
}

.strategy-card strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: #ffffff;
  font-size: clamp(18px, 1.5vw, 26px);
  line-height: 1.05;
}

.strategy-card small {
  display: block;
  margin-top: 8px;
  color: rgba(236, 243, 239, 0.55);
  font-size: 12px;
  line-height: 1.35;
}

.strategy-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  align-items: start;
}

.strategy-main,
.strategy-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.strategy-side {
  position: sticky;
  top: 24px;
}

.company-map,
.action-market,
.forecast-panel,
.event-deck,
.legacy-scenario {
  min-width: 0;
  padding: 16px;
}

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

.map-head.compact {
  align-items: center;
}

.map-head h2,
.forecast-panel h2,
.event-deck h2,
.legacy-scenario h2 {
  color: #ffffff;
  font-size: 18px;
}

.map-head p {
  margin-top: 5px;
  color: rgba(236, 243, 239, 0.58);
  font-size: 13px;
  line-height: 1.4;
}

.map-head > span,
.victory-badge {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(197, 255, 45, 0.3);
  border-radius: 999px;
  background: rgba(197, 255, 45, 0.1);
  color: #d9ff74;
  font-size: 12px;
  font-weight: 850;
}

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

.funnel-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.funnel-step {
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.funnel-step span,
.action-category-filter button .category-label {
  display: block;
  color: rgba(236, 243, 239, 0.58);
  font-size: 12px;
  font-weight: 850;
}

.funnel-step strong {
  display: block;
  margin-top: 7px;
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
}

.funnel-step small {
  display: block;
  margin-top: 7px;
  color: rgba(236, 243, 239, 0.56);
  font-size: 12px;
  line-height: 1.3;
}

.map-node {
  min-height: 138px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.035);
  position: relative;
  overflow: hidden;
}

.map-node::after {
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: rgba(197, 255, 45, 0.08);
  content: "";
}

.map-node.risk::after {
  background: rgba(255, 183, 77, 0.12);
}

.map-node.danger::after {
  background: rgba(255, 104, 104, 0.13);
}

.map-node strong,
.action-card strong {
  display: block;
  color: #ffffff;
  font-size: 15px;
}

.action-card strong span {
  display: block;
  margin-bottom: 3px;
  color: rgba(236, 243, 239, 0.56);
  font-size: 12px;
  font-weight: 850;
}

.map-node b {
  display: block;
  margin-top: 12px;
  color: #c5ff2d;
  overflow-wrap: anywhere;
  font-size: clamp(20px, 1.5vw, 25px);
  line-height: 1;
}

.map-node small,
.action-card small,
.forecast-row small {
  display: block;
  margin-top: 7px;
  color: rgba(236, 243, 239, 0.58);
  font-size: 12px;
  line-height: 1.35;
}

.node-bar,
.forecast-meter {
  height: 8px;
  overflow: hidden;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.node-bar span,
.forecast-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #c5ff2d;
}

.map-node.risk .node-bar span {
  background: #ffbd59;
}

.map-node.danger .node-bar span {
  background: #ff6f61;
}

.action-grid {
  column-count: 3;
  column-gap: 10px;
}

.action-category-filter {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.action-category-filter button {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  min-width: 0;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: #ffffff;
  text-align: left;
}

.action-category-filter button.active {
  border-color: rgba(197, 255, 45, 0.45);
  background: rgba(197, 255, 45, 0.12);
}

.action-category-filter button strong {
  color: #d9ff74;
  font-size: 14px;
}

.action-category-filter .category-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-icon,
.action-kind svg {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  color: #d9ff74;
}

.category-icon svg,
.action-kind svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.action-card {
  display: inline-block;
  width: 100%;
  min-height: 226px;
  margin: 0 0 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  break-inside: avoid;
  color: #ffffff;
  text-align: left;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, background 0.2s;
}

.action-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.action-kind {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid rgba(197, 255, 45, 0.28);
  border-radius: 999px;
  background: rgba(197, 255, 45, 0.08);
  color: #d9ff74;
  font-size: 11px;
  font-weight: 850;
}

.info-mark {
  display: inline-grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.action-detail {
  display: grid;
  gap: 8px;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0 12px;
  border: 0 solid rgba(197, 255, 45, 0.24);
  border-radius: 8px;
  background: rgba(14, 22, 18, 0.52);
  opacity: 0;
  transition: max-height 0.22s ease, opacity 0.18s ease, margin 0.18s ease, padding 0.18s ease, border-width 0.18s ease;
}

.action-card:hover .action-detail,
.action-card:focus-visible .action-detail {
  max-height: 520px;
  margin: 0 0 12px;
  padding: 12px;
  border-width: 1px;
  opacity: 1;
}

.action-detail strong {
  margin: 0;
  color: #ffffff;
  font-size: 13px;
}

.action-detail span {
  color: rgba(236, 243, 239, 0.72);
  font-size: 12px;
  line-height: 1.35;
}

.action-card:hover {
  transform: translateY(-2px);
  border-color: rgba(197, 255, 45, 0.42);
  background: rgba(197, 255, 45, 0.08);
}

.action-card:active {
  transform: translateY(0) scale(0.99);
}

.action-card.selected {
  border-color: #c5ff2d;
  background: rgba(197, 255, 45, 0.12);
}

.action-card.disabled {
  opacity: 0.45;
}

.action-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 12px 0;
  color: #d9ff74;
  font-size: 12px;
  font-weight: 850;
}

.effect-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.effect-strip span {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
}

.effect-strip .good {
  background: rgba(197, 255, 45, 0.12);
  color: #d9ff74;
}

.effect-strip .bad {
  background: rgba(255, 111, 97, 0.12);
  color: #ffb4aa;
}

.forecast-meter {
  margin: 12px 0;
}

.forecast-list,
.event-log {
  display: grid;
  gap: 8px;
}

.forecast-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.forecast-row:last-child {
  border-bottom: 0;
}

.forecast-row strong {
  color: #ffffff;
}

.game-event-select {
  margin-bottom: 12px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.game-event-select select {
  border-color: rgba(255, 255, 255, 0.14);
  background: #202925;
  color: #ffffff;
}

.legacy-scenario .gamification-controls {
  grid-template-columns: 1fr;
}

.strategy-shell .range-control,
.strategy-shell .select-control,
.strategy-shell .timeline-card,
.strategy-shell .log-card {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.strategy-shell .timeline-card {
  grid-template-columns: 66px 1fr auto;
}

.strategy-shell .timeline-card small,
.strategy-shell .log-card small {
  color: rgba(236, 243, 239, 0.58);
}

.strategy-shell input[type="range"] {
  accent-color: #c5ff2d;
}

.timeline,
.event-log,
.roadmap {
  display: grid;
  gap: 10px;
}

.timeline-card,
.log-card,
.roadmap-item {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.timeline-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
}

.timeline-card strong,
.log-card strong,
.roadmap-item strong {
  display: block;
  font-size: 14px;
}

.timeline-card small,
.log-card small,
.roadmap-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.file-drop {
  display: grid;
  gap: 5px;
  place-items: center;
  min-height: 132px;
  margin-top: 12px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--muted);
  text-align: center;
}

.file-drop strong {
  color: var(--ink);
}

.file-drop input {
  width: 100%;
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
}

.icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
}

.icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .sidebar {
    padding: 16px 10px;
  }

  .brand div:not(.brand-mark),
  .nav-item {
    font-size: 0;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .sidebar-note {
    display: none;
  }

  .module-grid,
  .payroll-layout,
  .bookkeeper-grid,
  .strategy-layout {
    grid-template-columns: 1fr;
  }

  .scenario-panel,
  .formula-panel,
  .strategy-side {
    position: static;
  }

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

  .strategy-explainer {
    grid-template-columns: 1fr;
  }

  .economy-map,
  .funnel-board,
  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-grid {
    column-count: 2;
  }
}

@media (max-width: 1500px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    max-width: 100vw;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .brand {
    flex: 0 0 auto;
    min-width: max-content;
    padding: 0 14px 0 0;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 0;
  }

  .nav-list {
    display: flex;
    min-width: 0;
    overflow-x: auto;
  }

  .nav-item {
    flex: 0 0 44px;
    min-width: 44px;
  }

  .workspace {
    padding: 16px;
  }

  .topbar,
  .section-head,
  .panel-title {
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .status-strip,
  .kpi-grid,
  .chart-row,
  .table-grid,
  .settings-grid,
  .accountant-summary,
  .entry-split,
  .payroll-period-bar,
  .payroll-period-summary,
  .monthly-toolbar,
  .monthly-summary,
  .monthly-ledgers,
  .gamification-controls,
  .simulator-board,
  .strategy-hero,
  .strategy-command,
  .strategy-scoreboard,
  .strategy-explainer,
  .economy-map,
  .funnel-board,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .action-grid {
    column-count: 1;
  }

  .strategy-hero {
    min-height: auto;
    padding: 18px;
  }

  .strategy-copy h1 {
    font-size: 36px;
  }

  .map-head {
    flex-direction: column;
  }

  .bar-chart {
    grid-template-columns: repeat(4, minmax(40px, 1fr));
  }

  .split-layout {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .payroll-card {
    grid-template-columns: 1fr;
  }
}

/* Reference-inspired finance cockpit redesign */
:root {
  color-scheme: dark;
  --bg: #080a0b;
  --panel: rgba(19, 21, 22, 0.86);
  --panel-soft: rgba(27, 29, 31, 0.76);
  --text: #f3f5ef;
  --muted: #a1a79f;
  --faint: #737a74;
  --border: rgba(255, 255, 255, 0.095);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #cdfb2f;
  --accent-dark: #c4f224;
  --accent-soft: rgba(205, 251, 47, 0.12);
  --violet: #805cf6;
  --violet-soft: rgba(128, 92, 246, 0.15);
  --amber: #dd8f1f;
  --amber-soft: rgba(221, 143, 31, 0.14);
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, 0.12);
  --ink: #eef2ea;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  --radius: 8px;
  font-family:
    Satoshi, Geist, "Avenir Next", "SF Pro Display", ui-sans-serif, system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 150px),
    linear-gradient(110deg, rgba(128, 92, 246, 0.16), transparent 32%),
    linear-gradient(250deg, rgba(205, 251, 47, 0.06), transparent 30%),
    #080a0b;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.95), transparent 86%);
  content: "";
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: radial-gradient(rgba(255, 255, 255, 0.9) 0.6px, transparent 0.6px);
  background-size: 3px 3px;
  content: "";
}

.app-shell,
.workspace,
.sidebar {
  position: relative;
  z-index: 1;
}

.sidebar {
  background: rgba(11, 13, 14, 0.9);
  border-right: 1px solid var(--border);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.brand {
  border-bottom-color: var(--border);
}

.brand-mark {
  background: var(--accent);
  color: #10120d;
  border-color: rgba(205, 251, 47, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.brand span,
.sidebar-note span,
.sidebar-note small {
  color: rgba(243, 245, 239, 0.54);
}

.nav-item {
  color: rgba(243, 245, 239, 0.7);
  transition:
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.nav-item:hover {
  transform: translateX(2px);
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.075);
  color: #ffffff;
}

.nav-item.active {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar-note,
.status-strip div,
.primary-panel,
.scenario-panel,
.data-panel,
.chart-panel,
.kpi-card,
.range-control,
.select-control,
.quest,
.payroll-card,
.formula-preview,
.formula-catalog article,
.timeline-card,
.log-card,
.roadmap-item,
.file-drop,
.quality-item,
.entry-box,
.monthly-summary article,
.accountant-summary article {
  border-color: var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.058), rgba(255, 255, 255, 0.018)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.workspace {
  padding: 28px 32px;
}

.topbar {
  align-items: center;
  margin-bottom: 18px;
}

h1 {
  max-width: 900px;
  color: #fbfff7;
  font-size: clamp(34px, 4.2vw, 58px);
  font-weight: 760;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

h2,
h3 {
  color: #f8fbf2;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.topbar p,
.section-head p,
.data-panel > p {
  color: var(--muted);
}

select,
.search-input,
.monthly-toolbar input,
.monthly-toolbar select,
.month-picker input,
.payroll-period-bar input,
.payroll-period-bar select {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  color-scheme: dark;
}

input[type="date"],
input[type="month"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.7;
}

option {
  background: #151719;
  color: var(--text);
}

td input,
td select {
  color: var(--text);
}

td input:focus,
td select:focus,
select:focus,
.search-input:focus,
.monthly-toolbar input:focus,
.month-picker input:focus {
  outline: 2px solid rgba(205, 251, 47, 0.18);
  border-color: rgba(205, 251, 47, 0.38);
  background: rgba(255, 255, 255, 0.085);
}

.ghost-button,
.primary-button,
.editor-tabs button,
.segmented {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.ghost-button:hover,
.editor-tabs button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.085);
}

.ghost-button:active,
.primary-button:active,
.editor-tabs button:active,
.nav-item:active {
  transform: scale(0.985);
}

.primary-button {
  border-color: rgba(205, 251, 47, 0.55);
  background: var(--accent);
  color: #12140e;
  font-weight: 860;
}

.expense-button {
  border-color: rgba(221, 143, 31, 0.58);
  background: var(--amber);
  color: #160d04;
}

.status-strip span,
.kpi-card .label,
.accountant-summary span,
.monthly-summary span,
th,
.panel-title span {
  color: var(--faint);
  letter-spacing: 0.015em;
}

.status-strip strong,
.accountant-summary strong,
.monthly-summary strong,
.kpi-card strong,
.scenario-score strong {
  font-family:
    "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.kpi-grid {
  gap: 12px;
}

.kpi-card {
  min-height: 126px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 13px;
  height: 2px;
  opacity: 0.86;
  background: repeating-linear-gradient(
    90deg,
    rgba(205, 251, 47, 0.9) 0 7px,
    transparent 7px 12px
  );
  content: "";
}

.kpi-card strong {
  margin-top: 13px;
  font-size: clamp(22px, 2.1vw, 34px);
  letter-spacing: -0.055em;
}

.tone-good {
  color: var(--accent);
}

.tone-risk {
  color: #f0a232;
}

.tone-bad {
  color: var(--red);
}

.scenario-score {
  background:
    linear-gradient(180deg, rgba(205, 251, 47, 0.12), rgba(128, 92, 246, 0.09)),
    rgba(19, 21, 22, 0.82);
}

.editor-tabs {
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.editor-tabs button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.editor-tabs button.active,
.segmented button.active {
  background: var(--accent);
  color: #12140e;
  box-shadow: none;
}

.segmented button {
  color: var(--muted);
}

.bar.income {
  background: linear-gradient(180deg, var(--accent), rgba(205, 251, 47, 0.28));
}

.bar.expense {
  background: linear-gradient(180deg, var(--violet), rgba(128, 92, 246, 0.24));
}

.bar-pair {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.donut {
  background: conic-gradient(
    var(--accent) 0 42%,
    var(--violet) 42% 66%,
    #5f6660 66% 82%,
    #2b302d 82%
  );
}

.donut::after {
  background: #111315;
}

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

th {
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
}

td {
  border-bottom-color: rgba(255, 255, 255, 0.075);
  color: var(--text);
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.035);
}

.computed {
  background: rgba(205, 251, 47, 0.08);
}

.pill {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill.expense {
  background: var(--violet-soft);
  color: #bfaeff;
}

.pill.risk {
  background: var(--red-soft);
  color: var(--red);
}

.progress-track {
  background: rgba(255, 255, 255, 0.08);
}

.progress-track span,
input[type="range"] {
  accent-color: var(--accent);
}

.progress-track span {
  background: linear-gradient(90deg, var(--violet), var(--accent));
}

.entry-box h3 {
  font-size: 18px;
}

.income-entry {
  border-color: rgba(205, 251, 47, 0.22);
}

.expense-entry {
  border-color: rgba(128, 92, 246, 0.24);
}

.quality-item.warn {
  border-color: rgba(221, 143, 31, 0.4);
  background: rgba(221, 143, 31, 0.1);
}

.quality-item.bad {
  border-color: rgba(255, 107, 107, 0.38);
  background: rgba(255, 107, 107, 0.095);
}

.quality-item.ok {
  border-color: rgba(205, 251, 47, 0.3);
  background: rgba(205, 251, 47, 0.1);
}

.formula-catalog code {
  color: var(--accent);
}

.crm-shell {
  display: grid;
  gap: 16px;
}

.crm-header {
  display: grid;
  gap: 16px;
}

.crm-sync-status {
  min-width: 160px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.crm-sync-status span,
.crm-sync-status strong {
  display: block;
}

.crm-sync-status span {
  color: var(--muted);
  font-size: 12px;
}

.crm-sync-status strong {
  margin-top: 4px;
  color: var(--accent);
  font-size: 14px;
}

.crm-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.crm-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.crm-filters select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.crm-refresh-panel {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(220px, 1fr) minmax(260px, 1.15fr);
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.crm-refresh-panel .primary-button {
  width: 100%;
  min-height: 46px;
  color: #10120d;
}

.crm-refresh-panel .primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.crm-refresh-panel .primary-button.is-loading .icon {
  animation: crm-spin 900ms linear infinite;
}

.crm-refresh-indicator {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
}

.crm-refresh-indicator input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-weight: 760;
}

.crm-refresh-meta {
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.crm-refresh-meta strong,
.crm-refresh-meta span {
  display: block;
}

.crm-refresh-meta strong {
  color: var(--accent);
  font-size: 13px;
  line-height: 1.3;
}

.crm-refresh-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.crm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.crm-tabs button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 760;
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.crm-tabs button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
}

.crm-tabs button.active {
  background: var(--accent);
  color: #12140e;
}

.crm-tab-panel {
  display: none;
  gap: 16px;
}

.crm-tab-panel.active {
  display: grid;
}

.crm-kpi-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.crm-kpi {
  min-height: 116px;
}

.crm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
}

.crm-table-wrap {
  max-height: 430px;
  overflow: auto;
}

.crm-year-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.crm-year-total-row td {
  background: rgba(255, 255, 255, 0.045);
}

.crm-result-bars {
  display: grid;
  gap: 14px;
}

.crm-result-row {
  display: grid;
  gap: 8px;
}

.crm-result-row > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.crm-result-row strong {
  font-size: 14px;
}

.crm-result-row span,
.crm-result-row small,
.crm-empty {
  color: var(--muted);
  font-size: 12px;
}

.employee-pulse-panel {
  overflow: hidden;
}

.employee-pulse-layout {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(300px, 1.1fr) minmax(220px, 0.9fr);
  gap: 18px;
  align-items: center;
}

.employee-pulse-summary {
  display: grid;
  gap: 12px;
  align-content: center;
}

.employee-pulse-summary span,
.employee-pulse-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.employee-pulse-summary strong {
  color: var(--accent);
  font-size: clamp(28px, 4vw, 46px);
  line-height: 0.96;
}

.employee-pulse-rank,
.employee-pulse-delta,
.employee-pulse-metric {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.employee-pulse-rank b {
  display: block;
  color: var(--amber);
  font-size: 28px;
}

.employee-pulse-rank small,
.employee-pulse-delta {
  color: var(--muted);
  font-size: 12px;
}

.employee-radar {
  min-height: 360px;
  display: grid;
  place-items: center;
}

.employee-radar svg {
  width: min(100%, 380px);
  height: auto;
}

.radar-ring {
  fill: rgba(255, 255, 255, 0.03);
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
}

.radar-axis {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
}

.radar-current {
  fill: rgba(205, 251, 47, 0.18);
  stroke: var(--accent);
  stroke-width: 3;
}

.radar-previous {
  fill: rgba(112, 122, 255, 0.11);
  stroke: #8d7cff;
  stroke-width: 2;
}

.radar-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.radar-legend {
  font-size: 11px;
  font-weight: 800;
}

.radar-legend.current {
  fill: var(--accent);
}

.radar-legend.previous {
  fill: #8d7cff;
}

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

.employee-pulse-metric {
  min-height: 92px;
}

.employee-pulse-metric strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.employee-pulse-metric small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.selected-row td {
  background: rgba(205, 251, 47, 0.08);
}

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

.crm-day {
  position: relative;
  min-height: 74px;
  overflow: hidden;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-soft);
}

.crm-day.has-items {
  border-color: rgba(15, 143, 107, 0.42);
  background: rgba(15, 143, 107, 0.09);
}

.crm-day span,
.crm-day strong,
.crm-day small {
  position: relative;
  z-index: 1;
  display: block;
}

.crm-day span {
  color: var(--muted);
  font-size: 12px;
}

.crm-day strong {
  margin-top: 3px;
  font-size: 19px;
}

.crm-day small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.crm-day em {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: var(--accent);
}

.crm-money-chart .bar-pair.single {
  justify-content: center;
}

.crm-money-chart .bar-pair.single .bar {
  width: 16px;
}

.crm-architecture {
  display: grid;
  gap: 8px;
}

.crm-architecture div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  font-weight: 800;
}

.crm-architecture span {
  color: var(--muted);
  text-align: center;
}

.field-map-list {
  display: grid;
  gap: 8px;
}

.field-map-item {
  display: grid;
  grid-template-columns: 145px minmax(150px, 1fr) minmax(170px, 0.9fr) 120px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-soft);
}

.field-map-item span,
.field-map-item em {
  color: var(--muted);
  font-size: 12px;
}

.field-map-item strong {
  font-size: 13px;
}

.field-map-item code {
  overflow-wrap: anywhere;
  color: var(--accent);
  font-family:
    "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
}

.auth-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
}

.auth-chip span,
.auth-chip small {
  display: block;
}

.auth-chip span {
  font-weight: 820;
}

.auth-chip small {
  color: var(--muted);
  font-size: 12px;
}

.auth-chip a {
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 780;
  text-decoration: none;
}

.auth-chip a:hover {
  background: var(--accent-soft);
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

[data-role-select] {
  min-height: 36px;
  min-width: 150px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
}

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 22% 18%, rgba(15, 143, 107, 0.16), transparent 30%),
    linear-gradient(180deg, #101613, #17211d);
  color: #edf5f1;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.login-card .brand-mark {
  margin-bottom: 20px;
}

.login-card h1 {
  font-size: 30px;
}

.login-card p {
  margin-top: 8px;
  color: rgba(237, 245, 241, 0.68);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: rgba(237, 245, 241, 0.78);
  font-size: 13px;
  font-weight: 760;
}

.login-form input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.login-form input:focus {
  outline: 2px solid rgba(15, 143, 107, 0.55);
  outline-offset: 2px;
}

.login-error {
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px solid rgba(196, 73, 73, 0.45);
  border-radius: 8px;
  background: rgba(196, 73, 73, 0.16);
  color: #ffd6d6;
  font-size: 13px;
  font-weight: 760;
}

.bitrix-settings-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(220px, 1fr) repeat(2, minmax(140px, 0.55fr));
  gap: 10px;
  margin-top: 14px;
}

.bitrix-settings-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
}

.bitrix-settings-grid input {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.bitrix-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.bitrix-actions .ghost-button,
.bitrix-actions .primary-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

.bitrix-status-line {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.bitrix-output {
  max-height: 360px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #101613;
  color: #dceee6;
  font-family:
    "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.pill.risk {
  background: var(--red-soft);
  color: var(--red);
}

@media (max-width: 860px) {
  .workspace {
    padding: 18px 16px 28px;
  }

  .sidebar {
    background: rgba(11, 13, 14, 0.96);
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  h1 {
    font-size: 30px;
  }

  .kpi-card::before {
    left: 12px;
    right: 12px;
  }

  .crm-filters,
  .crm-grid,
  .crm-kpi-grid,
  .employee-pulse-layout {
    grid-template-columns: 1fr;
  }

  .employee-pulse-metrics {
    grid-template-columns: 1fr;
  }

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

  .field-map-item {
    grid-template-columns: 1fr;
  }

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

  .auth-chip {
    width: 100%;
    justify-content: space-between;
  }
}

/* Mobile usability pass: keep the page fixed-width and move wide data inside panels. */
@media (max-width: 860px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    min-width: 0;
  }

  .app-shell,
  .app-shell.sidebar-collapsed {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
  }

  .sidebar,
  .app-shell.sidebar-collapsed .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    max-width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px 12px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand,
  .app-shell.sidebar-collapsed .brand {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  .brand div:not(.brand-mark),
  .app-shell.sidebar-collapsed .brand div:not(.brand-mark) {
    display: block;
    min-width: 0;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand span {
    font-size: 11px;
  }

  .sidebar-toggle {
    display: none;
  }

  .nav-list {
    display: flex;
    width: 100%;
    max-width: 100%;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item,
  .app-shell.sidebar-collapsed .nav-item {
    flex: 0 0 auto;
    justify-content: flex-start;
    min-width: 118px;
    width: auto;
    min-height: 42px;
    padding: 0 11px;
    scroll-snap-align: start;
    font-size: 12px;
    line-height: 1.12;
    white-space: normal;
  }

  .nav-item:hover {
    transform: none;
  }

  .sidebar-note {
    display: none;
  }

  .workspace,
  .app-shell.sidebar-collapsed .workspace {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 14px 12px 28px;
    overflow-x: hidden;
  }

  .topbar {
    align-items: stretch;
    margin-bottom: 12px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
    gap: 8px;
    justify-content: stretch;
  }

  .select-label {
    align-self: center;
  }

  .toolbar select,
  .toolbar .ghost-button,
  .toolbar .auth-chip {
    min-width: 0;
  }

  .toolbar .ghost-button,
  .toolbar .auth-chip {
    grid-column: 1 / -1;
    width: 100%;
  }

  .auth-chip {
    min-height: 46px;
  }

  .view-section,
  .crm-shell,
  .data-panel,
  .primary-panel,
  .chart-panel,
  .table-wrap,
  .crm-table-wrap {
    max-width: 100%;
    min-width: 0;
  }

  .primary-panel,
  .scenario-panel,
  .data-panel {
    padding: 14px;
  }

  .section-head,
  .panel-title {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
  }

  .panel-title .ghost-button {
    width: 100%;
  }

  h1 {
    font-size: 28px;
    line-height: 1.08;
  }

  h2 {
    font-size: 19px;
  }

  h3 {
    font-size: 14px;
  }

  .module-grid,
  .chart-row,
  .crm-grid,
  .employee-pulse-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kpi-grid,
  .crm-kpi-grid,
  .employee-pulse-metrics,
  .status-strip,
  .monthly-summary,
  .accountant-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-card,
  .crm-kpi {
    min-height: 104px;
    padding: 12px;
  }

  .kpi-card strong {
    margin-top: 12px;
    font-size: 22px;
  }

  .crm-header {
    gap: 14px;
  }

  .crm-filters {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .crm-refresh-panel {
    grid-template-columns: 1fr;
    padding: 8px;
  }

  .crm-filters select,
  .crm-refresh-indicator input,
  select,
  .search-input,
  .ghost-button,
  .primary-button {
    min-height: 44px;
    font-size: 15px;
  }

  .crm-tabs {
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .crm-tabs button {
    flex: 0 0 auto;
    min-height: 42px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .crm-table-wrap,
  .table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    width: max-content;
    min-width: 680px;
  }

  .crm-year-table,
  .monthly-table {
    min-width: 760px;
  }

  th,
  td {
    padding: 10px;
    font-size: 12px;
  }

  th {
    font-size: 11px;
  }

  .bar-chart {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 48px;
    justify-content: start;
    min-height: 210px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .month-bar {
    width: 48px;
    height: 190px;
  }

  .split-layout {
    grid-template-columns: 1fr;
    min-height: 0;
    justify-items: center;
  }

  .category-list {
    width: 100%;
  }

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

  .crm-day {
    min-height: 66px;
    padding: 8px;
  }

  .employee-pulse-panel {
    overflow: hidden;
  }

  .employee-pulse-layout {
    align-items: stretch;
  }

  .employee-pulse-summary strong {
    font-size: 30px;
    overflow-wrap: anywhere;
  }

  .employee-radar {
    min-height: 0;
    padding: 6px 0;
  }

  .employee-radar svg {
    width: min(100%, 320px);
  }

  .employee-pulse-metric {
    min-height: 86px;
  }

  .field-map-item,
  .entry-split,
  .monthly-toolbar,
  .monthly-ledgers,
  .payroll-period-bar,
  .payroll-period-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .workspace,
  .app-shell.sidebar-collapsed .workspace {
    padding: 12px 10px 24px;
  }

  .primary-panel,
  .scenario-panel,
  .data-panel,
  .chart-panel {
    border-radius: 7px;
  }

  .primary-panel,
  .scenario-panel,
  .data-panel {
    padding: 12px;
  }

  .nav-item,
  .app-shell.sidebar-collapsed .nav-item {
    min-width: 108px;
    padding: 0 10px;
    font-size: 11px;
  }

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

  .select-label {
    margin-bottom: -4px;
  }

  .crm-tabs button {
    padding: 0 10px;
    font-size: 13px;
  }

  .kpi-grid,
  .crm-kpi-grid,
  .employee-pulse-metrics,
  .status-strip,
  .monthly-summary,
  .accountant-summary {
    grid-template-columns: 1fr;
  }

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

  .employee-pulse-summary strong {
    font-size: 27px;
  }

  .employee-radar svg {
    width: min(100%, 290px);
  }

  table {
    min-width: 640px;
  }
}
