:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #172026;
  background: #f3f6f8;
  --ink: #172026;
  --muted: #697780;
  --line: #dce3e8;
  --panel: #ffffff;
  --soft: #f7fafb;
  --nav: #111820;
  --teal: #13777a;
  --blue: #2e6bb8;
  --amber: #b26a00;
  --red: #b94141;
  --green: #2f7d57;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f3f6f8;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  color: #f8fbfc;
  background: var(--nav);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #092528;
  background: #9fe3d5;
  font-weight: 900;
}

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

.brand small {
  margin-top: 2px;
  color: #94a5af;
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 4px;
  padding-top: 22px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #b7c5cc;
  font-size: 0.94rem;
  font-weight: 700;
}

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

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #9fe3d5;
}

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

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

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

h1 {
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.25;
}

.period-pill,
.status-chip,
.summary-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.period-pill {
  color: #29444b;
  background: #ffffff;
  border: 1px solid var(--line);
}

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

.kpi-card,
.chart-card,
.summary-card,
.work-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(22, 34, 43, 0.06);
}

.kpi-card {
  min-width: 0;
  padding: 18px;
}

.kpi-label,
.summary-label,
.task-list small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.kpi-value {
  display: block;
  margin-top: 10px;
  overflow-wrap: anywhere;
  font-size: 1.65rem;
  line-height: 1.1;
}

.positive {
  color: var(--green);
}

.kpi-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

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

.chart-card {
  min-width: 0;
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading.compact {
  align-items: center;
  margin-bottom: 14px;
}

.section-heading a {
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 900;
}

.status-chip.good {
  color: #1f6145;
  background: #e6f4ee;
}

.status-chip.neutral {
  color: #234e86;
  background: #e8f0fb;
}

.status-chip.warning {
  color: #7c4a00;
  background: #fff1d8;
}

.status-chip.danger {
  color: #8a2b2b;
  background: #fde8e8;
}

.chart-wrap {
  position: relative;
  min-height: 318px;
  margin-top: 20px;
  padding: 16px 6px 0 46px;
  border: 1px solid #e5ebef;
  border-radius: 8px;
  background:
    linear-gradient(#e9eef2 1px, transparent 1px) 0 24px / 100% 84px,
    var(--soft);
}

.chart-scale {
  position: absolute;
  left: 14px;
  top: 24px;
  bottom: 54px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #7a8990;
  font-size: 0.72rem;
  font-weight: 800;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(38px, 1fr));
  gap: 8px;
  height: 248px;
  align-items: end;
  overflow-x: auto;
  padding: 0 8px 4px 0;
}

.bar-column {
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  justify-items: center;
  gap: 7px;
  min-width: 38px;
  height: 100%;
}

.bar {
  width: 100%;
  max-width: 46px;
  min-height: 18px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #2e6bb8, #13777a);
}

.bar-column.current .bar {
  background: linear-gradient(180deg, #f2b950, #b26a00);
}

.bar-column strong {
  color: #405057;
  font-size: 0.82rem;
}

.bar-column small {
  color: #66747c;
  font-size: 0.76rem;
  font-weight: 800;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-box {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-box.profit {
  background: var(--blue);
}

.legend-box.current {
  background: var(--amber);
}

.summary-stack {
  display: grid;
  gap: 16px;
}

.summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  line-height: 1;
}

.summary-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.summary-badge.warning {
  color: #7c4a00;
  background: #fff1d8;
}

.summary-badge.neutral {
  color: #234e86;
  background: #e8f0fb;
}

.summary-badge.danger {
  color: #8a2b2b;
  background: #fde8e8;
}

.summary-badge:hover,
.summary-badge:focus-visible,
.section-heading a:hover,
.section-heading a:focus-visible {
  outline: 2px solid rgba(19, 119, 122, 0.28);
  outline-offset: 3px;
}

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

.work-card {
  min-width: 0;
  padding: 18px;
  scroll-margin-top: 24px;
}

.work-card:target {
  border-color: rgba(19, 119, 122, 0.6);
  box-shadow:
    0 0 0 3px rgba(19, 119, 122, 0.12),
    0 12px 30px rgba(22, 34, 43, 0.06);
}

.alert-card {
  border-color: #f0cccc;
}

.task-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-list li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 9px 0;
  border-top: 1px solid #edf1f4;
}

.task-list li:first-child {
  border-top: 0;
}

.task-list strong,
.task-list small {
  display: block;
  overflow-wrap: anywhere;
}

.task-list strong {
  font-size: 0.92rem;
}

.task-amount {
  color: #42515a;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.task-list li.is-selected {
  margin-inline: -8px;
  padding-inline: 8px;
  border-radius: 8px;
  background: #f3faf8;
}

.row-action {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #234e86;
  background: #e8f0fb;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.row-action.warning {
  color: #7c4a00;
  background: #fff1d8;
}

.row-action.neutral {
  color: #234e86;
  background: #e8f0fb;
}

.row-action.danger {
  color: #8a2b2b;
  background: #fde8e8;
}

.row-action:hover,
.row-action:focus-visible {
  outline: 2px solid rgba(19, 119, 122, 0.28);
  outline-offset: 3px;
}

.row-action:disabled {
  color: #51616a;
  background: #e7edf1;
  cursor: default;
}

.task-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.task-dot.warning {
  background: var(--amber);
}

.task-dot.neutral {
  background: var(--blue);
}

.task-dot.danger {
  background: var(--red);
}

.task-dot.muted {
  background: #9aa8af;
}

.action-panel,
.placeholder-section {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(22, 34, 43, 0.06);
}

.action-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  scroll-margin-top: 24px;
}

.action-panel.is-active {
  border-color: rgba(19, 119, 122, 0.6);
  box-shadow:
    0 0 0 3px rgba(19, 119, 122, 0.12),
    0 12px 30px rgba(22, 34, 43, 0.06);
}

.action-panel p,
.placeholder-section p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.account-section {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(22, 34, 43, 0.06);
}

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

.account-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid #e4eaef;
  border-radius: 8px;
  background: #f8fbfc;
}

.account-bank,
.account-meta {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.account-bank {
  margin-bottom: 6px;
  color: var(--teal);
  text-transform: uppercase;
}

.account-card h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.account-card strong {
  overflow-wrap: anywhere;
  font-size: 1.7rem;
  line-height: 1.05;
}

.account-total {
  color: #ffffff;
  background: linear-gradient(135deg, #13777a, #184f83);
}

.account-total .account-bank,
.account-total .account-meta {
  color: rgba(255, 255, 255, 0.78);
}

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

.module-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 950;
}

.module-button span {
  flex: 0 0 auto;
  font-size: 1.2rem;
}

.module-button.warning {
  color: #7c4a00;
  background: #fff1d8;
}

.module-button.neutral {
  color: #234e86;
  background: #e8f0fb;
}

.module-button.danger {
  color: #8a2b2b;
  background: #fde8e8;
}

.module-button.good {
  color: #1f6145;
  background: #e6f4ee;
}

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

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

.panel.wide {
  padding: 20px;
}

.panel-copy {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  font-weight: 650;
}

button,
.primary-action {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
}

button:hover,
button:focus-visible,
.primary-action:hover,
.primary-action:focus-visible {
  outline: 2px solid rgba(19, 119, 122, 0.24);
  outline-offset: 2px;
}

.primary-action {
  color: #ffffff;
  border-color: #13777a;
  background: #13777a;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.toolbar input {
  flex: 1 1 300px;
  min-height: 38px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.toolbar label,
.supplier-card label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.toolbar label input,
.supplier-card input,
.supplier-card select {
  min-height: 38px;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font: inherit;
  font-weight: 800;
}

.split-view {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.detail-panel {
  position: static;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(22, 34, 43, 0.06);
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf1f4;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.detail-list dd {
  margin: 0;
  text-align: right;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid #edf1f4;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

td {
  font-size: 0.9rem;
  font-weight: 700;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.match-grid,
.rule-grid,
.close-grid,
.export-grid,
.settings-grid,
.supplier-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.supplier-card {
  display: grid;
  gap: 14px;
}

.provider-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.provider-tab.active {
  color: #ffffff;
  border-color: #13777a;
  background: #13777a;
}

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

.payment-item {
  border: 1px solid #e3eaf0;
  border-radius: 8px;
  background: #ffffff;
}

.payment-item summary {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  cursor: pointer;
}

.payment-item summary strong,
.payment-item summary small {
  display: block;
  overflow-wrap: anywhere;
}

.payment-item summary small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.payment-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 14px 14px;
}

.payment-detail > div {
  min-width: 0;
  padding: 12px;
  border-radius: 8px;
  background: #f8fbfc;
}

.payment-detail span,
.payment-detail small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.payment-detail strong {
  display: block;
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.match-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(22, 34, 43, 0.06);
}

.meter {
  display: block;
  height: 9px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef2;
}

.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #13777a, #2e6bb8);
}

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

.match-columns > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid #e4eaef;
  border-radius: 8px;
  background: #f8fbfc;
}

.match-columns span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.match-columns strong,
.match-columns small {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 44px));
  padding: 14px 16px;
  border-radius: 8px;
  color: #ffffff;
  background: #172026;
  box-shadow: 0 18px 50px rgba(23, 32, 38, 0.22);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  font-weight: 850;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .content-grid,
  .review-grid,
  .account-grid,
  .split-view,
  .match-grid,
  .rule-grid,
  .close-grid,
  .export-grid,
  .settings-grid,
  .supplier-grid,
  .payment-detail {
    grid-template-columns: 1fr;
  }

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

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .brand {
    padding-bottom: 14px;
  }

  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    padding-top: 14px;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .section-heading {
    flex-direction: column;
  }

  .kpi-grid,
  .summary-stack,
  .action-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 1.55rem;
  }

  .kpi-value,
  .summary-card strong {
    font-size: 1.45rem;
  }

  .chart-wrap {
    padding-left: 38px;
  }

  .task-list li {
    grid-template-columns: 12px minmax(0, 1fr);
  }

  .task-amount,
  .row-action {
    grid-column: 2;
  }

  .payment-item summary {
    grid-template-columns: 1fr;
  }
}
