/* Hoplo Review. Dark UI bez preprocesora a bez závislostí.
   Poradie: tokeny, layout, zoznam, detail, akcie, modal, toasty, guard, responzív. */

:root {
  --bg: #0b0d11;
  --panel: #11141a;
  --panel-2: #161a22;
  --line: #222833;
  --line-soft: #1a1f28;
  --text: #e8eaee;
  --muted: #8b93a2;
  --muted-2: #6b7381;

  --accent: #5b8def;
  --ok: #2f9e63;
  --warn: #c99a2e;
  --danger: #cf4b4b;

  --radius: 8px;
  --radius-sm: 6px;
  --gap: 12px;
  --topbar-h: 56px;
  --actions-h: 64px;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.brand span {
  color: var(--muted);
  font-weight: 500;
  margin-left: 6px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.field-label {
  display: block;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.batch-picker { display: flex; align-items: center; gap: 8px; }

.batch-picker input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color-scheme: dark;
}

.counts {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.count .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.count b { color: var(--text); font-weight: 600; font-size: 12.5px; }

.count-label {
  color: var(--muted-2);
  font-size: 11.5px;
  letter-spacing: .01em;
}

.count[data-status="draft_ready"] { color: var(--warn); }
.count[data-status="in_review"] { color: var(--accent); }
.count[data-status="published"] { color: var(--ok); }
.count[data-status="rejected"] { color: var(--danger); }
.count[data-status="error"] { color: #9a6bd6; }

/* Layout */

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 38%) 1fr;
  min-height: 0;
  flex: 1 1 auto;
}

.col-list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  min-height: 0;
}

.col-detail {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#detail {
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 20px calc(var(--actions-h) + 24px);
}

.detail-inner {
  max-width: 760px;
  margin: 0 auto;
  padding-top: 20px;
}

/* Zoznam */

.list { display: flex; flex-direction: column; gap: 4px; }

.row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  position: relative;
  transition: background .12s ease, border-color .12s ease;
}

.row:hover { background: var(--panel-2); }
.row.is-active { background: var(--panel-2); border-color: var(--line); }
.row.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.row.is-busy { opacity: .5; pointer-events: none; }

.row-seq {
  color: var(--muted-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
  text-align: right;
}

.row-title {
  font-size: 14.5px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Badge */

.badge {
  --badge: #9aa2b1;
  --badge-bg: rgba(139, 147, 162, .10);
  --badge-bd: rgba(139, 147, 162, .35);
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--badge-bd);
  border-radius: 6px;
  background: var(--badge-bg);
  color: var(--badge);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.badge.draft_ready { --badge: #d8a94a; --badge-bg: rgba(201, 154, 46, .12); --badge-bd: rgba(201, 154, 46, .45); }
.badge.in_review { --badge: #7ba4f5; --badge-bg: rgba(91, 141, 239, .12); --badge-bd: rgba(91, 141, 239, .45); }
.badge.published { --badge: #5cc28c; --badge-bg: rgba(47, 158, 99, .12); --badge-bd: rgba(47, 158, 99, .45); }
.badge.rejected { --badge: #e08585; --badge-bg: rgba(207, 75, 75, .12); --badge-bd: rgba(207, 75, 75, .45); }
.badge.error { --badge: #b18ae0; --badge-bg: rgba(154, 107, 214, .12); --badge-bd: rgba(154, 107, 214, .45); }
.badge.waiting { --badge: #9aa2b1; --badge-bg: rgba(139, 147, 162, .10); --badge-bd: rgba(139, 147, 162, .35); }

/* Detail */

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -.01em;
  font-weight: 600;
}
.detail-head .badge { margin-top: 4px; flex: 0 0 auto; }

.btn-back {
  display: none;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 5px 9px 5px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.btn-back:hover { color: var(--text); border-color: var(--muted-2); }

.notice {
  margin: 0 0 16px;
  padding: 9px 12px;
  border-left: 2px solid var(--warn);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}
.notice-muted { border-left-color: var(--line); }

.preview { color: var(--text); word-break: break-word; }
.preview > *:first-child { margin-top: 0; }
.preview p { margin: 0 0 14px; }
.preview h2, .preview h3, .preview h4 {
  margin: 24px 0 10px;
  line-height: 1.3;
  letter-spacing: -.01em;
}
.preview h2 { font-size: 18px; }
.preview h3 { font-size: 16px; }
.preview ul, .preview ol { margin: 0 0 14px; padding-left: 22px; }
.preview li { margin-bottom: 6px; }
.preview a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.preview blockquote {
  margin: 0 0 14px;
  padding: 8px 0 8px 14px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}
.preview img, .preview iframe {
  max-width: 100%;
  display: block;
  margin: 16px 0;
  border: 0;
  border-radius: var(--radius-sm);
}
.preview img {
  width: auto;
  max-height: 340px;
}
.preview iframe { aspect-ratio: 16 / 9; width: 100%; height: auto; }
.preview figure { margin: 16px 0; }
.preview figcaption { color: var(--muted-2); font-size: 12px; margin-top: 6px; }

/* Fakty */

.facts {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0;
  margin: 24px 0 0;
  padding: 0;
  border-top: 1px solid var(--line-soft);
  font-size: 13.5px;
}

.facts dt {
  color: var(--muted);
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.facts dd {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.facts dd a { color: var(--accent); text-decoration: none; }
.facts dd a:hover { text-decoration: underline; }

.status {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: 13px;
}
.status.ok { border-color: rgba(47, 158, 99, .45); color: #8fd3ab; }
.status.err { border-color: rgba(207, 75, 75, .45); color: #e8a3a3; }

/* Akcie */

.actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--actions-h) + env(safe-area-inset-bottom));
  padding: 0 20px env(safe-area-inset-bottom);
  background: rgba(11, 13, 17, .88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, .35);
  border-top: 1px solid var(--line);
}

.actions-inner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  height: var(--actions-h);
  max-width: 760px;
  margin: 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: #1b212b; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--ok);
  border-color: var(--ok);
  color: #07150d;
  font-weight: 600;
}
.btn-primary:hover { background: #35b071; border-color: #35b071; }

.btn-danger {
  background: transparent;
  border-color: rgba(207, 75, 75, .55);
  color: #e8a3a3;
}
.btn-danger:hover { background: rgba(207, 75, 75, .12); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }

/* Skeleton pri načítaní zoznamu */

.skeleton { display: flex; flex-direction: column; gap: 4px; }

.sk-row {
  display: grid;
  grid-template-columns: 22px 1fr 56px;
  gap: 10px;
  align-items: center;
  padding: 14px 10px;
  border-radius: var(--radius);
  background: var(--panel);
}

.sk-seq, .sk-line, .sk-pill {
  background: linear-gradient(90deg, #1a1f28 25%, #232a36 37%, #1a1f28 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.5s ease infinite;
  border-radius: 4px;
}

.sk-seq { width: 12px; height: 12px; justify-self: end; }
.sk-title { height: 12px; width: 72%; }
.sk-pill { height: 20px; width: 56px; border-radius: 6px; }

@keyframes sk-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sk-seq, .sk-line, .sk-pill { animation: none; }
}

/* Empty a guard */

.empty {
  color: var(--muted-2);
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
}

/* prázdny detail sa centruje v celej ploche stĺpca */
.col-detail > .empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.guard {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  z-index: 40;
}

.guard-box { max-width: 320px; text-align: center; }
.guard-box h1 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.01em; }
.guard-box p { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.guard-box .btn { display: inline-flex; }

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 6, 9, .7);
  backdrop-filter: blur(3px);
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.modal-title { margin: 0 0 6px; font-size: 17px; letter-spacing: -.01em; }
.modal-text { margin: 0 0 16px; color: var(--muted); font-size: 14px; }

.reason { display: block; margin-bottom: 16px; }
.reason .field-label { margin-bottom: 6px; }

.reason textarea {
  width: 100%;
  resize: vertical;
  min-height: 76px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 14px;
}
.reason textarea:focus-visible { outline-offset: 0; }

.hint { display: block; min-height: 16px; margin-top: 5px; color: var(--muted-2); font-size: 12px; }
.hint.err { color: #e8a3a3; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Toasty */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--actions-h) + 20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  width: calc(100% - 36px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--muted-2);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }

/* Responzív */

@media (max-width: 760px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 8px;
  }

  .topbar-right { gap: 10px; }
  .counts { width: 100%; }

  .layout { grid-template-columns: 1fr; }
  .col-list { border-right: 0; }

  body.detail-open .col-list { display: none; }
  body:not(.detail-open) .col-detail { display: none; }
  body.detail-open .col-detail { display: flex; }

  .btn-back { display: inline-flex; }

  #detail { padding: 0 16px calc(128px + env(safe-area-inset-bottom)); }
  .detail-inner { padding-top: 14px; }
  .detail-title { font-size: 19px; }

  .facts { grid-template-columns: 120px 1fr; }

  .actions {
    position: sticky;
    height: auto;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }

  .actions-inner {
    height: auto;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }

  .actions-inner .btn { height: 44px; width: 100%; }

  .toasts { bottom: calc(120px + env(safe-area-inset-bottom)); }
}
