/* Styles for the pages added after the redesign (reports, expenses, corrections). Uses app.css tokens. */

.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.month-nav > span { display: flex; flex-direction: column; align-items: center; text-align: center; }
.month-nav b { font-size: 18px; }
.month-nav small { font-size: 13px; color: var(--muted); }
.month-nav-gap { width: 44px; }
.month-nav .btn-small { min-width: 44px; min-height: 44px; }

/* the headline: growing, falling or steady */
.verdict {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
}
.verdict h2 { font-size: 20px; font-weight: 800; }
.verdict p { margin-top: 4px; }
.verdict-icon {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%;
  font-size: 20px; background: var(--sunk); color: var(--muted);
}
.verdict-up { background: var(--paid-tint); border-color: #abefc6; }
.verdict-up .verdict-icon { background: var(--paid); color: #fff; }
.verdict-up h2 { color: var(--paid); }
.verdict-down { background: var(--danger-tint); border-color: #fecdca; }
.verdict-down .verdict-icon { background: var(--danger); color: #fff; }
.verdict-down h2 { color: var(--danger); }
.verdict-flat .verdict-icon { background: var(--primary-tint); color: var(--primary); }

.chg { font-weight: 700; color: var(--muted); white-space: nowrap; }
.chg-good { color: var(--paid); }
.chg-bad { color: var(--danger); }

.tips ul { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }

/* profit and loss */
.pl-table th { font-weight: 500; text-align: left; }
.pl-table td, .pl-table th { padding: 8px 4px; }
.pl-table th small { color: var(--muted); font-weight: 500; }
.pl-sub th, .pl-sub td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.pl-detail th { padding-left: 18px; color: var(--muted); font-size: 13px; }
.pl-detail td { font-size: 13px; color: var(--muted); }
.pl-total th, .pl-total td { font-size: 17px; font-weight: 800; border-top: 2px solid var(--ink); }

/* six months */
.trend { list-style: none; margin: 0; padding: 8px 0 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: end; height: 190px; }
.trend li { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.trend-value { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.trend-bars { display: flex; align-items: flex-end; gap: 3px; width: 100%; max-width: 56px; justify-content: center; }
.trend-sales, .trend-net { flex: 1; border-radius: 5px 5px 2px 2px; }
.trend-sales { background: #b9e2da; }
.trend-net { background: var(--paid); }
.trend-net.is-loss { background: var(--danger); }
.trend .is-this .trend-sales { background: var(--primary); }
.trend-month { font-size: 12px; color: var(--muted); text-decoration: none; min-height: 24px; }
.trend .is-this .trend-month, .trend .is-this .trend-value { color: var(--ink); font-weight: 700; }
.trend-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.trend-key span { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: -4px; }
.key-sales { background: #b9e2da; }
.key-net { background: var(--paid); }
.key-loss { background: var(--danger); }

/* expenses by category */
.spend-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.spend-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.spend-label { font-size: 14px; color: inherit; text-decoration: none; }
a.spend-label:hover { color: var(--primary); }
.spend-track { grid-column: 1 / -1; grid-row: 2; height: 8px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.spend-fill { display: block; height: 100%; background: var(--owed); border-radius: 4px; }
.spend-bars .num { grid-row: 1; grid-column: 2; font-weight: 600; white-space: nowrap; text-align: right; }

.input-big { font-size: 28px; font-weight: 800; min-height: 60px; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 8px; }

/* the dashboard's month card */
.month-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.month-card-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.month-card-figs div { display: flex; flex-direction: column; }
.month-card-figs span { font-size: 13px; color: var(--muted); }
.month-card-figs b { font-size: 20px; font-variant-numeric: tabular-nums; }
.month-card-figs small { font-size: 12px; }

@media print {
  .print-btn, .month-nav .btn, .dash-actions { display: none !important; }
  .verdict, .panel, .kpi { break-inside: avoid; }
}

/* sign-in: what to do about a forgotten PIN or password */
.login-help { color: rgba(240, 253, 250, .9); font-size: 15px; text-align: center; }
.login-help summary { cursor: pointer; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.login-help p { margin-top: 6px; }

/* small text links get a thumb-sized target */
.cust-more .linkish, .cust-more .inline-form .linkish { min-height: 44px; display: inline-flex; align-items: center; }
.cust-more .inline-form { display: inline; }

/* ---------------- expense and product categories ---------------- */
.cat-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.cat-add .field { flex: 1 1 220px; }
.cat-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; gap: 6px; }
.cat-actions form { display: flex; gap: 6px; }
.cat-actions details[open] { flex-basis: 100%; }
.cat-actions details .stack-form { margin: 8px 0 4px auto; }
.is-hidden-row td { color: var(--muted); }
.expense-table tfoot td, .expense-table tfoot th { border-top: 2px solid var(--line); }
.cat-actions .negative { color: var(--danger); }

/* ---------------- expenses list: month by the title, a ruled table always, categories beside it ---------------- */
.exp-month { gap: 8px; padding: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.exp-month b { min-width: 9.5em; font-size: 15px; text-align: center; }
.exp-month .btn-small { min-width: 40px; min-height: 40px; border: 0; }
.exp-grid { display: grid; gap: 14px; align-items: start; }
.exp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.exp-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.exp-card-head h2 { font-size: 16px; }
.exp-card-head .input-cat { width: auto; min-width: 190px; min-height: 40px; }
.exp-card .table-card { border: 0; border-radius: 0; }
.expense-table td, .expense-table th { border-bottom: 1px solid var(--line); }
.expense-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.exp-empty td { padding: 26px 14px !important; text-align: center; }
.exp-empty b, .exp-empty span { display: block; }
.exp-empty span { margin: 4px 0 12px; color: var(--muted); font-size: 13px; }
.exp-blank td { height: 44px; }
.exp-blank:hover { background: none !important; }
.exp-cats .spend-bars li.is-current .spend-label { color: var(--primary); font-weight: 700; }
.exp-all { display: inline-block; margin-top: 12px; font-size: 14px; }
@media (min-width: 900px) { .exp-grid { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; } }
.exp-head > div:first-child { flex: 1 1 300px; min-width: 0; }
.expense-table tbody td:first-child { white-space: nowrap; }
@media (max-width: 599px) { .exp-month { flex: 1 1 100%; justify-content: space-between; } }
/* the expenses page uses the whole width beside the menu */
@media (min-width: 900px) { body:has(.exp-grid) .main { max-width: none; } }

/* ---------------- month by month (?p=months): a card a month, swiped sideways ---------------- */
/* Newest first in the page, laid out right to left, so the strip opens on this month and
   earlier months are a swipe to the left away. */
.mb-strip {
  display: flex; flex-direction: row-reverse; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain; scrollbar-width: none; padding-bottom: 4px;
}
.mb-strip::-webkit-scrollbar { display: none; }
.mb-card { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; gap: 14px; }
.mb-card h2 { font-size: 18px; }
.mb-big { display: flex; flex-direction: column; gap: 2px; }
.mb-big b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mb-card .mix-list { margin: 0; }
.mb-card .panel-link { align-self: flex-start; }
.mb-steps { display: flex; gap: 8px; }
@media (min-width: 900px) { .mb-card { flex-basis: 340px; } }
