/* ---- App Header ---- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(1.5rem, 4vw, 3rem);
}

.app-header-inner {
  max-width: 76rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4.25rem;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-width: 0;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text-primary);
  flex-shrink: 0;
}

.app-brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.625rem;
  background: #1f2924;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.app-brand-name {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-header-user {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.app-header-avatar {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: #f1ece4;
  color: #77533e;
  font-size: 0.6875rem;
  font-weight: 700;
}

.app-header-admin-link {
  padding: 0.3125rem 0.5625rem;
  border-radius: 999px;
  background: #fff1e9;
  color: #b74716;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-header-signout {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: 0;
  border-radius: 0.5rem;
  padding: 0.5rem 0.625rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.app-header-signout:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

/* ---- App Main ---- */

.app-main {
  max-width: 76rem;
  margin: 0 auto;
  padding: 2.25rem clamp(1.5rem, 4vw, 3rem) 4rem;
}

/* ---- App Header Nav ---- */

.app-header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.app-header-nav-link {
  position: relative;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.5rem 0.6875rem;
  border-radius: 0.5rem;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.app-header-nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.app-header-nav-link.active {
  color: var(--text-primary);
  background: #f2efe9;
}

/* ---- Admin Nav ---- */

.admin-nav {
  display: flex;
  gap: 0.25rem;
  margin-left: var(--space-md);
}

.app-header-admin {
  border-bottom-color: var(--red);
}

.admin-badge {
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.375rem 0.625rem;
  border-radius: 0.375rem;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.admin-nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.admin-nav-link.active {
  color: var(--text-primary);
  background: var(--bg-surface);
}

/* ---- Auth Layout ---- */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.auth-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 2rem;
  width: 100%;
  max-width: 24rem;
}

.auth-logo {
  display: block;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-md);
}

.auth-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: var(--space-md);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-md);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--blue);
  font-weight: 500;
}

.auth-errors {
  background: rgba(185, 28, 28, 0.08);
  border: 1px solid rgba(185, 28, 28, 0.2);
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  margin-bottom: var(--space-sm);
  font-size: 0.8125rem;
  color: var(--red);
}

/* ---- Stat Row ---- */

.stat-row {
  display: flex;
  gap: var(--space-md);
  font-size: 0.8125rem;
}

.stat-item {
  color: var(--text-muted);
}

.stat-item strong {
  color: var(--text-primary);
}

a.stat-item {
  text-decoration: none;
}

/* ---- Filter Bar ---- */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.filter-bar-left {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.filter-form {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.filter-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.filter-select-sm { width: 5rem; }
.filter-text-md { width: 10rem; }

.quick-filter {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1875rem 0.5rem;
  border-radius: 0.25rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.quick-filter:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.quick-filter-active {
  background: var(--blue);
  color: #fff;
}

.quick-filter-active:hover {
  background: var(--blue-hover);
  color: #fff;
}

/* ---- Seat Items ---- */

.seat-item {
  border-bottom: 1px solid var(--border);
}

.seat-item:last-child {
  border-bottom: none;
}

.seat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.key-gen-form {
  display: flex;
  gap: var(--space-sm);
  align-items: end;
}

.key-gen-input {
  margin-bottom: 0;
  flex: 1;
}

/* ---- Full-Height Page ---- */

.page-full-height {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 3.5rem - 5rem);
}

.card-flex {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-flex-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ---- Token Bar ---- */

.sparkline-col {
  min-width: 160px;
  width: 160px;
}

.sparkline-cell {
  padding-top: 0.25rem !important;
  padding-bottom: 0.25rem !important;
}

.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 24px;
}

.spark-bar {
  flex: 1;
  min-height: 1px;
  background: var(--blue);
  border-radius: 1px 1px 0 0;
}

.spark-bar-midnight {
  position: relative;
  margin-left: 3px;
}

.spark-bar-midnight::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: -2px;
  width: 1px;
  height: 24px;
  background: var(--text-muted);
}

/* ---- Customer Dashboard ---- */

.dashboard-page {
  display: grid;
  gap: 1.25rem;
}

.dashboard-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 0.25rem 0 0.375rem;
}

.dashboard-eyebrow {
  margin-bottom: 0.375rem;
  color: #bd4e1c;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dashboard-heading h1 {
  color: var(--text-primary);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.dashboard-heading-copy {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.dashboard-period {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  box-shadow: 0 1px 2px rgba(35, 30, 24, 0.03);
}

.dashboard-period-presets {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.dashboard-control-label {
  padding-left: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.dashboard-range-options {
  display: inline-flex;
  gap: 0.1875rem;
  padding: 0.1875rem;
  background: #f1eee8;
  border-radius: 0.625rem;
}

.dashboard-range-option {
  min-width: 3.75rem;
  padding: 0.4375rem 0.625rem;
  border-radius: 0.4375rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.dashboard-range-option:hover {
  color: var(--text-primary);
}

.dashboard-range-option.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(35, 30, 24, 0.1);
}

.dashboard-date-form {
  display: flex;
  align-items: end;
  gap: 0.5rem;
}

.dashboard-date-field {
  display: grid;
  gap: 0.1875rem;
}

.dashboard-date-field label {
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dashboard-date-input {
  width: 8.75rem;
  height: 2.125rem;
  padding: 0 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dashboard-date-input:focus {
  outline: none;
  border-color: #dd6b36;
  box-shadow: 0 0 0 3px rgba(221, 107, 54, 0.12);
}

.dashboard-date-separator {
  padding-bottom: 0.375rem;
  color: #a39c93;
  font-size: 0.75rem;
}

.dashboard-date-submit {
  height: 2.125rem;
  margin-left: 0.125rem;
  padding: 0 0.875rem;
  border-radius: 0.5rem;
  background: #d75d26;
  border-color: #d75d26;
  box-shadow: none;
}

.dashboard-date-submit:hover {
  background: #bd4e1c;
  border-color: #bd4e1c;
}

.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.875rem;
}

.dashboard-metric {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  min-width: 0;
  padding: 1.125rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  color: var(--text-secondary);
  box-shadow: 0 1px 2px rgba(35, 30, 24, 0.03);
}

.dashboard-metric-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  flex: 0 0 auto;
}

.dashboard-metric-icon svg,
.dashboard-empty-icon svg {
  width: 1.125rem;
  height: 1.125rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.dashboard-metric-icon--requests {
  background: #eaf3ee;
  color: #367459;
}

.dashboard-metric-icon--input {
  background: #edf1fa;
  color: #51699d;
}

.dashboard-metric-icon--output {
  background: #f2edfa;
  color: #795c9f;
}

.dashboard-metric-label {
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.dashboard-metric-value {
  margin-top: 0.25rem;
  color: var(--text-primary);
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.dashboard-metric-detail {
  margin-top: 0.25rem;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.6875rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-usage-card {
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  box-shadow: 0 1px 2px rgba(35, 30, 24, 0.03);
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.dashboard-card-header h2 {
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.dashboard-card-header p {
  margin-top: 0.1875rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.dashboard-detail-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: #b74716;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-detail-link span {
  transition: transform 0.15s;
}

.dashboard-detail-link:hover span {
  transform: translateX(2px);
}

.dashboard-table-wrap {
  overflow-x: auto;
}

.dashboard-usage-table {
  min-width: 48rem;
}

.dashboard-usage-table thead th {
  padding: 0.6875rem 1rem;
  background: #fbfaf7;
  color: #625d56;
  font-size: 0.625rem;
  letter-spacing: 0.07em;
}

.dashboard-usage-table tbody th,
.dashboard-usage-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom-color: #ebe7e0;
  font-size: 0.8125rem;
  font-weight: 500;
  vertical-align: middle;
}

.dashboard-usage-table tbody tr {
  transition: background 0.15s;
}

.dashboard-usage-table tbody tr:hover {
  background: #fcfaf7;
}

.dashboard-model-cell {
  width: 32%;
  min-width: 14rem;
  color: var(--text-primary);
  text-align: left;
}

.dashboard-model-name {
  overflow: hidden;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-model-name code {
  padding: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
}

.dashboard-model-breakdown {
  display: grid;
  gap: 0.1875rem;
  width: min(12rem, 95%);
  margin-top: 0.375rem;
}

.dashboard-model-share {
  display: grid;
  grid-template-columns: 1.5rem minmax(3rem, 1fr) 2.5rem;
  align-items: center;
  gap: 0.375rem;
}

.dashboard-model-share-label,
.dashboard-model-share-value,
.dashboard-activity-label {
  color: var(--text-muted);
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dashboard-model-share-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dashboard-model-share-track {
  display: block;
  height: 0.1875rem;
  overflow: hidden;
  background: #eeeae3;
  border-radius: 999px;
}

.dashboard-model-share-bar {
  display: block;
  height: 100%;
  min-width: 1px;
  border-radius: inherit;
}

.dashboard-model-share-bar--input {
  background: #6078a8;
}

.dashboard-model-share-bar--output {
  background: #8a68a6;
}

.dashboard-input-cell {
  color: #465d8b;
}

.dashboard-output-cell {
  color: #735493;
}

.dashboard-total-cell {
  color: var(--text-primary);
  font-weight: 700 !important;
}

.dashboard-usage-table .sparkline-col {
  min-width: 11rem;
  width: 11rem;
}

.dashboard-usage-table .sparkline-cell {
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
}

.dashboard-activity {
  display: grid;
  gap: 0.25rem;
}

.dashboard-activity-series {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.375rem;
}

.dashboard-usage-table .sparkline {
  height: 0.875rem;
  gap: 2px;
}

.dashboard-activity-series--input .spark-bar {
  background: #6078a8;
  opacity: 0.78;
}

.dashboard-activity-series--output .spark-bar {
  background: #8a68a6;
  opacity: 0.78;
}

.dashboard-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  background: #fbfaf7;
  color: var(--text-muted);
  font-size: 0.6875rem;
  line-height: 1.4;
}

.dashboard-empty-state {
  display: grid;
  justify-items: center;
  padding: 4rem var(--space-md);
  text-align: center;
}

.dashboard-empty-icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 0.875rem;
  border-radius: 0.75rem;
  background: #f3eee7;
  color: #8e786a;
}

.dashboard-empty-state h3 {
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 700;
}

.dashboard-empty-state p {
  max-width: 25rem;
  margin: 0.375rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ---- API Keys ---- */

.api-key-primary-action {
  gap: 0.375rem;
  flex: 0 0 auto;
}

.api-key-primary-action svg,
.api-key-secret-icon svg,
.api-key-create-icon svg,
.api-key-create-note svg {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.api-key-secret {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.875rem;
  padding: 1rem;
  background: #edf7f1;
  border: 1px solid #cfe5d7;
  border-radius: 0.875rem;
  color: #285d45;
  box-shadow: 0 1px 2px rgba(35, 30, 24, 0.03);
}

.api-key-secret-icon,
.api-key-create-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  background: rgba(54, 116, 89, 0.1);
  color: #367459;
}

.api-key-secret-icon svg,
.api-key-create-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.api-key-secret h2 {
  color: #204c38;
  font-size: 0.9375rem;
  font-weight: 700;
}

.api-key-secret p {
  margin-top: 0.1875rem;
  font-size: 0.75rem;
  line-height: 1.45;
}

.api-key-secret-field {
  max-width: 46rem;
  margin-top: 0.75rem;
}

.api-key-secret-field .key-copy-input {
  min-width: 0;
  background: rgba(255, 255, 255, 0.86);
  border-color: #bdd8c8;
}

.api-key-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19rem;
  align-items: start;
  gap: 1rem;
}

.api-key-list-card {
  min-width: 0;
}

.api-key-count {
  flex: 0 0 auto;
  padding: 0.3125rem 0.5rem;
  border-radius: 999px;
  background: #f2efe9;
  color: #625d56;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.api-key-table {
  min-width: 43rem;
}

.api-key-table thead th {
  padding: 0.6875rem 1rem;
  background: #fbfaf7;
  color: #625d56;
  font-size: 0.625rem;
  letter-spacing: 0.07em;
}

.api-key-table tbody th,
.api-key-table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #ebe7e0;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  vertical-align: middle;
}

.api-key-table tbody tr:last-child th,
.api-key-table tbody tr:last-child td {
  border-bottom: 0;
}

.api-key-name-cell {
  min-width: 9rem;
  color: var(--text-primary) !important;
  text-align: left;
}

.api-key-name {
  display: block;
  max-width: 12rem;
  overflow: hidden;
  font-size: 0.8125rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
  color: #367459;
  font-size: 0.625rem;
  font-weight: 650;
}

.api-key-status::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: #4d9876;
}

.api-key-table code {
  padding: 0.1875rem 0.375rem;
  background: #f2efe9;
  color: #5e5952;
  font-size: 0.6875rem;
}

.api-key-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.375rem;
  white-space: nowrap;
}

.api-key-actions form {
  display: inline-flex;
}

.api-key-actions-cell {
  text-align: right;
}

.api-key-revoke-button {
  border-color: #ead4cf;
  color: #a94735;
}

.api-key-revoke-button:hover {
  border-color: #c86b58;
  color: #8f3424;
}

.api-key-create-panel {
  position: sticky;
  top: 5.5rem;
  padding: 1.25rem;
  background: #fffdf9;
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  box-shadow: 0 1px 2px rgba(35, 30, 24, 0.03);
  scroll-margin-top: 5.5rem;
}

.api-key-create-panel h2 {
  margin-top: 0.875rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.api-key-create-panel > p {
  margin-top: 0.375rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.api-key-create-form {
  margin-top: 1rem;
}

.api-key-create-form .form-label,
.api-key-client-form .form-label {
  font-size: 0.75rem;
  font-weight: 650;
}

.api-key-create-form .form-input,
.api-key-client-form .form-select {
  height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
}

.api-key-create-form .form-input:focus,
.api-key-client-form .form-select:focus {
  border-color: #dd6b36;
  box-shadow: 0 0 0 3px rgba(221, 107, 54, 0.12);
}

.api-key-create-submit {
  width: 100%;
}

.api-key-create-note {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  margin-top: 1rem !important;
  padding-top: 0.875rem;
  border-top: 1px solid #ebe7e0;
  color: #777168 !important;
}

.api-key-create-note svg {
  flex: 0 0 auto;
  margin-top: 0.1rem;
}

.api-key-empty-state {
  padding-block: 3.25rem;
}

.api-key-connect-card {
  overflow: visible;
}

.api-key-client-setup {
  display: grid;
  grid-template-columns: minmax(14rem, 0.8fr) minmax(20rem, 1.4fr);
  gap: 2rem;
  padding: 1.25rem;
}

.api-key-client-intro {
  padding-right: 1.5rem;
  border-right: 1px solid #ebe7e0;
}

.api-key-client-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.api-key-client-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: #242a27;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 1.125rem;
  font-weight: 700;
}

.api-key-client-title h3 {
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 700;
}

.api-key-client-title p {
  margin-top: 0.125rem;
  color: var(--text-muted);
  font-size: 0.6875rem;
}

.api-key-setup-steps {
  display: grid;
  gap: 0.625rem;
  margin-top: 1rem;
  list-style: none;
}

.api-key-setup-steps li {
  display: grid;
  grid-template-columns: 1.375rem minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.35;
}

.api-key-setup-steps li span {
  display: grid;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: #f2efe9;
  color: #6e675e;
  font-size: 0.625rem;
  font-weight: 700;
}

.api-key-client-note {
  margin-top: 1rem;
  padding-top: 0.875rem;
  border-top: 1px solid #ebe7e0;
  color: #625d56;
  font-size: 0.6875rem;
  line-height: 1.5;
}

.api-key-client-note code {
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: inherit;
}

.api-key-client-form {
  min-width: 0;
}

.api-key-client-form .form-select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font: inherit;
}

.api-key-storage-choice {
  margin-top: 0.875rem;
  padding: 0.75rem;
  background: #fbfaf7;
  border: 1px solid #ebe7e0;
  border-radius: 0.625rem;
}

.api-key-storage-choice .form-checkbox {
  margin: 0;
}

.api-key-storage-choice .form-hint {
  margin: 0.25rem 0 0 1.5rem;
  line-height: 1.45;
}

.api-key-storage-choice code {
  padding: 0;
  background: transparent;
  font-size: inherit;
}

.api-key-client-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.api-key-client-status {
  margin-top: 0.625rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.api-key-client-command {
  max-width: 100%;
  margin-top: 0.625rem;
  overflow-x: auto;
  padding: 0.75rem;
  background: #242a27;
  border-radius: 0.625rem;
  color: #eef4f0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.api-key-history {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
}

.api-key-history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  cursor: pointer;
  list-style: none;
}

.api-key-history summary::-webkit-details-marker {
  display: none;
}

.api-key-history summary strong,
.api-key-history summary small {
  display: block;
}

.api-key-history summary strong {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 650;
}

.api-key-history summary small {
  margin-top: 0.125rem;
  color: #625d56;
  font-size: 0.6875rem;
}

.api-key-history-count {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #f2efe9;
  color: #777168;
  font-size: 0.625rem;
  font-weight: 700;
}

.api-key-history-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.api-key-history-chevron {
  width: 1rem;
  height: 1rem;
  color: #6e675e;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  transition: transform 0.15s ease;
}

.api-key-history[open] summary {
  border-bottom: 1px solid var(--border);
}

.api-key-history[open] .api-key-history-chevron {
  transform: rotate(180deg);
}

/* ---- Usage Request Log ---- */

.usage-entry-count {
  display: inline-flex;
  align-items: center;
  min-height: 1.625rem;
  padding: 0 0.625rem;
  border-radius: 999px;
  background: #f2efe9;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
}

.usage-table-wrap {
  max-height: calc(100vh - 18rem);
  overflow-y: auto;
}

.usage-log-table {
  min-width: 48rem;
}

.usage-log-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.usage-log-table thead th {
  padding: 0.6875rem 1rem;
  background: #fbfaf7;
  color: #625d56;
  font-size: 0.625rem;
  letter-spacing: 0.07em;
}

.usage-log-table tbody th,
.usage-log-table tbody td {
  padding: 0.8125rem 1rem;
  border-bottom-color: #ebe7e0;
  font-size: 0.8125rem;
  font-weight: 500;
  vertical-align: middle;
}

.usage-log-table tbody tr {
  transition: background 0.15s;
}

.usage-log-table tbody tr:hover {
  background: #fcfaf7;
}

.usage-time-cell {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.usage-model-cell {
  max-width: 18rem;
  color: var(--text-primary);
  text-align: left;
}

.usage-model-cell code {
  display: block;
  overflow: hidden;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-key-cell {
  color: var(--text-muted);
}

.usage-speed-cell {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.usage-log-footer.pagination-bar {
  padding: 0.625rem 1.25rem;
}

.usage-log-footer .pagination-links a {
  color: #b74716;
  font-weight: 700;
}

/* ---- Responsive ---- */

@media (max-width: 1024px) {
  .dashboard-period {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-date-form {
    width: 100%;
  }

  .dashboard-date-field {
    flex: 1;
  }

  .dashboard-date-input {
    width: 100%;
  }

  .api-key-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .api-key-create-panel {
    position: static;
  }

}

@media (max-width: 768px) {
  .app-header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    padding: 0.75rem 0;
    gap: 0.625rem;
  }

  .app-header-left {
    display: contents;
  }

  .app-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .app-header-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .app-header-right {
    grid-column: 2;
    grid-row: 1;
    gap: var(--space-sm);
  }

  .app-header-email {
    display: none;
  }

  .app-header-user {
    display: inline-flex;
  }

  .admin-nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    margin-left: 0;
    gap: 0.125rem;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-form {
    flex-wrap: wrap;
  }

  .stat-row {
    flex-wrap: wrap;
  }

  .app-main {
    padding: 1.5rem var(--space-sm) 3rem;
  }

  .dashboard-page {
    gap: var(--space-sm);
  }

  .dashboard-period-presets {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.5rem;
  }

  .dashboard-range-options {
    width: 100%;
  }

  .dashboard-range-option {
    flex: 1;
  }

  .dashboard-date-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .dashboard-date-separator {
    display: none;
  }

  .dashboard-date-submit {
    grid-column: 1 / -1;
    margin-left: 0;
  }

  .dashboard-metric {
    padding: 1rem;
  }

  .dashboard-metric-detail {
    display: none;
  }

  .dashboard-card-header {
    align-items: flex-start;
    padding: 1rem;
  }

  .dashboard-card-footer {
    padding-inline: 1rem;
  }

  .api-key-client-setup {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .api-key-client-intro {
    padding: 0 0 1.25rem;
    border-right: 0;
    border-bottom: 1px solid #ebe7e0;
  }

  .usage-table-wrap {
    max-height: none;
  }

  .section-header-row {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .danger-zone {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .form-row {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding-inline: var(--space-sm);
  }

  .app-header-avatar {
    display: none;
  }

  .app-header-right {
    gap: 0.125rem;
  }

  .dashboard-heading-copy {
    max-width: 20rem;
  }

  .dashboard-summary {
    gap: 0.5rem;
  }

  .dashboard-metric {
    display: block;
    padding: 0.75rem;
  }

  .dashboard-metric-icon {
    width: 1.875rem;
    height: 1.875rem;
    margin-bottom: 0.75rem;
  }

  .dashboard-metric-value {
    font-size: 1.25rem;
  }

  .dashboard-card-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.625rem;
  }

  .dashboard-usage-table {
    display: block;
    min-width: 0;
  }

  .dashboard-table-head {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .dashboard-usage-table tbody {
    display: block;
  }

  .dashboard-usage-table tbody tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.875rem 0.625rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #ebe7e0;
  }

  .dashboard-usage-table tbody tr:last-child {
    border-bottom: 0;
  }

  .dashboard-usage-table tbody th,
  .dashboard-usage-table tbody td {
    padding: 0 !important;
    border: 0;
  }

  .dashboard-usage-table .dashboard-model-cell {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .dashboard-usage-table .dashboard-model-breakdown {
    width: min(14rem, 80%);
  }

  .dashboard-usage-table tbody td {
    color: var(--text-primary);
    font-size: 0.75rem;
    text-align: left;
  }

  .dashboard-usage-table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.1875rem;
    color: var(--text-muted);
    font-size: 0.5625rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.055em;
    text-transform: uppercase;
  }

  .dashboard-usage-table .sparkline-cell {
    grid-column: 1 / -1;
    padding-top: 0.125rem !important;
  }

  .dashboard-usage-table .sparkline {
    height: 1rem;
  }

  .dashboard-card-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.125rem;
  }

  .api-keys-page .dashboard-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .api-key-primary-action {
    width: 100%;
  }

  .api-key-secret {
    grid-template-columns: minmax(0, 1fr);
  }

  .api-key-secret-field {
    align-items: stretch;
    flex-direction: column;
  }

  .api-key-table {
    display: block;
    min-width: 0;
  }

  .api-key-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .api-key-table tbody {
    display: block;
  }

  .api-key-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.875rem 0.625rem;
    padding: 1rem;
    border-bottom: 1px solid #ebe7e0;
  }

  .api-key-table tbody tr:last-child {
    border-bottom: 0;
  }

  .api-key-table tbody th,
  .api-key-table tbody td {
    padding: 0 !important;
    border: 0;
    text-align: left;
  }

  .api-key-table .api-key-name-cell {
    grid-column: 1 / -1;
  }

  .api-key-table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.1875rem;
    color: #625d56;
    font-size: 0.5625rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.055em;
    text-transform: uppercase;
  }

  .api-key-actions-cell {
    grid-column: 1 / -1;
  }

  .api-key-actions {
    justify-content: flex-start;
  }

  .api-key-client-setup {
    padding: 1rem;
  }

  .api-key-client-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .api-key-history summary small {
    max-width: 16rem;
  }

  .usage-log-table {
    display: block;
    min-width: 0;
  }

  .usage-log-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .usage-log-table tbody {
    display: block;
  }

  .usage-log-table tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.875rem 0.625rem;
    padding: 1rem;
    border-bottom: 1px solid #ebe7e0;
  }

  .usage-log-table tbody tr:last-child {
    border-bottom: 0;
  }

  .usage-log-table tbody th,
  .usage-log-table tbody td {
    padding: 0 !important;
    border: 0;
    text-align: left;
  }

  .usage-log-table .usage-model-cell {
    grid-column: 1 / -1;
    grid-row: 1;
    max-width: none;
  }

  .usage-log-table .usage-time-cell {
    grid-column: span 2;
  }

  .usage-log-table tbody th::before,
  .usage-log-table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.1875rem;
    color: #625d56;
    font-size: 0.5625rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.055em;
    text-transform: uppercase;
  }

  .usage-log-footer.pagination-bar {
    align-items: flex-start;
    padding-inline: 1rem;
  }
}

/* ---- Admin Operations Console ---- */

.admin-body {
  min-width: 20rem;
  background: var(--admin-bg);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  transform: translateY(-200%);
  background: #fff;
  border-radius: 0.5rem;
  color: #1f2924;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(17, 24, 20, 0.2);
}

.skip-link:focus {
  transform: translateY(0);
}

.admin-shell {
  min-height: 100vh;
}

.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 16.5rem;
  overflow-y: auto;
  padding: 1.25rem 1rem 1rem;
  flex-direction: column;
  background: #202723;
  color: #f4f2ed;
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.04);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.25rem 0.375rem;
  color: #fff;
}

.admin-brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.6875rem;
  flex: 0 0 auto;
  background: #e56a34;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 2px 6px rgba(0, 0, 0, 0.18);
}

.admin-brand > span:last-child {
  display: grid;
  min-width: 0;
  line-height: 1.05;
}

.admin-brand strong {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.admin-brand small {
  margin-top: 0.25rem;
  color: #9fa9a3;
  font-size: 0.625rem;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.admin-navigation {
  display: grid;
  gap: 1.25rem;
  margin-top: 2rem;
}

.admin-nav-group {
  display: grid;
  gap: 0.1875rem;
}

.admin-nav-group-label {
  padding: 0 0.6875rem 0.375rem;
  color: #7f8b84;
  font-size: 0.5625rem;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6875rem;
  min-height: 2.375rem;
  padding: 0.5rem 0.6875rem;
  border-radius: 0.5625rem;
  color: #aeb7b1;
  font-size: 0.8125rem;
  font-weight: 560;
  line-height: 1.2;
  transition: color 0.15s, background 0.15s, transform 0.15s;
}

.admin-nav-item svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.admin-nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.admin-nav-item.active {
  background: #343d38;
  color: #fff;
  box-shadow: inset 2px 0 #e56a34;
}

.admin-nav-item:focus-visible,
.admin-brand:focus-visible,
.admin-session-actions a:focus-visible,
.admin-session-actions button:focus-visible {
  outline: 2px solid #f29a70;
  outline-offset: 2px;
}

.admin-sidebar-footer {
  display: grid;
  gap: 0.875rem;
  margin-top: auto;
  padding: 1.25rem 0.375rem 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-operator {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.admin-operator-avatar {
  display: grid;
  place-items: center;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #47534c;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 750;
}

.admin-operator-copy {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.admin-operator-copy strong {
  color: #e8ebe9;
  font-size: 0.6875rem;
  font-weight: 650;
}

.admin-operator-copy small {
  overflow: hidden;
  color: #8f9a94;
  font-size: 0.625rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-session-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.admin-session-actions a,
.admin-session-actions button {
  padding: 0;
  background: none;
  border: 0;
  color: #8f9a94;
  font: inherit;
  font-size: 0.625rem;
  font-weight: 600;
  cursor: pointer;
}

.admin-session-actions a:hover,
.admin-session-actions button:hover {
  color: #fff;
}

.admin-workspace {
  min-width: 0;
  margin-left: 16.5rem;
}

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

.admin-main {
  width: 100%;
  max-width: 96rem;
  min-height: 100vh;
  margin: 0 auto;
  padding: 2.25rem clamp(1.5rem, 3.2vw, 3.5rem) 4rem;
}

.admin-page {
  display: grid;
  min-width: 0;
  gap: 1.25rem;
}

.admin-page > *,
.admin-data-card,
.admin-table-scroll {
  min-width: 0;
}

.admin-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.5rem;
  padding: 0.125rem 0 0.375rem;
}

.admin-eyebrow {
  margin-bottom: 0.3125rem;
  color: var(--admin-accent);
  font-size: 0.625rem;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-page-heading h1 {
  color: var(--admin-text);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 730;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.admin-page-heading > div > p:last-child {
  max-width: 42rem;
  margin-top: 0.5rem;
  color: var(--admin-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.admin-financial-values {
  display: flex;
  flex: 0 0 auto;
  margin: 0;
}

.admin-financial-values > div {
  min-width: 11.5rem;
  padding: 0 1.25rem;
}

.admin-financial-values > div + div {
  border-left: 1px solid var(--admin-border-subtle);
}

.admin-financial-values dt {
  color: var(--admin-text-secondary);
  font-size: 0.625rem;
  font-weight: 720;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.admin-financial-values dd {
  margin-top: 0.25rem;
  color: var(--admin-text);
  font-size: 1rem;
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.admin-financial-values > div:first-child dd {
  color: #9a4f36;
}

.admin-financial-values > div:last-child dd {
  color: #397158;
}

.admin-financial-strip-header {
  align-items: center;
  min-height: 4.25rem;
}

.admin-financial-note {
  padding: 0.625rem 1.125rem;
  background: var(--admin-surface-subtle);
  color: var(--admin-text-muted);
  font-size: 0.59375rem;
  line-height: 1.45;
}

.admin-live-count {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  color: #3e6e59;
  font-size: 0.625rem;
  font-weight: 680;
  white-space: nowrap;
}

.admin-live-count > span,
.admin-activity-state > span {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: #a9aaa5;
}

.admin-live-count > span,
.admin-activity-state--live > span {
  background: #3e8967;
  box-shadow: 0 0 0 3px rgba(62, 137, 103, 0.12);
}

.admin-activity-state {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  flex: 0 0 auto;
  color: #77736c;
  font-size: 0.625rem;
  font-weight: 650;
  white-space: nowrap;
}

.admin-activity-state--live {
  color: #3e6e59;
}

.admin-empty-state--compact {
  padding: 2.5rem 1.25rem;
}

.admin-filter-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.125rem;
  background: #ece9e2;
  border: 1px solid #dfdbd2;
  border-radius: 0.875rem;
}

.admin-filter-panel h2 {
  color: #363832;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.3;
}

.admin-filter-panel p {
  margin-top: 0.1875rem;
  color: #77736c;
  font-size: 0.6875rem;
  line-height: 1.4;
}

.admin-filter-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.admin-filter-field {
  display: grid;
  gap: 0.25rem;
}

.admin-filter-field label {
  padding-left: 0.125rem;
  color: #69665f;
  font-size: 0.5625rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-filter-field .form-input {
  width: 8.5rem;
  height: 2.25rem;
  padding: 0 0.625rem;
  background: #fff;
  border-radius: 0.5rem;
  font-size: 0.6875rem;
}

.admin-filter-field--user .form-input {
  width: min(16rem, 25vw);
}

.admin-filter-submit {
  min-height: 2.25rem;
  padding-inline: 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.6875rem;
  box-shadow: none;
}

.admin-data-card {
  overflow: hidden;
}

.admin-data-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.125rem;
  border-bottom: 1px solid #e9e5dd;
}

.admin-data-kicker {
  margin-bottom: 0.1875rem;
  color: #918c84;
  font-size: 0.59375rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-data-card-header h2 {
  color: #292c27;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.admin-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.admin-usage-table {
  min-width: 50rem;
}

.admin-usage-table thead th {
  padding: 0.6875rem 1rem;
  background: #faf9f6;
  color: #6f6b64;
  border-bottom-color: #e6e2da;
  font-size: 0.5625rem;
  letter-spacing: 0.075em;
}

.admin-usage-table tbody th,
.admin-usage-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eeeae3;
  color: #5f5c56;
  font-size: 0.75rem;
  font-weight: 500;
  vertical-align: middle;
}

.admin-usage-table tbody tr:not(.admin-user-group-header):hover {
  background: #fcfbf8;
}

.admin-usage-table .admin-user-group-header th {
  padding: 0.75rem 1rem;
  background: #f1eee8;
  border-bottom: 1px solid #e1ddd4;
  color: #383a35;
  font-size: 0.6875rem;
  text-align: left;
}

.admin-user-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-user-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.admin-user-email {
  overflow: hidden;
  color: #30332e;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-totals {
  color: #77736c;
  font-size: 0.625rem;
  font-weight: 500;
  white-space: nowrap;
}

.admin-model-cell {
  width: 30%;
  min-width: 14rem;
  color: #2e312c !important;
  text-align: left;
}

.admin-model-cell code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.6875rem;
  font-weight: 650;
}

.admin-input-cell {
  color: #50668f !important;
}

.admin-output-cell {
  color: #745991 !important;
}

.admin-total-cell {
  color: #555852 !important;
  font-weight: 650 !important;
}

.admin-spend-cell {
  color: #343631 !important;
  font-weight: 650 !important;
}

.admin-usage-table .sparkline-col {
  width: 11rem;
  min-width: 11rem;
}

.admin-usage-table .sparkline {
  height: 1.125rem;
  gap: 2px;
}

.admin-usage-table .spark-bar {
  background: #5b806d;
  opacity: 0.8;
}

.admin-empty-state {
  display: grid;
  justify-items: center;
  padding: 4rem 1.5rem;
  text-align: center;
}

.admin-empty-state h3 {
  color: #343631;
  font-size: 0.875rem;
  font-weight: 700;
}

.admin-empty-state p {
  margin-top: 0.25rem;
  color: #8c877f;
  font-size: 0.75rem;
}

@media (max-width: 1200px) {
  .admin-filter-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-filter-form {
    width: 100%;
  }

  .admin-filter-field--user {
    flex: 1;
  }

  .admin-filter-field--user .form-input {
    width: 100%;
  }
}

@media (max-width: 960px) {
  .admin-sidebar {
    display: none;
  }

  .admin-workspace {
    margin-left: 0;
  }

  .admin-mobile-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4rem;
    padding: 0.625rem 1.25rem;
    background: rgba(32, 39, 35, 0.97);
    backdrop-filter: blur(14px);
  }

  .admin-mobile-header .admin-brand-mark {
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 0.5625rem;
    font-size: 0.75rem;
  }

  .admin-mobile-menu {
    position: relative;
  }

  .admin-mobile-menu summary {
    padding: 0.4375rem 0.6875rem;
    background: #343d38;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: #f4f2ed;
    font-size: 0.6875rem;
    font-weight: 650;
    cursor: pointer;
    list-style: none;
  }

  .admin-mobile-menu summary::-webkit-details-marker {
    display: none;
  }

  .admin-mobile-menu-panel {
    position: absolute;
    top: calc(100% + 0.625rem);
    right: 0;
    width: min(19rem, calc(100vw - 2rem));
    max-height: calc(100vh - 5.5rem);
    overflow-y: auto;
    padding: 0.875rem;
    background: #202723;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.75rem;
    box-shadow: 0 16px 40px rgba(10, 14, 12, 0.3);
  }

  .admin-mobile-menu-panel .admin-navigation {
    margin-top: 0;
  }

  .admin-mobile-session-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 1rem 0.5rem 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .admin-mobile-session-actions a,
  .admin-mobile-session-actions button {
    padding: 0;
    background: none;
    border: 0;
    color: #aeb7b1;
    font: inherit;
    font-size: 0.6875rem;
    cursor: pointer;
  }

  .admin-main {
    min-height: calc(100vh - 4rem);
    padding-top: 1.75rem;
  }
}

@media (max-width: 700px) {
  .admin-main {
    padding: 1.25rem 1rem 3rem;
  }

  .admin-page {
    gap: 1rem;
  }

  .admin-page-heading {
    align-items: flex-start;
    min-height: 0;
    flex-direction: column;
  }

  .admin-filter-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-filter-field .form-input {
    width: 100%;
  }

  .admin-filter-field--user,
  .admin-filter-submit {
    grid-column: 1 / -1;
  }

  .admin-filter-submit {
    width: 100%;
  }

  .admin-data-card-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.875rem;
  }

  .admin-financial-values {
    width: 100%;
  }

  .admin-financial-values > div {
    flex: 1 1 0;
    min-width: 0;
  }

}

@media (max-width: 480px) {
  .admin-mobile-header {
    padding-inline: 1rem;
  }

  .admin-usage-table {
    display: block;
    min-width: 0;
  }

  .admin-usage-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .admin-usage-table tbody {
    display: block;
  }

  .admin-usage-table tbody tr:not(.admin-user-group-header) {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem 0.5rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #eeeae3;
  }

  .admin-usage-table tbody th,
  .admin-usage-table tbody td {
    padding: 0 !important;
    border: 0;
  }

  .admin-usage-table .admin-user-group-header {
    display: block;
  }

  .admin-usage-table .admin-user-group-header th {
    display: block;
    padding: 0.75rem 1rem !important;
  }

  .admin-user-group-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.375rem;
  }

  .admin-user-identity {
    width: 100%;
    justify-content: space-between;
  }

  .admin-user-totals {
    white-space: normal;
  }

  .admin-usage-table .admin-model-cell {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .admin-usage-table tbody td {
    color: #343631;
    font-size: 0.6875rem;
    text-align: left;
  }

  .admin-usage-table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.125rem;
    color: #77736c;
    font-size: 0.5rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .admin-usage-table .sparkline-cell {
    grid-column: 1 / -1;
  }
}

/* ---- Admin Shared Pages ---- */

.admin-page-actions,
.admin-inline-actions,
.admin-table-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-page-actions {
  flex: 0 0 auto;
}

.admin-page-actions .btn,
.admin-form-actions .btn,
.admin-create-strip .btn,
.admin-danger-panel .btn {
  min-height: 2.375rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
}

.admin-page .btn-primary {
  background: #d75d26;
  border-color: #d75d26;
  color: #fff;
  box-shadow: none;
}

.admin-page .btn-primary:hover {
  background: #bd4e1c;
  border-color: #bd4e1c;
}

.admin-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.admin-eyebrow a:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 1.5rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  font-size: 0.5625rem;
  font-weight: 720;
  line-height: 1;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-status > span {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: currentColor;
}

.admin-status--success {
  background: #e9f4ed;
  color: #367459;
}

.admin-status--danger {
  background: #faece8;
  color: #a94d39;
}

.admin-status--warning {
  background: #fbf1df;
  color: #966621;
}

.admin-status--info {
  background: #edf0f8;
  color: #536998;
}

.admin-status--neutral {
  background: #efede8;
  color: #706c65;
}

.admin-count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.625rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  background: #f1eee8;
  color: #68645d;
  font-size: 0.625rem;
  font-weight: 700;
  white-space: nowrap;
}

.admin-table {
  min-width: 48rem;
}

.admin-accounts-table {
  min-width: 61rem;
}

.admin-packages-table {
  min-width: 72rem;
}

.admin-table thead th {
  padding: 0.6875rem 1rem;
  background: #faf9f6;
  border-bottom-color: #e6e2da;
  color: #6f6b64;
  font-size: 0.5625rem;
  letter-spacing: 0.075em;
  white-space: nowrap;
}

.admin-table tbody th,
.admin-table tbody td {
  padding: 0.8125rem 1rem;
  border-bottom: 1px solid #eeeae3;
  color: #5f5c56;
  font-size: 0.75rem;
  font-weight: 500;
  vertical-align: middle;
}

.admin-table tbody tr:last-child th,
.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table tbody tr:hover {
  background: #fcfbf8;
}

.admin-primary-cell {
  color: #30332e !important;
  font-weight: 680 !important;
  text-align: left;
}

.admin-primary-cell a:hover,
.admin-text-link:hover {
  color: #b74716;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.admin-text-link {
  color: #4c6257;
  font-weight: 620;
}

.admin-table-actions {
  justify-content: flex-end;
  white-space: nowrap;
}

.admin-table-actions .btn,
.admin-inline-actions .btn {
  min-height: 1.875rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.4375rem;
  font-size: 0.625rem;
}

.admin-margin {
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.admin-margin--positive {
  color: #367459;
}

.admin-margin--negative {
  color: #a94d39;
}

.admin-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.admin-detail-summary article {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 5.5rem;
  padding: 1rem 1.125rem;
  border-right: 1px solid #ece8e1;
}

.admin-detail-summary article:last-child {
  border-right: 0;
}

.admin-detail-summary small {
  color: #8b867e;
  font-size: 0.5625rem;
  font-weight: 740;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.admin-detail-summary strong {
  display: block;
  max-width: 100%;
  margin-top: 0.375rem;
  overflow: hidden;
  color: #333630;
  font-size: 0.8125rem;
  font-weight: 680;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-detail-summary a:hover {
  color: #b74716;
}

.admin-description-list {
  display: grid;
}

.admin-description-list > div {
  display: grid;
  grid-template-columns: minmax(10rem, 0.7fr) minmax(0, 1.5fr);
  align-items: center;
  gap: 1.5rem;
  min-height: 3.25rem;
  padding: 0.625rem 1.125rem;
  border-bottom: 1px solid #eeeae3;
}

.admin-description-list > div:last-child {
  border-bottom: 0;
}

.admin-description-list dt {
  color: #77736c;
  font-size: 0.6875rem;
  font-weight: 620;
}

.admin-description-list dd {
  min-width: 0;
  color: #373a34;
  font-size: 0.75rem;
  font-weight: 550;
  overflow-wrap: anywhere;
}

.admin-description-list code {
  font-size: 0.6875rem;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1rem;
}

.admin-danger-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.125rem;
  background: #fff8f6;
  border: 1px solid #edd6cf;
  border-radius: 0.875rem;
}

.admin-danger-panel h2 {
  color: #793c30;
  font-size: 0.875rem;
  font-weight: 700;
}

.admin-danger-panel p:last-child {
  margin-top: 0.1875rem;
  color: #8d665e;
  font-size: 0.6875rem;
}

.admin-form-page {
  max-width: 58rem;
}

.admin-form-card {
  overflow: hidden;
}

.admin-form-card > header {
  padding: 1.125rem 1.25rem;
}

.admin-form-card > header h2 {
  color: #292c27;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.admin-form-card > header > p:last-child {
  margin-top: 0.25rem;
  color: #7c776f;
  font-size: 0.6875rem;
  line-height: 1.5;
}

.admin-form-card > header code {
  font-size: 0.8125rem;
}

.admin-form {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.admin-form .form-group {
  margin: 0;
}

.admin-form .form-label {
  margin-bottom: 0.375rem;
  color: #494b46;
  font-size: 0.6875rem;
  font-weight: 680;
}

.admin-form .form-hint {
  color: #8b867e;
  font-size: 0.625rem;
  line-height: 1.45;
}

.admin-form-span {
  grid-column: 1 / -1;
}

.admin-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eeeae3;
}

.admin-readonly-field {
  display: grid;
  gap: 0.1875rem;
  padding: 0.75rem 0.875rem;
  background: #f5f2ec;
  border-radius: 0.625rem;
}

.admin-readonly-field small {
  color: #8b867e;
  font-size: 0.5625rem;
  font-weight: 740;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-readonly-field strong {
  color: #3d403a;
  font-size: 0.75rem;
  font-weight: 650;
}

.admin-checkbox-panel {
  display: flex;
  align-items: center;
  min-height: 4.25rem;
  padding: 0.75rem 0.875rem;
  background: #f8f6f1;
  border: 1px solid #e8e3da;
  border-radius: 0.625rem;
}

label.admin-checkbox-panel {
  cursor: pointer;
}

.admin-checkbox-panel .form-checkbox {
  margin: 0;
}

.admin-checkbox-panel > span,
.admin-compact-checkbox > span {
  display: grid;
  line-height: 1.25;
}

.admin-checkbox-panel strong,
.admin-compact-checkbox strong {
  color: #434640;
  font-size: 0.6875rem;
  font-weight: 670;
}

.admin-checkbox-panel small,
.admin-compact-checkbox small {
  margin-top: 0.1875rem;
  color: #8b867e;
  font-size: 0.59375rem;
  line-height: 1.35;
}

.admin-create-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.125rem;
  background: #ece9e2;
  border: 1px solid #dfdbd2;
  border-radius: 0.875rem;
}

.admin-create-strip h2 {
  color: #363832;
  font-size: 0.875rem;
  font-weight: 700;
}

.admin-create-strip > div > p:last-child {
  margin-top: 0.1875rem;
  color: #77736c;
  font-size: 0.6875rem;
}

.admin-create-strip-form {
  display: flex;
  align-items: flex-end;
  gap: 0.625rem;
}

.admin-invite-plan-field .form-input {
  width: 12rem;
}

.admin-compact-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.375rem;
  padding: 0 0.625rem;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 0.5rem;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .admin-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-detail-summary article:nth-child(2) {
    border-right: 0;
  }

  .admin-detail-summary article:nth-child(-n + 2) {
    border-bottom: 1px solid #ece8e1;
  }

  .admin-create-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-create-strip-form {
    width: 100%;
  }

  .admin-invite-plan-field {
    flex: 1;
  }

  .admin-invite-plan-field .form-input {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .admin-page-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .admin-page-actions .btn {
    flex: 1;
  }

  .admin-detail-grid,
  .admin-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-form-span {
    grid-column: auto;
  }

  .admin-description-list > div {
    grid-template-columns: minmax(7rem, 0.65fr) minmax(0, 1fr);
    gap: 0.75rem;
  }

  .admin-danger-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-danger-panel form,
  .admin-danger-panel .btn {
    width: 100%;
  }

  .admin-create-strip-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-create-strip-form .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .admin-detail-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-detail-summary article {
    min-height: 4.5rem;
    border-right: 0;
    border-bottom: 1px solid #ece8e1;
  }

  .admin-detail-summary article:last-child {
    border-bottom: 0;
  }

  .admin-description-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.1875rem;
    padding-block: 0.75rem;
  }

  .admin-form,
  .admin-form-card > header {
    padding: 1rem;
  }

  .admin-form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .admin-form-actions .btn {
    width: 100%;
  }
}

/* ---- Admin Catalog ---- */

.admin-model-list,
.admin-model-config,
.admin-model-form {
  display: grid;
  gap: 1rem;
}

.admin-model-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.125rem;
  border-bottom: 1px solid #e9e5dd;
}

.admin-model-identity {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.admin-model-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  flex: 0 0 auto;
  background: #edf0f8;
  color: #536998;
  font-size: 0.6875rem;
  font-weight: 780;
}

.admin-model-identity h2 {
  color: #2e312c;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.35;
}

.admin-model-identity h2 code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.8125rem;
}

.admin-model-identity p {
  max-width: 48rem;
  margin-top: 0.1875rem;
  color: #7c776f;
  font-size: 0.6875rem;
  line-height: 1.45;
}

.admin-model-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.admin-model-meta span {
  padding: 0.1875rem 0.4375rem;
  border-radius: 0.3125rem;
  background: #f1eee8;
  color: #716c64;
  font-size: 0.5625rem;
  font-weight: 630;
}

.admin-routes-table {
  min-width: 43rem;
}

.admin-model-no-routes {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  background: #fcfbf8;
}

.admin-model-no-routes p {
  color: #837e76;
  font-size: 0.6875rem;
}

.admin-url-code {
  display: inline-block;
  max-width: 28rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.admin-model-form-page {
  max-width: 78rem;
}

.admin-model-form > .admin-form-actions {
  margin-top: -0.125rem;
}

.admin-config-card {
  overflow: hidden;
}

.admin-config-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.875rem;
  padding: 1rem 1.125rem;
}

.admin-config-header > span {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  background: #ece8e0;
  color: #767168;
  font-size: 0.5625rem;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.admin-config-header h2 {
  color: #292c27;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.admin-config-header > div > p:last-child {
  margin-top: 0.1875rem;
  color: #7c776f;
  font-size: 0.6875rem;
  line-height: 1.45;
}

.admin-config-header .btn {
  align-self: center;
  min-height: 2rem;
  border-radius: 0.4375rem;
  font-size: 0.625rem;
}

.admin-config-body {
  display: grid;
  gap: 1.25rem;
  padding: 1.125rem;
}

.admin-config-body .form-group {
  margin: 0;
}

.admin-config-body .form-label,
.admin-fieldset legend {
  color: #4b4e48;
  font-size: 0.6875rem;
  font-weight: 680;
}

.admin-config-body .form-hint {
  color: #8b867e;
  font-size: 0.625rem;
  line-height: 1.5;
}

.admin-form-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-form-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

.admin-fieldset > legend {
  margin-bottom: 0.625rem;
}

.admin-fieldset--subtle {
  padding: 0.875rem;
  background: #f8f6f1;
  border: 1px solid #e8e3da;
  border-radius: 0.6875rem;
}

.admin-fieldset--subtle > .form-hint {
  margin: -0.25rem 0 0.75rem;
}

.admin-option-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.625rem;
}

.admin-option-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-option-card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  min-height: 3.875rem;
  padding: 0.6875rem 0.75rem;
  background: #f8f6f1;
  border: 1px solid #e8e3da;
  border-radius: 0.625rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.admin-option-card:hover {
  background: #fff;
  border-color: #d2ccc2;
}

.admin-option-card > span {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.admin-option-card strong {
  color: #41443e;
  font-size: 0.6875rem;
  font-weight: 670;
}

.admin-option-card small {
  margin-top: 0.1875rem;
  overflow: hidden;
  color: #8b867e;
  font-size: 0.5625rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-policy-profiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.875rem;
}

.admin-policy-profiles .admin-form-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.625rem;
}

.admin-code-input {
  min-height: 9rem !important;
  font-family: var(--mono) !important;
  font-size: 0.6875rem !important;
  line-height: 1.55;
  resize: vertical;
}

.admin-sticky-actions {
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
  padding: 0.75rem;
  background: rgba(250, 249, 246, 0.96);
  border: 1px solid #dfdad1;
  border-radius: 0.75rem;
  box-shadow: 0 8px 24px rgba(35, 30, 24, 0.12);
  backdrop-filter: blur(12px);
}

@media (max-width: 1200px) {
  .admin-form-grid--four,
  .admin-option-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-policy-profiles {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .admin-model-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-model-card-header .admin-page-actions .btn,
  .admin-model-card-header .admin-page-actions form {
    flex: 1;
  }

  .admin-model-card-header .admin-page-actions form .btn {
    width: 100%;
  }

  .admin-form-grid--three,
  .admin-form-grid--four,
  .admin-option-grid,
  .admin-option-grid--compact,
  .admin-policy-profiles .admin-form-grid--three {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-config-header {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .admin-config-header .btn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* ---- Admin Operations ---- */

.admin-filter-field--path {
  min-width: 14rem;
}

.admin-filter-field--path .form-input {
  width: 100%;
}

.admin-log-table {
  min-width: 82rem;
}

.admin-log-table-scroll {
  max-height: calc(100vh - 21rem);
  overflow-y: auto;
}

.admin-log-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.admin-log-path {
  max-width: 22rem;
  overflow: hidden;
  color: #353832 !important;
  font-weight: 600 !important;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-log-path code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.6875rem;
}

.admin-operations-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fbf1df;
  border: 1px solid #ead8b8;
  border-radius: 0.75rem;
  color: #795d32;
  font-size: 0.6875rem;
  line-height: 1.45;
}

.admin-operations-notice strong {
  flex: 0 0 auto;
  color: #61491f;
  font-size: 0.625rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-maintenance-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.875rem;
}

.admin-maintenance-card {
  display: flex;
  min-height: 13.5rem;
  padding: 1.125rem;
  flex-direction: column;
}

.admin-maintenance-card.admin-maintenance-card--emphasis {
  background: #fffaf7;
  border-color: #ead8ce;
}

.admin-maintenance-card header {
  display: grid;
  justify-items: start;
  gap: 0.5rem;
}

.admin-operation-tag {
  padding: 0.1875rem 0.4375rem;
  border-radius: 0.3125rem;
  background: #f0ede7;
  color: #777168;
  font-size: 0.53125rem;
  font-weight: 740;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.admin-maintenance-card--emphasis .admin-operation-tag {
  background: #f7e8df;
  color: #a4512c;
}

.admin-maintenance-card h2 {
  color: #30332e;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.admin-maintenance-card > p {
  margin: 0.5rem 0 1rem;
  color: #77736c;
  font-size: 0.6875rem;
  line-height: 1.55;
}

.admin-maintenance-card-action,
.admin-maintenance-form {
  margin-top: auto;
}

.admin-maintenance-card-action .btn,
.admin-maintenance-form .btn {
  min-height: 2.25rem;
  border-radius: 0.5rem;
  font-size: 0.6875rem;
}

.admin-maintenance-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.admin-maintenance-form .form-input {
  width: 9rem;
  height: 2.25rem;
  background: #fff;
}

.admin-provider-table {
  min-width: 67rem;
}

.admin-provider-row--disabled {
  opacity: 0.58;
}

.admin-provider-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.875rem 1.125rem;
  background: #faf7f3;
  border-top: 1px solid #e9e5dd;
}

.admin-provider-controls > div:first-child {
  display: grid;
}

.admin-provider-controls strong {
  color: #493c38;
  font-size: 0.6875rem;
  font-weight: 680;
}

.admin-provider-controls small {
  color: #8a7c76;
  font-size: 0.59375rem;
}

.admin-provider-control-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.admin-provider-control-actions .btn {
  min-height: 1.875rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.4375rem;
  font-size: 0.625rem;
}

.admin-playground-page {
  min-height: calc(100vh - 4.5rem);
  grid-template-rows: auto minmax(28rem, 1fr) auto;
}

.admin-playground-card {
  display: flex;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

.admin-playground-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.875rem 1rem;
}

.admin-playground-toolbar h2 {
  color: #30332e;
  font-size: 0.875rem;
  font-weight: 700;
}

.admin-playground-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-playground-controls label {
  color: #77736c;
  font-size: 0.625rem;
  font-weight: 680;
}

.admin-playground-controls .form-input {
  width: min(22rem, 32vw);
  height: 2.125rem;
  padding: 0 0.625rem;
  border-radius: 0.4375rem;
  font-size: 0.6875rem;
}

.admin-playground-controls .btn {
  min-height: 2.125rem;
  border-radius: 0.4375rem;
  font-size: 0.625rem;
}

.playground-messages {
  display: flex;
  flex: 1;
  min-height: 16rem;
  overflow-y: auto;
  padding: 1.25rem;
  flex-direction: column;
  gap: 0.625rem;
  background: #f5f2ec;
  scroll-behavior: smooth;
}

.playground-messages:empty::before {
  content: "Start a conversation to inspect a live streaming response.";
  display: grid;
  place-items: center;
  min-height: 100%;
  color: #99938a;
  font-size: 0.75rem;
  text-align: center;
}

.playground-message {
  max-width: min(48rem, 80%);
  padding: 0.75rem 0.875rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(35, 30, 24, 0.035);
}

.playground-message-user {
  align-self: flex-end;
  background: #e7eee9;
  border: 1px solid #cadbd1;
  color: #2f473a;
  border-bottom-right-radius: 0.25rem;
}

.playground-message-assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2ded6;
  color: #343631;
  border-bottom-left-radius: 0.25rem;
}

.playground-message-error {
  align-self: center;
  background: #fff1ed;
  border: 1px solid #e7c4ba;
  color: #9e4834;
}

.playground-input-row {
  display: flex;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  background: #fff;
  border-top: 1px solid #e9e5dd;
}

.playground-input-row .form-input {
  flex: 1;
  min-width: 0;
  height: 2.625rem;
  border-radius: 0.625rem;
  font-size: 0.75rem;
}

.playground-input-row .btn {
  min-height: 2.625rem;
  border-radius: 0.625rem;
  font-size: 0.75rem;
}

.admin-playground-note {
  color: #88837b;
  font-size: 0.625rem;
  line-height: 1.4;
  text-align: center;
}

@media (max-width: 1100px) {
  .admin-log-filter .admin-filter-form {
    display: grid;
    grid-template-columns: minmax(7rem, 0.6fr) minmax(12rem, 1.5fr) minmax(6rem, 0.5fr) auto;
  }

  .admin-log-filter .admin-filter-field .form-input {
    width: 100%;
  }
}

@media (max-width: 800px) {
  .admin-maintenance-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-maintenance-card {
    min-height: 0;
  }

  .admin-provider-controls,
  .admin-playground-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-provider-control-actions,
  .admin-playground-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .admin-playground-controls .form-input {
    flex: 1;
    width: auto;
  }

  .admin-playground-page {
    min-height: calc(100vh - 6rem);
  }
}

@media (max-width: 700px) {
  .admin-log-filter .admin-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-log-filter .admin-filter-field--path,
  .admin-log-filter .admin-filter-submit {
    grid-column: 1 / -1;
  }

  .admin-log-table-scroll {
    max-height: none;
  }

  .admin-maintenance-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-maintenance-form .admin-filter-field,
  .admin-maintenance-form .form-input {
    width: 100%;
  }

  .admin-maintenance-form .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .admin-playground-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-playground-controls label {
    grid-column: 1 / -1;
  }

  .playground-message {
    max-width: 90%;
  }
}

@media (max-width: 480px) {
  .admin-operations-notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-playground-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-playground-controls .form-input,
  .admin-playground-controls .btn {
    width: 100%;
  }

  .playground-input-row {
    align-items: stretch;
    flex-direction: column;
  }

  .playground-input-row .btn {
    width: 100%;
  }
}
