:root {
  color-scheme: light;
  --bg: #f3f7f5;
  --panel: #ffffff;
  --panel-muted: #e9f2ee;
  --text: #16241f;
  --muted: #5e6d67;
  --line: #d9e4df;
  --accent: #0f6b58;
  --accent-dark: #0a5044;
  --positive: #12805c;
  --negative: #c0392b;
  --danger: #c0392b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

a {
  color: inherit;
}

/* Login */

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

.login-card {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  display: grid;
  gap: 16px;
  text-align: center;
}

.login-hint {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}

.brand div {
  display: grid;
  line-height: 1.2;
}

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

.login-card .brand {
  justify-content: center;
}

/* Shell */

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

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

.nav-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-weight: 650;
  padding: 0 12px;
}

.nav-button.active,
.nav-button:hover {
  border-color: var(--line);
  background: var(--panel-muted);
}

.nav-button.active {
  color: var(--accent-dark);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sidebar-footer span {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.content {
  padding: 32px 40px;
}

/* Detail projektu ako samostatna stranka (vlastna zalozka) - plna sirka,
   nie stiesneny modal. */
.project-page {
  min-height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 40px 64px;
}

.project-page-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.project-page-header h1 {
  margin: 0;
  font-size: 28px;
}

.project-page-header .back-to-app {
  align-self: flex-start;
  text-decoration: none;
}

@media (max-width: 860px) {
  .project-page {
    padding: 20px 16px 48px;
  }
}

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

.content-header h2 {
  margin: 2px 0 0;
}

.content-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.duplicate-warning {
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid rgba(196, 130, 15, 0.35);
  border-radius: 10px;
  background: rgba(196, 130, 15, 0.08);
}

.duplicate-warning p {
  margin: 0 0 10px;
  font-size: 13px;
}

.duplicate-warning table {
  background: transparent;
}

.content-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

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

/* Summary cards */

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

.summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 6px;
}

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

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

.summary-card.emphasized {
  background: var(--panel-muted);
  border-color: var(--accent);
}

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

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

.unpaid {
  color: #b3540a;
  font-weight: 700;
}

/* Sections */

.section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-header h3 {
  margin: 0;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.section-amount {
  margin-left: auto;
  font-weight: 700;
  font-size: 15px;
}

.section-header .button {
  margin-left: auto;
}

/* Collapsible grouped sections */

.collapsible summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  cursor: pointer;
  list-style: none;
}

.collapsible summary::-webkit-details-marker {
  display: none;
}

.collapsible summary h3 {
  margin: 0;
}

.collapsible summary::before {
  content: "▸";
  color: var(--muted);
  transition: transform 0.15s ease;
}

.collapsible[open] summary::before {
  transform: rotate(90deg);
}

.group-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.tab-button.active {
  border-color: var(--accent);
  background: var(--panel-muted);
  color: var(--accent-dark);
}

.group-row {
  cursor: pointer;
}

.group-row:hover {
  background: var(--panel-muted);
}

.disclosure {
  display: inline-block;
  width: 14px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.group-row.open .disclosure {
  transform: rotate(90deg);
}

.group-detail-row td {
  padding: 0 0 12px 30px;
  border-bottom: 1px solid var(--line);
}

.group-detail-table {
  width: 100%;
  font-size: 12px;
}

.group-detail-table th,
.group-detail-table td {
  padding: 6px 10px;
}

/* Projects */

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

.project-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  transition: border-color 0.15s ease;
}

.project-card:hover {
  border-color: var(--accent);
}

.project-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.project-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.project-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.project-card dl div {
  display: grid;
  gap: 2px;
}

.project-card dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.project-card dd {
  margin: 0;
  font-weight: 700;
  font-size: 13px;
}

.project-card footer {
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

/* Payback banner */

.payback-banner {
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 20px;
}

.payback-banner.reached {
  background: rgba(18, 128, 92, 0.1);
  border-color: var(--positive);
}

/* Charts */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.chart-box h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 30px 0;
  text-align: center;
}

/* Table */

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}

.data-table thead th {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
}

.data-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid var(--line);
}

/* Bank import */

.import-upload {
  margin-bottom: 20px;
}

.import-upload input[type="file"] {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 16px;
  width: 100%;
  background: var(--panel);
}

.import-summary {
  margin-bottom: 16px;
}

.import-summary p {
  margin: 0 0 6px;
}

#importPreview h4 {
  margin: 20px 0 10px;
}

.import-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.import-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.import-group-header span:nth-child(2) {
  color: var(--muted);
  font-size: 13px;
}

.import-group-header span:last-child {
  margin-left: auto;
  font-weight: 700;
}

#commitImportBtn {
  margin-top: 16px;
}

/* Transaction detail + split */

.tx-row {
  cursor: pointer;
}

.tx-row:hover {
  background: var(--panel-muted);
}

.tx-detail-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* Popis / aktualny stav na vrchu detailu projektu. */
.project-note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.project-note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.project-note-head h3 {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.project-note-body {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Prilohy transakcie (PDF) v detail modale. */
.attachments-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.attachments-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}
.attachment-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 6px;
}
.attachment-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.attachment-list li a {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-size {
  color: var(--muted);
  font-size: 12px;
}
.attachment-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Splatky pozicky - podriadene riadky pod pozickou v tabulke Pozicky. */
.loans-table .loan-row td {
  font-weight: 600;
}
.loans-table .repayment-row td,
.loans-table .repayment-add-row td {
  border-top: none;
  padding-top: 4px;
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}
.loans-table .repayment-row {
  cursor: default;
  background: var(--panel-muted);
}
.loans-table .repayment-add-row {
  background: var(--panel-muted);
}
.loans-table .repayment-add-row .link-button {
  font-size: 13px;
}

.split-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.split-row {
  display: grid;
  grid-template-columns: 110px 1fr 1fr 1fr 32px;
  gap: 8px;
  margin-bottom: 8px;
}

.split-row input,
.split-row select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
}

.split-total {
  font-weight: 700;
  margin: 10px 0;
}

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.pill.positive {
  background: rgba(18, 128, 92, 0.12);
  color: var(--positive);
}

.pill.negative {
  background: rgba(192, 57, 43, 0.12);
  color: var(--negative);
}

.pill.warning {
  background: rgba(196, 130, 15, 0.14);
  color: #a5680c;
}

/* Buttons */

.button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

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

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

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

.button.danger {
  border-color: #f0b8b2;
  color: var(--danger);
}

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

.link-button {
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin-left: 6px;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--accent-dark);
}

.icon-button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.icon-button:hover {
  background: rgba(192, 57, 43, 0.1);
  color: var(--danger);
}

.danger-zone {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 40, 0.5);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}

.modal {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--panel);
  border-radius: 14px;
  border: 1px solid var(--line);
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal header h3 {
  margin: 0;
}

.modal-body {
  padding: 22px;
}

.modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  background: var(--panel);
}

/* Forms */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-weight: 700;
  font-size: 13px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.field-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.field-checkbox input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.span-2 {
  grid-column: span 2;
}

/* Misc */

.empty,
.empty-inline {
  color: var(--muted);
  font-size: 14px;
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 60;
}

.toast.error {
  background: var(--negative);
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .sidebar-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }
  .content {
    padding: 20px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: span 1;
  }
}

/* Vitality Park - drobne doplnky nad zdielanym zakladom */

.project-card header h3 {
  margin: 0;
  font-size: 16px;
}

.project-card footer {
  font-weight: 600;
  color: var(--text);
}



/* Tlacidla vo formularovej mriezke nemaju plnit celu sirku bunky. */
.field > .button {
  justify-self: start;
}

/* Priamo editovatelna tabulka zaznamov - kazda bunka je input, posledny riadok
   je prazdny na pridanie dalsieho. Ziadny samostatny formular pod tabulkou. */

/* Pevne rozlozenie stlpcov - pri automatickom si dlhsi obsah (napr. "Bez uhrady")
   ukradol sirku susedovi a stlpec Uhrada sa scvrkol. Pri uzkom okne radsej
   vodorovny scroll v .table-wrap nez rozdrvene stlpce. */
.data-table.editable {
  table-layout: fixed;
  min-width: 760px;
}

.data-table.editable td {
  padding: 4px 8px;
  vertical-align: middle;
}

.data-table.editable input[type="text"],
.data-table.editable input[type="number"] {
  width: 100%;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
}

.data-table.editable input[type="text"]:hover,
.data-table.editable input[type="number"]:hover {
  border-color: var(--line);
}

.data-table.editable input[type="text"]:focus,
.data-table.editable input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
}

.data-table.editable input:disabled {
  color: var(--muted);
}

.data-table.editable .col-name {
  width: 20%;
}
.data-table.editable .col-hours {
  width: 110px;
}
.data-table.editable .col-amount {
  width: 110px;
}
.data-table.editable .col-payment {
  width: 130px;
}

.data-table.editable .col-place {
  width: 110px;
}

.data-table.editable select {
  width: 100%;
  min-height: 34px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
}

.data-table.editable select:hover {
  border-color: var(--line);
}

.data-table.editable select:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
}
.data-table.editable .col-actions {
  width: 44px;
}

.data-table.editable tr.new-row input::placeholder {
  color: var(--muted);
}

/* Kratky zablesk po automatickom ulozeni riadku. */
.data-table.editable tr.saved td {
  background: rgba(15, 107, 88, 0.08);
  transition: background 0.4s ease;
}

.total-row td {
  background: var(--panel-muted);
  font-weight: 700;
  border-top: 1px solid var(--line);
  /* Sucty su dlhsie nez samotne bunky - v tomto riadku sa smu zalomit,
     inak by pretiekli do susedneho stlpca (zvysok tabulky ostava nowrap). */
  white-space: normal;
  font-size: 12px;
  line-height: 1.35;
}

.month-totals {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}


.section > h3 {
  margin: 0 0 12px;
}

/* Zalozenie mesiaca je jeden riadok - kapacita aj poznamka sa vyplnaju az v mesiaci. */
.new-month {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.new-month input {
  min-height: 38px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

/* Zoznam mesiacov je tabulka - cely riadok otvara mesiac. */
.data-table.rows-clickable tbody tr {
  cursor: pointer;
}

.data-table.rows-clickable tbody tr:hover td,
.data-table.rows-clickable tbody tr:focus-visible td {
  background: var(--panel-muted);
}

.data-table.rows-clickable tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.data-table .col-name {
  width: 22%;
}
.data-table .col-hours,
.data-table .col-amount {
  width: 130px;
}


/* ---------------------------------------------------------------------------
   Mobil. Tabulka so 7 stlpcami sa na telefone neda pouzivat ani so scrollom -
   pod 760px sa preto kazdy riadok zbali do karty: bunky pod sebou, popis
   stlpca sa berie z atributu data-label. Ziadne duplicitne markup vetvy,
   rovnake HTML len inak naskladane.
   --------------------------------------------------------------------------- */

/* Zlom je nad sirkou tabulky (760px) + bocny panel + odsadenia - pod nim by sa
   uz tabulka vodorovne posuvala, tak radsej karty. Tablet aj uzsie okno
   notebooku teda dostanu rovnake pohodlne zobrazenie ako telefon. */
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  /* Bocny panel sa zmeni na kompaktnu hlavicku. */
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 10px 14px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .sidebar .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .sidebar .brand span {
    display: none;
  }

  .sidebar .nav {
    grid-auto-flow: column;
    gap: 6px;
    margin-left: auto;
  }

  .sidebar .nav-button {
    min-height: 36px;
    padding: 0 10px;
    font-size: 14px;
  }

  .sidebar-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
  }

  .sidebar-footer strong,
  .sidebar-footer span {
    font-size: 12px;
    margin-bottom: 0;
  }

  .sidebar-footer strong {
    margin-right: auto;
  }

  .sidebar-footer span {
    display: none;
  }

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

  .content {
    padding: 20px 14px 60px;
  }

  .content-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .content-header-actions {
    flex-wrap: wrap;
  }

  .content-header-actions .button {
    flex: 1;
    justify-content: center;
  }

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

  .span-2 {
    grid-column: auto;
  }

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

  /* --- Tabulky ako karty --- */

  .table-wrap {
    border: none;
    background: transparent;
    overflow-x: visible;
  }

  .data-table {
    display: block;
    min-width: 0;
    font-size: 14px;
  }

  .data-table.editable {
    table-layout: auto;
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody {
    display: block;
  }

  .data-table tbody tr {
    display: block;
    margin-bottom: 10px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
  }

  .data-table tbody tr:not(:last-child) td {
    border-bottom: none;
  }

  .data-table tbody td {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    white-space: normal;
    text-align: left;
  }

  .data-table tbody td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 88px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  /* Editovatelna karta: popis NAD polom a kratke polia po dvojiciach vedla seba,
     inak by mal jeden zaznam sest riadkov a listovalo by sa donekonecna. */
  .data-table.editable tbody tr {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
  }

  .data-table.editable tbody td {
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 0;
  }

  .data-table.editable tbody td[data-label]::before {
    flex: none;
  }

  .data-table.editable tbody td[data-label="Hodín"],
  .data-table.editable tbody td[data-label="Miesto"],
  .data-table.editable tbody td[data-label="Suma (€)"],
  .data-table.editable tbody td[data-label="Úhrada"] {
    flex: 1 1 calc(50% - 5px);
  }

  /* Bez toho sa select vo flex bunke zbali na par pixelov. */
  .data-table.editable tbody td > input,
  .data-table.editable tbody td > select {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }

  /* Prazdna bunka (napr. dopocitany zvysok suctoveho riadku) len zaberala miesto. */
  .data-table tbody td:not([data-label]):empty {
    display: none;
  }

  /* Bunka "Spolu" je nadpis karty so suctami, nie dalsie pole. */
  .data-table.editable tbody tr.total-row td:first-child {
    flex: 1 1 100%;
    font-size: 14px;
  }

  /* Vstupy musia byt dost velke na prst a viditelne ako polia. */
  .data-table.editable input[type="text"],
  .data-table.editable input[type="number"],
  .data-table.editable select {
    min-height: 44px;
    border-color: var(--line);
    background: #ffffff;
    font-size: 16px; /* pod 16px iOS pri fokuse zoomuje stranku */
  }

  .data-table.editable .col-actions {
    flex-direction: row;
    justify-content: flex-end;
  }

  .data-table.editable .col-actions .icon-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
  }

  /* Prazdny riadok na pridanie je vizualne odlisena "karta noveho zaznamu". */
  .data-table.editable tr.new-row {
    border-style: dashed;
    border-color: var(--accent);
    background: var(--panel-muted);
  }

  .data-table.editable tr.new-row::before {
    content: "Nový záznam";
    display: block;
    margin-bottom: 4px;
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .total-row td {
    background: transparent;
    font-size: 13px;
  }

  .data-table tbody tr.total-row {
    background: var(--panel-muted);
    border-color: var(--accent);
  }

  /* Zoznam mesiacov je len na citanie a preklik - nemusi mat kazdy udaj na
     vlastnom riadku ako editovatelne karty, staci nazov + hodnoty za sebou. */
  .data-table.rows-clickable tbody tr {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 16px;
  }

  .data-table.rows-clickable tbody td {
    flex: 0 0 auto;
    padding: 2px 0;
  }

  .data-table.rows-clickable tbody td[data-label="Mesiac"] {
    flex: 1 0 100%;
    font-size: 16px;
  }

  .data-table.rows-clickable tbody td[data-label="Mesiac"]::before {
    display: none;
  }

  .data-table.rows-clickable tbody td[data-label]::before {
    flex: 0 0 auto;
  }

  .new-month {
    flex-direction: column;
    align-items: stretch;
  }

  .new-month .button {
    justify-content: center;
  }
}
