/*
 * BtlCloud – vizuální jazyk BTL101 / Bitlago: tmavá plocha, tečkovaná mřížka,
 * azurovo-fialový gradient, Space Mono pro nadpisy a popisky, DM Sans pro text.
 * Písma jsou hostovaná lokálně (SIL OFL, viz fonts/OFL-*.txt): dataroom nesmí
 * posílat adresy svých uživatelů Google Fonts a CSP povoluje jen vlastní zdroje.
 */

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('fonts/DMSans-300-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url('fonts/DMSans-300-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/SpaceMono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/SpaceMono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/SpaceMono-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/SpaceMono-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0a0e17;
  --surface: #111827;
  --surface-glass: rgba(17, 24, 39, 0.72);
  --field: #0b1220;
  --accent: #00d4ff;
  --accent2: #7c3aed;
  --accent3: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --muted: #9ca3af;
  --text: #e5e7eb;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --gradient: linear-gradient(90deg, var(--accent), var(--accent2));
  --mono: 'Space Mono', ui-monospace, 'Cascadia Mono', monospace;
  --sans: 'DM Sans', system-ui, sans-serif;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  background:
    radial-gradient(circle at 18% 6%, rgba(0, 212, 255, 0.10), transparent 38%),
    radial-gradient(circle at 92% 92%, rgba(124, 58, 237, 0.14), transparent 42%),
    var(--bg);
  background-attachment: fixed;
}

/* Tečkovaná mřížka přes celou plochu, dole vybledne. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
}

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

h1, h2, h3 { font-family: var(--mono); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); margin: 0 0 0.75rem; }
h1 .grad, h2 .grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

code, .mono { font-family: var(--mono); }
code { font-size: 0.85em; color: var(--accent); }

/* ---------- Stavební kameny ---------- */

.section-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.5);
  border-radius: 99px;
  padding: 3px 12px;
}

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 99px;
  background: rgba(0, 212, 255, 0.10);
  color: var(--accent);
  white-space: nowrap;
}
.pill.green { background: rgba(16, 185, 129, 0.12); color: var(--accent3); }
.pill.warn { background: rgba(245, 158, 11, 0.12); color: var(--warn); }
.pill.danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.pill.purple { background: rgba(124, 58, 237, 0.16); color: #a78bfa; }

.card {
  background: var(--surface-glass);
  backdrop-filter: blur(2px);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

/* ---------- Horní lišta ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.6rem clamp(16px, 4vw, 48px);
  background: rgba(10, 14, 23, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand-link { display: flex; align-items: center; gap: 0.75rem; min-width: 0; color: var(--text); }
.brand-link:hover { text-decoration: none; }
.brand-mark { height: 22px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-strip { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; }
.room-name { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-weight: 700; font-size: 0.95rem; }

.topbar nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; flex: 1; min-width: 0; }
.topbar nav a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.topbar nav a:hover, .topbar nav a.active { color: var(--text); text-decoration: none; border-bottom-color: var(--accent); }

.signout { display: flex; align-items: center; gap: 0.75rem; margin: 0; flex: none; }
.who { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Too narrow for brand, nav and account in one row: the nav takes a row of its own. */
@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; gap: 0.5rem 1.5rem; }
  .topbar nav { order: 3; flex-basis: 100%; }
  .signout { margin-left: auto; }
}

.content { padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 48px); max-width: 1240px; margin: 0 auto; }

/* ---------- Přihlášení a aktivace ---------- */

.account {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem 16px;
}

.account-panel { width: 100%; max-width: 28rem; }

.account-brand { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.25rem; }
.account-brand img { height: 34px; width: auto; }
.account-brand .brand-strip { font-size: 11px; }
.account-brand .brand-name { font-family: var(--mono); font-weight: 700; font-size: 1.1rem; }

.account .card { padding: 1.75rem; }
.account h1 { font-size: 1.6rem; }

.account-foot { margin-top: 1rem; font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-align: center; }

/* ---------- Formuláře ---------- */

form label {
  display: block;
  margin: 1rem 0 0.35rem;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

form input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.18); }

button {
  margin-top: 1.25rem;
  padding: 0.65rem 1.25rem;
  border: 0;
  border-radius: 8px;
  background: var(--gradient);
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
button:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0, 212, 255, 0.18); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
form > button[type="submit"] { width: 100%; }

.topbar button {
  margin-top: 0;
  padding: 0.35rem 0.8rem;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 11px;
}
.topbar button:hover { border-color: var(--accent); box-shadow: none; }

.validation-message { color: var(--danger); font-size: 0.85rem; margin-top: 0.25rem; }
.error, .notice {
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.92rem;
  margin: 0.75rem 0;
}
.error { color: #fca5a5; background: rgba(239, 68, 68, 0.10); border-left: 3px solid var(--danger); }
.notice { color: #6ee7b7; background: rgba(16, 185, 129, 0.10); border-left: 3px solid var(--accent3); }
ul.error { padding-left: 1.75rem; }
.hint { color: var(--muted); font-size: 0.88rem; margin-top: 1.25rem; }

/* Aktivace: QR kód potřebuje bílé pozadí, jinak ho telefon nepřečte. */
.steps { padding-left: 1.25rem; }
.steps li { margin-bottom: 0.9rem; }
.steps li::marker { font-family: var(--mono); color: var(--accent); }
.qr {
  display: block;
  margin: 0.75rem 0;
  width: 196px;
  height: 196px;
  image-rendering: pixelated;
  background: #fff;
  padding: 10px;
  border-radius: 8px;
}
.secret { display: inline-block; margin-top: 0.25rem; padding: 0.2rem 0.5rem; border-radius: 6px; background: var(--field); border: 1px solid var(--border); word-break: break-all; }

/* ---------- Přehled místnosti ---------- */

.room-head { margin-bottom: 2rem; }
.room-head .subtitle { color: var(--muted); max-width: 640px; }
/* A heading with its actions on one line, close to the content below (folder pages). */
.room-head.compact { margin-bottom: 0.75rem; }
.room-head .head-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.room-head .head-line h1 { margin: 0.25rem 0; }
.room-head .head-line .page-actions { margin-top: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-glass);
  overflow: hidden;
  margin-bottom: 2rem;
}
.stat { padding: 1.1rem 1.4rem; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat-value { font-family: var(--mono); font-size: 1.35rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.stat-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 0.3rem; }

/* ---------- Audit ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-glass); }


@media (max-width: 780px) {
  .topbar { flex-wrap: wrap; gap: 0.5rem 1rem; }
  .topbar nav { order: 3; flex-basis: 100%; }
  .stat { border-right: none; border-bottom: 1px solid var(--border); }
  .stat:last-child { border-bottom: none; }
}

@media (max-width: 640px) {
  .who { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
  button:hover { transform: none; }
}

/* ---------- Dokumenty a správa ---------- */

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; margin: 1.5rem 0; }
.card.purple { border-left-color: var(--accent2); }
.card.green { border-left-color: var(--accent3); }
.card.warn { border-left-color: var(--warn); }
.card.danger { border-left-color: var(--danger); margin-top: 1.5rem; }
.card + .card, .card + .table-wrap, .table-wrap + .card { margin-top: 1.5rem; }
/* A table of row actions sits inside its form; the card after it still needs the gap. */
form:has(> .table-wrap) + .card, .card + form:has(> .table-wrap) { margin-top: 1.5rem; }
/* Cards side by side share the row height (grid stretch); the stacking margin would shift the second one down. */
.grid-2 > .card + .card { margin-top: 0; }
.section-label.spaced { margin-top: 1.5rem; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 0.4rem; font-family: var(--mono); font-size: 12px; margin-bottom: 0.75rem; }
.breadcrumb .sep { color: var(--muted); }


.list { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.list th {
  text-align: left;
  padding: 0.7rem 0.8rem;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.2);
}
.list td { padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list tr:last-child td { border-bottom: 0; }
.list tr:hover td { background: rgba(0, 212, 255, 0.03); }
.list .hash { color: var(--muted); }
.list .actions { white-space: nowrap; }
.list.acl td, .list.acl th { text-align: center; }
.list.acl td:first-child, .list.acl th:first-child, .list.acl td:last-child, .list.acl th:last-child { text-align: left; }
.list.acl .source-own { display: inline-flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.list.acl .source-own button.small { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.list input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }

form select, form input[type="file"], form input[type="date"] {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  font: inherit;
}

button.ghost {
  margin: 0 0.25rem 0 0;
  padding: 0.3rem 0.7rem;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 11px;
}
button.ghost:hover { border-color: var(--accent); box-shadow: none; }
button.danger { background: var(--danger); }
button.ghost.danger { background: transparent; color: #fca5a5; }
button.ghost.danger:hover { border-color: var(--danger); }
button:disabled { opacity: 0.5; cursor: wait; transform: none; }

progress { width: 100%; margin-top: 0.75rem; accent-color: var(--accent); }

/* Práva skupin ve formuláři: řádek zaškrtávacích políček na skupinu, zalamuje se i v úzké kartě. */
details.rights { margin-top: 1rem; }
details.rights > summary { cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
details.rights > summary:hover { color: var(--accent); }
details.rights .hint { margin-top: 0.5rem; }
.rights-panel { display: grid; gap: 0.25rem; margin-top: 0.5rem; }
.rights-group { margin: 0; padding: 0.5rem 0 0.6rem; border: 0; border-top: 1px solid var(--border); }
.rights-group legend { padding: 0; font-weight: 500; float: left; width: 100%; margin-bottom: 0.35rem; }
.checks { clear: both; display: flex; flex-wrap: wrap; column-gap: 1rem; row-gap: 0.2rem; }
.checks label.check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-family: var(--sans);
  font-size: 0.88rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  cursor: pointer;
}
form label.check input[type="checkbox"] { width: 1rem; height: 1rem; padding: 0; accent-color: var(--accent); }

/* Nahrávání: zóna pro přetažení souborů i složek, s tlačítky pro výběr. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.4rem 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--field);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone > .icon { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.dropzone p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.dropzone.over { border-color: var(--accent); background: rgba(0, 212, 255, 0.06); }
.drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
form .drop-actions label.pick {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}
form .drop-actions label.pick:hover { border-color: var(--accent); color: var(--accent); }
.dropzone:focus-within { border-color: var(--accent); }

/* Náhled nahrávané složky: řádek na složku, odsazený podle hloubky. */
.folder-preview { margin-top: 1rem; }
.folder-tree { max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--field); }
.folder-row { padding: 0.45rem 0.8rem; border-bottom: 1px solid var(--border); }
.folder-row:last-child { border-bottom: 0; }
.folder-name { display: flex; align-items: center; gap: 0.5rem; }
.folder-name .icon { color: var(--accent2); }
.folder-name .muted { color: var(--muted); font-size: 0.85rem; }
.folder-row details.rights { margin: 0.35rem 0 0 1.5rem; }
.folder-row[data-touched] > details.rights > summary::after { content: " · vlastní"; color: var(--accent); }
/* Files of the preview under their folder: lighter than folder rows, no rights of their own. */
.file-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.8rem; border-bottom: 1px solid var(--border); font-size: 0.88rem; color: #cbd5e1; }
.file-row .icon { flex: none; color: var(--muted); }
.file-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row.d1 { padding-left: 2.2rem; }
.file-row.d2 { padding-left: 3.6rem; }
.file-row.d3 { padding-left: 5.0rem; }
.file-row.d4 { padding-left: 6.4rem; }
.file-row.d5 { padding-left: 7.8rem; }
.file-row.d6 { padding-left: 9.2rem; }
.file-row.d7 { padding-left: 10.6rem; }
.file-row.d8 { padding-left: 12.0rem; }
.file-row.d9 { padding-left: 13.4rem; }
.file-row.d10 { padding-left: 14.8rem; }
.folder-row.d1 { padding-left: 2.2rem; }
.folder-row.d2 { padding-left: 3.6rem; }
.folder-row.d3 { padding-left: 5.0rem; }
.folder-row.d4 { padding-left: 6.4rem; }
.folder-row.d5 { padding-left: 7.8rem; }
.folder-row.d6 { padding-left: 9.2rem; }
.folder-row.d7 { padding-left: 10.6rem; }
.folder-row.d8 { padding-left: 12.0rem; }
.folder-row.d9 { padding-left: 13.4rem; }
.folder-row.d10 { padding-left: 14.8rem; }

@media (max-width: 780px) {
  .list .wide { display: none; }
}

/* ---------- Prohlížeč ---------- */

.viewer-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.viewer-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 1rem 0; }
.viewer-toolbar button { margin: 0; }
.viewer-toolbar .hint { margin: 0; }
.viewer-search [data-viewer-search-count] { min-width: 4.5rem; }

.viewer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}
.viewer-page { display: block; width: 100%; max-width: 900px; height: auto; background: #fff; border-radius: 2px; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4); transition: filter 0.15s; }
.viewer.zoomed .viewer-page { max-width: 1800px; }
.viewer.blurred .viewer-page, .viewer.blurred .viewer-zoom { filter: blur(18px) grayscale(0.4); }
/* Search in the document: highlights over the page images and drawing overlays. */
.viewer-page-wrap { position: relative; width: 100%; max-width: 900px; }
.viewer.zoomed .viewer-page-wrap { max-width: 1800px; }
.viewer-page-wrap .viewer-page { max-width: none; }
.viewer-hit { position: absolute; background: rgba(250, 204, 21, 0.38); outline: 1px solid rgba(202, 138, 4, 0.7); border-radius: 2px; pointer-events: none; mix-blend-mode: multiply; }
.viewer-hit.is-current { background: rgba(249, 115, 22, 0.5); outline: 2px solid #ea580c; }
.viewer-search { display: inline-flex; align-items: center; gap: 0.25rem; margin: 0; }
.viewer-search input[type="search"] { width: 14rem; padding: 0.4rem 0.6rem; }
.viewer-search .icon-btn { margin: 0; }

/* A drawing: a deep-zoom area as wide as the viewer and most of the window high. */
.viewer-zoom { width: 100%; height: 78vh; background: #fff; border-radius: 2px; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4); transition: filter 0.15s; }

.viewer-shield {
  display: none;
  position: sticky;
  top: 40vh;
  z-index: 2;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: rgba(10, 14, 23, 0.9);
  border: 1px solid var(--accent);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
}
.viewer.blurred .viewer-shield { display: block; }
.viewer:not(.blurred) { cursor: default; }

/* ---------- NDA ---------- */

.nda-text { white-space: pre-line; max-height: 50vh; overflow-y: auto; padding: 1rem; margin: 1rem 0; border: 1px solid var(--border); border-radius: 8px; background: var(--field); font-size: 0.92rem; }
.nda-en summary { cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.account .card:has(.nda-text) { max-width: 46rem; }
.account-panel:has(.nda-text) { max-width: 46rem; }
textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  resize: vertical;
}
.decline { margin-top: 0.5rem; }
.decline button { width: 100%; }

/* Tisk z prohlížeče je v místnosti vypnutý; dokument se tiskne ze staženého PDF s vodoznakem. */
@media print {
  body { display: none !important; }
}

/* Storage gauge on the dashboard: a native meter, since the CSP allows no inline styles. */
meter.capacity {
  width: 100%;
  height: 0.6rem;
  margin: 0.4rem 0 0.6rem;
  appearance: none;
  border: none;
  border-radius: 999px;
  background: var(--field);
}
meter.capacity::-webkit-meter-bar { background: var(--field); border: none; border-radius: 999px; height: 0.6rem; }
meter.capacity::-webkit-meter-optimum-value,
meter.capacity::-webkit-meter-suboptimum-value { background: var(--gradient); border-radius: 999px; }
meter.capacity::-webkit-meter-even-less-good-value { background: var(--warn); border-radius: 999px; }
meter.capacity::-moz-meter-bar { background: var(--gradient); border-radius: 999px; }
meter.capacity:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--warn); }

/* ---------- Ikony (Lucide sprite wwwroot/icons.svg) ---------- */

/* Stroke styling lives here: presentation attributes of the sprite do not reach a <use>. */
.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.18em;
}
button .icon, a.btn .icon { margin-right: 0.45em; }
button, a.btn { display: inline-flex; align-items: center; justify-content: center; }

/* A link styled as the primary button, for navigation that reads as an action. */
a.btn {
  margin-top: 1.25rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  background: var(--gradient);
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
a.btn:hover { text-decoration: none; box-shadow: 0 6px 20px rgba(0, 212, 255, 0.18); }

/* Icon-only control; the label is the tooltip (data-tip) and the accessible name (aria-label). */
.icon-btn {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
}
.icon-btn .icon { margin: 0; }
.icon-btn:hover, .icon-btn:focus-visible {
  color: var(--accent);
  border-color: var(--border-strong);
  background: rgba(0, 212, 255, 0.06);
  text-decoration: none;
  transform: none;
  box-shadow: none;
}
.icon-btn[data-tip]:hover::after, .icon-btn[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  z-index: 20;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  pointer-events: none;
}
.page-actions { display: flex; gap: 0.25rem; align-items: center; }
.icon-btn.danger { background: transparent; }
.icon-btn.danger:hover, .icon-btn.danger:focus-visible { color: var(--danger); border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }
a.pill { margin: 0 0.3rem 0.2rem 0; text-decoration: none; }
a.pill:hover { text-decoration: none; filter: brightness(1.25); }

/* Záložky v hlavičce stránky (Přístupy: uživatelé / skupiny). */
.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 1rem; border-bottom: 1px solid var(--border-strong); }
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Formulář s poli vedle sebe; na úzké obrazovce pod sebou. */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); column-gap: 1rem; }
.form-row > button[type="submit"] { grid-column: 1 / -1; }
.room-head .page-actions, .viewer-head .page-actions { margin-top: 0.5rem; }

/* ---------- Strom dokumentů (název v tabulce DocumentTree) ---------- */

.tree-name { display: inline-flex; align-items: center; gap: 0.45rem; min-width: 0; max-width: 100%; }
.tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-name .kind { flex: none; color: var(--muted); }
.tree-name .kind.folder { color: var(--accent2); }
.tree-name span.tree-label { color: var(--text); font-weight: 500; }

/* Higher specificity than the full-width rule for form submit buttons, which would stretch it. */
form > button.icon-btn[type="submit"] { width: 2rem; }
.topbar .icon-btn { padding: 0; border-color: var(--border-strong); }
.topbar .icon-btn[data-tip]:hover::after, .topbar .icon-btn[data-tip]:focus-visible::after { bottom: auto; top: calc(100% + 6px); }

.nda-hash { word-break: break-all; }

/* Cards side by side: the submit button sits at the bottom, so buttons in one row line up. */
.grid-2 > .card { display: flex; flex-direction: column; }
.grid-2 > .card > form { flex: 1; display: flex; flex-direction: column; }
.grid-2 > .card > form > button[type="submit"] { margin-top: auto; }
.grid-2 > .card > form > :is(input, textarea, select, progress, p):last-of-type { margin-bottom: 1.25rem; }

/* ---------- Hledání ---------- */

.topbar-search { flex: 0 1 14rem; min-width: 8rem; margin: 0; }
.topbar-search input[type="search"] { width: 100%; padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.search-form { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.5rem; }
.search-form input[type="search"] { flex: 1; }
.search-form > button[type="submit"] { width: auto; margin-top: 0; white-space: nowrap; }
.search-hit h2 { margin: 0.25rem 0 0.75rem; font-size: 1.15rem; }
.search-version { margin-top: 0.5rem; }
.search-version ul { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.search-version li { display: grid; grid-template-columns: 6rem 1fr; gap: 0.75rem; padding: 0.35rem 0; border-top: 1px solid var(--border); font-size: 0.92rem; }
.search-snippet { color: #cbd5e1; }
.search-snippet mark, .search-hit mark { background: rgba(250, 204, 21, 0.25); color: #fde68a; padding: 0 0.1em; border-radius: 2px; }
.card.search-hit + .card.search-hit { margin-top: 1rem; }

/* Context of the session (group acted as, or administration) in the top bar. */
.topbar .ctx { display: inline-flex; align-items: center; gap: 0.35rem; padding: 4px 12px; flex: none; }
.topbar .ctx svg { width: 14px; height: 14px; }
a.ctx:hover { text-decoration: none; filter: brightness(1.25); }
.topbar a.ctx[data-tip] { position: relative; }
.topbar a.ctx[data-tip]:hover::after, .topbar a.ctx[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.25rem 0.6rem; font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0; text-transform: none; white-space: nowrap; z-index: 10;
}

/* Choice of the group to enter as: one button per option, the whole row clickable. */
.choice-list { display: grid; gap: 0.75rem; margin-top: 1rem; }
.choice-list .choice {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.25rem 0.75rem;
  width: 100%; margin: 0; padding: 0.85rem 1rem; text-align: left;
  background: var(--surface-glass); color: var(--text); border: 1px solid var(--border);
}
.choice-list .choice:hover, .choice-list .choice:focus-visible { border-color: var(--accent); }
.choice-list .choice.current { border-color: rgba(0, 212, 255, 0.5); }
.choice-list .choice svg { grid-row: span 2; width: 20px; height: 20px; color: var(--accent); }
.choice-list .choice-name { font-weight: 600; }
.choice-list .choice-hint { grid-column: 2; font-size: 0.8rem; color: var(--muted); }
.choice-list .choice .pill { grid-column: 3; grid-row: 1 / span 2; }
