:root {
  --bg: #f4f3ef;
  --card: #ffffff;
  --ink: #1b1f1d;
  --muted: #6b716e;
  --line: #e2e0d9;
  --brand: #1d3a33;
  --in: #1f8a4c;
  --in-dark: #176b3a;
  --out: #c4412f;
  --out-dark: #9e3223;
  --ok-bg: #e5f4ea;
  --err-bg: #fbe9e6;
  --warn-bg: #fff4d6;
  --radius: 14px;
  font-size: 17px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font-family: inherit; }

header#top {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--brand); color: #fff; font-size: .9rem;
}
header#top a, header#top .link { color: #d9e6e1; margin-left: 14px; }
.link { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.35rem; margin: 4px 0 14px; }
h2 { font-size: 1.1rem; margin: 18px 0 10px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .85rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }

/* ---- domov ---- */
.status { text-align: center; padding: 22px 16px; }
.status .state { font-size: 1.35rem; font-weight: 700; margin-bottom: 4px; }
.status .state.on { color: var(--in-dark); }
.status .elapsed { font-size: 2.1rem; font-variant-numeric: tabular-nums; font-weight: 600; margin: 6px 0; }
.punch-wrap { display: flex; justify-content: center; margin: 22px 0 16px; }
.punch {
  width: min(68vw, 250px); aspect-ratio: 1; border-radius: 50%; border: 0;
  font-size: 1.9rem; font-weight: 800; letter-spacing: .02em; color: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.18), inset 0 -6px 0 rgba(0,0,0,.15);
  cursor: pointer; touch-action: manipulation; user-select: none;
}
.punch.in { background: var(--in); }
.punch.out { background: var(--out); }
.punch:active { transform: scale(.97); }
.punch:disabled { opacity: .55; cursor: default; }

.banner { border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; font-weight: 600; text-align: center; }
.banner.ok { background: var(--ok-bg); color: var(--in-dark); font-size: 1.15rem; }
.banner.err { background: var(--err-bg); color: var(--out-dark); }
.banner.warn { background: var(--warn-bg); color: #6b4e00; }

/* ---- seznami ---- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .main { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .sub { color: var(--muted); font-size: .88rem; }
.list .right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-block; font-size: .72rem; padding: 2px 7px; border-radius: 99px; background: #eceae4; color: var(--muted); margin-left: 6px; vertical-align: middle; font-weight: 600; }
.tag.open { background: var(--ok-bg); color: var(--in-dark); }
.tag.fix { background: var(--warn-bg); color: #6b4e00; }

.monthbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.monthbar strong { font-size: 1.1rem; }
.total { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- obrazci ---- */
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; padding: 12px; border: 1px solid #cfccc3; border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }
.btn {
  display: inline-block; font: inherit; font-weight: 600; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; text-align: center; touch-action: manipulation;
}
.btn.secondary { background: #fff; color: var(--brand); }
.btn.danger { background: #fff; color: var(--out-dark); border-color: var(--out); }
.btn.small { padding: 7px 11px; font-size: .85rem; }
.btn.block { display: block; width: 100%; margin-top: 16px; }
.btn:disabled { opacity: .6; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
input[type=date], input[type=datetime-local] { min-width: 0; -webkit-appearance: none; appearance: none; min-height: 48px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.subtabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 4px; scrollbar-width: none; }
.subtabs a { flex: none; padding: 8px 13px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .9rem; font-weight: 600; }
.subtabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.history { font-size: .85rem; margin-top: 14px; }
.history li { display: block; }

/* ---- spodnja navigacija ---- */
nav#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav#tabs a { flex: 1; text-align: center; padding: 9px 0 10px; color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 600; }
nav#tabs a .ico { display: block; font-size: 1.3rem; line-height: 1.4; }
nav#tabs a.active { color: var(--brand); }

.login { max-width: 380px; margin: 8vh auto 0; }
.login .logo { width: 64px; height: 64px; display: block; margin: 0 auto 10px; }

.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; word-break: break-all; }
