﻿/*
 * Admin shell, navigation, cards, provider/routing controls.
 * Extracted from public/styles.css lines 1222-1717.
 */

/* =========================
   ADMIN PAGE â€” SHELL
========================= */

.admin-shell {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.admin-nav {
  width: 148px;
  flex-shrink: 0;
  background: #0e1117;
  border-right: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  gap: 2px;
}

.admin-nav-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #4b5563;
  padding: 0 16px 12px;
  border-bottom: 1px solid #1f2937;
  margin-bottom: 6px;
}

.admin-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.12s, color 0.12s;
}

.admin-nav-item:hover {
  background: #161a22;
  color: #d1d5db;
}

.admin-nav-item.active {
  background: #1a2235;
  color: #8ab4f8;
  font-weight: 600;
  border-right: 2px solid #3b82f6;
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.admin-back-to-chat {
  display: none;
}

.admin-mobile-header {
  display: none;
}

.admin-page-title {
  font-size: 16px;
  font-weight: 600;
  color: #e5e7eb;
  margin: 0 0 20px;
}

/* Users page */
.users-overview {
  max-width: 920px;
  margin: 0 auto 28px;
}

.users-eyebrow-meta {
  color: #4b5563;
}

.users-status {
  padding-top: 16px;
}

.users-registration-strip {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid #1f2937;
}

.users-registration-copy {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.users-registration-label {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6b7280;
}

.users-registration-copy p,
.users-registration-note {
  margin: 0;
  color: #6b7280;
  font-size: 12.5px;
  line-height: 1.55;
}

.users-registration-controls {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 18px 24px;
  align-items: center;
  margin-top: 18px;
}

.users-registration-toggle {
  display: inline-flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
}

.users-registration-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: 0 0 18px;
  accent-color: #e7c78f;
}

.users-registration-toggle span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.users-registration-toggle strong {
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 600;
}

.users-registration-toggle small {
  color: #6b7280;
  font-size: 11.5px;
  line-height: 1.45;
}

.users-registration-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.users-registration-actions button.primary {
  margin: 0;
}

#admin-registration-status {
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
}

.users-registration-note {
  margin-top: 12px;
}

.users-registration-note code {
  color: #9ca3af;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 0.95em;
}

@media (max-width: 768px) {
  .users-overview {
    margin-bottom: 22px;
  }

  .users-registration-strip {
    margin-top: 24px;
    padding-top: 16px;
  }

  .users-registration-copy {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .users-registration-controls {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 16px;
  }

  .users-registration-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.admin-search {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  background: #0e1117;
  border: 1px solid #2a2f3a;
  border-radius: 6px;
  color: #e5e7eb;
  font-size: 13px;
  padding: 7px 10px;
}

.admin-search:focus {
  outline: none;
  border-color: #3b82f6;
}

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-bottom-color: #1f2937;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.admin-user-row:hover {
  background: #161a22;
  border-color: rgba(211, 177, 128, 0.12);
}

.admin-user-row.selected {
  background: rgba(231, 199, 143, 0.08);
  border-color: rgba(231, 199, 143, 0.22);
  box-shadow: inset 3px 0 0 rgba(231, 199, 143, 0.55);
}

.admin-user-main {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.admin-user-email {
  font-size: 13px;
  color: #d1d5db;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-sub {
  color: #6b7280;
  font-size: 11px;
}

.admin-user-status {
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  text-transform: uppercase;
}

.admin-user-status.active {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

.admin-user-status.disabled {
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
}

.admin-user-role {
  font-size: 11px;
  color: #4b5563;
  padding: 2px 7px;
  border-radius: 10px;
  background: #1f2937;
}

.admin-user-role.admin {
  color: #8ab4f8;
  background: #1a2235;
}

.admin-user-access {
  border: 1px solid rgba(211, 177, 128, 0.18);
  border-radius: 999px;
  color: #c9b89d;
  font-size: 11px;
  padding: 2px 8px;
  white-space: nowrap;
}

.admin-user-access.subscription {
  background: rgba(138, 180, 248, 0.1);
  border-color: rgba(138, 180, 248, 0.22);
  color: #a9c7ff;
}

.admin-user-access.byok {
  background: rgba(231, 199, 143, 0.08);
}

.admin-user-detail-grid {
  display: grid;
  gap: 10px;
  font-size: 13px;
  color: #d1d5db;
}

.admin-user-detail-panel {
  display: grid;
  gap: 14px;
}

.admin-user-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  background: #161a22;
}

.admin-user-detail-header h3 {
  margin: 0 0 10px;
  color: #8ab4f8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-user-detail-header .admin-desc {
  margin: 0;
}

.admin-detail-close {
  flex-shrink: 0;
}

.admin-user-detail-sections {
  display: grid;
  gap: 12px;
}

.admin-detail-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(211, 177, 128, 0.14);
  border-radius: 10px;
  background: rgba(24, 21, 18, 0.42);
}

.admin-detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-detail-section-head strong {
  color: #e7c78f;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-detail-section-head span {
  color: #a99a86;
  font-size: 12px;
  text-align: right;
}

.admin-detail-section p {
  margin: -4px 0 0;
  color: #8f806f;
  font-size: 12px;
  line-height: 1.45;
}

.admin-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-detail-danger {
  border-color: rgba(248, 113, 113, 0.24);
  background: rgba(42, 13, 13, 0.28);
}

.admin-detail-danger .admin-detail-section-head strong {
  color: #f87171;
}

.admin-ai-access-box {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid rgba(211, 177, 128, 0.14);
  border-radius: 10px;
  background: rgba(24, 21, 18, 0.42);
}

.admin-ai-access-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-ai-access-head strong {
  color: #e7c78f;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-ai-access-head span {
  color: #a99a86;
  font-size: 12px;
  text-align: right;
}

.admin-ai-access-box p {
  margin: -4px 0 0;
  color: #8f806f;
  font-size: 12px;
  line-height: 1.45;
}

.admin-access-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid rgba(211, 177, 128, 0.14);
  border-radius: 12px;
  background: rgba(10, 9, 8, 0.18);
}

.admin-access-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: flex-start;
  margin: 0;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.admin-access-option:hover {
  background: rgba(231, 199, 143, 0.05);
}

.admin-access-option.selected,
.admin-access-option:has(input:checked) {
  background: rgba(231, 199, 143, 0.1);
  border-color: rgba(231, 199, 143, 0.3);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.admin-access-option input {
  margin-top: 3px;
  accent-color: #e7c78f;
}

.admin-access-option strong,
.admin-access-option small {
  display: block;
}

.admin-access-option strong {
  color: #eadcc8;
  font-size: 13px;
}

.admin-access-option strong em {
  color: #9f927f;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-left: 4px;
  text-transform: uppercase;
}

.admin-access-option small {
  margin-top: 3px;
  color: #9f927f;
  font-size: 12px;
  line-height: 1.45;
}

.admin-access-compat-note {
  border-left: 2px solid rgba(231, 199, 143, 0.28);
  padding-left: 10px;
}

@media (max-width: 640px) {
  .admin-user-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .admin-user-main {
    flex-basis: 100%;
  }

  .admin-user-detail-header {
    flex-direction: column;
  }

  .admin-detail-close {
    width: 100%;
  }

  .admin-detail-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-detail-section-head span {
    text-align: left;
  }

  .admin-ai-access-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-ai-access-head span {
    text-align: left;
  }

  .admin-access-segment {
    grid-template-columns: 1fr;
  }

  .admin-access-option {
    padding: 12px 10px;
  }
}

/* =========================
   ADMIN PAGE â€” CARDS
========================= */

.admin-card {
  background: #161a22;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.admin-card h3 {
  margin: 0 0 16px 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8ab4f8;
  border-bottom: 1px solid #2a2f3a;
  padding-bottom: 10px;
}

.admin-desc {
  font-size: 12px;
  color: #4b5563;
  margin: -6px 0 16px;
  line-height: 1.5;
}

.admin-desc-danger {
  color: #7f3535;
}

/* Providers inline row */
.admin-providers {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid #2a2f3a;
}

.admin-providers-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6b7280;
  margin-bottom: 10px;
}

.admin-provider-row {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.admin-provider-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #9ca3af;
  cursor: pointer;
  user-select: none;
}

.admin-provider-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  accent-color: #3b82f6;
  flex-shrink: 0;
}

/* Providers vertical list */
.admin-provider-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-provider-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: #9ca3af;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

.admin-provider-list-item:hover {
  background: #1a1f2b;
  color: #e2e8f0;
}

.admin-provider-list-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  accent-color: #3b82f6;
  flex-shrink: 0;
}

/* Routing (provider chain) rows */
.admin-chain-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.provider-chain-row {
  background: #0d1117 !important;
  border: 1px solid #2a2f3a !important;
  border-radius: 7px !important;
  padding: 8px 10px !important;
  margin-bottom: 0 !important;
}

/* Usable tokens display */
.admin-usable-tokens {
  font-size: 13px;
  color: #6b7280;
  margin: 8px 0 12px;
}

/* Collapsible Advanced card */
.admin-card-collapsible {
  padding: 0;
  overflow: hidden;
}

.admin-collapsible-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid #2a2f3a;
  color: #8ab4f8;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  margin: 0;
  border-radius: 0;
}

.admin-collapsible-toggle:hover {
  background: rgba(139, 180, 248, 0.04);
  color: #93c5fd;
}

.admin-collapsible-arrow {
  font-size: 10px;
  color: #4b5563;
  flex-shrink: 0;
  transition: color 0.15s;
}

.admin-collapsible-toggle[aria-expanded="true"] .admin-collapsible-arrow {
  color: #6b7280;
}

.admin-collapsible-body {
  padding: 4px 20px 16px;
}

#admin-advanced-body {
  padding: 16px 20px 4px;
}

/* Memory Rules field (vertical layout, explicit sizing) */
.admin-rules-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-rules-label {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.4;
}

.admin-rules-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 120px;
  max-height: 300px;
  padding: 8px 10px;
  background: #1a1d23;
  border: 1px solid #2a2f3a;
  border-radius: 6px;
  color: #eee;
  font-size: 12px;
  font-family: "Courier New", monospace;
  resize: vertical;
  line-height: 1.5;
}

.admin-rules-textarea:focus {
  outline: none;
  border-color: #3b82f6;
}

/* Inline collapsible subsection within a card */
.admin-sub-collapsible {
  margin-top: 14px;
  padding-top: 2px;
  border-top: 1px solid #2a2f3a;
}

.admin-sub-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 0;
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin: 0;
  text-align: left;
}

.admin-sub-toggle:hover {
  color: #9ca3af;
  background: transparent;
}

/* Danger Zone */
.admin-card-danger {
  border-color: #5a1d1d;
  background: #0e0808;
}

.admin-card-danger h3 {
  color: #f87171;
  border-bottom-color: #5a1d1d;
}

/* =========================
   USAGE ANALYTICS PAGE
========================= */

/* Compact executive snapshot — top-level summary, no box backgrounds */
.admin-snapshot-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
  padding: 4px 0;
}

.admin-snapshot-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-snapshot-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #4b5563;
}

.admin-snapshot-value {
  font-size: 20px;
  font-weight: 700;
  color: #e7c78f;
  line-height: 1.2;
}

.admin-snapshot-sub {
  font-size: 11px;
  color: #6b7280;
}

.admin-usage-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.admin-stat-box {
  background: #0e1117;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #4b5563;
}

.admin-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #e7c78f;
  line-height: 1.2;
}

.admin-stat-sub {
  font-size: 11px;
  color: #6b7280;
}

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

.admin-usage-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4b5563;
  padding: 4px 8px 8px;
  border-bottom: 1px solid #1f2937;
}

.admin-usage-table td {
  padding: 7px 8px;
  color: #d1d5db;
  border-bottom: 1px solid #161a22;
}

.admin-usage-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-usage-table tbody tr:hover td {
  background: #161a22;
}

.admin-usage-bar {
  height: 6px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: 3px;
  min-width: 2px;
}

.btn-danger-action {
  background: transparent;
  border: 1px solid #7f1d1d;
  color: #f87171;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 0;
}

.btn-danger-action:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border-color: #991b1b;
}

.field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  width: 160px;
  flex-shrink: 0;
  font-size: 13px;
  color: #9ca3af;
  padding-top: 8px;
  line-height: 1.4;
}

.label-hint {
  color: #4b5563;
  font-size: 11px;
}

.label-deprecated {
  color: #f59e0b;
  font-size: 11px;
  font-style: italic;
}

.field-hint {
  font-size: 11px;
  color: #6b7280;
  margin: 2px 0 0;
}

/* Hint indented to sit under the input column (past the 160px label + 12px gap) */

/* =========================
   AUDIT LOG
========================= */

.audit-overview {
  margin-bottom: 26px;
}

/* Integrated filter strip */
.audit-filter-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(245, 239, 230, 0.042);
}

.audit-filter-strip select,
.audit-filter-strip input[type="text"] {
  background: rgba(255, 255, 255, 0.026);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  height: 30px;
  font: inherit;
  font-size: 12px;
  color: #d8cfc3;
  box-sizing: border-box;
  transition: border-color 150ms ease, background 150ms ease;
}

.audit-filter-strip select:focus,
.audit-filter-strip input[type="text"]:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.036);
}

/* Select-specific: dark popup, custom arrow */
.audit-filter-strip select {
  padding: 0 26px 0 8px;
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  flex-shrink: 0;
  max-width: 190px;
  cursor: pointer;
}

.audit-filter-strip select option,
.audit-filter-strip select optgroup {
  background: #111827;
  color: #d8cfc3;
}

.audit-filter-strip input[type="text"] {
  padding: 0 8px;
  flex: 1;
  min-width: 120px;
}

.audit-clear-btn {
  padding: 0 10px;
  height: 30px;
  border: 1px solid rgba(245, 239, 230, 0.08);
  background: transparent;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  box-sizing: border-box;
  transition: color 130ms ease, border-color 130ms ease;
}

.audit-clear-btn:hover {
  color: #d8cfc3;
  border-color: rgba(245, 239, 230, 0.14);
}

/* Timeline table */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.audit-table thead th {
  text-align: left;
  padding: 0 10px 8px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.18);
  border-bottom: 1px solid rgba(245, 239, 230, 0.05);
}

/* Date group separator rows */
.audit-date-group td {
  padding: 0;
  border: none;
  background: transparent;
}

.audit-date-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 10px 6px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.22);
}

.audit-date-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(245, 239, 230, 0.04);
}

.audit-date-group:first-child .audit-date-label {
  padding-top: 12px;
}

/* Event rows */
.audit-row td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(245, 239, 230, 0.028);
  vertical-align: middle;
  transition: background 120ms ease;
}

.audit-row:last-child td { border-bottom: none; }

.audit-row:hover td { background: rgba(255, 255, 255, 0.018); }

/* Time column */
.audit-time { white-space: nowrap; }

.audit-time-only {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.26);
  font-variant-numeric: tabular-nums;
}

.audit-time-compact {
  display: none;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.26);
}

/* Event badge cell */
.audit-event { white-space: nowrap; }

/* Actor / target cells */
.audit-actor,
.audit-target {
  font-size: 12px;
  color: #9ca3af;
}

.audit-email-domain {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.2);
}

.audit-email-empty,
.audit-self-marker {
  color: rgba(255, 255, 255, 0.15);
}

/* Empty / no-results state */
.audit-empty {
  padding: 36px 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.2);
  text-align: center;
}

/* Event badges — two-tier taxonomy */
.audit-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
}

/* Routine events — neutral (inherits base) */
.audit-badge--normal { }

/* Security elevation — slightly more legible */
.audit-badge--security {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.09);
  color: #9ca3af;
}

/* Privilege / admin events — faint warm tint */
.audit-badge--admin {
  background: rgba(231, 199, 143, 0.07);
  border-color: rgba(231, 199, 143, 0.16);
  color: rgba(231, 199, 143, 0.72);
}

/* Destructive events — quiet red */
.audit-badge--destructive {
  background: rgba(239, 68, 68, 0.07);
  border-color: rgba(239, 68, 68, 0.15);
  color: rgba(239, 68, 68, 0.65);
}

/* Pagination controls */
.audit-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(245, 239, 230, 0.04);
  flex-wrap: wrap;
}

.audit-pagination-btn {
  padding: 3px 10px;
  border: 1px solid rgba(245, 239, 230, 0.08);
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: #6b7280;
  transition: color 130ms ease, border-color 130ms ease;
}

.audit-pagination-btn:hover {
  color: #d8cfc3;
  border-color: rgba(245, 239, 230, 0.14);
}

.audit-pagination-btn:disabled {
  color: rgba(255, 255, 255, 0.1);
  border-color: rgba(245, 239, 230, 0.04);
  cursor: default;
}

.audit-pagination-range {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.25);
}

.audit-pagination-sep { flex: 1; }

.audit-page-size {
  background: rgba(255, 255, 255, 0.026);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 3px 6px;
  font: inherit;
  font-size: 12px;
  color: #9ca3af;
  cursor: pointer;
}

.audit-sort-btn {
  padding: 3px 10px;
  border: 1px solid rgba(245, 239, 230, 0.08);
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  transition: color 130ms ease, border-color 130ms ease;
}

.audit-sort-btn:hover {
  color: #d8cfc3;
  border-color: rgba(245, 239, 230, 0.14);
}

/* Dev-only danger zone */
#admin-audit-danger {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(245, 239, 230, 0.04);
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .audit-filter-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .audit-filter-strip select,
  .audit-filter-strip input[type="text"],
  .audit-clear-btn {
    width: 100%;
    min-width: 0;
    height: 44px;
    font-size: 14px;
    box-sizing: border-box;
  }

  /* restore native select on mobile — custom arrow doesn't scale well */
  .audit-filter-strip select {
    max-width: 100%;
    appearance: auto;
    -webkit-appearance: auto;
    background-image: none;
    padding: 0 12px;
  }

  #admin-audit-table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .audit-table {
    table-layout: fixed;
    min-width: 0;
    font-size: 13px;
  }

  .audit-table th,
  .audit-row td {
    padding: 8px 8px;
  }

  .audit-table th:nth-child(1),
  .audit-row td:nth-child(1) { width: 35%; }

  .audit-table th:nth-child(2),
  .audit-row td:nth-child(2) { width: 35%; }

  .audit-table th:nth-child(3),
  .audit-row td:nth-child(3) { width: 30%; }

  .audit-table th:nth-child(4),
  .audit-row td:nth-child(4) { display: none; }

  .audit-time-only { display: none; }
  .audit-time-compact { display: inline; }

  .audit-time,
  .audit-event,
  .audit-actor,
  .audit-target {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .audit-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
  }

  .audit-pagination {
    flex-wrap: wrap;
    gap: 8px;
  }

  .audit-pagination-range {
    order: -1;
    flex: 1 0 100%;
  }

  .audit-pagination-sep { display: none; }
}

/* =========================
   ORCHESTRATION PRESETS
========================= */

/* Flat row wrapper — replaces per-mode admin-card boxing */
.orch-row {
  border-bottom: 1px solid rgba(245, 239, 230, 0.042);
  transition: background 150ms ease, box-shadow 150ms ease;
}

.orch-row:last-child { border-bottom: 0; }

.orch-row:not(.orch-row-active):hover {
  background: rgba(245, 239, 230, 0.016);
}

.orch-row-active {
  box-shadow: inset 2px 0 0 rgba(231, 199, 143, 0.22);
}

.orch-row--new {
  border-top: 1px solid rgba(245, 239, 230, 0.055);
  margin-top: 10px;
}

/* Collapsed summary row */
.orch-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 6px;
  cursor: pointer;
  user-select: none;
}

.orch-row-active .orch-summary {
  padding-bottom: 6px;
}

.orch-summary-main {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

/* CSS chevron — toggled via .orch-icon-open class */
.orch-expand-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.orch-expand-icon::before {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid #3d4451;
  border-bottom: 1.5px solid #3d4451;
  transform: rotate(-45deg) translate(-1px, 1px);
  transition: transform 160ms ease, border-color 160ms ease;
}

.orch-icon-open::before {
  transform: rotate(45deg) translate(-1px, -1px);
  border-color: rgba(232, 201, 124, 0.5);
}

.orch-summary-label {
  font-size: 13px;
  font-weight: 620;
  color: #d8cfc3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 150ms ease;
}

.orch-row-active .orch-summary-label { color: #e5dfd8; }

.orch-new-label {
  color: rgba(232, 201, 124, 0.65);
  font-weight: 500;
}

.orch-preset-id {
  font-size: 10px;
  font-weight: 600;
  font-family: 'Geist Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #4b5563;
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.orch-dirty-dot {
  font-size: 10px;
  color: rgba(232, 201, 124, 0.65);
  display: none;
  flex-shrink: 0;
}

.orch-dirty-dot.orch-dirty-visible { display: inline; }

.orch-summary-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
  max-width: 50%;
}

.orch-summary-desc {
  font-size: 12px;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.orch-prompt-preview {
  font-size: 12px;
  color: #3d4451;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  transition: opacity 150ms ease;
}

.orch-row-active .orch-prompt-preview,
.orch-row-active .orch-summary-desc { opacity: 0; pointer-events: none; }

/* Expandable body */
.orch-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 6px 0 26px;
  transition: max-height 220ms ease, opacity 160ms ease, padding 220ms ease;
}

.orch-body.orch-open {
  max-height: 2000px;
  opacity: 1;
  padding: 10px 14px 26px 24px;
}

.orch-preset-modified {
  font-size: 11px;
  font-weight: 600;
  color: rgba(232, 201, 124, 0.8);
  background: rgba(232, 201, 124, 0.08);
  border: 1px solid rgba(232, 201, 124, 0.2);
  border-radius: 4px;
  padding: 2px 7px;
}

.orch-field { margin-bottom: 14px; }

.orch-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.18);
  margin-bottom: 4px;
}

.orch-field-optional {
  font-size: 10.5px;
  color: #3d4451;
  font-weight: 400;
}

.orch-char-count {
  color: #4b5563;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* Inputs within expanded editor — open baseline, no box identity */
.orch-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: 34px;
  padding: 0 2px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0;
  color: #e8e2da;
  font: inherit;
  font-size: 13px;
}

.orch-input::placeholder { color: #3d4451; }

.orch-input:focus {
  outline: none;
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

/* Prompt textarea — fully open composing surface, no box */
.orch-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 130px;
  max-height: 50vh;
  padding: 8px 2px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #f5efe6;
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
}

.orch-textarea::placeholder { color: #3d4451; }

.orch-textarea:focus { outline: none; }

.orch-preset-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.orch-preset-status {
  font-size: 12px;
  color: #86efac;
  margin-left: 4px;
}

.orch-reset-btn {
  background: transparent;
  border: 1px solid rgba(245, 239, 230, 0.08);
  color: #6b7280;
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: border-color 130ms ease, color 130ms ease, background 130ms ease;
}

.orch-reset-btn:hover {
  border-color: rgba(245, 239, 230, 0.14);
  color: #d8cfc3;
  background: rgba(245, 239, 230, 0.04);
}

.orch-reset-btn--danger { color: #a05555; border-color: rgba(160, 85, 85, 0.2); }

.orch-reset-btn--danger:hover {
  color: #e8988c;
  border-color: rgba(232, 152, 140, 0.28);
  background: rgba(232, 152, 140, 0.04);
}

/* =========================
   AI STUDIO PAGE
========================= */

.studio-overview {
  max-width: 920px;
  margin-bottom: 32px;
}

/* Runtime controls — compact 3-col strip */
.studio-runtime-strip {
  display: grid;
  grid-template-columns: minmax(110px, 150px) 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 22px 0 20px;
  max-width: 920px;
  border-top: 1px solid rgba(245, 239, 230, 0.042);
}

.studio-runtime-fields {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.studio-runtime-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.studio-runtime-ctx {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  min-width: 72px;
  flex-shrink: 0;
}

.studio-runtime-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 12.5px;
  color: #d8cfc3;
  user-select: none;
}

.studio-runtime-toggle input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
  cursor: pointer;
  accent-color: rgba(232, 201, 124, 0.7);
  flex-shrink: 0;
}

.studio-runtime-num {
  width: 68px;
  height: 28px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.026);
  border: 1px solid rgba(255, 255, 255, 0.072);
  border-radius: 5px;
  color: #e8e2da;
  font: inherit;
  font-size: 13px;
  text-align: right;
  flex-shrink: 0;
}

.studio-runtime-num:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.036);
}

.studio-runtime-hint {
  font-size: 11px;
  color: #4b5563;
  white-space: nowrap;
}

.studio-runtime-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-top: 2px;
}

.studio-runtime-status {
  font-size: 12px;
  color: #86efac;
  min-height: 16px;
}

/* Global Physics composing section */
.studio-physics {
  padding: 22px 0 20px;
  max-width: 920px;
  border-top: 1px solid rgba(245, 239, 230, 0.042);
}

.studio-physics-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.studio-physics-hint {
  font-size: 12px;
  color: #4b5563;
  margin: 0 0 10px;
  line-height: 1.5;
  max-width: 600px;
}

.studio-physics-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 80px;
  max-height: 200px;
  padding: 11px 13px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  color: #f5efe6;
  font: inherit;
  font-size: 13px;
  line-height: 1.65;
  resize: vertical;
}

.studio-physics-textarea::placeholder { color: #3d4451; }

.studio-physics-textarea:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.018);
  border-color: rgba(255, 255, 255, 0.096);
}

.studio-physics-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.studio-physics-status {
  font-size: 12px;
  color: #86efac;
  min-height: 16px;
}

/* Conversation Modes library section */
.studio-modes {
  padding-top: 22px;
  max-width: 920px;
  border-top: 1px solid rgba(245, 239, 230, 0.042);
}

.studio-modes-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.studio-modes-list {
  display: flex;
  flex-direction: column;
}

@media (max-width: 860px) {
  .studio-runtime-strip {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .studio-runtime-actions { padding-top: 4px; }
}

/* =========================
   USAGE — OVERVIEW REDESIGN
========================= */

/* Status dot palette */
.usage-dot-sage    { background: #86efac; }
.usage-dot-amber   { background: #e7c78f; }
.usage-dot-ember   { background: #f97316; }
.usage-dot-neutral { background: #6b7280; }

/* Constrained reading column */
.usage-overview {
  max-width: 920px;
  margin: 0 auto;
}

/* Eyebrow row */
.usage-eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6b7280;
}

.usage-eyebrow-month { color: #4b5563; }

.usage-eyebrow-refresh {
  background: none;
  border: none;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #4b5563;
  cursor: pointer;
  padding: 0;
  transition: color 0.12s;
}

.usage-eyebrow-refresh:hover { color: #9ca3af; }

/* Status sentence */
.usage-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 0;
}

.usage-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.usage-status-text {
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.018em;
  font-weight: 500;
  color: #e5e7eb;
}

.usage-status-ital {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: #e7c78f;
}

.usage-status-ital.clickable {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.usage-status-ital.clickable:hover { opacity: 0.82; }
.usage-status-ital.ember { color: #f97316; }
.usage-status-ital.muted { color: #6b7280; }

/* Two-column body */
.usage-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 64px;
  margin-top: 48px;
  align-items: start;
}

/* Operations card */
.usage-ops-eyebrow {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6b7280;
}

.usage-ops-row {
  padding: 18px 0;
  border-top: 1px solid #1f2937;
}

.usage-ops-row:first-of-type { border-top: none; padding-top: 12px; }

.usage-ops-label { font-size: 12.5px; color: #6b7280; }

.usage-ops-value {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: #e5e7eb;
  margin-top: 4px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 500;
}

.usage-ops-value .sub { font-size: 13px; color: #6b7280; font-weight: 400; }

.usage-ops-meta { font-size: 12px; color: #6b7280; margin-top: 6px; }

/* Quiet spend bar */
.usage-ubar {
  height: 4px;
  background: #1f2937;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.usage-ubar-fill {
  height: 100%;
  background: #6b7280;
  border-radius: 999px;
}

.usage-ubar-fill.amber { background: #e7c78f; }

/* Inspect strip */
.usage-inspect {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 18px;
  margin-top: 22px;
  border-top: 1px solid #1f2937;
  font-size: 12.5px;
}

.usage-inspect-label { color: #6b7280; }

.usage-inspect-btn {
  background: none;
  border: none;
  font-size: 12.5px;
  font-family: inherit;
  color: #d1d5db;
  cursor: pointer;
  padding: 0;
  transition: color 0.12s;
}

.usage-inspect-btn:hover { color: #e7c78f; }

/* Vital signs column */
.usage-vitals { display: flex; flex-direction: column; padding-top: 12px; }

.usage-vital { padding: 14px 0; border-top: 1px solid #1f2937; }
.usage-vital:first-of-type { padding-top: 0; border-top: none; }

.usage-vital-label {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6b7280;
}

.usage-vital-value { font-size: 15px; color: #d1d5db; margin-top: 6px; line-height: 1.4; }
.usage-vital-value.muted { color: #6b7280; }

.usage-vital-btn {
  display: block;
  background: none;
  border: none;
  font: inherit;
  font-size: 15px;
  color: #d1d5db;
  cursor: pointer;
  padding: 0;
  margin-top: 6px;
  line-height: 1.4;
  text-align: left;
  transition: color 0.12s;
}

.usage-vital-btn:hover { color: #e7c78f; }

.usage-vital-meta { font-size: 11.5px; color: #6b7280; margin-top: 4px; }

/* Provider mix mini bars */
.usage-mix { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

.usage-mix-row {
  display: grid;
  grid-template-columns: 72px 1fr 36px;
  gap: 8px;
  align-items: center;
  font-size: 11.5px;
}

.usage-mix-name { color: #9ca3af; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-mix-bar { height: 3px; background: #1f2937; border-radius: 999px; overflow: hidden; }
.usage-mix-bar > div { height: 100%; background: #6b7280; border-radius: 999px; }
.usage-mix-pct { color: #6b7280; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; text-align: right; }

.usage-mix-row.dominant .usage-mix-name { color: #d1d5db; }
.usage-mix-row.dominant .usage-mix-bar > div { background: #e7c78f; }
.usage-mix-row.dominant .usage-mix-pct { color: #e7c78f; }

/* === INSPECTION DRAWER === */

.usage-drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 400;
}

.usage-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 56%;
  max-width: 680px;
  min-width: 340px;
  background: #0e1117;
  border-left: 1px solid #1f2937;
  box-shadow: -24px 0 60px -20px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  z-index: 401;
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.usage-drawer.open { transform: translateX(0); }

.usage-drawer-head {
  padding: 18px 24px;
  border-bottom: 1px solid #1f2937;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.usage-drawer-eyebrow {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6b7280;
}

.usage-drawer-title { font-size: 14px; font-weight: 500; color: #d1d5db; }

.usage-drawer-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #111827;
  border: 1px solid #1f2937;
  font-size: 11px;
  color: #9ca3af;
}

.usage-drawer-pill-dot { width: 5px; height: 5px; border-radius: 999px; }

.usage-drawer-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
}

.usage-drawer-close:hover { color: #d1d5db; background: #1f2937; }

.usage-drawer-tabs {
  display: flex;
  padding: 0 24px;
  border-bottom: 1px solid #1f2937;
  flex-shrink: 0;
}

.usage-drawer-tab {
  padding: 13px 0 11px;
  margin-right: 22px;
  font-size: 12.5px;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 1.5px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.12s;
  white-space: nowrap;
}

.usage-drawer-tab:hover { color: #9ca3af; }
.usage-drawer-tab.active { color: #d1d5db; border-bottom-color: #d1d5db; }

.usage-drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 28px; }

/* Drawer table */
.usage-drawer-table { width: 100%; border-collapse: collapse; font-size: 12px; }

.usage-drawer-table th {
  text-align: left;
  padding: 0 14px 10px 0;
  border-bottom: 1px solid #1f2937;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 400;
}

.usage-drawer-table th.right { text-align: right; padding-right: 0; }

.usage-drawer-table td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid #111827;
  color: #6b7280;
}

.usage-drawer-table td.right { text-align: right; padding-right: 0; }
.usage-drawer-table td.mono { font-family: 'Geist Mono', ui-monospace, monospace; }
.usage-drawer-table td.primary { color: #d1d5db; }
.usage-drawer-table tr:last-child td { border-bottom: none; }

/* Mobile */
@media (max-width: 768px) {
  .usage-body {
    grid-template-columns: 1fr;
    gap: 32px;
    margin-top: 28px;
  }

  .usage-status-text { font-size: clamp(17px, 5vw, 22px); }
  .usage-vitals { padding-top: 0; }
  .usage-vital { padding: 10px 0; }
  .usage-vital-value { font-size: 13px; }
  .usage-vital-meta { font-size: 11px; }
  .usage-mix { display: none; }

  .usage-drawer {
    width: 100%;
    max-width: 100%;
    min-width: unset;
  }
}

/* =========================
   AI CONFIG — OVERVIEW REDESIGN
========================= */

/* Constrained reading column */
.aiconfig-overview {
  max-width: 920px;
  margin: 0 auto;
}

/* Layer container */
.aiconfig-layer {
  margin-top: 36px;
}

/* Layer eyebrow */
.aiconfig-layer-eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 6px;
}

.aiconfig-layer-right {
  font-size: 10px;
  color: #4b5563;
}

/* === PROVIDER ROWS === */
.aiconfig-prow {
  display: grid;
  grid-template-columns: 18px 130px 100px 1fr 28px;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid #1f2937;
}

.aiconfig-prow:hover {
  background: #161a22;
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
  border-radius: 8px;
  border-top-color: transparent;
}

.aiconfig-prow.disabled { opacity: 0.55; }

.aiconfig-prow-grip {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10px;
  color: #4b5563;
  user-select: none;
  cursor: default;
}

.aiconfig-prow.disabled .aiconfig-prow-grip { opacity: 0.4; }

.aiconfig-prow-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #e5e7eb;
  font-weight: 500;
}

.aiconfig-prow.invalid .aiconfig-prow-name { color: #f97316; }
.aiconfig-prow.no-key  .aiconfig-prow-name { color: #9ca3af; }

.aiconfig-state-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

.aiconfig-prow-role {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6b7280;
}

.aiconfig-prow-role.primary { color: #e7c78f; }
.aiconfig-prow-role.dim     { color: #4b5563; }

.aiconfig-prow-routing {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11.5px;
  color: #6b7280;
}

.aiconfig-prow-routing.invalid { color: #f97316; }
.aiconfig-prow-routing.dim     { color: #4b5563; }
.aiconfig-prow-routing.italic  { color: #4b5563; font-family: inherit; font-style: italic; }

.aiconfig-prow-primary-model { color: #d1d5db; }

.aiconfig-prow-arrow { color: #4b5563; }

.aiconfig-prow-chev {
  color: #4b5563;
  font-size: 14px;
  text-align: right;
}

/* === CONTROL ROWS === */
.aiconfig-crow {
  display: grid;
  grid-template-columns: 140px 1fr 32px;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid #1f2937;
}

.aiconfig-crow:hover {
  background: #161a22;
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
  border-radius: 8px;
  border-top-color: transparent;
}

.aiconfig-crow-label {
  font-size: 13px;
  color: #9ca3af;
}

.aiconfig-crow-summary {
  font-size: 13px;
  color: #e5e7eb;
}

.aiconfig-crow-sub { color: #6b7280; }

.aiconfig-crow-chev {
  color: #4b5563;
  font-size: 14px;
  text-align: right;
}

/* Mobile — overview rows */
@media (max-width: 768px) {
  .aiconfig-prow {
    grid-template-columns: 0 1fr auto 28px;
    grid-template-rows: auto auto;
    gap: 4px 10px;
    padding: 12px 0;
  }

  .aiconfig-prow-grip    { display: none; }
  .aiconfig-prow-name    { grid-column: 2; grid-row: 1; }
  .aiconfig-prow-role    { grid-column: 3; grid-row: 1; font-size: 9.5px; }
  .aiconfig-prow-routing { grid-column: 2 / 4; grid-row: 2; font-size: 11px; }
  .aiconfig-prow-chev    { grid-column: 4; grid-row: 1; }

  .aiconfig-crow {
    grid-template-columns: 110px 1fr 28px;
    gap: 10px;
  }
}

/* ================================
   AI CONFIG DRAWER
   ================================ */
.aiconfig-drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 400;
}

.aiconfig-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 60%;
  max-width: 760px;
  min-width: 340px;
  background: #0e1117;
  border-left: 1px solid #1f2937;
  box-shadow: -24px 0 60px -20px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  z-index: 401;
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.aiconfig-drawer.open {
  transform: translateX(0);
}

.aiconfig-drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 24px 16px;
  border-bottom: 1px solid #1f2937;
  flex-shrink: 0;
}

.aiconfig-drawer-mobile-back {
  display: none;
}

.aiconfig-drawer-eyebrow {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4b5563;
}

.aiconfig-drawer-title {
  font-size: 15px;
  font-weight: 600;
  color: #e5e7eb;
  flex: 1;
}

.aiconfig-drawer-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: #1f2937;
  color: #9ca3af;
  border: 1px solid #374151;
}

.aiconfig-drawer-pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  flex-shrink: 0;
  background: #6b7280;
}

/* Pill color variants */
.aiconfig-drawer-pill.sage {
  background: rgba(134, 239, 172, 0.08);
  border-color: rgba(134, 239, 172, 0.28);
  color: #86efac;
}
.aiconfig-drawer-pill.sage  .aiconfig-drawer-pill-dot { background: #86efac; }

.aiconfig-drawer-pill.amber {
  background: rgba(231, 199, 143, 0.10);
  border-color: rgba(231, 199, 143, 0.28);
  color: #e7c78f;
}
.aiconfig-drawer-pill.amber .aiconfig-drawer-pill-dot { background: #e7c78f; }

.aiconfig-drawer-pill.ember {
  background: rgba(249, 115, 22, 0.08);
  border-color: rgba(249, 115, 22, 0.28);
  color: #f97316;
}
.aiconfig-drawer-pill.ember .aiconfig-drawer-pill-dot { background: #f97316; }

.aiconfig-drawer-pill.neutral {
  background: rgba(107, 114, 128, 0.08);
  border-color: rgba(107, 114, 128, 0.22);
  color: #6b7280;
}

.aiconfig-drawer-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}

.aiconfig-drawer-close:hover {
  color: #e5e7eb;
  background: #1f2937;
}

.aiconfig-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Responsive widths */
@media (max-width: 1280px) {
  .aiconfig-drawer { width: 70%; }
}

@media (max-width: 1024px) {
  .aiconfig-drawer {
    width: 100%;
    min-width: 0;
  }
}

/* ================================
   DRAWER FIELD LAYOUT
   ================================ */
.aiconfig-df {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  align-items: start;
  padding: 16px 0;
  border-top: 1px solid #1f2937;
}

.aiconfig-df:first-child {
  border-top: 0;
  padding-top: 0;
}

.aiconfig-df-label {
  font-size: 12.5px;
  color: #6b7280;
  padding-top: 3px;
  line-height: 1.4;
}

.aiconfig-df-req {
  color: #f97316;
  margin-left: 2px;
}

.aiconfig-df-value {
  font-size: 13.5px;
  color: #e5e7eb;
  line-height: 1.5;
}

.aiconfig-df-sub {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-top: 7px;
  line-height: 1.55;
}

/* ================================
   PSEUDO INPUT (read-only display)
   ================================ */
.aiconfig-pseudo-input {
  display: inline-flex;
  align-items: center;
  background: #161a22;
  border: 1px solid #1f2937;
  border-radius: 7px;
  padding: 7px 12px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: #9ca3af;
  letter-spacing: 0.01em;
  vertical-align: middle;
}

.aiconfig-pseudo-input.empty {
  color: #4b5563;
  font-style: italic;
  font-family: inherit;
  font-size: 13px;
}

/* ================================
   DRAWER BUTTON
   ================================ */
.aiconfig-dbtn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #374151;
  background: transparent;
  color: #d1d5db;
  margin-left: 10px;
  vertical-align: middle;
}

.aiconfig-dbtn:hover         { background: #1f2937; }
.aiconfig-dbtn:disabled      { opacity: 0.45; cursor: default; }
.aiconfig-dbtn-primary       { background: #e5e7eb; color: #0e1117; border-color: transparent; margin-left: 0; }
.aiconfig-dbtn-primary:hover { background: #f3f4f6; }
.aiconfig-dbtn-danger        { color: #f97316; border-color: rgba(249, 115, 22, 0.30); margin-left: 0; }
.aiconfig-dbtn-danger:hover  { background: rgba(249, 115, 22, 0.08); }
.aiconfig-dbtn-sage          { color: #86efac; border-color: rgba(134, 239, 172, 0.28); margin-left: 0; }
.aiconfig-dbtn-sage:hover    { background: rgba(134, 239, 172, 0.08); }
.aiconfig-dbtn-dim           { opacity: 0.35; }

/* ================================
   DRAWER DIRTY INDICATOR
   ================================ */
.aiconfig-drawer-dirty {
  font-size: 10px;
  color: #e7c78f;
  margin-left: 2px;
  flex-shrink: 0;
  animation: aiconfig-pulse 2s ease-in-out infinite;
}

@keyframes aiconfig-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* ================================
   DIRTY GUARD BAR
   ================================ */
.aiconfig-dirty-guard {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(231, 199, 143, 0.08);
  border: 1px solid rgba(231, 199, 143, 0.22);
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 12.5px;
  color: #e7c78f;
}

.aiconfig-dirty-guard-text { flex: 1; }

.aiconfig-dirty-guard-btns { display: flex; gap: 8px; }

.aiconfig-dirty-guard.shake {
  animation: aiconfig-shake 220ms ease;
}

@keyframes aiconfig-shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-4px); }
  75%       { transform: translateX(4px); }
}

/* ================================
   MODEL INPUT
   ================================ */
.aiconfig-model-input {
  display: inline-block;
  width: 100%;
  max-width: 280px;
  background: #161a22;
  border: 1px solid #1f2937;
  border-radius: 7px;
  padding: 7px 12px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: #d1d5db;
  outline: none;
  transition: border-color 120ms;
}

.aiconfig-model-input:focus {
  border-color: #4b5563;
}

.aiconfig-model-input::placeholder { color: #4b5563; }

.aiconfig-field-error {
  font-size: 11.5px;
  color: #f97316;
  margin-top: 5px;
  min-height: 0;
  line-height: 1.45;
}

/* ================================
   MODELS FOOTER (inline save)
   ================================ */
.aiconfig-models-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 4px;
}

.aiconfig-models-save-status {
  font-size: 12px;
  color: #86efac;
}

/* ================================
   REPLACE KEY FORM
   ================================ */
.aiconfig-replace-key { margin-top: 2px; }

.aiconfig-newkey-input {
  max-width: 340px;
  font-family: inherit;
  letter-spacing: 0.08em;
}

.aiconfig-replace-key-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ================================
   REORDER BUTTONS (move up/down)
   ================================ */
.aiconfig-reorder-btns {
  display: none; /* shown on mobile only */
  gap: 8px;
  padding: 16px 0 4px;
  border-top: 1px solid #1f2937;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .aiconfig-reorder-btns { display: flex; }
}

/* ================================
   DANGER ZONE
   ================================ */
.aiconfig-danger-zone {
  margin-top: 32px;
  padding: 16px 18px;
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 10px;
  background: rgba(249, 115, 22, 0.04);
}

.aiconfig-dz-head {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f97316;
  margin-bottom: 8px;
}

.aiconfig-dz-body {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.65;
  margin-bottom: 14px;
}

.aiconfig-dz-body strong { color: #e5e7eb; font-weight: 500; }

.aiconfig-dz-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================================
   IN-DRAWER CONFIRMATION
   ================================ */
.aiconfig-confirm-panel {
  padding: 4px 0;
}

.aiconfig-confirm-title {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: #e5e7eb;
  margin-bottom: 14px;
}

.aiconfig-confirm-impact {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.7;
}

.aiconfig-confirm-impact strong { color: #e5e7eb; font-weight: 500; }

.aiconfig-confirm-prompt {
  font-size: 11.5px;
  color: #6b7280;
  margin-bottom: 6px;
}

.aiconfig-confirm-prompt strong { color: #f97316; }

.aiconfig-confirm-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ================================
   DRAG STATE
   ================================ */
.aiconfig-prow.dragging   { opacity: 0.38; }
.aiconfig-prow.drag-over  { border-top-color: #e7c78f !important; }

/* ================================
   LINK BUTTON (inline actions)
   ================================ */
.aiconfig-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #6b7280;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.aiconfig-link:hover { color: #9ca3af; }

/* ================================
   INCIDENT BANNER
   ================================ */
.aiconfig-incident-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 16px;
  background: rgba(249, 115, 22, 0.07);
  border: 1px solid rgba(249, 115, 22, 0.28);
  border-radius: 9px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #f97316;
  line-height: 1.55;
}

.aiconfig-incident-icon {
  flex-shrink: 0;
  font-size: 14px;
  margin-top: 1px;
}

.aiconfig-incident-text { flex: 1; }
.aiconfig-incident-text strong { font-weight: 600; }

/* ================================
   RADIO GROUP (cost controls)
   ================================ */
.aiconfig-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aiconfig-radio-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.aiconfig-radio-opt input[type="radio"] {
  accent-color: #e7c78f;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

.aiconfig-radio-label {
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.4;
}

/* ================================
   TOGGLE ROW (access controls)
   ================================ */
.aiconfig-toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.4;
}

.aiconfig-toggle-row input[type="checkbox"] {
  accent-color: #86efac;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

/* ================================
   ADVANCED DISCLOSURE SECTION
   ================================ */
.aiconfig-advanced-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #1a1f29;
}

.aiconfig-advanced-body {
  animation: aiconfig-fadein 120ms ease;
}

@keyframes aiconfig-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================
   USERS LIST — u-* namespace
========================= */

.u-card {
  background: #0e1117;
  border: 1px solid #1f2937;
  border-radius: 8px;
  overflow: hidden;
}

.u-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #1a1f29;
}

.u-title {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
  letter-spacing: 0.02em;
}

.u-total {
  font-size: 12px;
  color: #4b5563;
}

/* Ops strip */
.u-opstrip {
  display: flex;
  gap: 20px;
  padding: 10px 20px;
  border-bottom: 1px solid #1a1f29;
  background: #0b0e14;
}

.u-fact {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.u-fact-n {
  font-size: 18px;
  font-weight: 700;
  color: #e5e7eb;
  line-height: 1.1;
}

.u-fact-l {
  font-size: 10px;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.u-fact-amber .u-fact-n { color: #d4a042; }
.u-fact-ember .u-fact-n { color: #c45f3a; }

.u-sep {
  width: 1px;
  background: #1a1f29;
  align-self: stretch;
  margin: 2px 0;
}

/* Filter chips */
.u-chips {
  display: flex;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid #1a1f29;
  flex-wrap: wrap;
}

.u-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #1f2937;
  background: transparent;
  color: #6b7280;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms, color 120ms, background 120ms;
  white-space: nowrap;
}

.u-chip:hover {
  border-color: #374151;
  color: #9ca3af;
}

.u-chip-active {
  border-color: #374151;
  background: #1a1f29;
  color: #e5e7eb;
}

.u-chip-amber.u-chip-active {
  border-color: #92700e;
  background: #1c1609;
  color: #d4a042;
}

.u-chip-ember.u-chip-active {
  border-color: #7a3520;
  background: #190d08;
  color: #c45f3a;
}

.u-chip-count {
  font-size: 10px;
  opacity: 0.7;
}

/* Search */
.u-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid #1a1f29;
}

.u-search-icon {
  color: #374151;
  font-size: 13px;
  flex-shrink: 0;
}

.u-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e5e7eb;
  font-size: 12px;
  font-family: inherit;
  padding: 0;
}

.u-search-input::placeholder {
  color: #374151;
}

/* Rows */
.u-rows {
  overflow-y: auto;
  max-height: 480px;
}

.u-empty {
  padding: 24px 20px;
  text-align: center;
  color: #374151;
  font-size: 12px;
}

.u-row {
  display: grid;
  grid-template-columns: 10px 1fr 68px 100px 130px 14px;
  align-items: center;
  gap: 0 12px;
  padding: 9px 20px;
  border-bottom: 1px solid #111827;
  cursor: pointer;
  transition: background 100ms;
}

.u-row:last-child { border-bottom: none; }

.u-row:hover { background: #111827; }

.u-row-dim {
  opacity: 0.55;
}

.u-row-selected {
  background: #111827;
}

/* State dot */
.u-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.u-dot-sage    { background: #6db891; }
.u-dot-amber   { background: #d4a042; }
.u-dot-ember   { background: #c45f3a; }
.u-dot-neutral { background: #374151; }
.u-dot-dim     { opacity: 0.5; }

/* Identity */
.u-id {
  min-width: 0;
}

.u-email {
  font-size: 12px;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.u-meta {
  font-size: 10px;
  color: #4b5563;
  margin-top: 1px;
}

.u-meta-ember { color: #c45f3a; }

.u-verif      { font-size: 10px; margin-left: 5px; }
.u-verif-ok   { color: #3d6b50; }
.u-verif-no   { color: #8a7558; }

/* Access badge */
.u-access {
  font-size: 10px;
  color: #4b5563;
  text-align: right;
  white-space: nowrap;
}

.u-access-byok {
  color: #6b7280;
}

/* Balance */
.u-balance {
  text-align: right;
}

.u-bal {
  font-size: 12px;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}

.u-bal-amber { color: #d4a042; }
.u-bal-ember { color: #c45f3a; }

.u-bal-dash {
  color: #374151;
}

.u-bal-sub {
  font-size: 10px;
  color: #4b5563;
  margin-top: 1px;
}

/* Activity */
.u-activity {
  text-align: right;
}

.u-act-spend {
  font-size: 12px;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
}

.u-act-last {
  font-size: 10px;
  color: #4b5563;
  margin-top: 1px;
}

/* Chevron */
.u-chev {
  color: #374151;
  font-size: 10px;
}

/* Mobile */
@media (max-width: 640px) {
  .u-opstrip {
    gap: 12px;
    padding: 10px 14px;
    flex-wrap: wrap;
  }

  .u-chips {
    padding: 8px 14px;
  }

  .u-search-wrap {
    padding: 8px 14px;
  }

  .u-row {
    grid-template-columns: 8px 1fr 60px;
    grid-template-areas:
      "dot id  bal"
      ".   act act";
    gap: 2px 8px;
    padding: 10px 14px;
  }

  .u-row > .u-dot     { grid-area: dot; }
  .u-row > .u-id      { grid-area: id; }
  .u-row > .u-balance { grid-area: bal; text-align: right; }
  .u-row > .u-activity{ grid-area: act; text-align: left; }
  .u-row > .u-access  { display: none; }
  .u-row > .u-chev    { display: none; }
}

/* =========================
   USER DETAIL — ud-* namespace
========================= */

.ud-panel {
  /* wraps header + body */
}

/* Crumb */
.ud-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #4b5563;
  margin-bottom: 16px;
}

.ud-crumb-back {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  font-family: inherit;
}

.ud-crumb-back:hover { color: #9ca3af; }

.ud-crumb-sep { color: #374151; }

.ud-crumb-curr {
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

/* Header */
.ud-header {
  padding: 20px 0 0;
  margin-bottom: 4px;
}

/* Identity grid */
.ud-identity {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  align-items: center;
}

/* Avatar */
.ud-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #111827;
  border: 1px solid #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #6b7280;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.ud-avatar-sage   { box-shadow: inset 0 0 0 1.5px #6db891; color: #6db891; }
.ud-avatar-amber  { box-shadow: inset 0 0 0 1.5px #d4a042; color: #d4a042; }
.ud-avatar-ember  { box-shadow: inset 0 0 0 1.5px #c45f3a; color: #c45f3a; }
.ud-avatar-neutral{ box-shadow: inset 0 0 0 1.5px #374151; }

/* Name block */
.ud-name {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.ud-name-email {
  font-size: 16px;
  font-weight: 600;
  color: #e5e7eb;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ud-name-email-dis {
  text-decoration: line-through;
  text-decoration-color: #c45f3a;
  color: #9ca3af;
}

.ud-badges {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 10px;
  color: #4b5563;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-wrap: wrap;
}

.ud-bdg-sep     { color: #374151; }
.ud-bdg-managed { color: #d4a042; }
.ud-bdg-byok    { color: #6b7280; }
.ud-bdg-admin   { color: #e5e7eb; }
.ud-bdg-blocked { color: #c45f3a; }
.ud-bdg-disabled{ color: #c45f3a; }

/* Actions */
.ud-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.ud-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #0e1117;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.ud-btn-primary:hover { background: #f9fafb; }

.ud-btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid #1f2937;
  color: #9ca3af;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.ud-btn-icon:hover {
  background: #111827;
  border-color: #374151;
}

/* Overflow menu */
.ud-overflow-wrap { position: relative; }

.ud-overflow-menu {
  display: none;
  position: absolute;
  top: 38px;
  right: 0;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 8px;
  min-width: 190px;
  padding: 4px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.ud-overflow-menu.ud-overflow-open { display: block; }

.ud-overflow-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 12px;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 5px;
  font-family: inherit;
}

.ud-overflow-item:hover {
  background: #1a1f29;
  color: #e5e7eb;
}

.ud-overflow-item-danger { color: #c45f3a; }
.ud-overflow-item-danger:hover { background: #190d08; color: #c45f3a; }

.ud-overflow-divider {
  height: 1px;
  background: #1a1f29;
  margin: 4px 0;
}

/* Balance headline */
.ud-headline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: baseline;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #1a1f29;
}

.ud-headline-simple {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #1a1f29;
}

.ud-bal-prom {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.ud-bal-label {
  font-size: 10px;
  color: #4b5563;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ud-bal-val {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #e5e7eb;
  font-variant-numeric: tabular-nums;
}

.ud-bal-val-amber { color: #d4a042; }
.ud-bal-val-ember { color: #c45f3a; }

.ud-bal-delta {
  font-size: 11px;
  color: #4b5563;
}

.ud-ctx {
  font-size: 11px;
  color: #4b5563;
  text-align: right;
  line-height: 1.7;
}

.ud-ctx strong {
  color: #9ca3af;
  font-weight: 400;
}

/* Body wrapper */
.ud-body {
  padding-top: 4px;
}

/* Responsive */
@media (max-width: 640px) {
  .ud-identity {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
    gap: 10px 12px;
  }

  .ud-avatar {
    width: 40px;
    height: 40px;
    font-size: 13px;
  }

  .ud-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .ud-name-email { font-size: 14px; }

  .ud-headline {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .ud-ctx { text-align: left; }
  .ud-bal-val { font-size: 22px; }
}

/* =========================
   USER DETAIL BODY — 3A layout, 3B drawer, 3C events
========================= */

/* Body 2-column grid */
.ud-body-grid {
  display: grid;
  grid-template-columns: 1fr 230px;
  gap: 0 28px;
  padding-top: 20px;
  align-items: start;
}

/* ── Event stream ──────────────────────────────────────────────── */
.ud-stream {}

.ud-stream-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid #1a1f29;
  margin-bottom: 2px;
}

.ud-stream-title {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4b5563;
}

.ud-stream-controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 4px;
  flex-wrap: wrap;
}

.ud-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ud-filter-group-range {
  justify-content: flex-end;
}

.ud-filter-chip,
.ud-load-more {
  border: 1px solid #1f2937;
  background: rgba(17, 24, 39, 0.42);
  color: #6b7280;
  border-radius: 999px;
  font: inherit;
  font-size: 10.5px;
  line-height: 1;
  padding: 6px 9px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.ud-filter-chip:hover,
.ud-load-more:hover {
  background: rgba(31, 41, 55, 0.45);
  border-color: #374151;
  color: #9ca3af;
}

.ud-filter-chip.active {
  background: rgba(120, 83, 21, 0.20);
  border-color: rgba(190, 150, 82, 0.45);
  color: #d7c5a8;
}

.ud-events-more {
  padding: 12px 0 2px;
}

.ud-load-more {
  border-radius: 7px;
  padding: 7px 11px;
}

.ud-load-more:disabled {
  cursor: default;
  opacity: 0.55;
}

.ud-day-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #374151;
  padding: 14px 0 6px;
}

.ud-day-label:first-child { padding-top: 8px; }

.ud-evt {
  display: grid;
  grid-template-columns: 18px 50px 1fr 72px 60px;
  gap: 0 9px;
  align-items: baseline;
  padding: 7px 0;
  border-top: 1px solid #111827;
  font-size: 11.5px;
}

.ud-evt:first-of-type { border-top: none; }

.ud-evt-icon {
  font-size: 12px;
  text-align: center;
  color: #374151;
}

.ud-evt-icon-up   { color: #6db891; }
.ud-evt-icon-down { color: #c45f3a; }
.ud-evt-icon-ai   { color: #9b7b42; }

.ud-evt-time {
  font-size: 11px;
  color: #4b5563;
  white-space: nowrap;
}

.ud-evt-desc {
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ud-evt-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  white-space: nowrap;
}

.ud-evt-amount-up   { color: #6db891; }
.ud-evt-amount-down { color: #c45f3a; }
.ud-evt-amount-ai   { color: #6b7280; }

.ud-evt-running {
  text-align: right;
  color: #374151;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ud-evt-empty {
  padding: 20px 0;
  font-size: 12px;
  color: #374151;
}

.ud-loading {
  padding: 16px 0;
  font-size: 12px;
  color: #374151;
}

/* ── Vitals column ─────────────────────────────────────────────── */
.ud-vitals {
  border-left: 1px solid #1a1f29;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
}

.ud-vital {
  padding: 12px 0;
  border-bottom: 1px solid #111827;
}

.ud-vital:last-child { border-bottom: none; }

.ud-vital-label {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4b5563;
  margin-bottom: 5px;
}

.ud-vital-value {
  font-size: 13px;
  color: #e5e7eb;
  margin-bottom: 3px;
  font-weight: 500;
}

.ud-vital-value-amber { color: #d4a042; }
.ud-vital-value-ember { color: #c45f3a; }

.ud-vital-value-sm {
  font-size: 11.5px;
  color: #9ca3af;
  line-height: 1.75;
  font-weight: 400;
}

.ud-vital-meta {
  font-size: 11px;
  color: #4b5563;
  margin-bottom: 4px;
  line-height: 1.5;
}

.ud-vital-link {
  display: block;
  background: none;
  border: none;
  padding: 2px 0;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  margin-top: 3px;
}

.ud-vital-link:hover { color: #9ca3af; }

.ud-vital-link-danger        { color: #9a4a35; }
.ud-vital-link-danger:hover  { color: #c45f3a; }

.ud-vital-sep {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid #1a1f29;
  border-bottom: none;
}

/* ── Drawer (udw-*) ────────────────────────────────────────────── */
.udw-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.50);
  z-index: 300;
}

.udw-scrim.udw-open { display: block; }

.udw-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: #0e1117;
  border-left: 1px solid #1f2937;
  box-shadow: -20px 0 48px rgba(0, 0, 0, 0.55);
  z-index: 301;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.udw-panel.udw-open { transform: translateX(0); }

.udw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #1a1f29;
  flex-shrink: 0;
}

.udw-title {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
}

.udw-close {
  background: none;
  border: none;
  color: #4b5563;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}

.udw-close:hover { color: #9ca3af; }

.udw-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.udw-desc {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.6;
  margin: 0;
}

.udw-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.udw-label {
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}

.udw-input {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 6px;
  color: #e5e7eb;
  font-size: 13px;
  font-family: inherit;
  padding: 8px 10px;
  outline: none;
  width: 100%;
}

.udw-input:focus { border-color: #374151; }

.udw-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.udw-cancel {
  background: none;
  border: 1px solid #1f2937;
  border-radius: 999px;
  color: #6b7280;
  font-size: 12px;
  font-family: inherit;
  padding: 7px 14px;
  cursor: pointer;
}

.udw-cancel:hover { border-color: #374151; color: #9ca3af; }

/* Responsive Phase 3 */
@media (max-width: 640px) {
  .ud-body-grid {
    grid-template-columns: 1fr;
  }

  .ud-vitals {
    border-left: none;
    border-top: 1px solid #1a1f29;
    padding-left: 0;
    padding-top: 16px;
    margin-top: 16px;
  }

  .ud-evt {
    grid-template-columns: 16px 1fr 64px;
    grid-template-areas: "icon desc amt" "icon time run";
    gap: 2px 8px;
  }

  .ud-evt > .ud-evt-icon   { grid-area: icon; align-self: center; }
  .ud-evt > .ud-evt-time   { grid-area: time; }
  .ud-evt > .ud-evt-desc   { grid-area: desc; }
  .ud-evt > .ud-evt-amount { grid-area: amt; }
  .ud-evt > .ud-evt-running{ display: none; }

  .ud-stream-controls {
    gap: 8px;
  }

  .ud-filter-group,
  .ud-filter-group-range {
    justify-content: flex-start;
  }

  .udw-panel { width: 100%; }
}

/* ── Danger-confirm modal (ud-dc-*) ────────────────────────────────────────── */
.ud-dc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ud-dc-box {
  background: #0e1117;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 24px 28px;
  width: 380px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.ud-dc-title {
  font-size: 14px;
  font-weight: 600;
  color: #f9fafb;
  margin: 0 0 10px;
}

.ud-dc-body {
  font-size: 12.5px;
  color: #9ca3af;
  line-height: 1.6;
  margin: 0 0 12px;
}

.ud-dc-body strong { color: #e5e7eb; }

.ud-dc-warn {
  font-size: 11.5px;
  color: #c45f3a;
  background: rgba(196, 95, 58, 0.08);
  border: 1px solid rgba(196, 95, 58, 0.25);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.ud-dc-label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 5px;
}

.ud-dc-label strong { color: #d1d5db; }

.ud-dc-input {
  width: 100%;
  box-sizing: border-box;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #e5e7eb;
  font-size: 13px;
  padding: 7px 10px;
  margin-bottom: 16px;
  outline: none;
  font-family: inherit;
}

.ud-dc-input:focus { border-color: #4b5563; }

.ud-dc-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.ud-dc-cancel {
  background: none;
  border: 1px solid #1f2937;
  color: #6b7280;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.ud-dc-cancel:hover { border-color: #374151; color: #9ca3af; }

.ud-dc-confirm-btn {
  background: #7f1d1d;
  border: none;
  border-radius: 6px;
  color: #fca5a5;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 18px;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms;
}

.ud-dc-confirm-btn:hover:not(:disabled) { background: #991b1b; }
.ud-dc-confirm-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.ud-dc-confirm-btn.ud-dc-safe {
  background: #1e3a5f;
  color: #93c5fd;
}
.ud-dc-confirm-btn.ud-dc-safe:hover:not(:disabled) { background: #1d4ed8; color: #bfdbfe; }

/* Undo toast */
.ud-undo-toast { display: flex; align-items: center; gap: 12px; white-space: normal; }
.ud-undo-msg   { flex: 1; }
.ud-undo-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #d1d5db;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.ud-undo-btn:hover { border-color: rgba(255, 255, 255, 0.38); color: #f9fafb; }

/* Drawer field validation helpers */
.udw-required    { color: #c45f3a; margin-left: 2px; }
.udw-field-hint  { font-size: 10.5px; color: #4b5563; margin-top: 3px; display: block; }
.udw-input-error { border-color: #c45f3a !important; }
.udw-field-err   { font-size: 11px; color: #c45f3a; margin-top: 4px; display: block; }

/* =========================
   AI STYLES PAGE
========================= */

.styles-overview {
  max-width: 920px;
  margin-bottom: 32px;
}

/* Defaults strip — compact 3-col: label | fields | action */
.styles-defaults-strip {
  display: grid;
  grid-template-columns: minmax(110px, 150px) 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 22px 0 20px;
  max-width: 920px;
  border-top: 1px solid rgba(245, 239, 230, 0.042);
}

.styles-defaults-fields {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.styles-defaults-row {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 10px;
}

.styles-defaults-ctx {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

/* Library section */
.styles-library {
  max-width: 920px;
  padding-top: 22px;
  border-top: 1px solid rgba(245, 239, 230, 0.042);
}

.styles-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.styles-library-head button { flex-shrink: 0; }

.styles-new-btn {
  height: 29px;
  padding: 0 13px;
  background: transparent;
  border: 1px solid rgba(245, 239, 230, 0.08);
  border-radius: 999px;
  color: #6b7280;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 130ms ease, color 130ms ease, background 130ms ease;
}

.styles-new-btn:hover {
  border-color: rgba(232, 201, 124, 0.3);
  color: rgba(232, 201, 124, 0.75);
  background: rgba(232, 201, 124, 0.04);
}

/* Style rows — expandable personality library */
.styles-list {
  display: flex;
  flex-direction: column;
}

/* Row wrapper */
.styles-row-wrap {
  border-bottom: 1px solid rgba(245, 239, 230, 0.04);
  transition: background 150ms ease, box-shadow 150ms ease;
}

.styles-row-wrap:last-child { border-bottom: 0; }

.styles-row-wrap:not(.styles-row-wrap--open):hover {
  background: rgba(245, 239, 230, 0.016);
}

.styles-row-wrap--open {
  box-shadow: inset 2px 0 0 rgba(231, 199, 143, 0.22);
  border-bottom-color: rgba(245, 239, 230, 0.055);
}

/* Clickable row header */
.styles-row-head {
  display: grid;
  grid-template-columns: 14px minmax(100px, 190px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  cursor: pointer;
  user-select: none;
}

.styles-row-wrap--open .styles-row-head {
  padding-bottom: 6px;
}

/* CSS chevron */
.styles-row-chevron {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.styles-row-chevron::before {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid #3d4451;
  border-bottom: 1.5px solid #3d4451;
  transform: rotate(-45deg) translate(-1px, 1px);
  transition: transform 160ms ease, border-color 160ms ease;
}

.styles-row-wrap--open .styles-row-chevron::before {
  transform: rotate(45deg) translate(-1px, -1px);
  border-color: rgba(232, 201, 124, 0.5);
}

/* Name */
.styles-row-name {
  font-size: 13px;
  font-weight: 650;
  color: #d8cfc3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 150ms ease;
}

.styles-row-wrap--open .styles-row-head .styles-row-name {
  color: #e5dfd8;
}

.styles-row-name--draft {
  font-weight: 400;
  color: #4b5563;
  font-style: normal;
}

/* Preview */
.styles-row-preview {
  font-size: 12px;
  color: #3d4451;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
  transition: opacity 150ms ease;
}

.styles-row-wrap--open .styles-row-preview {
  opacity: 0;
  pointer-events: none;
}

/* Inline editor — expands within the row */
.styles-row-editor {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 6px 0 26px;
  transition: max-height 220ms ease, opacity 160ms ease, padding 220ms ease;
}

.styles-row-wrap--open .styles-row-editor {
  max-height: 800px;
  opacity: 1;
  padding: 10px 14px 26px 24px;
}

/* Name input — open baseline, no box identity */
.styles-row-name-input {
  display: block;
  width: 100%;
  max-width: 300px;
  height: 34px;
  padding: 0 2px;
  margin-bottom: 10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0;
  color: #e8e2da;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  box-sizing: border-box;
}

.styles-row-name-input::placeholder { color: #3d4451; }

.styles-row-name-input:focus {
  outline: none;
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

/* Inline editor textarea — tighter height than standalone use */
.styles-row-editor .styles-content-input {
  min-height: 110px;
}

/* Content textarea — fully open composing surface, no box */
.styles-content-input {
  display: block;
  width: 100%;
  min-height: 140px;
  max-height: 50vh;
  box-sizing: border-box;
  padding: 8px 2px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #f5efe6;
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
}

.styles-content-input::placeholder { color: #4b5563; }

.styles-content-input:focus { outline: none; }

.styles-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.styles-form-actions .btn-danger-action { margin-left: auto; }

/* State indicators */
.styles-empty,
.styles-loading {
  padding: 18px 6px;
  font-size: 13px;
  color: #4b5563;
}

.styles-error {
  padding: 18px 6px;
  font-size: 13px;
  color: #c45f3a;
}

@media (max-width: 860px) {
  .styles-defaults-strip {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .styles-defaults-actions { padding-top: 4px; }
}
