/* Gridlim Admin: Paper & Cobalt, sidebar + obsah. Zdieľané pre login, prehľad, nastavenia, blog. */
:root {
  --paper: #FAFAF7; --ink: #111213; --cobalt: #2547F2; --cobalt-dark: #1d3ad4; --paper-grey: #E9E8E2; --grey: #C9C9C2;
  --grey-mid: #62635D; --tint: #EDF1FE; --hairline: #DCDCD6; --band: #F4F3EE; --surface: #FFFFFF;
  --green: #1d7a4f; --amber: #b26a00; --red: #b3261e;
  --font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Instrument Serif", Georgia, serif;
  --radius: 12px; --side: 232px;
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100vh; }
body [hidden] { display: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select { touch-action: manipulation; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.1; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--grey-mid); }
.accent { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--cobalt); }
.muted { color: var(--grey-mid); font-size: 13px; line-height: 1.65; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; padding: 28px 18px 20px; border-right: 1px solid var(--hairline); background: var(--band); display: flex; flex-direction: column; gap: 26px; }
.brand { display: flex; align-items: baseline; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.brand sup { color: var(--cobalt); font-size: 0.55em; }
.brand .crumb { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--grey-mid); }
.side nav { display: grid; gap: 4px; }
.side nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 9px 10px; border-radius: 8px; color: var(--grey-mid); font-weight: 500; }
.side nav a:nth-last-child(2) { margin-top: 16px; }
.side nav a .ic { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--paper); border: 1px solid var(--hairline); font-family: var(--mono); font-size: 11px; color: var(--ink); }
.side nav a:hover { background: var(--paper); color: var(--ink); }
.side nav a.is-active { background: var(--ink); color: var(--paper); }
.side nav a.is-active .ic { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.side .spacer { flex: 1; }
.side .who { font-size: 13px; color: var(--grey-mid); display: grid; gap: 8px; }
.side .who b { color: var(--ink); }
.main { padding: 36px clamp(24px, 3.2vw, 48px) 60px; min-width: 0; width: 100%; max-width: 1700px; margin-inline: auto; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid var(--hairline); margin-bottom: 24px; }
.head > div:first-child { min-width: 0; }
.head h1 { font-size: clamp(28px, 3.2vw, 42px); font-weight: 700; margin-top: 8px; text-wrap: balance; }
.head p { margin: 8px 0 0; color: var(--grey-mid); max-width: 60ch; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.tools > .mono { overflow-wrap: anywhere; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--hairline); background: var(--surface); font-weight: 600; line-height: 1.4; text-align: center; cursor: pointer; transition: background 0.18s, border-color 0.18s; }
.btn:hover { background: var(--band); border-color: var(--grey); }
.btn.primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn.primary:hover { background: var(--cobalt-dark); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 7px 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
select, input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="number"], input[type="url"], input[type="search"], textarea { width: 100%; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--hairline); border-radius: 9px; background: var(--surface); }
textarea { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
select { width: auto; height: 44px; border-radius: 9px; padding: 0 36px 0 14px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23111213' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center; }
input:focus-visible, textarea:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid rgba(37, 71, 242, 0.28); outline-offset: 2px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field label, .field .lbl { font-weight: 600; font-size: 14px; }
.field .help { color: var(--grey-mid); font-size: 13px; }
.field.is-error input { border-color: var(--red); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 4px; accent-color: var(--cobalt); width: 16px; height: 16px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 42px; height: 24px; flex: 0 0 42px; border-radius: 999px; background: var(--grey); position: relative; transition: background 0.2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch input:checked + .track { background: var(--cobalt); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--cobalt); outline-offset: 3px; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; align-content: start; }
.grid > * { min-width: 0; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 22px; min-width: 0; box-shadow: none; }
.card.band { background: var(--band); box-shadow: none; }
.card.ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.card.ink .eyebrow { color: rgba(250, 250, 247, 0.6); }
.card h2 { font-size: 16px; font-weight: 600; line-height: 1.4; margin-bottom: 16px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; align-items: baseline; }
.card h2 .hint { font-weight: 400; color: var(--grey-mid); font-size: 13px; }
.stat .v { font-size: clamp(30px, 3.4vw, 44px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; margin: 16px 0 10px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat > .eyebrow { display: block; line-height: 1.65; }
.kpi .stat > b { display: block; margin: 16px 0 10px; font-size: 32px; line-height: 1.2; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .stat > .hint { display: block; color: var(--grey-mid); font-size: 12px; overflow-wrap: anywhere; }
.stat .s { color: var(--grey-mid); font-size: 13px; }
.stat.ink .s { color: rgba(250, 250, 247, 0.65); }
.status-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.status { border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); padding: 12px 14px; }
.status .v { margin-top: 6px; font-weight: 600; font-size: 14px; }
.ok { color: var(--green); } .warn { color: var(--amber); } .bad { color: var(--red); }
.pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 9px; border-radius: 6px; font-family: var(--mono); font-size: 10.5px; line-height: 1.4; letter-spacing: 0.025em; border: 1px solid var(--hairline); background: var(--paper); }
.pill::before { content: ""; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--grey); }
.pill.on::before { background: var(--green); } .pill.off::before { background: var(--grey); } .pill.warn::before { background: var(--amber); } .pill.bad::before { background: var(--red); }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 52px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; background: var(--paper-grey); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--w, 0%); background: var(--cobalt); border-radius: 999px; }
.empty { color: var(--grey-mid); font-size: 13.5px; padding: 8px 0; }
.list { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--paper-grey); font-size: 13.5px; }
.row:last-child { border-bottom: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--grey-mid); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--grey-mid); padding: 10px; border-bottom: 1px solid var(--hairline); font-weight: 500; }
td { padding: 14px 10px; border-bottom: 1px solid var(--paper-grey); vertical-align: top; }
td > .pill { margin: 0 3px 5px 0; }
tr:last-child td { border-bottom: 0; }
.thumb { width: 96px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; border: 1px solid var(--hairline); display: block; background: var(--paper-grey); }
.note { border-left: 3px solid var(--cobalt); background: var(--tint); padding: 12px 14px; border-radius: 0 10px 10px 0; font-size: 13.5px; overflow-wrap: anywhere; }
.card code, .foot code { overflow-wrap: anywhere; }
.note code { background: rgba(37, 71, 242, 0.08); padding: 1px 6px; border-radius: 6px; }
.toast { position: fixed; left: 50%; bottom: 24px; width: max-content; max-width: min(620px, calc(100vw - 32px)); transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 10px; font-weight: 500; font-size: 14px; overflow-wrap: anywhere; transition: transform 0.3s, opacity 0.3s; pointer-events: none; z-index: 50; }
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.toast.bad { background: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--hairline); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; color: var(--grey-mid); font-size: 12.5px; }
.badge-dev { background: #FFF4DB; color: var(--amber); border: 1px solid #F1D9A6; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.device-note { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; padding: 16px 18px; margin: 0 0 20px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--band); }
.device-note > div { flex: 1 1 260px; min-width: 0; }
.device-note strong { display: block; font-size: 13px; font-weight: 600; }
.device-note p { margin: 5px 0 0; color: var(--grey-mid); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.device-note .btn { flex-shrink: 0; }

/* Shared content views keep detail controls readable beside long titles. */
.blog-page table { min-width: 860px; }
.blog-page th { white-space: nowrap; }
.blog-page td:nth-child(2) { min-width: 230px; max-width: 360px; }
.blog-page td:nth-child(2) .mono { overflow-wrap: anywhere; font-size: 11px; }
.blog-page td:nth-child(3) { white-space: nowrap; font-size: 11px; }
.blog-page td:nth-child(5) { min-width: 140px; }
.blog-page td > .pill { white-space: nowrap; }
.blog-page td:last-child { min-width: 180px; max-width: 260px; }
.blog-page td:last-child .btn { white-space: nowrap; }
.blog-page .share-disclosure .article-share h2 { font-size: 16px; }
.blog-page .share-disclosure .article-share > p { font-size: 12px; }
.blog-page .share-disclosure .article-share :is(a, button) { font-size: 12px; padding-inline: 10px; }
.blog-page .share-disclosure > summary:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.blog-page .draft-card .pill { align-self: flex-start; }
.main .plan-grid { grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr); gap: 16px; align-items: start; }
.main .plan-row { grid-template-columns: 72px minmax(0, 1fr); gap: 8px 12px; padding-block: 16px; }
.main .plan-row .thumb { width: 72px; }
.main .plan-row .t { line-height: 1.4; }
.main .plan-row .m { font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.main .plan-row > .pill { grid-column: 2; justify-self: start; }
.main .nl-row > div { min-width: 0; overflow-wrap: anywhere; }
.main .cal .d { min-height: 34px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(60% 50% at 70% 20%, var(--tint), transparent 70%), var(--paper); }
.login .card { width: min(420px, 100%); padding: 30px 28px 26px; }
.login h1 { font-size: 30px; font-weight: 700; margin: 14px 0 6px; }
.login p.sub { margin: 0 0 22px; color: var(--grey-mid); }
.login form { display: grid; gap: 14px; }
.login .err { color: var(--red); font-size: 13.5px; min-height: 1.2em; }
.login .back { display: inline-block; margin-top: 18px; font-size: 13.5px; color: var(--grey-mid); }

/* ---------- mobile ---------- */
.topbar { display: none; }
@media (min-width: 961px) and (max-width: 1240px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.split, .main .plan-grid, .main .nl-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; min-width: 0; overflow: visible; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px; padding: 16px 20px 10px; border-right: 0; border-bottom: 1px solid var(--hairline); }
  .side nav { display: flex; flex-wrap: nowrap; flex: 1 0 100%; order: 3; gap: 5px; min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; padding: 0 2px 6px; }
  .side nav a { flex: 0 0 auto; padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  .side nav a:nth-last-child(2) { margin-top: 0; margin-left: 10px; }
  .side nav a .ic { width: 23px; height: 23px; font-size: 10px; }
  .side > #logout { margin-left: auto; min-height: 38px; }
  .side .badge-dev { order: 4; width: 100%; }
  .side .who { display: none; }
  .side .spacer { display: none; }
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2, .grid.split, .main .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .status-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: minmax(0, 1fr) 90px 44px; }
  .main { padding: 28px 20px 40px; }
}
@media (max-width: 600px) {
  .main { padding: 24px 16px 36px; }
  .side { padding-inline: 16px; }
  .head { gap: 18px; padding-bottom: 20px; }
  .head h1 { font-size: 30px; line-height: 1.12; }
  .head p { font-size: 13px; line-height: 1.65; }
  .head .tools { width: 100%; }
  .head .tools > .mono { flex: 1 0 100%; font-size: 11px; }
  .card { padding: 18px 16px; }
  .grid { gap: 12px; }
  .grid.cols-3, .form-grid, .main .kpi { grid-template-columns: minmax(0, 1fr); }
  .grid.cols-4 .card { padding: 16px 14px; }
  .stat > .eyebrow { font-size: 10px; letter-spacing: .06em; }
  .stat .v { font-size: 34px; }
  .stat .s { font-size: 12px; }
  .btn.small { min-height: 44px; }
  .field input, .field textarea, .field select { font-size: 16px; }
  .main .cal { gap: 4px; }
  .main .cal .d { padding: 5px; }
  .foot { font-size: 11px; line-height: 1.7; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
