/* ============ admin panel ============ */
.page-admin { background: var(--bg); }
/* buttons set their own display, which would otherwise show them while hidden */
.admin [hidden] { display: none !important; }
.admin { min-height: 100vh; }
.admin-boot, .adm-loading { display: grid; place-items: center; min-height: 40vh; }

.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 10px; gap: 6px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); border-color: transparent; color: #fff; }
.btn-ghost.danger { color: var(--danger); }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--lapis); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.link-btn { border: 0; background: none; padding: 0; color: var(--lapis); cursor: pointer; font-weight: 600; }
.link-btn:disabled { color: var(--muted); cursor: default; font-weight: 400; }

.badge { display: inline-flex; align-items: center; padding: 1px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 70%, var(--ink)); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.lapis { background: var(--lapis-soft); color: var(--lapis); }

/* top bar */
.adm-top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.adm-top-inner { width: min(1180px, 100% - 32px); margin-inline: auto; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.adm-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.adm-brand span { display: flex; flex-direction: column; line-height: 1.3; }
.adm-brand strong { font-family: var(--font-display); font-size: 23px; }
.adm-brand small { font-size: 12px; color: var(--muted); }
.adm-nav { display: flex; align-items: center; gap: 4px; }
.adm-nav a, .adm-logout {
  display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px;
  color: var(--ink-2); font-size: 14px; font-weight: 500; border: 0; background: none; cursor: pointer;
}
.adm-nav a:hover, .adm-logout:hover { background: var(--surface-2); color: var(--lapis); }
.adm-nav a.active { background: var(--lapis-soft); color: var(--lapis); }
@media (max-width: 760px) {
  .adm-nav span, .adm-brand small { display: none; }
  .adm-brand strong { font-size: 20px; }
}

.adm-main { width: min(1180px, 100% - 32px); margin: 0 auto; padding: 30px 0 80px; }
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.adm-head h1 { font-family: var(--font-display); font-size: clamp(30px, 4vw, 40px); }
.adm-head p { color: var(--ink-2); font-size: 14.5px; max-width: 640px; }
.adm-head-meta { display: flex; align-items: center; gap: 14px; font-size: 14px; margin-top: 4px; }
.adm-head-meta a { display: inline-flex; align-items: center; gap: 5px; }
.adm-crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 10px; color: var(--ink-2); }
@media (max-width: 600px) { .adm-head { flex-direction: column; align-items: stretch; } }

/* stats */
.adm-stats { list-style: none; margin: 0 0 28px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.adm-stats li { padding: 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; }
.adm-stats strong { font-family: var(--font-display); font-size: 34px; line-height: 1.2; color: var(--lapis); }
.adm-stats span { font-size: 13.5px; color: var(--muted); }
.adm-stats.compact { grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; }
.adm-stats.compact strong { font-size: 26px; }
@media (max-width: 700px) { .adm-stats { grid-template-columns: repeat(2, 1fr); } }

/* books */
.adm-books { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; }
@media (max-width: 520px) { .adm-books { grid-template-columns: 1fr; } }
.adm-book { display: flex; gap: 18px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); transition: box-shadow .2s, border-color .2s; }
.adm-book:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.adm-book-cover { flex: none; width: 92px; aspect-ratio: 2 / 3; border-radius: 8px 3px 3px 8px; overflow: hidden; box-shadow: var(--shadow-book); background: var(--paper-b); }
.adm-book-cover img { width: 100%; height: 100%; object-fit: cover; }
.thumb-art { width: 100%; height: 100%; display: grid; place-items: center; padding: 8px; text-align: center; color: #fbf3df; font-size: 11.5px; font-weight: 700; line-height: 1.5; background: linear-gradient(160deg, hsl(var(--hue) 46% 30%), hsl(calc(var(--hue) + 30) 50% 18%)); }
.adm-book-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.adm-book-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-book-title a { font-size: 17px; font-weight: 700; color: var(--ink); }
.adm-book-title a:hover { color: var(--lapis); }
.adm-book-meta { font-size: 13.5px; color: var(--ink-2); }
.adm-book-meta span { color: var(--muted); }
.adm-book-meta span::before { content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 7px 2px; background: currentColor; transform: rotate(45deg); vertical-align: middle; }
.adm-book-nums { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); margin-top: 4px; }
.adm-book-nums span { display: inline-flex; align-items: center; gap: 5px; }
.adm-book-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; }

.adm-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 60px 20px; border-radius: 18px; border: 1.5px dashed var(--line-strong); background: var(--surface); color: var(--muted); }
.adm-empty h2 { color: var(--ink); font-size: 20px; }
.adm-empty .btn { margin-top: 10px; }
.adm-empty.small { padding: 36px 20px; }

/* tabs & panel */
.adm-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.adm-tabs a {
  display: flex; align-items: center; gap: 7px; padding: 12px 16px; white-space: nowrap;
  color: var(--ink-2); font-weight: 600; font-size: 15px; border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.adm-tabs a:hover { color: var(--lapis); }
.adm-tabs a.active { color: var(--lapis); border-bottom-color: var(--lapis); }

/* forms */
.adm-form { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field b { color: var(--danger); }
.field small { color: var(--muted); font-size: 12.5px; }
.field input, .field textarea, .field select, .codes-toolbar select, .lookup-row input {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line-strong);
  background: var(--bg); font-size: 15px; line-height: 1.8; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field textarea:focus, .codes-toolbar select:focus, .lookup-row input:focus, .chips:focus-within {
  outline: none; border-color: var(--lapis); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lapis) 13%, transparent);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .7; }
.adm-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.hint { font-size: 13px; color: var(--muted); margin: 12px 0 4px; }

.book-form { display: grid; grid-template-columns: 240px 1fr; gap: 32px; }
.book-form .fields { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.cover-field { display: flex; flex-direction: column; gap: 10px; }
.cover-drop { display: block; cursor: pointer; }
.cover-preview {
  aspect-ratio: 2 / 3; border-radius: 12px 4px 4px 12px; overflow: hidden;
  border: 2px dashed var(--line-strong); background: var(--surface-2); transition: border-color .15s;
}
.cover-drop:hover .cover-preview, .cover-drop.over .cover-preview { border-color: var(--lapis); }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview:has(img) { border-style: solid; border-color: transparent; box-shadow: var(--shadow-book); }
.cover-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.cover-empty small { font-size: 12px; opacity: .8; }
@media (max-width: 760px) {
  .book-form { grid-template-columns: 1fr; }
  .cover-field { width: min(200px, 60%); justify-self: center; }
}

.chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 50px; padding: 7px 10px; cursor: text;
  border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--bg); transition: border-color .15s, box-shadow .15s;
}
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 6px 2px 4px; padding-inline: 12px 4px; border-radius: 99px; background: var(--lapis-soft); color: var(--lapis); font-size: 13.5px; font-weight: 600; }
.chip button { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 0; background: none; color: inherit; cursor: pointer; }
.chip button:hover { background: color-mix(in srgb, var(--lapis) 15%, transparent); }
.chip-input { flex: 1; min-width: 160px; border: 0 !important; background: transparent !important; outline: none; padding: 4px !important; box-shadow: none !important; font-size: 14.5px; }

.switch-row { display: flex; align-items: flex-start; gap: 14px; cursor: pointer; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row .switch { position: relative; flex: none; width: 44px; height: 26px; margin-top: 2px; border-radius: 99px; background: var(--line-strong); transition: background .2s; }
.switch-row .switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: inset-inline-start .2s; }
.switch-row input:checked + .switch { background: var(--ok); }
.switch-row input:checked + .switch::after { inset-inline-start: 21px; }
.switch-row input:disabled + .switch { opacity: .5; }
.switch-row input:focus-visible + .switch { outline: 2.5px solid var(--lapis); outline-offset: 2px; }
.switch-row strong { display: block; font-size: 15px; }
.switch-row small { display: block; font-size: 13px; color: var(--muted); line-height: 1.8; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; padding: 18px 22px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line)); }
.danger-zone p { font-size: 13.5px; color: var(--muted); }

/* text tab */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: 14px; background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 55%, var(--ink)); margin-bottom: 20px; font-size: 14.5px; }
.text-summary { margin-bottom: 22px; }
.chapter-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.chapter-list li { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.chapter-list li:last-child { border-bottom: 0; }
.chapter-list .num { font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--gold); min-width: 1.6em; }
.chapter-list .t { flex: 1; min-width: 0; font-weight: 500; }
.chapter-list .n { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.upload-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.file-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 34px 20px; border-radius: 18px; border: 2px dashed var(--line-strong); background: var(--surface);
  color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s;
}
.file-drop strong { color: var(--ink); font-size: 16px; }
.file-drop span { font-size: 13.5px; }
.file-drop .i { color: var(--lapis); }
.file-drop:hover, .file-drop.over { border-color: var(--lapis); background: var(--lapis-soft); }
.file-drop.busy { pointer-events: none; opacity: .6; }
.or { display: flex; align-items: center; color: var(--muted); font-size: 13px; }
.text-edit { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 24px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.text-edit p { font-size: 13.5px; color: var(--muted); }
@media (max-width: 760px) { .upload-grid { grid-template-columns: 1fr; } .or { justify-content: center; } }

.markup-help { margin-top: 20px; padding: 14px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.markup-help summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.markup-help p { margin: 10px 0; }
.markup-help table { border-collapse: collapse; width: 100%; }
.markup-help td { padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.markup-help code, .codes-table code, .devices code, .lookup-card code, .dlg-head code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13.5px;
  background: var(--surface-2); padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); white-space: nowrap;
}

/* codes tab */
.code-form h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; margin-bottom: 16px; }
.code-form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.code-form-grid .wide { grid-column: span 2; }
@media (max-width: 760px) { .code-form-grid { grid-template-columns: 1fr 1fr; } .code-form-grid .wide { grid-column: 1 / -1; } }

.codes-box { margin-top: 24px; }
.codes-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.search-mini { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--muted); }
.search-mini:focus-within { border-color: var(--lapis); }
.search-mini input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 9px 0; font-size: 14.5px; color: var(--ink); }
.codes-toolbar select { width: auto; padding: 8px 12px; font-size: 14px; background: var(--surface); }
.codes-count { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

.codes-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; font-size: 14px; }
.codes-table th { text-align: start; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.codes-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.codes-table tr:last-child td { border-bottom: 0; }
.codes-table tbody tr:hover td { background: var(--surface-2); }
.codes-table td small { display: block; font-size: 12px; color: var(--muted); }
.code-cell { display: inline-flex; align-items: center; gap: 4px; }
.code-cell code { font-size: 14.5px; font-weight: 600; letter-spacing: .5px; }
.note-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.row-actions { white-space: nowrap; text-align: end; }
@media (max-width: 860px) {
  .codes-table, .codes-table tbody, .codes-table tr, .codes-table td { display: block; }
  .codes-table { border: 0; background: none; }
  .codes-table thead { display: none; }
  .codes-table tr { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; padding: 8px 4px; }
  .codes-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 6px 12px; }
  .codes-table td[data-label]::before { content: attr(data-label); font-size: 12.5px; color: var(--muted); }
  .codes-table tbody tr:hover td { background: none; }
  .note-cell { max-width: none; }
  .row-actions { justify-content: flex-end !important; }
}

/* dialogs */
.adm-dialog {
  width: min(520px, calc(100% - 24px)); max-height: calc(100% - 40px); padding: 22px 24px; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -10px rgb(0 0 0 / .45);
}
.adm-dialog.wide { width: min(860px, calc(100% - 24px)); }
.adm-dialog::backdrop { background: rgb(15 18 28 / .45); backdrop-filter: blur(3px); }
.adm-dialog[open] { animation: dlg-in .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.adm-dialog h3 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.adm-dialog p { color: var(--ink-2); font-size: 14.5px; margin: 8px 0 14px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.r-x { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; flex: none; }
.r-x:hover { background: var(--surface-2); color: var(--ink); }
.adm-confirm .adm-actions { justify-content: flex-start; }
.created .i-checkCircle { color: var(--ok); }
.created textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--bg); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; line-height: 1.9; resize: vertical; text-align: left; }
.text-editor textarea {
  width: 100%; height: min(60vh, 560px); padding: 16px 18px; border-radius: 14px; border: 1.5px solid var(--line-strong);
  background: var(--bg); font-size: 15.5px; line-height: 2.1; resize: vertical;
}
.text-editor textarea:focus { outline: none; border-color: var(--lapis); }
.text-editor .markup-help { margin: 12px 0; }

.preview-body { max-height: 65vh; overflow: auto; padding: 8px 6px; font-size: 16px; line-height: 2.1; }
.preview-body h1 { font-family: var(--font-display); font-size: 30px; text-align: center; margin: 10px 0 20px; }
.preview-body h2 { font-size: 21px; margin: 20px 0 8px; }
.preview-body h3 { font-size: 18px; margin: 16px 0 6px; }
.preview-body p { text-align: justify; margin-bottom: 8px; }
.preview-body blockquote { margin: 14px 0; padding: 4px 18px; border-inline-start: 3px solid var(--gold); color: var(--ink-2); }
.preview-body hr { border: 0; text-align: center; margin: 18px 0; }
.preview-body hr::after { content: "◆ ◆ ◆"; color: var(--gold); font-size: 11px; letter-spacing: 10px; }

.device-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.device-list li { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.device-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--lapis-soft); color: var(--lapis); }
.device-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.device-body span, .device-body small { font-size: 12.5px; color: var(--muted); }
.device-body .progress { margin-top: 6px; height: 5px; }

/* lookup */
.lookup-form { max-width: 560px; }
.lookup-row { display: flex; gap: 10px; }
.lookup-row input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: 3px; text-align: center; text-transform: uppercase; }
.lookup-card { margin-top: 20px; max-width: 560px; padding: 22px 24px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.lookup-card h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; margin-bottom: 14px; }
.lookup-card dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 20px; margin: 0 0 18px; font-size: 14.5px; }
.lookup-card dt { color: var(--muted); }
.lookup-card dd { margin: 0; font-weight: 500; }

/* login */
.adm-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 80% 0%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 70%), var(--bg); }
.adm-login-card { width: min(400px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 36px 30px 26px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.adm-login-card h1 { font-family: var(--font-display); font-size: 30px; margin-top: 6px; }
.adm-login-card > p { color: var(--ink-2); font-size: 14px; margin-bottom: 6px; }
.adm-login-card .field { width: 100%; text-align: start; }
.form-error { min-height: 1.4em; font-size: 13.5px; color: var(--danger); font-weight: 500; }
.adm-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; margin-top: 6px; color: var(--muted); }
.adm-back.link-btn { font-weight: 400; color: var(--muted); }
.otp-input { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 24px !important; letter-spacing: 6px; text-align: center; }

.setup-card { width: min(460px, 100%); }
.setup-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--ok-soft); color: var(--ok); }
.setup-steps { margin: 4px 0 0; padding: 0; list-style: none; counter-reset: st; text-align: start; display: flex; flex-direction: column; gap: 8px; width: 100%; }
.setup-steps li { position: relative; padding-inline-start: 36px; font-size: 14px; color: var(--ink-2); line-height: 1.9; }
.setup-steps li::before {
  counter-increment: st; content: counter(st, persian);
  position: absolute; inset-inline-start: 0; top: 2px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--lapis-soft); color: var(--lapis); font-size: 13px; font-weight: 700;
}
.qr { width: 196px; height: 196px; padding: 8px; margin: 6px 0; background: #fff; border-radius: 14px; box-shadow: var(--shadow-sm); }
.qr svg { display: block; width: 100%; height: 100%; }
.manual-key { width: 100%; font-size: 13.5px; color: var(--muted); }
.manual-key summary { cursor: pointer; }
.manual-key div { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; }
.manual-key code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); word-break: break-all; }
.setup-note { font-size: 12.5px !important; color: var(--muted) !important; line-height: 1.9; }
.setup-note code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }

/* toast */
.adm-toast {
  position: fixed; z-index: 100; bottom: 24px; left: 50%; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  padding: 12px 20px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14.5px; font-weight: 500;
  box-shadow: 0 12px 30px -8px rgb(0 0 0 / .4); transition: opacity .2s, transform .2s;
}
.adm-toast.show { opacity: 1; transform: translate(-50%, 0); }
.adm-toast.ok .i { color: #7fd6a0; }
.adm-toast.error { background: var(--danger); color: #fff; }

/* codes that open every book */
.code-form .scope-row { margin-top: 16px; }
.codes-table .scope-badge { display: table; margin-top: 6px; }
