/* Argumentor — „papier na plátne“. Newton-ovský pokoj: biely list na pálenej
   sivej, zelený akcent, hairline detaily, žiadne ťažké rámy. */

:root {
  --canvas: #F2F4F4;
  --paper: #FFFFFF;
  --ink: #1C2326;
  --muted: #79858A;
  --faint: #A8B2B6;
  --line: #E4E8E9;
  --accent: #0E9F6E;
  --accent-ink: #0B7F58;
  --accent-soft: #E3F4EC;

  --neg: #C4504C;     --neg-bg: #FAEDEC;   --neg-strong: #F5D9D7;
  --dual: #A87C24;    --dual-bg: #FAF2DF;  --dual-strong: #F3E4BC;
  --pos: #178F62;     --pos-bg: #E7F4EE;   --pos-strong: #CFEADD;

  --ui: "Schibsted Grotesk", -apple-system, sans-serif;
  --doc: "Source Serif 4", Charter, Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- horný pás ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 36px;
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: blur(10px);
}
.brand {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 700; font-size: 19px; letter-spacing: -0.02em;
}
.topbar-right { display: flex; align-items: center; gap: 18px; }

.counter { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--neg); font-weight: 600; }

.status { font-size: 13px; color: var(--neg); max-width: 420px; }
.status.busy { color: var(--muted); }

.btn {
  font: 600 14px/1 var(--ui);
  border: 0; border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(14,159,110,.35);
}
.btn.primary:hover { background: var(--accent-ink); box-shadow: 0 4px 14px rgba(14,159,110,.30); }
.btn.primary:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line);
}
.btn.ghost:hover { color: var(--ink); border-color: var(--faint); }

/* tenká zelená linka počas analýzy */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 50; }
.progress span {
  display: block; height: 100%; width: 30%;
  background: var(--accent);
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

/* ---------- pracovná plocha ---------- */

.workspace {
  display: flex; justify-content: center; align-items: flex-start;
  gap: 20px;
  padding: 16px 36px 96px;
}

/* výber žánru */
.genre-sel {
  font: 600 12px/1 var(--ui); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); padding: 8px 12px;
  cursor: pointer; outline: none; appearance: none;
}
.genre-sel:hover { color: var(--ink); border-color: var(--faint); }

/* chip so zisteným žánrom */
.genre-chip {
  display: inline-block; margin-top: 10px;
  font: 600 11px/1 var(--ui); letter-spacing: .04em;
  color: var(--accent-ink); background: var(--accent-soft);
  border-radius: 999px; padding: 6px 12px;
}

/* keď sú odporúčania vypnuté v Nastaveniach, skry „→ odporúčanie" v kartách */
html.hide-rec .ph .rec { display: none !important; }

/* prepínač šírky papiera */
.widths {
  display: flex; align-items: center; gap: 4px;
  padding: 4px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper);
}
.w-btn {
  width: 30px; height: 22px;
  border: 0; border-radius: 999px; background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s ease;
}
.w-btn span { height: 3px; border-radius: 2px; background: var(--faint); transition: background .15s; }
.w-btn[data-w="760"] span { width: 10px; }
.w-btn[data-w="920"] span { width: 15px; }
.w-btn[data-w="1100"] span { width: 20px; }
.w-btn:hover { background: var(--canvas); }
.w-btn.on { background: var(--accent-soft); }
.w-btn.on span { background: var(--accent-ink); }

/* list papiera */
.page-col { flex: 0 1 var(--sheet-w, 760px); min-width: 0; transition: flex-basis .3s cubic-bezier(.2,.7,.3,1); }
.paper {
  background: var(--paper);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(22,32,38,.07), 0 12px 40px rgba(22,32,38,.07);
  min-height: 82vh;
  padding: clamp(40px, 7vw, 84px) clamp(28px, 7vw, 92px);
  animation: rise .45s cubic-bezier(.2,.7,.3,1) both;
  transition: box-shadow .2s ease;
}
.paper:focus-within {
  box-shadow: 0 1px 2px rgba(22,32,38,.07), 0 12px 40px rgba(22,32,38,.09),
              0 0 0 3px var(--accent-soft);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.doc-title {
  outline: none;
  font: 600 27px/1.3 var(--doc);
  color: var(--ink);
  margin: 0 0 20px;
  caret-color: var(--accent);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.doc-title:empty::before {
  content: attr(data-placeholder);
  color: var(--faint); font-style: italic; font-weight: 400;
}

.sheet {
  min-height: 60vh;
  font-family: var(--doc);
  font-size: 17.5px;
  line-height: 1.78;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  outline: none;
  caret-color: var(--accent);
}

.sheet:empty::before {
  content: attr(data-placeholder);
  color: var(--faint);
  font-style: italic;
}
.sheet[contenteditable="false"] { cursor: default; }
.sheet ::selection { background: var(--accent-soft); }

/* block-element styles for imported / formatted body HTML */
.sheet p { margin: 0 0 0.9em; }
.sheet p:last-child { margin-bottom: 0; }
.sheet ul,
.sheet ol { margin: 0 0 0.9em; padding-left: 1.5em; }
.sheet li { margin: 0.2em 0; }
.sheet a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.sheet strong { font-weight: 700; }
.sheet em { font-style: italic; }

/* zvýraznenia v liste */
mark {
  border-radius: 3px;
  padding: 1px 1px;
  cursor: pointer;
  color: inherit;
  transition: background .18s ease;
  border-bottom: 2px solid transparent;
}
mark.negativna { background: var(--neg-bg); border-bottom-color: var(--neg); }
mark.dvojsecna { background: var(--dual-bg); border-bottom-color: var(--dual); }
mark.pozitivna { background: var(--pos-bg); border-bottom-color: var(--pos); }
mark.abstain { background: transparent; border-bottom-style: dotted; }
mark.lit.negativna { background: var(--neg-strong); }
mark.lit.dvojsecna { background: var(--dual-strong); }
mark.lit.pozitivna { background: var(--pos-strong); }
.sheet.focused mark:not(.lit) { background: transparent; border-bottom-color: var(--line); }

/* ---------- pravý stĺpec ---------- */

.rail {
  flex: 0 0 var(--rail-w, 320px);
  position: sticky; top: 84px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding-left: 12px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  transition: flex-basis .3s cubic-bezier(.2,.7,.3,1);
}
.rail--dragging { transition: none; }
.rail-resizer {
  flex: 0 0 6px; align-self: stretch;
  position: relative; z-index: 10; cursor: col-resize;
}
.rail-resizer::after {
  content: ""; position: absolute; left: 1px; top: 90px;
  width: 4px; height: 54px; border-radius: 4px;
  background: var(--line); transition: background .15s;
}
.rail-resizer:hover::after,
.rail-resizer.rail--dragging::after { background: var(--accent); }
.workspace.rail-resized { justify-content: flex-start; }

.rail-empty { padding-top: 28px; animation: fade .6s .15s both; }
@keyframes fade { from { opacity: 0; } }
.rail-hint { color: var(--faint); font-size: 14px; margin: 0 0 18px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.s-neg { background: var(--neg); } .s-dual { background: var(--dual); } .s-pos { background: var(--pos); }

.score { padding: 22px 0 18px; display: flex; flex-direction: column; align-items: flex-start; }
.score-label { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; color: var(--muted); }
/* Grade is demoted: the qualitative one-liner reads first, the band sits below it
   (both secondary to the argument map, which is the hero above this block). */
.score-num { margin: 4px 0 2px; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.score-num .of { font-size: 12px; color: var(--faint); }
/* ---- A–F grade palette: green (A) → red (F) ---- */
#scoreNum.grade { font-weight: 800; font-size: 64px; line-height: 1; letter-spacing: -0.03em; color: var(--ink); }
#scoreNum.grade--A { color: #0e9f6e; }
#scoreNum.grade--B { color: #8a9410; }
#scoreNum.grade--C { color: #c98a00; }
#scoreNum.grade--D { color: #e8590c; }
#scoreNum.grade--F { color: #e02424; }
#scoreNum.grade--none { color: var(--faint); }

/* Sidebar + version-history grade chip: tinted by letter, right-aligned slot */
.sidebar-grade { min-width: 18px; text-align: center; flex-shrink: 0; font-weight: 700; }
.sidebar-grade--A { color: #0a7c54; background: #cfeee0; }
.sidebar-grade--B { color: #7c8500; background: #f1f4c2; }
.sidebar-grade--C { color: #9a6a00; background: #f6ecc9; }
.sidebar-grade--D { color: #b8480c; background: #fbe3d2; }
.sidebar-grade--F { color: #b91c1c; background: #fbdada; }
.sidebar-grade--none { color: var(--faint); background: var(--canvas); }
.score-note { margin: 12px 0 0; font-size: 12px; line-height: 1.55; color: var(--faint); }

.dimensions {
  display: grid; gap: 9px;
  padding: 18px 0 22px;
  border-top: 1px solid var(--line);
}
.dim { display: grid; grid-template-columns: 108px 1fr; align-items: center; gap: 12px; }
.dim span:first-child { font-size: 12px; color: var(--muted); }
.dim .bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.dim .bar > span {
  display: block; height: 100%; border-radius: 2px;
  background: var(--ink); opacity: .55;
  animation: grow .7s cubic-bezier(.2,.7,.3,1) both;
}
.dim-legend { margin-top: 9px; font-size: 11px; color: var(--faint); }
@keyframes grow { from { width: 0 !important; } }

.rail-heading {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 4px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.phenomena { list-style: none; margin: 0; padding: 0; }
.ph {
  position: relative;
  padding: 14px 12px 14px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease;
  animation: fade .4s both;
}
.ph + .ph { border-top: 1px solid var(--line); }
.ph::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 2px;
}
.ph.negativna::before { background: var(--neg); }
.ph.dvojsecna::before { background: var(--dual); }
.ph.pozitivna::before { background: var(--pos); }
.ph:hover { background: #FBFCFC; }
.ph.active { background: var(--paper); box-shadow: 0 1px 2px rgba(22,32,38,.06), 0 6px 22px rgba(22,32,38,.08); }
.ph.active { border-top-color: transparent; }
.ph.active + .ph { border-top-color: transparent; }

.ph .name { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.ph .meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.ph .why { font-size: 13px; line-height: 1.55; color: var(--muted); margin-top: 8px; }
.ph .rec { font-size: 13px; line-height: 1.5; margin-top: 8px; color: var(--accent-ink); display: none; }
.ph .rec::before { content: "→ "; }
.ph.active .why { color: var(--ink); }
.ph.active .rec { display: block; }

.ph.abstain { opacity: .52; }
.ph.abstain:hover, .ph.abstain.active { opacity: 1; }
.maybe {
  margin-left: 8px; font-size: 10.5px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px;
  vertical-align: 2px;
}

/* ---------- responzivita ---------- */

@media (max-width: 1180px) {
  .workspace { flex-direction: column; align-items: center; }
  .rail { position: static; max-height: none; flex-basis: auto; width: 100%; max-width: 760px; }
}
@media (max-width: 640px) {
  .topbar { padding: 14px 18px; }
  .workspace { padding: 8px 14px 64px; }
  .counter { display: none; }
}

/* ==========================================================================
   App layout (sidebar + main)
   ========================================================================== */

body.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */

.sidebar {
  flex: 0 0 240px;
  width: 240px;
  min-width: 0;
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: width .25s cubic-bezier(.2,.7,.3,1), flex-basis .25s cubic-bezier(.2,.7,.3,1);
  overflow: hidden;
  position: relative;
}

.sidebar--collapsed {
  flex: 0 0 40px;
  width: 40px;
}
.sidebar--collapsed .sidebar-inner { opacity: 0; pointer-events: none; }
.sidebar--collapsed .sidebar-expand-btn { display: flex !important; }

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: opacity .15s;
  overflow: hidden;
}

.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 14px 10px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 700; font-size: 16px; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden;
}

.sidebar-collapse-btn,
.sidebar-expand-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--line); border-radius: 6px;
  background: transparent; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: color .15s, background .15s;
}
.sidebar-collapse-btn:hover,
.sidebar-expand-btn:hover { color: var(--ink); background: var(--canvas); }

.sidebar-expand-btn {
  position: absolute; top: 18px; left: 6px; display: none;
}

/* brand wordmarks are home links — keep them looking like text */
.sidebar-brand, .brand { color: inherit; text-decoration: none; }
.sidebar-brand:hover, .brand:hover { opacity: .85; }

/* collapsed sidebar: small O logo (home link) stays visible, expand btn below it */
.sidebar-mini { display: none; }
.sidebar-mini img { display: block; border-radius: 5px; }
.sidebar--collapsed .sidebar-mini { display: flex; position: absolute; top: 16px; left: 9px; }
.sidebar--collapsed .sidebar-expand-btn { top: 54px; left: 6px; }

.sidebar-new-btn {
  display: flex; align-items: center; gap: 7px;
  margin: 4px 10px 8px;
  padding: 9px 12px;
  font: 600 13px/1 var(--ui); color: var(--accent-ink);
  background: var(--accent-soft); border: none; border-radius: 8px;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.sidebar-new-btn:hover { background: #d1eee1; }

/* Articles list */
.sidebar-articles-wrap {
  flex: 1; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  padding: 0 6px 8px;
}

.sidebar-articles {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 1px;
}

.sidebar-empty {
  padding: 12px 8px;
  font-size: 13px; color: var(--faint); text-align: center;
}

.sidebar-item {
  display: flex; align-items: center;
  padding: 9px 8px 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .12s;
  gap: 6px;
  min-width: 0;
}
.sidebar-item:hover { background: var(--canvas); }
.sidebar-item--active { background: var(--accent-soft); }
.sidebar-item--active:hover { background: #d1eee1; }

.sidebar-item-title {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 500; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-item-actions {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}

.sidebar-score {
  font: 700 11px/1 var(--ui);
  border-radius: 4px; padding: 2px 5px;
  /* colour + background come from .sidebar-grade--A…F (per-letter) */
}

.sidebar-action-btn {
  width: 22px; height: 22px;
  border: none; border-radius: 4px; background: transparent;
  color: var(--faint);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0;
  transition: opacity .12s, background .12s, color .12s;
}
.sidebar-item:hover .sidebar-action-btn { opacity: 1; }
.sidebar-action-btn:hover { background: var(--canvas); color: var(--muted); }
.sidebar-action-btn--danger:hover { background: var(--neg-bg); color: var(--neg); }

.sidebar-rename-input {
  flex: 1; min-width: 0;
  font: 500 13px/1 var(--ui); color: var(--ink);
  border: 1.5px solid var(--accent); border-radius: 5px;
  padding: 3px 6px; outline: none; background: var(--paper);
}

/* Bottom menu */
.sidebar-bottom {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0; flex-wrap: wrap;
}

.sidebar-menu-btn {
  font: 500 12px/1 var(--ui); color: var(--muted);
  background: transparent; border: none; cursor: pointer;
  padding: 2px 4px; border-radius: 4px;
  transition: color .12s, background .12s;
}
.sidebar-menu-btn:hover { color: var(--ink); background: var(--canvas); }

.sidebar-menu-sep {
  font-size: 12px; color: var(--faint);
}

/* ---------- App main (topbar + workspace) ---------- */

.app-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.app-main .workspace {
  flex: 1;
  overflow-y: auto;
}

.topbar-right--full { margin-left: auto; }

/* ---------- No-article hint ---------- */
.no-article-hint {
  margin-top: 40px; text-align: center;
  color: var(--faint); font-size: 14px;
}

/* ---------- Version switcher ---------- */

.version-switcher {
  background: var(--canvas);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

.version-switcher-head {
  margin-bottom: 8px;
}

.version-switcher-label {
  font: 600 10.5px/1 var(--ui); letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint);
}

.version-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 2px;
  max-height: 130px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}

.version-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
}
.version-item:hover { background: #e8efec; }
.version-item--active { background: var(--accent-soft); }

.version-num {
  font: 600 12px/1 var(--ui); color: var(--ink);
  min-width: 24px;
}
.version-score {
  font: 700 11px/1 var(--ui);
  min-width: 20px; text-align: center;
  border-radius: 4px; padding: 2px 5px;
  /* colour + background come from .sidebar-grade--A…F */
}
.version-date {
  font-size: 11.5px; color: var(--faint);
  margin-left: auto;
}

/* ---------- Modals ---------- */

/* Atribút hidden musí vždy vyhrať nad display z tried (.modal-overlay,
   .auth-form…). Bez !important trieda s display:flex prebije UA [hidden]. */
[hidden] { display: none !important; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(22,32,38,.35);
  display: flex; align-items: center; justify-content: center;
  animation: fade .18s ease;
}

.modal-card {
  background: var(--paper);
  border-radius: 12px;
  box-shadow: 0 4px 32px rgba(22,32,38,.18);
  width: 100%; max-width: 460px;
  margin: 20px;
  animation: rise .25s cubic-bezier(.2,.7,.3,1);
}

.modal-card--sm { max-width: 360px; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font: 700 17px/1 var(--ui); letter-spacing: -0.01em; color: var(--ink);
  margin: 0;
}

.modal-close {
  width: 28px; height: 28px;
  border: none; border-radius: 6px;
  background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--canvas); color: var(--ink); }

.modal-body { padding: 20px 24px 24px; }
.modal-body-text { font-size: 14px; line-height: 1.55; color: var(--muted); margin: 0 0 20px; }
.modal-stub-note { font-size: 14px; color: var(--faint); line-height: 1.55; margin: 0; }

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

.btn.danger {
  background: var(--neg); color: #fff;
  box-shadow: 0 1px 2px rgba(196,80,76,.3);
}
.btn.danger:hover { background: #b03c38; }

/* ---------- Settings modal ---------- */

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-child { border-bottom: none; }
.settings-label {
  font-size: 14px; font-weight: 500; color: var(--ink);
}
/* label + explanation stacked on the left, control on the right */
.settings-text { display: flex; flex-direction: column; gap: 3px; }
.settings-help {
  margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted);
}
.settings-row .settings-switch { flex-shrink: 0; }

/* ---------- Account modal ---------- */

.modal-card--wide { max-width: 520px; }

.account-section { padding: 4px 0 12px; }
.account-section-title {
  font: 600 12px/1 var(--ui); letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 14px;
}
.account-section-title--danger { color: var(--neg); }
.account-divider { height: 1px; background: var(--line); margin: 4px 0 16px; }

.form-row {
  display: grid; grid-template-columns: 110px 1fr;
  align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.form-label {
  font-size: 13px; font-weight: 500; color: var(--muted);
}
.form-input {
  font: 400 14px/1 var(--ui); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line);
  border-radius: 7px; padding: 9px 12px;
  outline: none; transition: border-color .15s;
  width: 100%;
}
.form-input:focus { border-color: var(--accent); }
.form-input--readonly {
  background: var(--canvas); color: var(--muted);
  cursor: default;
}

.form-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; margin-top: 4px;
}
.form-msg {
  font-size: 13px; line-height: 1.4;
  max-width: 240px; text-align: right;
}
.form-msg--ok { color: var(--accent-ink); }
.form-msg--error { color: var(--neg); }

.account-danger-note {
  font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0 0 14px;
}

.privacy-note {
  font-size: 13px; color: var(--faint); line-height: 1.65; margin: 0;
}
.privacy-link {
  color: var(--accent-ink); text-decoration: none; border-bottom: 1px solid var(--accent-soft);
}
.privacy-link:hover { border-bottom-color: var(--accent-ink); }

/* ---------- App-layout responsive ---------- */

@media (max-width: 900px) {
  body.app-layout { flex-direction: column; }
  .sidebar {
    flex: 0 0 auto; width: 100%; height: auto;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .sidebar--collapsed { flex: 0 0 auto; height: 40px; width: 100%; }
  .sidebar-inner { flex-direction: row; padding: 8px 12px; overflow: visible; }
  .sidebar-articles-wrap { display: none; }
  .sidebar-bottom { border-top: none; padding: 0; }
  .app-main { flex: 1; overflow: auto; }
  .app-main .workspace { overflow: visible; }
}

/* ---------- External source banner (read-only imports) ---------- */

.source-banner {
  display: flex; align-items: center; gap: 8px;
  max-width: var(--sheet-w, 760px);
  margin: 0 auto 12px;
  padding: 8px 14px;
  font-size: 12.5px; color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.source-banner svg { color: var(--faint); flex-shrink: 0; }
.source-banner a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.source-banner a:hover { text-decoration: underline; }
.source-fetched { color: var(--faint); }

/* External marker in the sidebar list — chain icon after title + score */
.sidebar-ext {
  display: inline-flex; align-items: center;
  color: var(--faint); flex-shrink: 0;
}

/* ---------- Multi-span phenomenon (numbered related spans) ---------- */

.ph-spans {
  display: flex; flex-direction: column; gap: 6px;
  margin: 8px 0 4px;
}
.ph-span {
  display: flex; align-items: baseline; gap: 6px;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--canvas); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px;
  font: inherit; color: var(--ink);
  transition: border-color .12s, background .12s;
}
.ph-span:hover { border-color: var(--accent); background: var(--accent-soft); }
.ph-span-num { font-weight: 700; color: var(--accent-ink); flex-shrink: 0; }
.ph-span-role {
  font: 600 10px/1.4 var(--ui); text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--paper);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
  flex-shrink: 0;
}
.ph-span-text {
  font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- New-article modal (write own / import URL) ---------- */

.new-choice { display: flex; flex-direction: column; gap: 10px; }
.new-choice-btn {
  display: grid; grid-template-columns: 28px 1fr; grid-row-gap: 2px;
  column-gap: 12px; align-items: center; text-align: left;
  padding: 14px 16px;
  background: var(--paper); cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 10px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.new-choice-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 2px 10px rgba(14,159,110,.12);
}
.new-choice-icon {
  grid-row: 1 / span 2;
  font-size: 20px; color: var(--accent-ink);
  text-align: center;
}
.new-choice-label { font: 600 14px/1.2 var(--ui); color: var(--ink); }
.new-choice-desc { font-size: 12.5px; color: var(--muted); }

.new-url-form { display: flex; flex-direction: column; gap: 8px; }
.new-url-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- Claim verification (on-demand web check) ---------- */

.ph-verify { margin-top: 10px; }
.ph-verify-btn {
  font: 600 12px/1 var(--ui); color: var(--accent-ink);
  background: var(--accent-soft); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.ph-verify-btn:hover { background: #d1eee1; border-color: var(--accent); }
.ph-verify-btn:disabled { opacity: .6; cursor: default; }
.ph-verify-result { margin-top: 8px; font-size: 12.5px; line-height: 1.5; }
.ph-verify-loading, .ph-verify-error { color: var(--muted); font-style: italic; }
.ph-verify-error { color: var(--neg); }
.verdict {
  display: inline-block; font: 700 11px/1 var(--ui); text-transform: uppercase;
  letter-spacing: .04em; border-radius: 4px; padding: 3px 7px; margin-bottom: 6px;
}
.verdict--podlozene { color: #0a7c54; background: #d7f0e4; }
.verdict--ciastocne { color: #9a6a00; background: #f6ecc9; }
.verdict--sporne    { color: #b91c1c; background: #fbdada; }
.verdict--nenaslo_sa { color: var(--muted); background: var(--canvas); }
.ph-verify-summary { color: var(--ink); margin-bottom: 6px; }
.ph-verify-sources { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.ph-verify-sources a {
  color: var(--accent-ink); font-size: 12px; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ph-verify-sources a:hover { text-decoration: underline; }
.ph-verify-note { font-size: 11px; color: var(--faint); line-height: 1.4; }

/* ---------- Version history dropdown (topbar) ---------- */
.version-dd { position: relative; }
.version-dd-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: 600 12px/1 var(--ui); color: var(--muted);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 12px; cursor: pointer;
  transition: color .12s, border-color .12s;
}
.version-dd-btn:hover { color: var(--ink); border-color: var(--faint); }
.version-dd-btn .version-score { min-width: 0; padding: 1px 5px; }
.version-dd-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40;
  min-width: 240px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 4px 24px rgba(22,32,38,.14);
  padding: 8px; animation: rise .16s ease;
}
.version-dd-head {
  font: 600 10px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); padding: 4px 8px 8px;
}
.version-dd-menu .version-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }

/* ---------- formatting selection bubble ---------- */
.fmt-bubble {
  position: absolute; z-index: 60;
  display: flex; gap: 2px; padding: 4px;
  background: var(--ink); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(22,32,38,.28);
  animation: rise .12s ease;
}
.fmt-btn {
  border: 0; background: transparent; color: #fff;
  width: 30px; height: 28px; border-radius: 6px; cursor: pointer;
  font: 600 14px/1 var(--ui);
}

/* ---------- argument map ---------- */
.argmap { font: 400 13.5px/1.5 var(--ui); margin-bottom: 18px; }
.arg-flash { background: var(--accent-soft); border-radius:3px; transition: background .4s; }

.fmt-btn:hover { background: rgba(255,255,255,.16); }

/* argument map heading + connector tree */
.argmap-heading { font: 600 11px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); margin: 18px 0 10px; }
.argmap-thesis { font-weight: 600; color: var(--ink); margin: 0 0 12px; }
.argmap-thesis-k { color: var(--accent-ink); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; margin-right: 6px; }
.argmap-tree { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 2px solid var(--line); display: grid; gap: 6px; }
.arg-row { position: relative; }
/* node dot centered ON the spine; canvas ring makes the line read into the dot */
.arg-node { position: absolute; left: -27px; top: 9px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--faint); box-shadow: 0 0 0 3px var(--canvas); }
.arg-node--pevny { background: var(--pos); }
.arg-node--slaby { background: var(--dual); }
.arg-node--nepodlozeny { background: var(--neg); }
.arg-row--weak .arg-node { box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--neg); }
.arg-head { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0;
  cursor: pointer; text-align: left; padding: 6px 4px; font: inherit; color: var(--ink); }
.arg-head:hover { background: var(--canvas); border-radius: 6px; }
.arg-claim { flex: 1; } .arg-toggle { color: var(--faint); }
.arg-row--weak .arg-claim { font-weight: 600; }
.arg-detail { padding: 4px 6px 12px 14px; display: grid; gap: 11px; }
.arg-field-k { display: block; color: var(--faint); font-size: 10.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; margin: 0 0 3px; }
.arg-field-v { display: block; font-size: 13.5px; line-height: 1.62; color: var(--ink); }
.arg-implicit { color: var(--faint); font-style: italic; }
.argmap-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.argmap-section-h { font: 600 11px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 10px; }
.argmap-counter { padding: 9px 11px; border-radius: 8px;
  background: var(--canvas); border-left: 3px solid var(--faint); }
.argmap-counter-label { font: 700 11px/1.4 var(--ui); letter-spacing: .02em; color: var(--muted); margin-bottom: 3px; }
.argmap-counter-note { font-size: 12.5px; line-height: 1.55; color: var(--ink); }
/* weakest link reason, inline under its (red-dotted) argument — no duplicate box */
.arg-weak-note { margin: 2px 0 4px; padding: 7px 10px; border-radius: 6px;
  background: var(--neg-bg); border-left: 3px solid var(--neg);
  font-size: 12px; line-height: 1.5; color: var(--ink); }
.arg-weak-k { color: var(--neg); font-weight: 700; }
.argmap-abstain { color: var(--muted); font-style: italic; }
.argmap-abstain-hint { color: var(--faint); font-style: normal; font-size: 12px; }
/* expert extras */
.expert-score { margin: 6px 0 0; font: 600 12.5px/1 var(--ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.ph-expert { margin-top: 4px; font: 500 11px/1.3 var(--ui); color: var(--faint); font-variant-numeric: tabular-nums; }
.settings-switch { width: 38px; height: 22px; cursor: pointer; }

/* ---------- Processing indicator (sidebar spinner + rail block) ---------- */

.sidebar-spinner, .rail-processing .sidebar-spinner {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.rail-processing { padding: 28px 4px; display: flex; align-items: center; gap: 10px; color: var(--muted); animation: fade .5s both; }
.rail-processing .sidebar-spinner { width: 18px; height: 18px; }
.sidebar-item .sidebar-spinner { margin-left: 6px; }

/* ---------- public share page ---------- */

.share-top {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 14px; padding: 18px 36px;
  border-bottom: 1px solid var(--line);
}
.share-top .brand { font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.share-tag { font-size: 12px; color: var(--faint); text-align: center; }
.share-cta { justify-self: end; font-size: 13px; color: var(--accent-ink); text-decoration: none; font-weight: 600; }
.share-workspace { padding-top: 24px; }
.share-error { max-width: 520px; margin: 80px auto; text-align: center; color: var(--muted); font-size: 16px; }
.share-body { --sheet-w: 920px; }  /* medium paper width on shared pages */
/* keep the rail sticky + independently scrollable so findings co-locate with text */
.share-body .rail { top: 24px; max-height: calc(100vh - 48px); }

/* ---------- share dialog ---------- */

.share-url { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: 13px var(--ui); margin: 10px 0; }
.share-actions { display: flex; gap: 10px; }
