/* styl.css — built for a phone held in one hand. Big figures, big targets.
   No web fonts, no external files: the app must work with no network. */

:root {
  --ink: #16202c;
  --ink-soft: #5a6878;
  --paper: #f6f7f9;
  --card: #ffffff;
  --edge: #dfe3e8;
  --accent: #1b3a5c;
  --warn: #8a4b12;
  --warn-bg: #fdf3e6;
  --ok: #1d5c3a;
  --negative: #9a2a2a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 0 5rem 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}

.test-strip {
  margin: 0;
  padding: 0.7rem 1rem;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.85rem;
  border-bottom: 1px solid var(--edge);
}

.top { padding: 1rem 1rem 0 1rem; }
.top h1 { margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--ink-soft); }

main { padding: 0 1rem; }

h2 { font-size: 1.25rem; margin: 1.2rem 0 0.6rem; }
h3 { font-size: 0.95rem; margin: 1.2rem 0 0.4rem; color: var(--ink-soft); font-weight: 600; }

/* The balance is the biggest thing on the screen. */
.headline {
  margin: 1rem 0 0.4rem;
  padding: 1.2rem 1rem;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 14px;
  text-align: center;
}
.headline-label { margin: 0; font-size: 0.9rem; color: var(--ink-soft); }
.headline-value {
  margin: 0.3rem 0 0;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.headline-value.negative { color: var(--negative); }
.headline-note { margin: 0.3rem 0 0; font-size: 0.85rem; color: var(--ink-soft); }

.period { margin: 0 0 1rem; font-size: 0.82rem; color: var(--ink-soft); text-align: center; }

.block {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 0.6rem 1rem 0.9rem;
  margin-bottom: 0.8rem;
}
.block h3:first-child { margin-top: 0.5rem; }

.line { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; }
.line + .line { border-top: 1px solid var(--edge); }
.line-label { color: var(--ink-soft); }
.line-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.line.strong .line-label, .line.strong .line-value { font-weight: 700; color: var(--ink); }
.line.negative .line-value { color: var(--negative); font-weight: 700; }

.cat { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.55rem 0; }
.cat + .cat { border-top: 1px solid var(--edge); }
.cat-body { flex: 1 1 auto; min-width: 0; }
.cat-name { display: block; font-weight: 600; }
.cat-figures { display: block; font-size: 0.85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cat-state { display: block; font-size: 0.85rem; margin-top: 0.15rem; }

/* The dot is a summary of the figures above it. The sentence beside it says
   the same in words, so the colour is never the only carrier of meaning. */
.cat-dot {
  flex: 0 0 0.75rem;
  width: 0.75rem; height: 0.75rem;
  margin-top: 0.42rem;
  border-radius: 50%;
  background: var(--edge);
}
.cat-blue   .cat-dot { background: #2f6fb0; }
.cat-green  .cat-dot { background: #1d7a4a; }
.cat-orange .cat-dot { background: #c2700f; }
.cat-red    .cat-dot { background: #a52727; }
.cat-blue   .cat-state { color: #2f6fb0; }
.cat-green  .cat-state { color: var(--ok); }
.cat-orange .cat-state { color: var(--warn); }
.cat-red    .cat-state { color: var(--negative); font-weight: 600; }
.cat-none   .cat-state { color: var(--ink-soft); }
.cat-grey   .cat-dot { background: #8a8f98; }
.cat-grey   .cat-state { color: var(--ink-soft); }

/* "Odložil jsem" */
.deposit-form { display: flex; gap: 0.5rem; align-items: flex-end; margin-top: 0.4rem; }
.deposit-form .field { margin-bottom: 0; flex: 1 1 auto; }
.deposit-list { list-style: none; margin: 0.4rem 0 0; padding: 0; font-size: 0.85rem; color: var(--ink-soft); }
.deposit-list li { display: flex; gap: 0.6rem; align-items: center; justify-content: space-between; padding: 0.15rem 0; }
.cat-body > button.small { margin-top: 0.4rem; }

.field { display: block; margin-bottom: 0.8rem; }
.field-label { display: block; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.2rem; }

input, select, button { font: inherit; }

input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.big-input { font-size: 1.8rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--edge);
}
.row-name { flex: 1 1 auto; }
.row-hint { font-size: 0.78rem; color: var(--ink-soft); }
.row input.amount { flex: 0 0 7rem; text-align: right; font-variant-numeric: tabular-nums; }
.row input.day { flex: 0 0 4rem; text-align: right; }
.row input.cat-name { flex: 1 1 auto; }
.row-hidden { opacity: 0.55; }

button.primary {
  display: block;
  width: 100%;
  margin: 1rem 0 0.4rem;
  padding: 0.85rem 1rem;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
button.small {
  margin-top: 0.5rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.85rem;
}

/* The daily closing. It sits at the top and does not hide: the difference has
   to be dealt with before the new day's figures mean anything. */
.closing { border-color: var(--accent); }
.closing-title { margin: 0.5rem 0 0.2rem; font-size: 0.95rem; color: var(--ink-soft); font-weight: 600; }
.closing-sum { margin: 0 0 0.6rem; font-size: 1.05rem; font-weight: 600; }
.choice { padding: 0.5rem 0; }
.choice + .choice { border-top: 1px solid var(--edge); }
.choice-text { margin: 0 0 0.4rem; font-variant-numeric: tabular-nums; }
.choice button { margin-top: 0; }

.note { margin: 0.5rem 0; font-size: 0.83rem; color: var(--ink-soft); }
.note-warning {
  padding: 0.6rem 0.7rem;
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 9px;
}

.message { min-height: 1.3rem; margin: 0.4rem 0 0; font-size: 0.9rem; }
.message-ok { color: var(--ok); font-weight: 600; }
.message-warning { color: var(--warn); font-weight: 600; }

.summary {
  margin-top: 1rem;
  padding: 0.6rem 0.8rem;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 12px;
}
.summary-line { display: flex; justify-content: space-between; padding: 0.2rem 0; }

.entry { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.4rem 0; }
.entry + .entry { border-top: 1px solid var(--edge); }
.entry-amount { flex: 0 0 6rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.entry-name { flex: 1 1 auto; }
.entry-date { flex: 0 0 auto; font-size: 0.8rem; color: var(--ink-soft); }

/* A cancelled expense stays visible — struck through, not gone (CLAUDE.md:
   nothing is ever deleted). */
.entry-cancelled .entry-amount,
.entry-cancelled .entry-name { text-decoration: line-through; color: var(--ink-soft); }

.link-button {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 0.1rem 0.3rem;
  font: inherit;
  font-size: 0.83rem;
  color: var(--ink-soft);
  text-decoration: underline;
  cursor: pointer;
  width: auto;
}

.correction-form {
  margin: 0.4rem 0 0.9rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--edge);
  border-radius: 0.6rem;
}
.correction-form h4 { margin: 0 0 0.3rem; font-size: 0.95rem; }
.correction-form button { margin-top: 0.4rem; }

/* Historie (bod 7). Den je tlačítko: nadpisová čísla jsou vidět vždy,
   podrobnost se rozbalí teprve kliknutím — jinak by se na telefonu
   jeden den roztáhl na celou obrazovku a hledání by se znemožnilo. */
.history-nav { align-items: center; }
.history-nav .row-name { text-align: center; font-size: 0.82rem; color: var(--ink-soft); }

.history-day {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.6rem;
  width: 100%;
  margin: 0.35rem 0 0;
  padding: 0.6rem 0.7rem;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 0.6rem;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.history-date { flex: 1 1 8rem; font-weight: 600; }
.history-diff { flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.history-figures {
  flex: 1 1 100%;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.history-mark { flex: 0 0 auto; font-size: 0.78rem; color: var(--ink-soft); }
.history-changed { flex: 0 0 auto; font-size: 0.78rem; color: var(--warn); font-weight: 600; }
.history-diff.negative { color: var(--negative); }

/* Neuzavřený den má být vidět na první pohled — to je ta část
   „co jsem zapomněl doplnit“. */
.history-day-open { border-color: var(--warn); }

.history-detail { padding: 0 0.2rem 0.4rem; }
.history-detail h4 { margin: 0.8rem 0 0.2rem; font-size: 0.9rem; color: var(--ink-soft); }

/* Pátá karta: kratší text, aby se do spodní lišty vešly všechny. */
/* Loan or saving. Both sides look exactly the same on purpose: a highlighted
   column would be a recommendation (rule N8). On a phone they sit one under the
   other; where there is room they stand side by side, which is how the zadání
   asks for them ("dvě čísla vedle sebe"). */
#loan-result { display: grid; grid-template-columns: 1fr; }
@media (min-width: 560px) {
  #loan-result { grid-template-columns: 1fr 1fr; column-gap: 0.8rem; }
  #loan-result > :not(.block) { grid-column: 1 / -1; }
}

.loan-price {
  margin: 0.5rem 0 0.2rem;
  font-weight: 700;
}
.loan-detail {
  margin: 0.2rem 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.loan-same {
  margin: 0.2rem 0 0.8rem;
  padding: 0.6rem 0.7rem;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 9px;
  font-variant-numeric: tabular-nums;
}

/* Six cards now, so the labels need the room. */
.tab { font-size: 0.74rem; }

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--edge);
}
.tab {
  flex: 1 1 0;
  padding: 0.9rem 0.15rem;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
}
.tab-active { color: var(--accent); font-weight: 700; box-shadow: inset 0 2px 0 var(--accent); }

@media (prefers-color-scheme: dark) {
  .cat-blue   .cat-dot { background: #7fb0e0; }
  .cat-green  .cat-dot { background: #7fd0a2; }
  .cat-orange .cat-dot { background: #e9b878; }
  .cat-red    .cat-dot { background: #f08f8f; }
  .cat-blue   .cat-state { color: #7fb0e0; }

  :root {
    --ink: #e8ecf1;
    --ink-soft: #a4b0bf;
    --paper: #121820;
    --card: #1a222c;
    --edge: #2c3744;
    --accent: #7fb0e0;
    --warn: #e9b878;
    --warn-bg: #2e2416;
    --ok: #7fd0a2;
    --negative: #f08f8f;
  }
  button.primary { color: #0e141b; }
}
