/* Admin area. Shares tokens and components with the rest of the app. */
.admin-head { margin-bottom: 20px; }
.admin-head h1 { font-size: 28px; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a { padding: 10px 16px; color: var(--ink-2); font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 20px 0 12px; }
.toolbar p { margin: 0; }
.search-form { display: flex; gap: 8px; }
.search-form .input { width: 260px; max-width: 100%; }

.btn.danger, .btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover { background: var(--danger-bg); color: var(--danger); }
.input-sm { height: 36px; font-size: var(--fs-md); }
.input.area { height: auto; padding: 10px 14px; line-height: 1.5; resize: vertical; font-family: inherit; }
.input.mono, .mono { font-family: var(--mono); font-size: 14px; }
select.input { appearance: auto; }

.table-card { padding: 0; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.admin-table th, .admin-table td { padding: 11px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.admin-table th { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); background: var(--surface-2); }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .num { text-align: right; width: 90px; }
.admin-table .actions { text-align: right; white-space: nowrap; width: 1%; }
.admin-table tr.is-off td { opacity: .6; }
form.inline { display: inline; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
.q-cell { min-width: 280px; max-width: 520px; }
.q-excerpt { margin-bottom: 4px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--fs-sm); }
.chip-off { background: var(--danger-bg); color: var(--danger); }
.inline-edit { display: flex; gap: 8px; align-items: center; }
.inline-edit .input { max-width: 260px; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; margin-top: 20px; }
.filters .field { margin: 0; }
.filter-actions { display: flex; gap: 8px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }

.form-card { max-width: 100%; }
.form-card.wide { max-width: 860px; }
.form-card h3 { margin-bottom: 12px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; margin-top: 20px; }
fieldset.field { border: 0; padding: 0; margin: 0 0 16px; }
fieldset.field legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
.color-row { display: flex; gap: 8px; }
.color-row input[type="color"] { width: 48px; height: 48px; padding: 2px; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.error-list { margin: 6px 0 0; padding-left: 18px; }

/* option editor */
.opt-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; padding: 12px; margin-bottom: 10px;
  border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.opt-label { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-weight: 700;
  background: var(--surface-2); color: var(--ink-2); }
.opt-body { display: grid; gap: 8px; }
.opt-side { display: grid; gap: 8px; align-content: start; justify-items: end; }

.md-preview { margin-top: 8px; padding: 0 14px; border-left: 3px solid var(--border); color: var(--ink); }
.md-preview:empty { display: none; }

.term-tools { display: flex; gap: 8px; margin-bottom: 8px; }
.term-tools .input { max-width: 280px; }
.term-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px;
  max-height: 200px; overflow-y: auto; padding: 10px; border: 2px solid var(--border); border-radius: var(--radius-sm); }
.term-list [hidden] { display: none; }

@media (max-width: 640px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .opt-row { grid-template-columns: 1fr; }
  .opt-side { grid-auto-flow: column; justify-content: space-between; justify-items: start; }
}
tr.is-weak td { background: var(--danger-bg); }
