﻿.board-empty {
  display: block;
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--muted, #5a6570);
  font-size: 1rem;
  line-height: 1.5;
}
/* חשבון שלי — page-specific styles (uses styles.css palette) */

.account-page {
  background: var(--mint);
  min-height: 100vh;
  display: flex;
  flex-direction: column;

  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 300;
}

.account-page main {
  flex: 1;
}

.proto-banner {
  display: none; /* removed from client-facing UI */
}

.account-section {
  padding: 2rem 0 3rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.account-head {
  margin-bottom: 1.5rem;
}

.account-head h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 300;
  color: var(--green-900);
  line-height: 1.25;
}

.account-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.65rem 1.45rem 1.85rem;
  box-shadow: var(--shadow);
  max-width: 440px;
  margin-inline: auto;
}

/* Subtle calm hint (replaces dashed demo-notice) */
.login-hint,
.demo-notice {
  margin: 0 0 1.25rem;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--green-50);
  border: 1px solid var(--green-100);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.55;
  font-weight: 300;
}

.demo-notice code {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.15rem 0.45rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-weight: 300;
  color: var(--green-800);
}

.login-form .form-row {
  margin-bottom: 1rem;
}

.login-form .form-row label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 300;
  color: var(--green-900);
  font-size: calc(0.95rem * var(--copy-scale));
}

.login-form .form-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-form .form-row input:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(27, 122, 74, 0.18);
}

.form-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #fdecea;
  color: #8a1f1f;
  font-weight: 300;
  font-size: 0.92rem;
}

/* Home header */
.account-home-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.company-name {
  margin: 0 0 0.25rem;
  font-size: clamp(1.45rem, 3.5vw, 2rem);
  font-weight: 300;
  color: var(--green-900);
  line-height: 1.25;
}

.company-meta {
  margin: 0;
  color: var(--muted);
  font-weight: 300;
}

.account-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* Archive layout */
.archive-layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 800px) {
  .archive-layout {
    grid-template-columns: minmax(200px, 260px) 1fr;
    align-items: start;
  }
}

.periods-panel,
.period-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.35rem;
  box-shadow: var(--shadow);
}

.panel-title {
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--green-800);
}

.periods-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.period-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
  font: inherit;
  font-weight: 300;
  color: var(--ink);
  cursor: pointer;
  text-align: start;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.period-btn:hover {
  background: var(--green-50);
  border-color: var(--green-600);
}

.period-btn.is-active {
  background: var(--green-100);
  border-color: var(--green-700);
  color: var(--green-900);
}

.period-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 300;
  white-space: nowrap;
}

.period-badge.open {
  background: #dff5e6;
  color: var(--green-800);
}

.period-badge.archived {
  background: #e8ece9;
  color: var(--muted);
}

.period-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.period-status {
  margin: -0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 300;
}

.period-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-sm {
  min-height: 2.4rem;
  padding: 0.45rem 0.95rem;
  font-size: 0.9rem;
}

.download-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.fake-files {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--green-50);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 300;
}

.search-row {
  margin-bottom: 1rem;
}

.search-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.95rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.search-row input:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(27, 122, 74, 0.18);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  table-layout: fixed;
}

.invoice-table th,
.invoice-table td {
  padding: 0.55rem 0.4rem;
  text-align: start;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.invoice-table th {
  background: var(--soft);
  color: var(--green-900);
  font-weight: 300;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-table tbody tr:last-child td {
  border-bottom: none;
}

.invoice-table tbody tr:hover td {
  background: var(--green-50);
}

.invoice-table .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: end;
  unicode-bidi: isolate;
}
.invoice-table th.num {
  direction: rtl;
}
.invoice-table td.num {
  direction: rtl;
}

/* col widths: date | type | supplier | inv# | before | vat | total | pdf */
.invoice-table th:nth-child(1),
.invoice-table td:nth-child(1) { width: 6.2rem; }
.invoice-table th:nth-child(2),
.invoice-table td:nth-child(2) { width: 4.2rem; }
.invoice-table th:nth-child(3),
.invoice-table td:nth-child(3) { width: auto; }
.invoice-table th:nth-child(4),
.invoice-table td:nth-child(4) { width: 5.2rem; }
.invoice-table th:nth-child(5),
.invoice-table td:nth-child(5) { width: 6.2rem; }
.invoice-table th:nth-child(6),
.invoice-table td:nth-child(6) { width: 4.6rem; }
.invoice-table th:nth-child(7),
.invoice-table td:nth-child(7) { width: 5.4rem; }
.invoice-table th:nth-child(8),
.invoice-table td:nth-child(8) { width: 3.6rem; }

.invoice-table td:nth-child(3),
.invoice-table .supplier-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-table th:nth-child(4),
.invoice-table td:nth-child(4),
.invoice-table .inv-number {
  max-width: 5.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-table th.num,
.invoice-table td:nth-child(5),
.invoice-table td:nth-child(6),
.invoice-table td:nth-child(7) {
  white-space: nowrap;
  text-align: end;
}

.invoice-table th.num {
  direction: rtl;
  unicode-bidi: isolate;
}

.empty-row td {
  text-align: center;
  color: var(--muted);
  font-weight: 300;
  padding: 1.5rem 0.75rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.account-footer .footer-legal {
  max-width: 42rem;
  margin-inline: auto;
  line-height: 1.55;
}

[hidden] {
  display: none !important;
}

/* Auth flow extras — WhatsApp copy, force-change, reset */

.demo-notice p {
  margin: 0 0 0.5rem;
}

.demo-notice p:last-child {
  margin-bottom: 0;
}

.demo-notice-sub {
  color: var(--muted);
  font-weight: 300;
}

.form-links {
  margin: 1rem 0 0;
  text-align: center;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 300;
  color: var(--green-700);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--green-900);
}

.form-hint {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.wa-sent-banner {
  margin: 0 0 1.15rem;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
  background: #dff5e6;
  border: 1px solid var(--green-100);
  color: var(--green-800);
  font-weight: 300;
  font-size: 0.92rem;
}

#view-change-password .account-card,
#view-reset .account-card {
  max-width: 440px;
}

.login-form .btn-ghost.btn-block {
  margin-top: 0.65rem;
}

/* ========== Expense board (Balash registry only) ========== */

.expense-board {
  margin: 0 0 2rem;
  padding: 1.35rem 1.25rem 1.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

/* KPI cubes: fixed grid row with title — never wrap below month pills.
   Col1 (RTL start/right) = title; Col2 (RTL end/left) = 4 green cubes.
   Same June/July top-left layout for every month. */
.expense-board-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 1.5rem;
  align-items: start;
  margin-bottom: 0.75rem;
}

.expense-board-head h2 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  color: var(--green-900);
  font-weight: 300;
}

.board-period {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.board-kpis {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.65rem;
  justify-self: end; /* RTL: end = visual left (June/July top-left) */
  align-self: start;
  max-width: 100%;
}

.board-kpi {
  flex: 0 0 auto;
  min-width: 6.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--green-50);
  border: 1px solid var(--green-100);
  box-sizing: border-box;
}

.board-kpi .kpi-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 300;
}

.board-kpi .kpi-value {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--green-900);
  font-variant-numeric: tabular-nums;
}
/* Narrow: KPIs still ABOVE month bar (own row under title) — never after months */
@media (max-width: 799px) {
  .expense-board-head {
    grid-template-columns: 1fr;
  }
  .board-kpis {
    justify-self: stretch;
    flex-wrap: wrap;
  }
}


.board-disclaimer {
  margin: 0 0 1rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #f7faf7;
  border: 1px dashed var(--green-100);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 300;
}

.board-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.15rem;
}

.board-stub {
  opacity: 0.85;
}

.board-stub::after {
  content: " · בקרוב";
  font-size: 0.78em;
  color: var(--muted);
  font-weight: 300;
}

.board-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .board-grid {
    grid-template-columns: 1.05fr 1fr;
  }
}

.board-card {
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fcfdfc;
}

.board-card-wide {
  margin-bottom: 1rem;
}

.board-card-title {
  margin: 0 0 0.85rem;
  font-size: 1.02rem;
  color: var(--green-800);
  font-weight: 300;
}

.pie-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

.pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 18rem;
  min-width: 14rem;
  max-width: min(28rem, 55%);
}

.pie-legend li {
  display: grid;
  grid-template-columns: 0.75rem minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.45rem;
  min-width: 0;
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
  line-height: 1.35;
}

.pie-legend .pie-label {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.pie-legend .pie-amt {
  grid-column: 3;
  flex: none;
  width: auto;
  max-width: 9.5rem;
  margin-inline-start: 0;
  overflow: hidden;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: end;
  direction: ltr;
  unicode-bidi: isolate;
  font-size: 0.8rem;
}

.board-thin-note {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  min-height: 140px;
  padding: 0.5rem 0.25rem 0;
  margin-bottom: 1rem;
}

.bar-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.bar-fill {
  width: 100%;
  max-width: 3.2rem;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--green-700), var(--green-900));
  min-height: 4px;
}

.bar-val {
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--green-900);
  font-variant-numeric: tabular-nums;
}

.bar-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 300;
  text-align: center;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.board-table th,
.board-table td {
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line);
  text-align: start;
}

.board-table th {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 300;
}

.board-table td.num,
.board-table th.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: end;
  unicode-bidi: isolate;
}

/* Hebrew headers stay RTL so end-align matches the amount cells */
#board-suppliers-table th.num {
  direction: rtl;
}

#board-suppliers-table td.num,
#board-suppliers-table .supplier-amount,
#board-suppliers-table .supplier-count,
#board-suppliers-table .supplier-share,
#board-suppliers-table .mom-cell {
  direction: rtl;
  text-align: end;
}

#board-suppliers-table th:nth-child(1),
#board-suppliers-table td.supplier-rank {
  text-align: center;
}

/* Fit full width — no horizontal scroll; names truncate. */
#board-suppliers-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.board-card-wide > .table-wrap {
  overflow-x: hidden;
}

#board-suppliers-table th:nth-child(1),
#board-suppliers-table td:nth-child(1) { width: 2.4rem; }
#board-suppliers-table th:nth-child(2),
#board-suppliers-table td:nth-child(2) { width: auto; }
#board-suppliers-table th:nth-child(3),
#board-suppliers-table td:nth-child(3) { width: 3.4rem; }
#board-suppliers-table th:nth-child(4),
#board-suppliers-table td:nth-child(4) { width: 6.2rem; }
#board-suppliers-table th:nth-child(5),
#board-suppliers-table td:nth-child(5) { width: 5.2rem; }
#board-suppliers-table th:nth-child(6),
#board-suppliers-table td:nth-child(6) { width: 6.2rem; }
#board-suppliers-table th:nth-child(7),
#board-suppliers-table td:nth-child(7) { width: 3.8rem; }
#board-suppliers-table th:nth-child(8),
#board-suppliers-table td:nth-child(8) { width: 5.5rem; }

#board-suppliers-table th:nth-child(n + 3) {
  white-space: nowrap;
  text-align: end;
  font-size: 0.72rem;
  direction: rtl;
}

#board-suppliers-table .supplier-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: start;
}

#board-suppliers-table .supplier-amount,
#board-suppliers-table .supplier-count,
#board-suppliers-table .supplier-share {
  min-width: 0;
  white-space: nowrap;
  text-align: end;
  font-size: 0.85rem;
}

#board-suppliers-table .mom-cell {
  min-width: 0;
  white-space: nowrap;
  text-align: end;
}

#board-suppliers-table .mom-new,
#board-suppliers-table .mom-arrow {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
}

.board-table tbody tr:hover {
  background: var(--green-50);
}

.board-callout {
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #eef7f0, #f7fbf8);
  border: 1px solid var(--green-100);
  color: var(--ink);
  line-height: 1.6;
  font-size: 0.94rem;
}

.board-callout p {
  margin: 0;
}

.board-callout strong {
  color: var(--green-900);
}

.board-error {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: #fff4f0;
  border: 1px solid #f0c2b0;
  color: #7a2e1b;
  font-weight: 300;
}

/* Board polish — bar chart needs explicit track height */
.bars {
  height: auto;
  align-items: stretch;
}
.bar-col {
  height: auto;
  justify-content: flex-start;
}
.bar-track {
  height: 112px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex: 0 0 112px;
}
.bar-fill {
  width: 70%;
  margin-inline: auto;
}
.bar-val {
  min-height: 1.2em;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
}
.bar-label {
  min-height: 2.4em;
  line-height: 1.15;
}
.pie-swatch,
.pie-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}
.pie-legend .pie-amt,
.pie-legend .pie-amt {
  margin-inline-start: auto;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}
.board-error {
  color: #9b1c1c;
  font-weight: 300;
}
.board-table .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: end;
  direction: ltr;
  unicode-bidi: isolate;
}


/* Month selector — monthly invoice-date view */
.board-month-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.15rem;
}
.board-month-bar-label {
  font-size: 0.86rem;
  font-weight: 300;
  color: var(--green-800);
}
.board-month-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.board-month-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-900);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 300;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.board-month-tab:hover {
  border-color: var(--green-600);
  background: var(--green-50);
}
.board-month-tab.is-active,
.board-month-tab[aria-selected="true"] {
  background: var(--green-800);
  border-color: var(--green-800);
  color: #fff;
}
.board-month-tab .tab-amt {
  display: block;
  font-size: 0.72rem;
  font-weight: 300;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}
.board-dedupe-note {
  margin: 0 0 0.85rem;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  background: #fff8e8;
  border: 1px solid #f0d9a0;
  color: #6a4b00;
  font-size: 0.84rem;
  font-weight: 300;
}
.bar-col.is-selected .bar-fill {
  outline: 2px solid var(--green-600);
  outline-offset: 2px;
}
.bar-col.is-selected .bar-label {
  color: var(--green-900);
  font-weight: 300;
}

/* Password show/hide toggle — button outside the input */
.password-field {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}
.password-field input {
  flex: 1;
  min-width: 0;
}
.password-toggle {
  flex: 0 0 auto;
  align-self: stretch;
  border: 1px solid var(--border, #cfd8d2);
  background: var(--green-50);
  color: var(--green-800);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 300;
  padding: 0.35rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}
.password-toggle:hover {
  background: var(--green-100);
  color: var(--green-900);
}
.password-toggle[aria-pressed="true"] {
  background: var(--green-800);
  color: #fff;
  border-color: var(--green-800);
}

/* Supplier expand + MoM */
.suppliers-expand-row {
  margin-top: 0.75rem;
  text-align: center;
}
.mom-cell {
  white-space: nowrap;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}
.mom-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.82rem;
}
.mom-up::before { content: "↑ "; }
.mom-down::before { content: "↓ "; }
.mom-flat { color: var(--muted); font-weight: 300; }
.mom-new {
  color: var(--green-800);
  background: var(--green-50);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 300;
}
.mom-green { color: #1b7a4a; background: #e6f6ec; }
.mom-yellow { color: #8a6d00; background: #fff6d6; }
.mom-red { color: #9b1c1c; background: #fdecea; }

/* Soft row highlight: supplier spend rose vs previous month (suppliers table only) */
#board-suppliers-table tbody tr.mom-row-up > td,
#board-suppliers-table tbody tr:has(.mom-up) > td {
  background: #f8ecec;
}
#board-suppliers-table tbody tr.mom-row-up:hover > td,
#board-suppliers-table tbody tr:has(.mom-up):hover > td {
  background: #f3e2e2;
}

/* Expense MoM: up = cost rise (red), down = drop (green) */
#board-suppliers-table .mom-arrow.mom-up {
  color: #9b1c1c;
  background: #fdecea;
}
#board-suppliers-table .mom-arrow.mom-down {
  color: #1b7a4a;
  background: #e6f6ec;
}

/* Archive PDF link */
.invoice-table a.pdf-link {
  color: var(--green-700);
  font-weight: 300;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.invoice-table a.pdf-link:hover { color: var(--green-900); }
.invoice-table .pdf-missing {
  color: var(--muted);
  font-size: 0.85rem;
}
.type-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 300;
}
.type-badge.expense { background: #eef7f0; color: var(--green-800); }
.type-badge.income { background: #e8f0fe; color: #1a4a8a; }

.board-month-table-wrap tr.is-selected-month td {
  background: var(--green-50);
  font-weight: 300;
}


/* Month leaders: full name; CSS ellipsis only if overflows */
.month-top-supplier {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-top-amt {
  color: var(--muted, #5a6b66);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.month-top-supplier {
  white-space: nowrap;
}

/* Month table: payment header aligns with amount column (RTL label, end-align) */
#board-month-table th.num {
  direction: rtl;
  unicode-bidi: isolate;
  text-align: end;
}
#board-month-table td.num {
  text-align: end;
}

.invoice-table .inv-number {
  max-width: 5.5rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}



/* Compact/full name + MoM: desktop always shows full; compact is mobile-only */
.name-compact,
.mom-compact {
  display: none !important;
}
.name-full,
.mom-full {
  display: inline;
}
.mom-compact.mom-up::before,
.mom-compact.mom-down::before {
  content: none;
}

/* Mobile: invoice + suppliers = one-line compact rows (tap to expand).
   Month board-table keeps stacked cards. */
@media (max-width: 799px) {
  /* Full-bleed cards/tables: same usable width for month, suppliers, invoices, periods */
  .account-page .container {
    width: calc(100% - 0.9rem);
    max-width: none;
    padding-inline: 0;
    box-sizing: border-box;
  }

  .shell,
  .account-section,
  .expense-board,
  .archive-layout {
    max-width: 100%;
  }

  .board-card,
  .board-card-wide,
  .periods-panel,
  .period-detail {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-inline: 0.7rem;
  }

  .board-card-wide > .table-wrap,
  .board-month-table-wrap,
  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
    box-sizing: border-box;
  }

  #board-suppliers-table,
  #invoice-table,
  #board-month-table,
  .board-table {
    width: 100% !important;
    min-width: 0;
    table-layout: auto !important;
  }

  #board-suppliers-table col,
  #board-suppliers-table th,
  #board-suppliers-table td,
  #invoice-table th,
  #invoice-table td {
    width: auto !important;
    max-width: none !important;
  }

  .table-wrap {
    overflow: visible;
    border: none;
    background: transparent;
  }

  /* --- Generic board-table (month table etc.): stacked cards --- */
  .board-table {
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0 0.65rem;
    font-size: 0.95rem;
  }

  .board-table thead {
    display: none;
  }

  .board-table tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 0.55rem 0.75rem 0.65rem;
  }

  .board-table tbody td {
    display: grid;
    grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 0.45rem 0.75rem;
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
    padding: 0.42rem 0;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    text-align: start;
  }

  .board-table tbody td:last-child {
    border-bottom: none;
  }

  .board-table tbody td::before {
    content: attr(data-label);
    font-weight: 300;
    color: var(--green-800);
    font-size: 0.82rem;
  }

  .board-table tbody td.num {
    text-align: start;
    direction: inherit;
  }

  .board-table tbody td.num > *,
  .board-table tbody td.num:not(:has(> *)) {
    justify-self: end;
    text-align: end;
    direction: ltr;
    unicode-bidi: isolate;
  }

  .board-table tbody td.supplier-name,
  .board-table tbody td.month-top-supplier {
    white-space: normal;
    overflow-wrap: anywhere;
    overflow: visible;
    text-overflow: unset;
  }

  .board-table tbody tr:hover {
    background: var(--surface);
  }

  /* --- Invoice + suppliers: expandable compact one-liners --- */
  #invoice-table,
  #board-suppliers-table {
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0 0.55rem;
    font-size: 0.95rem;
  }

  #invoice-table thead,
  #board-suppliers-table thead {
    display: none;
  }

  #invoice-table tbody tr.mobile-expandable,
  #board-suppliers-table tbody tr.mobile-expandable {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    box-sizing: border-box;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 0.6rem 0.7rem;
    cursor: pointer;
    outline: none;
  }

  #invoice-table tbody tr.mobile-expandable:focus-visible,
  #board-suppliers-table tbody tr.mobile-expandable:focus-visible {
    box-shadow: 0 0 0 2px var(--green-700), var(--shadow);
  }

  #invoice-table tbody tr.mobile-expandable:not(.is-expanded) td.col-detail,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) td.col-detail {
    display: none !important;
  }

  #invoice-table tbody tr.mobile-expandable:not(.is-expanded) td.col-compact,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) td.col-compact {
    display: flex;
    align-items: center;
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    padding: 0;
    border: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: start;
  }

  #invoice-table tbody tr.mobile-expandable:not(.is-expanded) td.col-compact::before,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) td.col-compact::before {
    content: none;
  }

  #invoice-table tbody tr.mobile-expandable:not(.is-expanded) td.supplier-name,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) td.supplier-name {
    flex: 1 1 0;
    min-width: 0;
    padding-inline-end: 0.45rem;
    margin-inline-end: 0;
  }

  #invoice-table tbody tr.mobile-expandable:not(.is-expanded) td.supplier-name .name-compact,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) td.supplier-name .name-compact {
    display: block !important;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #invoice-table tbody tr.mobile-expandable:not(.is-expanded) td.num,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) td.num,
  #invoice-table tbody tr.mobile-expandable:not(.is-expanded) td.inv-total,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) td.supplier-total {
    flex: 0 0 auto;
    flex-shrink: 0;
    direction: ltr;
    unicode-bidi: isolate;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    padding-inline-start: 0.25rem;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    min-width: max-content;
  }

  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) td.mom-cell {
    flex: 0 0 auto;
    flex-shrink: 0;
    overflow: visible !important;
    min-width: max-content;
  }

  #invoice-table tbody tr.mobile-expandable:not(.is-expanded) .name-full,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) .name-full,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) .mom-full {
    display: none !important;
  }

  #invoice-table tbody tr.mobile-expandable:not(.is-expanded) .name-compact,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) .name-compact,
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) .mom-compact {
    display: inline !important;
  }

  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) .mom-compact {
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1;
  }
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) .mom-compact.mom-up {
    color: #9b1c1c;
  }
  #board-suppliers-table tbody tr.mobile-expandable.mom-row-up,
  #board-suppliers-table tbody tr.mobile-expandable:has(.mom-up) {
    background: #f8ecec !important;
    border-color: #e8c9c9;
  }
  #board-suppliers-table tbody tr.mobile-expandable.mom-row-up > td,
  #board-suppliers-table tbody tr.mobile-expandable:has(.mom-up) > td {
    background: transparent !important;
  }

  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) .mom-compact.mom-down {
    color: #1b7a4a;
  }
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) .mom-compact.mom-flat {
    color: var(--muted);
  }
  #board-suppliers-table tbody tr.mobile-expandable:not(.is-expanded) .mom-compact.mom-new {
    font-size: 0.72rem;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: var(--green-50);
    color: var(--green-800);
  }

  /* Expanded: stacked labeled card (same pattern as month table) */
  #invoice-table tbody tr.mobile-expandable.is-expanded,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded {
    display: block;
    flex-wrap: unset;
    gap: 0;
    padding: 0.55rem 0.75rem 0.65rem;
    cursor: pointer;
  }

  #invoice-table tbody tr.mobile-expandable.is-expanded td,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded td {
    display: grid;
    grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 0.45rem 0.75rem;
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    text-align: start;
  }

  #invoice-table tbody tr.mobile-expandable.is-expanded td:last-child,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded td:last-child {
    border-bottom: none;
  }

  #invoice-table tbody tr.mobile-expandable.is-expanded td::before,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded td::before {
    content: attr(data-label);
    font-weight: 300;
    color: var(--green-800);
    font-size: 0.82rem;
  }

  #invoice-table tbody tr.mobile-expandable.is-expanded td.num,
  #invoice-table tbody tr.mobile-expandable.is-expanded td.inv-number,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded td.num {
    text-align: start;
    direction: inherit;
  }

  #invoice-table tbody tr.mobile-expandable.is-expanded td.num > *,
  #invoice-table tbody tr.mobile-expandable.is-expanded td.inv-number,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded td.num > *,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded td.num:not(:has(> *)) {
    justify-self: end;
    text-align: end;
    direction: ltr;
    unicode-bidi: isolate;
  }

  #invoice-table tbody tr.mobile-expandable.is-expanded .name-compact,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded .name-compact,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded .mom-compact {
    display: none !important;
  }

  #invoice-table tbody tr.mobile-expandable.is-expanded .name-full,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded .name-full,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded .mom-full {
    display: inline !important;
  }

  #invoice-table tbody tr.mobile-expandable.is-expanded td.supplier-name,
  #board-suppliers-table tbody tr.mobile-expandable.is-expanded td.supplier-name {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Empty / colspan rows */
  #invoice-table tbody tr.empty-row,
  #invoice-table tbody tr:has(td.empty-state),
  #invoice-table tbody tr:has(td[colspan]),
  #board-suppliers-table tbody tr.empty-row,
  #board-suppliers-table tbody tr:has(td[colspan]) {
    display: block;
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    box-shadow: none;
    padding: 0.75rem;
    cursor: default;
  }

  #invoice-table tbody td[colspan],
  #board-suppliers-table tbody td[colspan] {
    display: block;
    text-align: center;
    border: none;
    width: 100% !important;
  }

  #invoice-table tbody td[colspan]::before,
  #board-suppliers-table tbody td[colspan]::before {
    content: none;
  }

  #invoice-table tbody tr:hover td,
  #board-suppliers-table tbody tr:hover td {
    background: transparent;
  }
}

/* ACCOUNT_DELETION_UI_V1 */
.delete-account-panel {
  margin: 0 0 1.5rem;
  padding: 1.25rem;
  max-width: 560px;
  border: 1px solid #e6caca;
  border-radius: var(--radius-sm, 12px);
  background: #fffafa;
}

.delete-account-panel .delete-body {
  margin: 0 0 1rem;
  line-height: 1.6;
  font-weight: 300;
}

.delete-confirm-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-weight: 300;
  cursor: pointer;
}

.delete-confirm-row input {
  margin-top: 0.3rem;
}

.delete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.btn-danger {
  background: #8a1f1f;
  border: 1px solid #8a1f1f;
  color: #fff;
}

.btn-danger:hover,
.btn-danger:focus-visible {
  background: #6f1717;
  border-color: #6f1717;
}

.btn-danger[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* PA_MOBILE_NO_OVERFLOW_V1 (15.11.2026): grid tracks must not grow to min-content */
.board-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .board-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
}
.board-grid > *, .board-card, .pie-wrap, .bars { min-width: 0; }
#board-pie { max-width: 100%; height: auto; }
/* many months: scroll inside the card, never the page */
.bars { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.bar-col { flex: 1 0 3.6rem; }
.bar-val { white-space: nowrap; }
@media (max-width: 799px) {
  .pie-legend { flex: 1 1 100%; min-width: 0; max-width: 100%; } /* full-width legend = less truncation */
  .board-kpi { flex: 1 1 6rem; min-width: 0; }
  /* global guard */
  .account-page :where(section, .board-card, .board-month-bar, .board-month-tabs,
                       .board-actions, .board-kpis, .table-wrap) { max-width: 100%; min-width: 0; }
  .account-page :where(canvas, svg, img, video) { max-width: 100%; }
  .account-page :where(.board-month-tabs, .board-actions, .board-kpis) { flex-wrap: wrap; }
}

/* PA_MOBILE_NO_OVERFLOW_V2 (15.11.2026): same min-content bug in the archive grid (periods + invoices) */
.archive-layout { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 800px) {
  .archive-layout { grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); }
}
.archive-layout > *, .expense-board-head > * { min-width: 0; }
@media (max-width: 799px) {
  /* compact invoice/supplier rows are flex rows; let the table box follow the card width */
  #invoice-table, #board-suppliers-table,
  #invoice-table > tbody, #board-suppliers-table > tbody { display: block; width: 100%; min-width: 0; }
}
