:root {
  --ground: #cfd8e6;
  --card: #ffffff;
  --text: #141c2b;
  --muted: #4a566b;
  --line: #cfd6e2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .10), 0 4px 12px rgba(20, 30, 50, .10);
  --tabele: #047857;
  --tekst: #4f46e5;
  --prezentacije: #a23677;
  --skripta: #a4461a;
  --link: #1d4ed8;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 16px 0;
}
body.admin .top, body.admin main { max-width: 1240px; }

.brand { font-weight: 650; font-size: 15px; color: var(--text); text-decoration: none; }
.topnav { display: flex; gap: 16px; align-items: center; }
.topnav a { color: var(--text); }

main { max-width: 920px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 0 0 16px;
}

h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.card > h2:first-child { margin-top: 0; }
h3 { font-size: 14px; margin: 0 0 6px; }

.hero { padding: 24px 4px 16px; }
.hero h1 { font-size: 30px; }
.lead { font-size: 15px; color: var(--muted); margin: 0 0 8px; max-width: 60ch; }
.muted { color: var(--muted); }

.apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 16px; }
.app { margin: 0; display: flex; flex-direction: column; border-top: 4px solid var(--accent); }
.app p { flex: 1; margin: 0 0 16px; color: var(--muted); }
.app h2 { margin: 0 0 6px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.app .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.app-tabele { --accent: var(--tabele); }
.app-tekst { --accent: var(--tekst); }
.app-prezentacije { --accent: var(--prezentacije); }
.app-skripta { --accent: var(--skripta); }

.button {
  display: inline-block;
  align-self: flex-start;
  background: var(--accent, var(--text));
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { filter: brightness(1.1); }
.button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.button.disabled { background: #e7ebf2; color: var(--muted); cursor: default; }

.links { padding-left: 18px; margin: 8px 0; }
.foot { color: var(--muted); font-size: 13px; padding: 8px 4px 24px; }
.foot a { color: var(--muted); }

.prose { max-width: 760px; }
.prose p, .prose li { max-width: 68ch; }
.prose li { margin-bottom: 6px; }
.prose h2 { margin-top: 24px; }

/* admin */
.login { max-width: 360px; margin: 48px auto; }
.login form { display: grid; gap: 8px; }
.login input[type=password] { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.login .button { margin-top: 8px; }
.error { color: #b42318; background: #fef3f2; border-radius: 8px; padding: 8px 10px; }
form.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--text); text-decoration: underline; cursor: pointer; }

.range { margin: 0 0 16px; color: var(--muted); }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; }
td.err { min-width: 260px; }
.msg { color: var(--muted); word-break: break-word; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.splits { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 24px; margin-top: 16px; }
.split { min-width: 0; overflow-x: auto; }

.chart { width: 100%; height: auto; display: block; margin: 8px 0; }
.chart .ax { font-size: 10px; fill: var(--muted); }
.bar { display: block; margin-top: 4px; }

.legend { list-style: none; padding: 0; margin: 0 0 4px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 6px; }

.tag { display: inline-block; font-size: 11px; font-weight: 600; color: #fff; border-radius: 4px; padding: 1px 6px; background: var(--muted); }
.tag-tabele { background: var(--tabele); }
.tag-tekst { background: var(--tekst); }
.tag-prezentacije { background: var(--prezentacije); }
.tag-skripta { background: var(--skripta); }

pre.stack {
  background: #f4f6fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 480px;
  overflow: auto;
}

details { margin: 4px 0 0; }
summary { cursor: pointer; color: var(--muted); }

@media (max-width: 520px) {
  .card { padding: 16px; }
  .hero h1 { font-size: 26px; }
}
