:root {
  --bg: #0e1116;
  --bg-2: #12171e;
  --panel: #161c24;
  --line: #243042;
  --text: #e8eef6;
  --muted: #8b9bb0;
  --teal: #14b8a6;
  --teal-2: #0f766e;
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #34d399;
  --shadow: 0 10px 30px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, Segoe UI, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
}

a { color: var(--teal); text-decoration: none; }
button, input, select, textarea { font: inherit; }

.sidebar {
  width: 232px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  color: var(--text);
  font-weight: 700;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--teal); color: #042f2e;
  display: grid; place-items: center; font-weight: 800;
}
.brand-logo { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; }
.menu { padding: 8px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); padding: 9px 10px; border-radius: 8px;
}
.menu-item:hover, .menu-item.is-active {
  background: rgba(20, 184, 166, .12);
  color: var(--text);
}
.menu-item.is-active { color: var(--teal); }
.icon { width: 18px; height: 18px; flex: 0 0 18px; }
.sidebar-foot {
  padding: 14px 16px; color: var(--muted); font-size: 12px;
  display: flex; align-items: center; gap: 8px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.shell { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 17, 22, .92);
}
.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; color: var(--muted);
}
.search { position: relative; }
.search input {
  flex: 1; border: 0; background: transparent; color: var(--text); outline: none;
}
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); z-index: 20; overflow: hidden;
}
.suggest a {
  display: block; padding: 8px 12px; color: var(--text);
}
.suggest a:hover, .suggest a.is-active { background: rgba(20,184,166,.12); }
.suggest .hint { color: var(--muted); font-size: 12px; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.editor-area {
  min-height: 220px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px; color: var(--text);
  width: 100%; max-width: 100%; box-sizing: border-box; display: block;
}
.form textarea { width: 100%; box-sizing: border-box; }
.note-body h2, .editor-area h2 { font-size: 22px; margin: 12px 0 8px; }
.note-body h3, .editor-area h3 { font-size: 18px; margin: 10px 0 6px; }
.form-wide { max-width: 900px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.lock-pill {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
}
.lock-pill.is-on { border-color: rgba(20,184,166,.45); color: var(--teal); }
.lock-pill.is-off { border-color: rgba(251,191,36,.4); color: var(--warn); }
.user-menu { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--teal); color: #042f2e;
  display: grid; place-items: center; font-weight: 700;
}
.content { padding: 24px; }

.flash { padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; }
.flash-ok { background: rgba(52,211,153,.12); color: var(--ok); }
.flash-error { background: rgba(248,113,113,.12); color: var(--danger); }
.flash-warning { background: rgba(251,191,36,.12); color: var(--warn); }

h1 { margin: 0 0 6px; font-size: 28px; }
.lead { color: var(--muted); margin: 0 0 22px; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 28px; font-weight: 700; margin-top: 8px; }
.grid-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 600; }
/* Flex nesmí jít na TD — rozbije vodorovné linky tabulky. */
td.row.actions {
  display: table-cell;
  vertical-align: middle;
  white-space: nowrap;
  width: 1%;
}
td.row.actions a.btn {
  display: inline-block;
  vertical-align: middle;
}
td.row.actions form {
  display: inline-block;
  vertical-align: middle;
  margin: 0;
}
.row.actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
}

.muted { color: var(--muted); }

.form { max-width: 720px; display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=email], select {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
}
.btn {
  background: var(--teal); color: #042f2e; border: 0; border-radius: 8px;
  padding: 9px 14px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
a.btn { text-decoration: none; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.btn.danger {
  background: #3a1c1c;
  color: #f5b7b1;
  border: 1px solid #7a3b3b;
  font-weight: 600;
}
.btn.danger:hover { background: #4a2323; color: #ffd4d0; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.row.actions { align-items: center; gap: 8px; }
.row.actions form { margin: 0; }
.upload-progress { display: grid; gap: 8px; }
.upload-progress-top { display: flex; justify-content: space-between; color: var(--text); font-size: 14px; }
.upload-progress-track {
  height: 12px; background: #1b2430; border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden;
}
.upload-progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #0f766e, #14b8a6, #5eead4);
  transition: width .15s linear;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.inline { display: inline; }

.login-wrap {
  min-height: 100vh; width: 100%;
  display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
}
.login-card.is-note {
  max-width: 720px;
  text-align: left;
}
.login-card.is-note .note-body { margin-top: 12px; }
.login-card.is-note .note-body p { margin: 0 0 10px; }
.help { font-size: 13px; color: var(--muted); }
.menu-sorter { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.menu-sorter li {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}

.crumb { color: var(--muted); margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.info-bar {
  display: flex; gap: 16px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; margin: 12px 0 16px; color: var(--muted);
}
.item-name {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 600;
}
.item-media {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-name img.thumb,
.item-media img.thumb,
.thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.item-text {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}
.item-name .item-title,
.item-text .item-title {
  display: block;
  min-width: 0;
  line-height: 1.25;
}
.item-name .item-meta,
.item-text .item-meta,
.item-meta {
  display: block;
  margin: 2px 0 0;
  padding: 0;
  font-weight: 400;
  line-height: 1.2;
}
.ext-badge {
  width: 40px;
  min-height: 22px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--teal);
  border: 1px solid rgba(20,184,166,.35);
  border-radius: 999px;
  padding: 3px 6px;
  white-space: nowrap;
}
.tree { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }

@media (max-width: 1100px) {
  .cards, .grid-2 { grid-template-columns: 1fr; }
  .sidebar { width: 76px; }
  .brand-name, .menu-item span, .sidebar-foot { display: none; }
  .menu-item { justify-content: center; }
  .page-head { flex-direction: column; }
}

.login-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.login-actions .btn { width: 100%; }


/* Dialog pro [url] v poznámkách */
.bb-url-modal{position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;padding:16px}
.bb-url-modal[hidden]{display:none!important}
.bb-url-dialog{background:var(--card,#1a2332);border:1px solid rgba(255,255,255,.08);border-radius:12px;padding:18px 20px;width:100%;max-width:420px;box-shadow:0 12px 40px rgba(0,0,0,.45)}
.bb-url-title{font-weight:600;margin-bottom:12px;font-size:1.05rem}
.bb-url-label{display:block;margin-bottom:12px;color:var(--muted,#9aa4b2);font-size:.9rem}
.bb-url-label input{display:block;width:100%;margin-top:6px;box-sizing:border-box}
.bb-url-check{display:flex;align-items:center;gap:8px;margin-bottom:16px;cursor:pointer;color:var(--text,#e8eef6);font-weight:400}
.bb-url-actions{display:flex;gap:10px;justify-content:flex-end}
