:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  color: #15324c;
  background: #eef7fa;
  --blue: #00a3d9;
  --blue-dark: #173d68;
  --blue-soft: #dff6fc;
  --red: #d83a55;
  --yellow: #dff6fc;
  --green: #23865a;
  --border: #bdd5df;
  --muted: #5c7282;
  --surface: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #eef7fa;
}

button,
input,
select {
  font: inherit;
}

button,
label.file-button {
  cursor: pointer;
}

.app-header {
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 10px clamp(16px, 3vw, 42px);
  color: white;
  background: var(--blue);
  border-bottom: 5px solid var(--blue-dark);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand strong,
.brand span {
  display: block;
  letter-spacing: 0;
}

.brand-lockup {
  position: relative;
  min-width: 104px;
  padding-top: 13px;
  flex: 0 0 auto;
}

.hvem-ka {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 4px;
  padding: 1px 8px 2px;
  color: white;
  background: var(--blue-dark);
  border: 2px solid white;
  font-size: 11px;
  font-style: italic;
  font-weight: 950;
  line-height: 1;
  transform: rotate(-5deg) skew(-8deg);
}

.brand .bilka-word {
  color: white;
  font-size: 34px;
  font-weight: 900;
  line-height: 0.88;
}

.brand-copy strong {
  font-size: 18px;
}

.brand-copy > span {
  margin-top: 1px;
  color: #e4f8ff;
  font-size: 12px;
}

.period-control {
  display: grid;
  grid-template-columns: 36px minmax(190px, 260px) 36px;
  align-items: stretch;
  border: 1px solid rgba(255, 255, 255, 0.46);
  background: var(--blue-dark);
}

.icon-button,
.period-button {
  border: 0;
  color: white;
  background: transparent;
}

.icon-button {
  font-size: 28px;
  line-height: 1;
}

.icon-button:hover,
.period-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.period-button {
  min-width: 0;
  padding: 7px 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.period-button span,
.period-button small {
  display: block;
  letter-spacing: 0;
}

.period-button span {
  overflow: hidden;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-button small {
  margin-top: 2px;
  color: #d9ebfa;
  font-size: 10px;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.secondary-button,
.primary-button,
.danger-button {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: 700;
}

.secondary-button {
  color: white;
  border-color: rgba(255, 255, 255, 0.55);
  background: transparent;
}

.secondary-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.primary-button {
  color: white;
  background: var(--blue);
}

.primary-button:hover {
  background: var(--blue-dark);
}

.danger-button {
  color: white;
  background: var(--red);
}

.file-button {
  display: inline-flex;
  align-items: center;
}

.file-button input {
  display: none;
}

.tabs {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0 clamp(16px, 3vw, 42px);
  background: #fff;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}

.tab {
  min-height: 48px;
  padding: 0 18px;
  flex: 0 0 auto;
  border: 0;
  border-bottom: 4px solid transparent;
  color: #43586a;
  background: transparent;
  font-weight: 750;
}

.tab:hover {
  color: var(--blue);
  background: #f4f8fb;
}

.tab.active {
  color: var(--blue-dark);
  border-bottom-color: var(--blue);
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 42px) 48px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.page-heading h1 {
  margin: 0;
  color: var(--blue-dark);
  font-size: clamp(23px, 3vw, 32px);
  line-height: 1.1;
  letter-spacing: 0;
}

.page-heading p {
  margin: 5px 0 0;
  color: var(--muted);
}

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

.kpi {
  min-width: 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 5px solid var(--blue);
}

.kpi.primary {
  color: white;
  border-top-color: var(--blue-dark);
  background: var(--blue);
}

.kpi-label,
.kpi-value,
.kpi-note {
  display: block;
  letter-spacing: 0;
}

.kpi-label {
  color: #526879;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi.primary .kpi-label {
  color: white;
}

.kpi.primary .kpi-note {
  color: #e4f8ff;
}

.kpi-value {
  overflow-wrap: anywhere;
  margin-top: 7px;
  font-size: clamp(20px, 2.4vw, 29px);
  font-weight: 850;
  line-height: 1.05;
}

.kpi-note {
  min-height: 17px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(310px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
  align-items: start;
}

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

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
}

.panel-heading {
  min-height: 43px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  color: white;
  background: var(--blue);
}

.panel-heading.red {
  background: var(--red);
}

.panel-heading.navy {
  background: var(--blue-dark);
}

.panel-heading.green {
  background: var(--green);
}

.panel-heading h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.panel-heading small {
  color: rgba(255, 255, 255, 0.82);
}

.panel-body {
  padding: 14px;
}

.metric-list {
  margin: 0;
}

.metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 32px;
  padding: 5px 0;
  border-bottom: 1px solid #e8eef3;
}

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

.metric-row dt,
.metric-row dd {
  margin: 0;
}

.metric-row dd {
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  text-align: right;
}

.metric-row.negative dd {
  color: #b00016;
}

.metric-row.total {
  margin: 5px -14px -14px;
  padding: 11px 14px;
  color: #172a3a;
  background: var(--blue-soft);
  border: 0;
  font-weight: 850;
}

.goal-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) repeat(2, minmax(95px, 0.8fr));
  gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field > span {
  color: #526879;
  font-size: 12px;
  font-weight: 750;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 7px 9px;
  border: 1px solid #9eb2c2;
  border-radius: 3px;
  color: #172a3a;
  background: white;
}

.field input:focus,
.field select:focus,
.table-input:focus {
  outline: 3px solid rgba(0, 87, 168, 0.18);
  border-color: var(--blue);
}

.output-box {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid #acd5bb;
  background: #e8f6ed;
  font-weight: 800;
}

.chart-wrap {
  min-height: 335px;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(160px, 220px);
  gap: 18px;
  align-items: center;
  padding: 18px;
}

#pay-chart {
  width: 100%;
  height: auto;
  max-height: 300px;
}

.chart-legend {
  display: grid;
  gap: 11px;
}

.legend-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  margin-top: 3px;
}

.legend-item strong,
.legend-item span {
  display: block;
  letter-spacing: 0;
}

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

.legend-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.table-shell {
  overflow: hidden;
  background: white;
  border: 1px solid var(--border);
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  height: 38px;
  padding: 6px 9px;
  border-right: 1px solid #d8e2ea;
  border-bottom: 1px solid #d8e2ea;
  text-align: right;
  white-space: nowrap;
}

th:last-child,
td:last-child {
  border-right: 0;
}

thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  color: white;
  background: var(--blue-dark);
  font-size: 12px;
  line-height: 1.25;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

tbody tr:nth-child(odd) {
  background: #e3f5fa;
}

tbody tr:hover {
  background: #cceef7;
}

tfoot td {
  color: #172a3a;
  background: #cceef7;
  font-weight: 850;
}

.date-cell {
  min-width: 122px;
}

.date-main {
  display: block;
  font-weight: 700;
}

.holiday-badge {
  display: block;
  width: fit-content;
  margin-top: 2px;
  padding: 1px 5px;
  color: white;
  background: var(--blue-dark);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 750;
}

.table-input {
  width: 100%;
  min-width: 76px;
  height: 29px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: inherit;
  background: rgba(255, 255, 255, 0.8);
}

.time-input {
  width: 132px;
}

.pause-input {
  width: 82px;
  text-align: right;
}

.money-cell {
  font-weight: 800;
}

.invalid-input {
  border-color: var(--red);
  background: #fff0f2;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.table-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.payments-table th:first-child,
.payments-table td:first-child {
  min-width: 125px;
}

.payments-table th:nth-child(2),
.payments-table td:nth-child(2) {
  min-width: 170px;
}

.payments-table .payment-mode {
  min-width: 112px;
}

.payments-overview {
  display: grid;
  grid-template-columns: minmax(280px, 1.25fr) repeat(2, minmax(210px, 0.75fr));
  gap: 12px;
  margin-bottom: 18px;
}

.payment-balance,
.payment-stat {
  min-width: 0;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  box-shadow: 0 7px 20px rgba(23, 61, 104, 0.08);
}

.payment-balance {
  color: white;
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.payment-balance span,
.payment-stat span {
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.payment-balance strong,
.payment-stat strong {
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: clamp(23px, 3vw, 32px);
  line-height: 1;
}

.payment-balance small,
.payment-stat small {
  margin-top: 8px;
  color: #dff6fc;
}

.payment-stat {
  border-top: 5px solid var(--blue);
}

.payment-stat span,
.payment-stat small {
  color: var(--muted);
}

.payments-shell {
  border-radius: 6px;
  box-shadow: 0 7px 22px rgba(23, 61, 104, 0.08);
}

.payments-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 11px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.payments-list-heading h2,
.payments-list-heading span {
  display: block;
  margin: 0;
  letter-spacing: 0;
}

.payments-list-heading h2 {
  color: var(--blue-dark);
  font-size: 16px;
}

.payments-list-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.payments-table tbody tr {
  background: white;
}

.payments-table tbody tr:nth-child(odd) {
  background: #f3fafc;
}

.payments-table .payment-row td:first-child {
  border-left: 4px solid var(--blue);
}

.payments-table .payment-row.status-paid td:first-child {
  border-left-color: var(--green);
}

.payments-table .payment-row.status-skipped {
  opacity: 0.64;
}

.payments-table .table-input {
  border-color: transparent;
  background: transparent;
}

.payments-table .table-input:hover,
.payments-table .table-input:focus {
  border-color: var(--border);
  background: white;
}

.payments-table th:last-child,
.payments-table td:last-child {
  width: 48px;
  text-align: center;
}

.remove-row {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  color: #9e0013;
  background: transparent;
  font-size: 22px;
  line-height: 1;
}

.remove-row:hover {
  background: #ffe5e8;
}

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

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

.toggle-row {
  min-height: 49px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid #e8eef3;
}

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

.toggle-row strong,
.toggle-row small {
  display: block;
  letter-spacing: 0;
}

.toggle-row small {
  margin-top: 3px;
  color: var(--muted);
}

.switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: #9aabb8;
  transition: background 150ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: white;
  transition: transform 150ms ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(22px);
}

.rates-table input {
  width: 92px;
  text-align: right;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.empty-state {
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 28, 42, 0.72);
  backdrop-filter: blur(2px);
}

.payment-modal {
  position: relative;
  width: min(850px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  color: #15324c;
  background: white;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(4, 21, 35, 0.36);
}

.modal-close {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 18px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  color: var(--blue-dark);
  background: transparent;
  font-size: 32px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

.modal-content {
  padding: 28px 42px 20px;
}

.modal-step {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.payment-modal h2 {
  margin: 0;
  padding-right: 42px;
  color: var(--blue-dark);
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.15;
  letter-spacing: 0;
}

.modal-intro {
  max-width: 590px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.payment-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
  padding: 5px;
  background: #e8f3f7;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.payment-mode-switch button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--blue-dark);
  background: transparent;
  font-weight: 800;
}

.payment-mode-switch button:hover {
  background: white;
}

.payment-mode-switch button.selected {
  color: white;
  background: var(--blue-dark);
  box-shadow: 0 4px 12px rgba(23, 61, 104, 0.2);
}

.payment-mode-switch span {
  display: grid;
  min-width: 32px;
  height: 28px;
  place-items: center;
  color: inherit;
  border: 2px solid currentColor;
  border-radius: 2px;
  font-size: 12px;
}

.modal-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 30px;
}

.modal-choice {
  min-height: 245px;
  display: grid;
  grid-template-rows: 1fr auto auto;
  justify-items: center;
  gap: 9px;
  padding: 24px;
  border: 3px solid transparent;
  border-radius: 7px;
  color: #15324c;
  background: #eef8fb;
  box-shadow: 0 9px 24px rgba(23, 61, 104, 0.12);
  text-align: center;
}

.modal-choice:hover {
  border-color: #8ed8ed;
  transform: translateY(-2px);
}

.modal-choice.selected {
  color: white;
  border-color: var(--blue-dark);
  background: var(--blue);
  box-shadow: 0 12px 28px rgba(0, 163, 217, 0.28);
}

.choice-symbol {
  width: 128px;
  height: 104px;
  display: grid;
  place-items: center;
  align-self: center;
  color: white;
  background: var(--blue-dark);
  border: 6px solid white;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(23, 61, 104, 0.2);
  font-size: 34px;
  font-weight: 950;
}

.modal-choice strong {
  font-size: 21px;
}

.modal-choice small {
  max-width: 250px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.modal-choice.selected small {
  color: #e4f8ff;
}

.modal-footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 14px 42px;
  background: #f3f8fa;
  border-top: 1px solid var(--border);
}

.modal-footer-right {
  display: flex;
  gap: 10px;
}

.modal-text-button,
.secondary-modal-button {
  min-height: 38px;
  padding: 8px 13px;
  border: 0;
  color: var(--blue-dark);
  background: transparent;
  font-weight: 800;
}

.modal-text-button:hover,
.secondary-modal-button:hover {
  background: var(--blue-soft);
}

.secondary-modal-button {
  border: 1px solid var(--border);
  background: white;
}

.modal-next {
  min-width: 105px;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

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

.modal-form-grid .field input,
.modal-form-grid .field select {
  height: 40px;
}

.category-field {
  align-content: start;
}

.category-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 7px;
}

.category-add-button {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  color: white;
  background: var(--blue);
  font-size: 25px;
  font-weight: 500;
  line-height: 1;
}

.category-add-button:hover {
  background: var(--blue-dark);
}

.category-manager {
  position: relative;
  z-index: 2;
  grid-column: 1 / -1;
  margin-top: 3px;
  padding: 11px;
  background: #f2f9fb;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(23, 61, 104, 0.12);
}

.category-create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
}

.category-create-row input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 7px 9px;
  border: 1px solid #9eb2c2;
  border-radius: 3px;
}

.category-create-row button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  color: white;
  background: var(--blue-dark);
  font-size: 22px;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.category-chip {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 5px 4px 9px;
  color: var(--blue-dark);
  background: white;
  border: 1px solid #9fcbd9;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 750;
}

.category-chip.protected {
  padding-right: 9px;
  color: var(--muted);
  background: #e8f1f4;
  border-color: #d1e0e6;
}

.category-chip button {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: white;
  background: var(--red);
  font-size: 15px;
  line-height: 1;
}

.category-manager > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

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

.payment-preview {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 14px 16px;
  color: white;
  background: var(--blue-dark);
}

.payment-preview span {
  font-size: 13px;
}

.payment-preview strong {
  font-size: 22px;
  text-align: right;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 18px;
  bottom: 18px;
  max-width: min(380px, calc(100vw - 36px));
  padding: 11px 14px;
  border-radius: 4px;
  color: white;
  background: #163247;
  box-shadow: 0 8px 28px rgba(10, 31, 48, 0.24);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app-header {
    grid-template-columns: 1fr auto;
  }

  .period-control {
    grid-column: 1 / -1;
    grid-row: 2;
    width: min(100%, 420px);
    margin: 0 auto;
  }

  .header-actions {
    grid-column: 2;
    grid-row: 1;
  }

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

  .chart-wrap {
    min-height: 300px;
  }

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

  .payment-balance {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .app-header {
    gap: 12px;
    padding: 9px 12px;
  }

  .brand-copy > span {
    display: none;
  }

  .header-actions .secondary-button {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .tabs {
    padding: 0 8px;
  }

  .tab {
    min-height: 44px;
    padding: 0 12px;
    font-size: 13px;
  }

  main {
    padding: 16px 10px 38px;
  }

  .page-heading {
    align-items: start;
    flex-direction: column;
  }

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

  .payments-overview {
    grid-template-columns: 1fr;
  }

  .payment-balance {
    grid-column: auto;
  }

  .kpi {
    padding: 13px;
  }

  .goal-grid,
  .two-column,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  #pay-chart {
    max-height: 250px;
  }

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

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .payment-modal {
    width: 100%;
    max-height: 94vh;
    border-radius: 8px 8px 0 0;
  }

  .modal-content {
    padding: 32px 18px 24px;
  }

  .modal-choice-grid,
  .modal-form-grid {
    grid-template-columns: 1fr;
  }

  .payment-mode-switch {
    grid-template-columns: 1fr;
  }

  .modal-choice-grid {
    gap: 12px;
    margin-top: 22px;
  }

  .modal-choice {
    min-height: 150px;
    grid-template-columns: 94px 1fr;
    grid-template-rows: auto auto;
    justify-items: start;
    align-items: center;
    padding: 16px;
    text-align: left;
  }

  .choice-symbol {
    width: 78px;
    height: 72px;
    grid-row: 1 / 3;
    font-size: 22px;
  }

  .modal-choice small {
    text-align: left;
  }

  .modal-wide {
    grid-column: auto;
  }

  .modal-footer {
    padding: 12px 18px;
  }
}

@media (max-width: 440px) {
  .brand-lockup {
    min-width: 78px;
    padding-top: 11px;
  }

  .brand .bilka-word {
    font-size: 27px;
  }

  .hvem-ka {
    left: 2px;
    font-size: 9px;
    padding: 1px 6px;
  }

  .brand-copy {
    display: none;
  }

  .header-actions {
    gap: 4px;
  }

  .period-control {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
  }

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

  .chart-legend {
    grid-template-columns: 1fr;
  }

  .modal-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .modal-footer-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .modal-footer > button,
  .modal-footer-right button {
    width: 100%;
  }
}
