/* components.css — reusable primitives. Depends on tokens.css. */

/* ────────── Utility ────────── */
.hidden { display: none !important; }

/* ────────── Button ────────── */
.ot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--ot-btn-h);
  padding: 0 12px;
  font-family: var(--ot-font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ot-text-2);
  background: var(--ot-surface);
  border: 1px solid var(--ot-border);
  border-radius: var(--ot-radius-md);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  text-decoration: none;
  white-space: nowrap;
}
.ot-btn:hover {
  background: var(--ot-surface-2);
  border-color: var(--ot-border-strong);
  color: var(--ot-text);
}
.ot-btn:focus-visible { outline: none; box-shadow: var(--ot-shadow-focus); }
.ot-btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.ot-btn-primary {
  background: var(--ot-primary);
  border-color: var(--ot-primary);
  color: var(--ot-text-inverse);
}
.ot-btn-primary:hover {
  background: var(--ot-primary-hover);
  border-color: var(--ot-primary-hover);
  color: var(--ot-text-inverse);
}

.ot-btn-ghost { background: transparent; border-color: transparent; }
.ot-btn-ghost:hover { background: var(--ot-surface-2); border-color: transparent; }

.ot-btn-danger {
  background: var(--ot-danger);
  border-color: var(--ot-danger);
  color: var(--ot-text-inverse);
}
.ot-btn-danger:hover { opacity: 0.9; color: var(--ot-text-inverse); }

.ot-btn-sm { height: var(--ot-btn-h-sm); padding: 0 10px; font-size: 12px; }
.ot-btn-lg { height: var(--ot-btn-h-lg); padding: 0 16px; font-size: 14px; }

/* ────────── Badge ────────── */
.ot-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--ot-badge-h);
  padding: 0 8px;
  font-family: var(--ot-font-sans);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--ot-text-2);
  background: var(--ot-surface-2);
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ot-badge-success { background: var(--ot-success-soft); color: var(--ot-success); }
.ot-badge-warning { background: var(--ot-warning-soft); color: var(--ot-warning); }
.ot-badge-danger  { background: var(--ot-danger-soft);  color: var(--ot-danger); }
.ot-badge-info    { background: var(--ot-info-soft);    color: var(--ot-info); }
.ot-badge-primary { background: var(--ot-primary-soft); color: var(--ot-primary); }
.ot-badge-neutral { background: var(--ot-bg-subtle);    color: var(--ot-text-2); }
.ot-badge-premium { background: var(--ot-premium-soft); color: var(--ot-premium); }

.ot-badge-method-get    { background: var(--ot-success-soft); color: var(--ot-success); }
.ot-badge-method-post   { background: var(--ot-info-soft);    color: var(--ot-info); }
.ot-badge-method-put    { background: var(--ot-warning-soft); color: var(--ot-warning); }
.ot-badge-method-patch  { background: var(--ot-warning-soft); color: var(--ot-warning); }
.ot-badge-method-delete { background: var(--ot-danger-soft);  color: var(--ot-danger); }

/* ────────── Input / Select / Textarea ────────── */
.ot-input, .ot-select {
  display: inline-flex;
  align-items: center;
  height: var(--ot-input-h);
  padding: 0 12px;
  font-family: var(--ot-font-sans);
  font-size: 13px;
  color: var(--ot-text);
  background: var(--ot-surface);
  border: 1px solid var(--ot-border);
  border-radius: var(--ot-radius-md);
  box-sizing: border-box;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ot-input:focus, .ot-select:focus {
  outline: none;
  border-color: var(--ot-primary);
  box-shadow: var(--ot-shadow-focus);
}
.ot-input[aria-invalid="true"], .ot-select[aria-invalid="true"] {
  border-color: var(--ot-danger);
}
.ot-input[aria-invalid="true"]:focus, .ot-select[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.18);
}
.ot-textarea {
  display: block;
  width: 100%;
  min-height: 80px;
  padding: 8px 12px;
  font-family: var(--ot-font-sans);
  font-size: 13px;
  color: var(--ot-text);
  background: var(--ot-surface);
  border: 1px solid var(--ot-border);
  border-radius: var(--ot-radius-md);
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ot-textarea:focus {
  outline: none;
  border-color: var(--ot-primary);
  box-shadow: var(--ot-shadow-focus);
}
.ot-textarea[aria-invalid="true"] { border-color: var(--ot-danger); }
.ot-textarea[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.18);
}
.ot-form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ot-text-3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.ot-form-helper { font-size: 12px; color: var(--ot-text-3); margin-top: 4px; }
.ot-form-helper-error { font-size: 12px; color: var(--ot-danger); margin-top: 4px; }

/* ────────── Card ────────── */
.ot-card {
  background: var(--ot-surface);
  border: 1px solid var(--ot-border);
  border-radius: var(--ot-radius-lg);
  box-shadow: var(--ot-shadow-xs);
}
.ot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ot-divider);
  font-size: 14px;
  font-weight: 600;
  color: var(--ot-text);
}
.ot-card-body   { padding: 16px; }
.ot-card-footer { padding: 12px 16px; border-top: 1px solid var(--ot-divider); }

/* ────────── Table ────────── */
.ot-table {
  width: 100%;
  font-family: var(--ot-font-sans);
  font-size: 13px;
  border-collapse: collapse;
}
.ot-table thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--ot-text-3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--ot-surface-2);
  border-bottom: 1px solid var(--ot-border-strong);
  white-space: nowrap;
}
.ot-table tbody tr {
  border-bottom: 1px solid var(--ot-divider);
  height: var(--ot-row-h);
}
.ot-table tbody tr:hover { background: var(--ot-surface-2); }
.ot-table tbody tr[aria-selected="true"] { background: var(--ot-primary-soft); }
.ot-table td {
  padding: var(--ot-cell-py) var(--ot-cell-px);
  color: var(--ot-text);
  vertical-align: middle;
}
.ot-table .ot-col-num { text-align: right; font-family: var(--ot-font-mono); }
.ot-table tr.ot-row-error td { background: var(--ot-danger-soft); }
.ot-table-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--ot-text-4);
  font-size: 13px;
}

/* ────────── Tabs ────────── */
.ot-tabs {
  display: flex;
  border-bottom: 1px solid var(--ot-border);
}
.ot-tab {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ot-text-3);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.ot-tab:hover { color: var(--ot-text-2); }
.ot-tab:focus-visible { outline: none; box-shadow: var(--ot-shadow-focus); }
.ot-tab.active, .ot-tab[aria-selected="true"] {
  color: var(--ot-primary);
  border-bottom-color: var(--ot-primary);
  font-weight: 500;
}
.ot-tab-count { font-size: 11px; color: var(--ot-text-4); }

/* ────────── Details (collapsible card) ────────── */
.ot-details > summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ot-text);
  padding: 12px 16px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ot-details > summary:focus-visible { outline: none; box-shadow: var(--ot-shadow-focus); border-radius: var(--ot-radius-md); }
.ot-details > summary::-webkit-details-marker { display: none; }
.ot-details > summary::before {
  content: "▸";
  color: var(--ot-text-3);
  font-size: 10px;
  flex-shrink: 0;
}
.ot-details[open] > summary::before { content: "▾"; }
.ot-details > .ot-details-body { padding: 0 16px 16px; }

/* ────────── Code + hint helpers ────────── */
.ot-code-block {
  font-family: var(--ot-font-mono);
  font-size: 12px;
  line-height: 1.55;
  background: var(--ot-bg-subtle);
  color: var(--ot-text);
  border: 1px solid var(--ot-border);
  border-radius: var(--ot-radius-md);
  padding: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}
.ot-code-block-error {
  background: var(--ot-danger-soft);
  color: var(--ot-danger);
  border-color: var(--ot-danger-soft);
  border-left: 4px solid var(--ot-danger);
}
.ot-subheading {
  font-size: 11px;
  font-weight: 600;
  color: var(--ot-text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.ot-hint {
  font-size: 12px;
  color: var(--ot-text-3);
  font-style: italic;
  padding: 8px 12px;
  border: 1px dashed var(--ot-border);
  border-radius: var(--ot-radius-md);
  background: var(--ot-surface-2);
}

/* ────────── Datatable ────────── */
.ot-datatable {
  background: var(--ot-surface);
  border: 1px solid var(--ot-border);
  border-radius: var(--ot-radius-lg);
  overflow: hidden;
}

.ot-datatable-scroll {
  overflow-x: auto;
}

.ot-datatable-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ot-datatable-head {
  background: var(--ot-surface-2);
  border-bottom: 1px solid var(--ot-border);
}

.ot-datatable-th {
  text-align: left;
  padding: var(--ot-cell-py) var(--ot-cell-px);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ot-text-4);
  white-space: nowrap;
  user-select: none;
}
.ot-datatable-th--mono {
  font-family: var(--ot-font-mono);
  text-transform: none;
  letter-spacing: 0;
}
.ot-datatable-th--num { text-align: right; }
.ot-datatable-th--actions { text-align: right; }
.ot-datatable-th--checkbox { width: 40px; text-align: center; }
.ot-datatable-th--drag { width: 32px; }
.ot-datatable-th--sortable {
  cursor: pointer;
}
.ot-datatable-th--sortable:hover { color: var(--ot-text-2); }

.ot-datatable-body { background: var(--ot-surface); }

.ot-datatable-row {
  border-top: 1px solid var(--ot-divider);
  transition: background 0.1s;
}
.ot-datatable-row:hover { background: var(--ot-surface-2); }

.ot-datatable-row--selected {
  background: var(--ot-primary-soft);
  box-shadow: inset 2px 0 0 0 var(--ot-primary);
}
.ot-datatable-row--selected:hover { background: var(--ot-primary-soft); }

.ot-datatable-row--danger { background: var(--ot-danger-soft); }
.ot-datatable-row--danger:hover { background: #fbe1de; }

.ot-datatable-row--empty > td { padding: 0; border-top: 0; }

.ot-datatable-cell {
  padding: var(--ot-cell-py) var(--ot-cell-px);
  height: var(--ot-row-h);
  color: var(--ot-text);
  vertical-align: middle;
}

.ot-datatable-cell--mono {
  font-family: var(--ot-font-mono);
  font-size: 12px;
  color: var(--ot-text-2);
}

.ot-datatable-cell--num {
  text-align: right;
  font-family: var(--ot-font-mono);
  font-variant-numeric: tabular-nums;
}
.ot-datatable-cell--num.ot-datatable-cell--positive { color: var(--ot-success); }
.ot-datatable-cell--num.ot-datatable-cell--negative { color: var(--ot-danger); }

.ot-datatable-cell--actions {
  text-align: right;
  white-space: nowrap;
}
.ot-datatable-cell--actions > * + * { margin-left: 4px; }

.ot-datatable-cell--muted { color: var(--ot-text-3); }

.ot-datatable-cell--ellipsis {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ot-datatable-cell--drag-handle {
  width: 32px;
  color: var(--ot-text-4);
  cursor: grab;
  text-align: center;
}

.ot-datatable-cell--checkbox {
  width: 40px;
  text-align: center;
}

.ot-datatable-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ot-cell-py) var(--ot-cell-px);
  font-size: 11px;
  color: var(--ot-text-3);
  border-top: 1px solid var(--ot-divider);
  background: var(--ot-surface);
}

.ot-datatable-footer-count {
  font-family: var(--ot-font-mono);
  letter-spacing: 0;
}

.ot-datatable-footer-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Empty state block (reused by non-datatable empty panes too) */
.ot-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--ot-text-4);
  font-size: 13px;
}

/* ────────── Filter bar (reused by 6 list pages + api-logs) ────────── */
.ot-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 16px;
  background: var(--ot-surface);
  border-bottom: 1px solid var(--ot-divider);
}

.ot-filter-bar-segment {
  display: inline-flex;
  align-items: stretch;
  padding: 2px;
  background: var(--ot-surface-2);
  border: 1px solid var(--ot-border);
  border-radius: var(--ot-radius-md);
  gap: 2px;
  height: 32px;
}

.ot-filter-bar-segment-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ot-text-2);
  border-radius: var(--ot-radius-sm);
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.ot-filter-bar-segment-item:hover {
  background: var(--ot-surface);
  color: var(--ot-text);
}
.ot-filter-bar-segment-item:focus-visible {
  outline: none;
  box-shadow: var(--ot-shadow-focus);
}
.ot-filter-bar-segment-item.is-active {
  background: var(--ot-surface);
  color: var(--ot-primary);
  font-weight: 600;
  box-shadow: var(--ot-shadow-xs);
}

.ot-filter-bar-segment-count {
  font-size: 11px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.ot-filter-bar-spacer { flex: 1 1 auto; }

.ot-filter-bar-search {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.ot-filter-bar-search-input {
  width: 240px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-family: var(--ot-font-sans);
  color: var(--ot-text);
  background: var(--ot-surface-2);
  border: 1px solid var(--ot-border);
  border-radius: var(--ot-radius-md);
}
.ot-filter-bar-search-input:focus {
  outline: none;
  border-color: var(--ot-primary);
  box-shadow: var(--ot-shadow-focus);
  background: var(--ot-surface);
}

/* .ot-filter-bar-more: use .ot-btn .ot-btn-ghost directly in markup — no CSS needed */

/* ────────── Alert (inline flash/status banner) ────────── */
.ot-alert {
  display: block;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--ot-radius-md);
  font-size: 13px;
  margin-bottom: 16px;
}
.ot-alert-info    { background: var(--ot-info-soft);    border-color: #c7d9ef; color: var(--ot-info); }
.ot-alert-warning { background: var(--ot-warning-soft); border-color: #f0d494; color: var(--ot-warning); }
.ot-alert-success { background: var(--ot-success-soft); border-color: #b7e0c5; color: var(--ot-success); }
.ot-alert-danger  { background: var(--ot-danger-soft);  border-color: #f1b7b0; color: var(--ot-danger); }

/* ────────── Form helpers ────────── */
.ot-form { display: block; }
.ot-form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.ot-form-label { font-size: 12px; font-weight: 500; color: var(--ot-text-2); }
.ot-form-hint  { font-size: 11px; color: var(--ot-text-4); }
.ot-form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
}
.ot-form-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--ot-divider);
  margin-top: 16px;
}

.ot-input-mono { font-family: var(--ot-font-mono); }

.ot-code-inline {
  background: var(--ot-surface-2);
  border: 1px solid var(--ot-border);
  padding: 1px 6px;
  border-radius: var(--ot-radius-sm);
  font-family: var(--ot-font-mono);
  font-size: 12px;
}

/* ────────── Main content shell (page-body + main grid) ────────── */
.ot-app { display: flex; height: 100vh; }
.ot-main {
  flex: 1 1 auto;
  overflow-y: auto;
  background: var(--ot-bg);
}
.ot-page-body {
  padding: 24px;
  max-width: 100%;
}
.ot-page-body--narrow { max-width: 720px; }

/* Page title group — column of crumbs + title + optional subtitle */
.ot-page-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}
.ot-page-subtitle {
  font-size: 12px;
  color: var(--ot-text-3);
  margin: 0;
}

/* Only override .ot-page-header (from D1+D4 shell.css) to flex when it directly
   contains .ot-page-title-group. This keeps api-logs-list.html /
   api-log-detail.html (which use the older .ot-page-header-row wrapper) working. */
.ot-page-header:has(> .ot-page-title-group) {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ────────── Reset-confirm page specifics ────────── */
.ot-reset-confirm { max-width: 640px; }
.ot-reset-warning-card {
  border-color: #f1b7b0;
  background: var(--ot-danger-soft);
  margin-bottom: 16px;
}
.ot-reset-warning-title { font-size: 16px; font-weight: 600; color: var(--ot-danger); margin: 0 0 8px; }
.ot-reset-warning-intro { font-size: 13px; color: var(--ot-danger); margin: 0 0 8px; }
.ot-reset-warning-list {
  margin: 0 0 12px 18px;
  padding: 0;
  color: var(--ot-danger);
  font-size: 13px;
  line-height: 1.6;
}
.ot-reset-warning-preserve { font-size: 13px; color: var(--ot-danger); font-weight: 500; margin: 0; }
.ot-reset-confirm-card { padding: 20px 24px; }
.ot-reset-confirm-instruction { font-size: 13px; color: var(--ot-text-2); margin: 0 0 12px; }
.ot-reset-confirm-input { width: 100%; margin-bottom: 16px; }

/* ────────── Logs-page filter (kept page-scoped; 4-field grid) ────────── */
.ot-logs-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 16px;
  background: var(--ot-surface);
  border-bottom: 1px solid var(--ot-divider);
}
.ot-logs-filter-field { margin-bottom: 0; min-width: 160px; }
.ot-logs-filter-field--narrow { min-width: 96px; }
.ot-logs-filter-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* ────────── Breadcrumb ────────── */
.ot-crumbs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--ot-text-4);
}
.ot-crumb { color: var(--ot-text-4); text-decoration: none; }
.ot-crumb:hover { color: var(--ot-text-2); }
.ot-crumb--current { color: var(--ot-text-3); }
.ot-crumb-sep { color: var(--ot-text-4); }

/* ────────── Card title (used inside .ot-card) ────────── */
.ot-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ot-text);
  margin: 0 0 12px;
}
.ot-card-subtitle {
  font-size: 12px;
  color: var(--ot-text-3);
  margin: 0 0 12px;
}

/* ────────── Readonly input ────────── */
.ot-input-readonly {
  background: var(--ot-surface-2);
  color: var(--ot-text-3);
  cursor: not-allowed;
}

/* ────────── User cell (avatar + nick + secondary line) ────────── */
.ot-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ot-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: hsl(var(--ot-avatar-hue, 220), 55%, 58%);
  flex-shrink: 0;
  user-select: none;
}
.ot-user-avatar--lg { width: 56px; height: 56px; font-size: 20px; }

.ot-user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ot-user-nick {
  font-size: 13px;
  font-weight: 500;
  color: var(--ot-text);
  line-height: 1.3;
}
.ot-user-provider {
  font-size: 11px;
  line-height: 1.3;
}

/* ────────── Stat card + stat grid (dashboard + coins) ────────── */
.ot-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 1180px) { .ot-stat-grid { grid-template-columns: repeat(2, 1fr); } }

.ot-stat-card {
  background: var(--ot-surface);
  border: 1px solid var(--ot-border);
  border-radius: var(--ot-radius-lg);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  row-gap: 2px;
  column-gap: 12px;
  align-items: center;
}
.ot-stat-card--danger { border-color: #f1b7b0; background: linear-gradient(0deg, rgba(180, 35, 24, 0.04), rgba(180, 35, 24, 0.04)), var(--ot-surface); }

.ot-stat-card-label {
  grid-column: 1;
  grid-row: 1;
  font-size: 11px;
  color: var(--ot-text-4);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.ot-stat-card-value {
  grid-column: 1;
  grid-row: 2;
  font-size: 24px;
  font-weight: 600;
  color: var(--ot-text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.ot-stat-card-delta {
  grid-column: 1;
  grid-row: 3;
  font-size: 11px;
  color: var(--ot-text-3);
  font-variant-numeric: tabular-nums;
}
.ot-stat-card-delta--up   { color: var(--ot-success); }
.ot-stat-card-delta--down { color: var(--ot-danger); }

.ot-stat-card-spark {
  grid-column: 2;
  grid-row: 1 / span 3;
  width: 120px;
  height: 32px;
  align-self: center;
  color: var(--ot-text-4);
}

/* ────────── Hint (small muted annotation, used under placeholders) ────────── */
.ot-hint {
  display: inline-block;
  font-size: 11px;
  color: var(--ot-text-4);
  margin-top: 6px;
}
.ot-hint--warning { color: var(--ot-warning); }

/* ────────── Toggle switch (36×20 pill) ────────── */
.ot-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--ot-text);
}

.ot-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ot-toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--ot-text-4);
  border-radius: 999px;
  transition: background 0.15s;
  flex-shrink: 0;
}

.ot-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 999px;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.ot-toggle-input:checked + .ot-toggle-track { background: var(--ot-primary); }
.ot-toggle-input:checked + .ot-toggle-track > .ot-toggle-thumb { transform: translateX(16px); }

.ot-toggle-input:focus-visible + .ot-toggle-track {
  box-shadow: var(--ot-shadow-focus);
}

.ot-toggle-input:disabled + .ot-toggle-track { opacity: 0.5; cursor: not-allowed; }

/* ────────── Upload field (R2 file picker, preview, progress) ────────── */
.ot-upload-field { display: flex; flex-direction: column; gap: 8px; }
.ot-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ot-upload-row .ot-input { flex: 1 1 auto; min-width: 0; }
.ot-upload-file {
  font-size: 12px;
  color: var(--ot-text-3);
}
.ot-upload-file::file-selector-button {
  margin-right: 8px;
  padding: 6px 10px;
  border: 1px solid var(--ot-border);
  background: var(--ot-surface);
  border-radius: var(--ot-radius-md);
  font-size: 12px;
  cursor: pointer;
  color: var(--ot-text-2);
}
.ot-upload-file::file-selector-button:hover { background: var(--ot-surface-2); }
.ot-upload-progress { font-size: 11px; color: var(--ot-text-3); min-height: 14px; }
.ot-upload-preview img, .ot-upload-preview video {
  max-height: 160px;
  border-radius: var(--ot-radius-md);
  border: 1px solid var(--ot-border);
}

/* ────────── Split view (used by feedbacks T5.1 + config T5.2) ────────── */
.ot-split-view {
  display: grid;
  grid-template-columns: var(--ot-split-side-w, 360px) 1fr;
  height: calc(100vh - var(--ot-shell-header-h, 120px));
  min-height: 480px;
  background: var(--ot-surface);
  border-top: 1px solid var(--ot-divider);
}

@media (max-width: 900px) {
  .ot-split-view {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.ot-split-view-side {
  border-right: 1px solid var(--ot-divider);
  overflow-y: auto;
  background: var(--ot-surface);
}

.ot-split-view-main {
  overflow-y: auto;
  padding: 24px;
  background: var(--ot-surface);
}

.ot-split-view-side-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ot-divider);
  font-size: 12px;
  font-weight: 600;
  color: var(--ot-text-2);
  background: var(--ot-surface-2);
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ────────── Icon (sprite consumer) ────────── */
.ot-icon {
  width: 16px;
  height: 16px;
  color: currentColor;
  flex-shrink: 0;
  vertical-align: middle;
}
.ot-icon--sm { width: 14px; height: 14px; }
.ot-icon--lg { width: 20px; height: 20px; }

/* ────────── D7 Story Editor Primitives (B-2 Task 1.1) ────────── */

/* Story node card — story-viewer.html, story-json-editor.html, story-viewer-fragments.html */
.ot-node-card {
  background: var(--ot-surface);
  border: 1px solid var(--ot-border);
  border-left: 4px solid var(--ot-text-4);
  border-radius: var(--ot-radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--ot-shadow-xs);
}
.ot-node-card--video      { border-left-color: var(--ot-node-video); }
.ot-node-card--scene      { border-left-color: var(--ot-node-scene); }
.ot-node-card--chat       { border-left-color: var(--ot-node-chat); }
.ot-node-card--choice     { border-left-color: var(--ot-node-choice); }
.ot-node-card--fullscreen { border-left-color: var(--ot-node-fullscreen); }

.ot-node-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

/* Message card — story-json-editor.html */
.ot-msg-card {
  background: var(--ot-bg-subtle);
  border: 1px solid var(--ot-divider);
  border-left: 4px solid var(--ot-text-4);
  border-radius: var(--ot-radius-md);
  padding: 12px;
  margin-bottom: 8px;
  transition: box-shadow 0.15s ease;
}
.ot-msg-card:hover { box-shadow: var(--ot-shadow-sm); }
.ot-msg-card--narration { border-left-color: var(--ot-text-4); }
.ot-msg-card--my        { border-left-color: var(--ot-primary); }
.ot-msg-card--other     { border-left-color: var(--ot-warning); }
.ot-msg-card--media     { border-left-color: var(--ot-success); }

/* Chat bubble — story-viewer-fragments.html */
/* Parent must be display:flex; flex-direction:column for --in/--out to position correctly. */
.ot-msg-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: var(--ot-radius-lg);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 4px;
  word-break: break-word;
}
.ot-msg-bubble--in {
  background: var(--ot-bg-subtle);
  color: var(--ot-text);
  border-bottom-left-radius: var(--ot-radius-sm);
  align-self: flex-start;
}
.ot-msg-bubble--out {
  background: var(--ot-primary);
  color: var(--ot-text-inverse);
  border-bottom-right-radius: var(--ot-radius-sm);
  margin-left: auto;
  align-self: flex-end;
}

/* Media preview — story-viewer-fragments.html, story-viewer.html, story-json-editor.html */
.ot-media-preview {
  max-width: 100%;
  border-radius: var(--ot-radius-md);
  transition: opacity 0.2s ease;
  cursor: pointer;
}
.ot-media-preview:hover { opacity: 0.9; }

/* Branch column (FREE/PREMIUM 2-col) — story-viewer-fragments.html, story-viewer.html */
.ot-branch-wrap {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.ot-branch-col {
  min-width: 0;
  flex: 1;
}
