:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1d2330;
  --muted: #6b7280;
  --line: #e3e6eb;
  --accent: #1f5fbf;
  --ok: #1a7f45;
  --warn: #b7791f;
  --bad: #c0362c;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: .2em 0 .4em; }
h2 { font-size: 1.1rem; margin: 0 0 .7em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ok { color: var(--ok); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  background: #1d2330; color: #fff; padding: 10px 16px; }
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; letter-spacing: .03em; }
.brand span { font-weight: 400; opacity: .7; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 16px; }
.topbar nav a.muted { color: #aab; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.flash { background: #e8f1fd; border: 1px solid #bcd3f5; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }
.alert { background: #fdecea; border: 1px solid #f3b8b2; color: var(--bad); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.error { color: var(--bad); }
.empty { color: var(--muted); padding: 24px 0; }

button, .button { display: inline-block; font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 10px 16px;
  background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; }
button.secondary, .button.secondary { background: #e8ebf0; color: var(--text); }
button.danger { background: #fff; color: var(--bad); border: 1px solid var(--bad); }
input, select, textarea { font: inherit; width: 100%; padding: 9px 10px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; }
label { display: block; font-size: .9rem; color: var(--muted); }
label input, label select, label textarea { margin-top: 4px; color: var(--text); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
label.check input { width: auto; margin: 0; }

.login { max-width: 360px; margin: 10vh auto; display: grid; gap: 14px; }
.login .error:empty { display: none; }
button.big { padding: 14px 16px; font-size: 1.05rem; }

.list-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 8px 14px; border-radius: 8px; text-decoration: none; color: var(--text); }
.tabs a.active { background: var(--card); border: 1px solid var(--line); font-weight: 600; }

.list .row { display: flex; gap: 16px; justify-content: space-between; text-decoration: none; color: inherit; margin-bottom: 10px; border-left: 5px solid var(--line); }
.list .row:hover { border-color: var(--accent); }
.row.blizko { border-left-color: var(--warn); }
.row.po-terminu { border-left-color: var(--bad); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 1.05rem; }
.row-meta { color: var(--muted); font-size: .92rem; }
.row-side { width: 260px; flex-shrink: 0; }
.termin { font-size: .92rem; margin-bottom: 4px; }
.row.blizko .termin b { color: var(--warn); }
.row.po-terminu .termin b { color: var(--bad); }
.dalsi { font-size: .85rem; color: var(--muted); margin-top: 4px; }

.progress { position: relative; height: 20px; background: #e8ebf0; border-radius: 10px; overflow: hidden; }
.progress div { height: 100%; background: var(--accent); }
.progress.done div { background: var(--ok); }
.progress span { position: absolute; inset: 0; text-align: center; font-size: .75rem; line-height: 20px; font-weight: 600; color: #1d2330; }

.detail-head { margin-bottom: 16px; }
.detail-head .progress { height: 26px; border-radius: 13px; max-width: 520px; }
.detail-head .progress span { line-height: 26px; font-size: .85rem; }
.termin-big { font-size: 1.05rem; margin-bottom: 8px; }
.termin-big.blizko b { color: var(--warn); }
.termin-big.po-terminu b { color: var(--bad); }

.cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }

.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; }
.step { counter-increment: s; border: 1px solid var(--line); border-radius: 8px; padding: 12px 12px 12px 48px; margin-bottom: 8px; position: relative; }
.step::before { content: counter(s); position: absolute; left: 12px; top: 12px; width: 26px; height: 26px; border-radius: 50%;
  background: #e8ebf0; text-align: center; line-height: 26px; font-weight: 700; font-size: .85rem; }
.step.done { background: #f2faf5; border-color: #bfe3cc; }
.step.done::before { content: "✓"; background: var(--ok); color: #fff; }
.step-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; align-items: baseline; }
.step-name { font-weight: 600; }
.step-who { font-size: .85rem; color: var(--ok); }
.step-fields { display: flex; gap: 10px; margin-top: 8px; }
.step-fields label { flex: 1; }
.calc { margin: 8px 0 0; font-size: .92rem; }
.step-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; }
dt { color: var(--muted); }
dd { margin: 0; }
dd.pre { white-space: pre-wrap; }

details.card summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.danger-zone { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.history { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.history li { padding: 4px 0; border-bottom: 1px solid var(--line); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
form.inline { display: flex; gap: 6px; }
form.inline input { width: 150px; }
.badge-bad { display: inline-block; background: #fdecea; color: var(--bad); border: 1px solid #f3b8b2; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; margin-left: 6px; vertical-align: middle; }
.dotisk { background: #fdecea; border: 1px solid #f3b8b2; border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.dotisk-head { color: var(--bad); font-size: 1.05rem; }
.dotisk-tisk { background: #fff7e6; border-color: #f0d49a; }
.dotisk-tisk .dotisk-head { color: var(--warn); }
.dotisk-kroky { margin-top: 10px; display: grid; gap: 6px; }
.dotisk-krok { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-height: 44px; }
.dotisk-krok.done { background: #f2faf5; border-color: #bfe3cc; }
.warn-text { color: var(--warn); font-weight: 600; }
.form-grid h3 { margin: 8px 0 0; font-size: 1rem; }
.stitek-box { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.stitek-box summary { cursor: pointer; font-weight: 600; }
.stitek-form { display: grid; gap: 8px; margin-top: 10px; padding: 10px; border-radius: 8px; }
.stitek-form.zvyraznit { background: #e8f1fd; border: 1px solid #bcd3f5; }
label.radio { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 1rem; }
label.radio input { width: auto; margin: 0; }
.small-btn { padding: 6px 12px; font-size: .9rem; }
.badge-warn { display: inline-block; background: #fff7e6; color: var(--warn); border: 1px solid #f0d49a; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; margin-left: 6px; vertical-align: middle; }
.dotisk-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.dotisk-form label { width: 150px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.badge { background: #e8f1fd; color: var(--accent); font-size: .75rem; padding: 2px 6px; border-radius: 6px; }

@media (max-width: 760px) {
  .cols, .form-grid { grid-template-columns: 1fr; }
  .list .row { flex-direction: column; gap: 8px; }
  .row-side { width: auto; }
  .table, .table tr, .table td { display: block; }
  .table th { display: none; }
}
