:root {
  --bg: #0d1117;
  --bg2: #111826;
  --card: #161e2e;
  --card2: #1b2438;
  --border: #273249;
  --border-soft: #1f2a40;
  --text: #e7ecf5;
  --muted: #8b98b1;
  --accent: #4f8cff;
  --accent2: #7aa5ff;
  --green: #34d399;
  --green-dim: #103a2c;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #16213a 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  min-height: 100vh;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 22px;
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); }
.brand strong { display: block; font-size: 15px; color: var(--text); letter-spacing: .2px; }
.brand span { font-size: 11px; color: var(--muted); }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs a {
  color: var(--muted); text-decoration: none; padding: 7px 14px;
  border-radius: 999px; font-size: 14px; transition: .15s;
}
.tabs a:hover { color: var(--text); background: var(--card2); }
.tabs a.active { color: #fff; background: linear-gradient(135deg, var(--accent), #3056c9); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.api-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.api-link:hover { color: var(--accent2); }
.api-link.ok { color: var(--green); }
.excel-pill {
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); cursor: default;
}
.excel-pill.ok { color: var(--green); border-color: var(--green-dim); }
.excel-pill.err { color: var(--red); border-color: #4a2525; }

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }
.page-title { font-size: 22px; margin: 4px 0 2px; }
.page-sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.mt { margin-top: 16px; }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.stat-value small { font-size: 15px; color: var(--muted); font-weight: 500; }
.stat-hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.stat-hint b.good { color: var(--green); }
.stat-hint b.bad { color: var(--amber); }

.progress { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--violet)); border-radius: 99px; transition: width .5s ease; }
.progress.green > div { background: linear-gradient(90deg, #0ea471, var(--green)); }
.progress.amber > div { background: linear-gradient(90deg, #d97706, var(--amber)); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--border);
}
.badge.green { color: var(--green); border-color: var(--green-dim); background: var(--green-dim); }
.badge.amber { color: var(--amber); border-color: #4a3a15; background: #2b230d; }
.badge.red { color: var(--red); border-color: #4a2525; background: #2b1414; }
.badge.blue { color: var(--blue); border-color: #1d3a5f; background: #12233a; }
.badge.violet { color: var(--violet); border-color: #37306b; background: #221d44; }

/* ---------- buttons & forms ---------- */
.btn {
  appearance: none; border: 1px solid var(--border); background: var(--card2); color: var(--text);
  padding: 8px 16px; border-radius: 10px; font-size: 14px; cursor: pointer; transition: .15s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #3056c9); border: none; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.15); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); background: #2b1414; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

input[type=text], input[type=number], input[type=date], input[type=url], select, textarea {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 10px; font-size: 14px; font-family: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(79,140,255,.04); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- week editor ---------- */
.week-day {
  display: grid; grid-template-columns: 150px 1fr 230px; gap: 14px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: 12px;
  background: var(--card); margin-bottom: 10px;
}
.week-day.blocked { opacity: .72; }
.week-day .dname { font-weight: 600; }
.week-day .ddate { color: var(--muted); font-size: 13px; }
.week-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.hours-ctl { display: flex; align-items: center; gap: 6px; }
.hours-ctl .btn { width: 34px; height: 34px; padding: 0; font-size: 17px; border-radius: 9px; }
.hours-ctl input { width: 74px; text-align: center; font-variant-numeric: tabular-nums; }
.hours-ctl .preset { font-size: 11px; padding: 4px 8px; }
.desc-input { width: 100%; }
.week-nav { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.week-nav h2 { margin: 0; font-size: 19px; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.cal-head h2 { margin: 0; font-size: 19px; min-width: 190px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow { text-align: center; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; padding: 4px 0; }
.cal-cell {
  min-height: 86px; border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 8px 10px; background: var(--card); cursor: pointer; transition: .15s; position: relative;
}
.cal-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
.cal-cell.out { opacity: .35; cursor: default; }
.cal-cell.out:hover { border-color: var(--border-soft); transform: none; }
.cal-cell .num { font-weight: 700; font-size: 14px; }
.cal-cell .hrs { position: absolute; right: 10px; bottom: 8px; font-weight: 700; font-size: 15px; color: var(--green); }
.cal-cell .tag { font-size: 10.5px; color: var(--muted); display: block; margin-top: 3px; line-height: 1.25; }
.cal-cell.w0 { background: #12251e; }
.cal-cell.hol { background: #2b1418; }
.cal-cell.vac { background: #12233a; }
.cal-cell.wknd { background: var(--bg2); }
.cal-cell.today { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- lists ---------- */
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border: 1px solid var(--border-soft); border-radius: 12px; background: var(--card); margin-bottom: 8px;
}
.list-item .grow { flex: 1; }
.list-item .title { font-weight: 600; }
.list-item .sub { color: var(--muted); font-size: 13px; }

.section-title { font-size: 17px; margin: 26px 0 12px; }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(5,8,14,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  width: min(480px, 92vw); background: var(--card2); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 4px; }
.modal .msub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 12px 18px; border-radius: 12px; background: var(--card2); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 14px; max-width: 380px; animation: slidein .25s ease;
  border-left: 4px solid var(--accent);
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- charts ---------- */
.chart { width: 100%; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.tbl.mini { font-size: 13px; width: 100%; }
.tbl.mini td, .tbl.mini th { white-space: nowrap; }
.tbl.mini th { font-size: 11px; padding: 6px 8px; }
.tbl.mini td { padding: 7px 8px; }
.tbl.mini tfoot td { border-top: 1px solid var(--border); border-bottom: none; padding-top: 9px; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }
.loading { display: flex; justify-content: center; padding: 60px; color: var(--muted); }

@media (max-width: 760px) {
  .week-day { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 8px; }
}

/* ---------- description textareas (multiline) ---------- */
textarea.desc-input {
  width: 100%; background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 10px; font-size: 14px; font-family: inherit;
  outline: none; resize: none; line-height: 1.45; min-height: 38px; max-height: 260px; overflow-y: auto;
}
textarea.desc-input:focus { border-color: var(--accent); }
textarea.desc-input.big { min-height: 120px; max-height: 55vh; width: 100%; box-sizing: border-box; }

/* rendered markdown (len na zobrazovanie v tabuľkách) */
.md { font-size: 14px; line-height: 1.55; }
.md p { margin: 4px 0; }
.md h1, .md h2, .md h3 { margin: 10px 0 4px; line-height: 1.3; }
.md h1 { font-size: 19px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; }
.md ul, .md ol { margin: 4px 0; padding-left: 22px; }
.md li { margin: 2px 0; }
.md li.task { list-style: none; margin-left: -18px; }
.md blockquote {
  margin: 6px 0; padding: 2px 12px; border-left: 3px solid var(--accent);
  color: var(--muted); background: rgba(79,140,255,.06); border-radius: 0 8px 8px 0;
}
.md code { background: var(--card2); border: 1px solid var(--border-soft); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.md pre { background: var(--card2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; overflow-x: auto; }
.md pre code { background: none; border: none; padding: 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.md a { color: var(--accent2); }
.md-cell { max-height: 46px; overflow: hidden; mask-image: linear-gradient(#000 55%, transparent); -webkit-mask-image: linear-gradient(#000 55%, transparent); }
