/* ═══════════════════════════════════════════════════════════
   Trezor – vzhled A (kalkulačka) s dlaždicemi účelu
   ═══════════════════════════════════════════════════════════ */

:root {
  --tz-steel:     #131a1c;   /* tmavý podklad zápisu a menu */
  --tz-steel-2:   #1d272a;
  --tz-steel-3:   #2a3639;
  --tz-brass:     #d9a94a;   /* zůstatek, akcent */
  --tz-brass-dim: #8a7133;
  --tz-in:        #1c7550;   /* vklad */
  --tz-in-soft:   #e2f0e9;
  --tz-in-bright: #4fcb95;
  --tz-out:       #a8442f;   /* výdej */
  --tz-out-soft:  #f7e5e0;
  --tz-out-bright:#f0846b;
  --tz-bg:        #eef1ee;
  --tz-surface:   #fff;
  --tz-ink:       #131a1c;
  --tz-muted:     #5b6a6c;
  --tz-line:      #d9e0da;
  --tz-side-w:    218px;
  --tz-tab-h:     58px;
  --tz-num-font:  ui-monospace, "SF Mono", Menlo, monospace;
}

body.tz-body {
  background: var(--tz-bg);
  color: var(--tz-ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .95rem;
  margin: 0;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
.tz-num { font-family: var(--tz-num-font); font-variant-numeric: tabular-nums; }

/* ── Postranní menu (počítač) ─────────────────────────────── */
.tz-side { display: none; }

@media (min-width: 992px) {
  .tz-side {
    display: flex; flex-direction: column;
    position: fixed; inset: 0 auto 0 0;
    width: var(--tz-side-w);
    background: var(--tz-steel); color: #c6d2d0;
    z-index: 100;
  }
  .tz-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.1rem 1.2rem; color: #fff; font-weight: 700; font-size: 1.05rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .tz-brand i { color: var(--tz-brass); }
  .tz-side-balance { padding: .9rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,.08); }
  .tz-side-balance span {
    display: block; font-size: .62rem; letter-spacing: .14em;
    text-transform: uppercase; color: #7e8e90;
  }
  .tz-side-balance b { font-size: 1.35rem; color: var(--tz-brass); font-weight: 500; }
  .tz-nav { padding: .6rem .7rem; flex: 1; }
  .tz-nav-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem .8rem; margin-bottom: 2px; border-radius: .55rem;
    color: #94a3a4; text-decoration: none; font-size: .9rem;
    transition: background .15s, color .15s;
  }
  .tz-nav-item:hover { background: rgba(255,255,255,.07); color: #e7ede9; }
  .tz-nav-item.active { background: var(--tz-brass); color: #131a1c; font-weight: 600; }
  .tz-side-foot {
    display: flex; align-items: center; gap: .6rem;
    padding: .8rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .82rem;
  }
  .tz-side-user { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tz-side-foot a { color: #94a3a4; }
  .tz-side-foot a:hover { color: #fff; }

  .tz-main { margin-left: var(--tz-side-w); }
  .tz-topbar, .tz-tabbar { display: none !important; }
  .tz-content { padding: 1.5rem 1.75rem 2.5rem; max-width: 1180px; }
}

/* ── Horní a spodní lišta (mobil) ─────────────────────────── */
.tz-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .55rem 1rem calc(.55rem + env(safe-area-inset-top)) 1rem;
  padding-top: calc(.55rem + env(safe-area-inset-top));
  background: var(--tz-steel); color: #e7ede9;
}
.tz-topbar-label {
  display: block; font-size: .6rem; letter-spacing: .14em;
  text-transform: uppercase; color: #7e8e90;
}
.tz-topbar-balance { font-size: 1.2rem; color: var(--tz-brass); font-weight: 500; }
.tz-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: rgba(255,255,255,.12); color: #e7ede9; text-decoration: none;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
}

.tz-tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 60;
  display: flex; background: var(--tz-surface);
  border-top: 1px solid var(--tz-line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tz-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; height: var(--tz-tab-h); text-decoration: none;
  color: var(--tz-muted); font-size: .66rem;
}
.tz-tab i { font-size: 1.15rem; }
.tz-tab.active { color: var(--tz-ink); font-weight: 600; }
.tz-tab.active i { color: var(--tz-brass-dim); }

.tz-content { padding: 1rem 1rem calc(var(--tz-tab-h) + 1.5rem); }
.tz-body-full .tz-content { padding: 0 0 calc(var(--tz-tab-h) + env(safe-area-inset-bottom)); }
@media (min-width: 992px) { .tz-body-full .tz-content { padding: 1.5rem 1.75rem 2.5rem; } }

/* ── Karty a nadpisy ──────────────────────────────────────── */
.tz-card {
  background: var(--tz-surface); border: 1px solid var(--tz-line);
  border-radius: .85rem; padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.tz-h { font-size: 1.15rem; font-weight: 650; margin: 0 0 .85rem; }
.tz-label {
  font-size: .64rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--tz-muted); font-weight: 700;
}

.tz-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; }
.tz-kpi > div {
  background: var(--tz-surface); border: 1px solid var(--tz-line);
  border-radius: .7rem; padding: .6rem .8rem;
}
.tz-kpi span { display: block; font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; color: var(--tz-muted); }
.tz-kpi b { font-family: var(--tz-num-font); font-size: 1.15rem; font-weight: 600; }
.tz-in-color  { color: var(--tz-in); }
.tz-out-color { color: var(--tz-out); }

/* ═══ Obrazovka ZÁPIS ═════════════════════════════════════ */
.tz-pad-screen {
  background: var(--tz-steel); color: #e7ede9;
  display: flex; flex-direction: column;
  min-height: calc(100vh - var(--tz-tab-h) - 52px);
}
@media (min-width: 992px) {
  .tz-pad-screen {
    min-height: 0; border-radius: 1rem; padding-bottom: 1rem;
    max-width: 460px; box-shadow: 0 18px 40px -24px rgba(0,0,0,.5);
  }
  .tz-zapis-grid { display: grid; grid-template-columns: 460px 1fr; gap: 1.5rem; align-items: start; }
}

/* Přepínač vklad / výdej */
.tz-seg { display: flex; gap: .25rem; margin: .9rem 1rem 0; background: rgba(255,255,255,.07); border-radius: .8rem; padding: .25rem; }
.tz-seg button {
  flex: 1; border: 0; background: transparent; color: #9aa9aa;
  font-size: .95rem; font-weight: 650; padding: .6rem 0; border-radius: .65rem;
  cursor: pointer; transition: background .15s, color .15s;
}
.tz-seg button[aria-pressed="true"] { background: #e7ede9; color: #131a1c; }
.tz-seg button.tz-seg-in[aria-pressed="true"]  { background: var(--tz-in-bright); color: #08110d; }
.tz-seg button.tz-seg-out[aria-pressed="true"] { background: var(--tz-out-bright); color: #2a0d07; }

/* Částka */
.tz-amount {
  text-align: center; padding: 1.3rem 1rem .3rem;
  font-family: var(--tz-num-font); font-size: 2.9rem; font-weight: 500; letter-spacing: -.02em;
  line-height: 1.1; word-break: break-all;
}
.tz-amount small { font-size: 1.1rem; color: #7e8e90; margin-left: .35rem; }
.tz-amount.tz-empty { color: #55676a; }

/* Rychlé částky */
.tz-quick { display: flex; gap: .4rem; padding: .4rem 1rem .7rem; }
.tz-quick button {
  flex: 1; border: 1px solid rgba(255,255,255,.14); background: transparent;
  color: #c6d2d0; border-radius: .6rem; padding: .45rem 0;
  font-family: var(--tz-num-font); font-size: .85rem; cursor: pointer;
}
.tz-quick button:active { background: rgba(255,255,255,.12); }

/* Číselník */
.tz-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; padding: 0 1rem; }
.tz-pad button {
  background: rgba(255,255,255,.07); border: 0; color: #e7ede9;
  font-family: var(--tz-num-font); font-size: 1.45rem; padding: .75rem 0;
  border-radius: .7rem; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.tz-pad button:active { background: rgba(255,255,255,.2); }

/* Dlaždice účelu */
.tz-cats-label {
  margin: .85rem 1rem -.2rem; font-size: .64rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: #7e8e90;
  transition: color .15s;
}
.tz-cats-label.tz-chybi { color: var(--tz-brass); }

.tz-cats {
  display: flex; gap: .45rem; overflow-x: auto; padding: .55rem 1rem .2rem;
  scrollbar-width: none;
}
.tz-cats::-webkit-scrollbar { display: none; }
.tz-cat {
  flex: none; min-width: 92px; max-width: 120px;
  background: rgba(255,255,255,.07); border: 1px solid transparent; color: #c6d2d0;
  border-radius: .8rem; padding: .55rem .6rem; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: .25rem; line-height: 1.2;
}
.tz-cat i { font-size: 1.05rem; }
.tz-cat span { font-size: .74rem; font-weight: 600; }
.tz-cat[aria-pressed="true"] { background: rgba(217,169,74,.16); border-color: var(--tz-brass); color: #fff; }
.tz-cat[aria-pressed="true"] i { color: var(--tz-brass); }
.tz-cat-more { align-items: center; justify-content: center; min-width: 62px; text-align: center; }

/* Potvrzení */
.tz-go {
  margin: .9rem 1rem 0; padding: .95rem; border: 0; border-radius: .8rem;
  width: calc(100% - 2rem); font-size: 1.05rem; font-weight: 700;
  background: var(--tz-in-bright); color: #08110d; cursor: pointer;
}
.tz-go.tz-go-out { background: var(--tz-out-bright); color: #2a0d07; }
/* Nevyplněný zápis: tlačítko je ztlumené, ale klepnutí ukáže, co chybí. */
.tz-go[data-cekam="1"] { opacity: .45; }

/* Zvýraznění dlaždic, když uživatel klepne na tlačítko a účel chybí */
@keyframes tz-upozorni {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,169,74,0); }
  30%      { box-shadow: 0 0 0 3px rgba(217,169,74,.75); }
}
.tz-cats.tz-upozorni .tz-cat { animation: tz-upozorni 1.1s ease-in-out 2; border-radius: .8rem; }
@media (prefers-reduced-motion: reduce) {
  .tz-cats.tz-upozorni .tz-cat { animation: none; box-shadow: 0 0 0 2px var(--tz-brass); }
}

.tz-more-link {
  display: block; width: 100%; background: none; border: 0; cursor: pointer;
  color: #7e8e90; font-size: .78rem; padding: .7rem 0 .3rem; text-align: center;
}
.tz-more-link:hover { color: #c6d2d0; }

/* Podrobnosti (popis, protistrana, foto, datum) */
.tz-details { padding: .3rem 1rem .6rem; display: none; flex-direction: column; gap: .5rem; }
.tz-details.open { display: flex; }
.tz-details input, .tz-details textarea {
  width: 100%; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  color: #e7ede9; border-radius: .6rem; padding: .55rem .7rem; font-size: .9rem;
}
.tz-details input::placeholder { color: #6f7f80; }
.tz-details label { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: #7e8e90; }
.tz-file-btn {
  display: flex; align-items: center; gap: .5rem; justify-content: center;
  border: 1px dashed rgba(255,255,255,.22); border-radius: .6rem;
  padding: .6rem; color: #c6d2d0; font-size: .85rem; cursor: pointer;
}

/* Dnešní zápisy pod číselníkem */
.tz-today { padding: 1rem; }
.tz-today-row {
  display: flex; align-items: baseline; gap: .6rem;
  padding: .5rem 0; border-bottom: 1px solid var(--tz-line);
}
.tz-today-row:last-child { border-bottom: 0; }
.tz-today-row .t { font-family: var(--tz-num-font); font-size: .72rem; color: var(--tz-muted); width: 38px; flex: none; }
.tz-today-row .d { flex: 1; font-size: .85rem; min-width: 0; }
.tz-today-row .d i { display: block; font-style: normal; font-size: .72rem; color: var(--tz-muted); }
.tz-today-row .v { font-family: var(--tz-num-font); font-weight: 600; font-size: .9rem; }

/* ── Kniha ────────────────────────────────────────────────── */
.tz-day {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .6rem .1rem .35rem; font-size: .66rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--tz-muted); font-weight: 700;
}
.tz-row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: .7rem;
  align-items: baseline; padding: .65rem .9rem;
  background: var(--tz-surface); border: 1px solid var(--tz-line);
  border-radius: .7rem; margin-bottom: .35rem; text-decoration: none; color: inherit;
}
.tz-row:hover { border-color: var(--tz-brass-dim); }
.tz-row .t { font-family: var(--tz-num-font); font-size: .72rem; color: var(--tz-muted); }
.tz-row .d { min-width: 0; }
.tz-row .d b { display: block; font-size: .9rem; font-weight: 600; }
.tz-row .d i { font-style: normal; font-size: .74rem; color: var(--tz-muted); }
.tz-row .v { text-align: right; font-family: var(--tz-num-font); font-weight: 600; }
.tz-row .v i { display: block; font-style: normal; font-size: .68rem; font-weight: 400; color: var(--tz-muted); }
.tz-row.tz-storno { opacity: .55; }
.tz-row.tz-storno .v b, .tz-row.tz-storno .d b { text-decoration: line-through; }

.tz-empty-state { text-align: center; color: var(--tz-muted); padding: 2.5rem 1rem; }
.tz-empty-state i { font-size: 2rem; opacity: .4; display: block; margin-bottom: .5rem; }

/* ── Toast ────────────────────────────────────────────────── */
.tz-toast {
  /* Zelený pruh se pozná i na tmavé obrazovce zápisu – je to jediné potvrzení,
     že se peníze zapsaly. */
  position: fixed; left: 50%;
  bottom: calc(var(--tz-tab-h) + 1.25rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 1.5rem); z-index: 200;
  background: var(--tz-in); color: #fff;
  padding: .75rem 1.2rem; border-radius: .7rem; font-size: .9rem; font-weight: 650;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.55);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: min(92vw, 420px); text-align: center;
}
.tz-toast.show { opacity: 1; transform: translate(-50%, 0); }
.tz-toast.err { background: var(--tz-out); }
@media (min-width: 992px) { .tz-toast { bottom: 1.5rem; left: calc(50% + var(--tz-side-w) / 2); } }

/* ── Přihlášení ───────────────────────────────────────────── */
.tz-login-body {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 0%, #26333a, #0d1214 60%);
  padding: 1.5rem; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.tz-login-card {
  width: 100%; max-width: 370px; background: #fff;
  border-radius: 1rem; padding: 2rem 1.6rem;
  box-shadow: 0 30px 60px -25px rgba(0,0,0,.6);
}
.tz-login-logo {
  width: 54px; height: 54px; border-radius: .9rem; margin: 0 auto .9rem;
  background: var(--tz-steel); color: var(--tz-brass);
  display: grid; place-items: center; font-size: 1.6rem;
}
.tz-login-card h1 { font-size: 1.3rem; text-align: center; margin: 0 0 .2rem; font-weight: 700; }
.tz-login-card .sub { text-align: center; color: var(--tz-muted); font-size: .85rem; margin-bottom: 1.4rem; }

/* ── Drobnosti ────────────────────────────────────────────── */
.tz-badge {
  display: inline-block; font-size: .68rem; font-weight: 700; padding: .12rem .45rem;
  border-radius: .35rem; letter-spacing: .04em;
}
.tz-badge-in  { background: var(--tz-in-soft);  color: var(--tz-in); }
.tz-badge-out { background: var(--tz-out-soft); color: var(--tz-out); }
.tz-warn {
  background: #fff6e0; border: 1px solid #f0d9a0; color: #6b5011;
  border-radius: .7rem; padding: .7rem .9rem; font-size: .86rem; margin-bottom: 1rem;
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
