body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f7fb;
  color: #222;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.muted {
  color: #666;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.nested-card {
  background: #f8fafc;
  margin-top: 0;
}

.admin-hero {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.admin-login-screen {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-login-screen.is-hidden {
  display: none;
}

.admin-login-card {
  width: 100%;
  max-width: 980px;
  margin: 0;
  padding: 24px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.admin-login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 20px;
}

.admin-login-panel {
  min-width: 0;
}

.admin-login-brand-panel {
  border-radius: 16px;
  padding: 28px;
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
  color: #eff6ff;
}

.admin-login-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  letter-spacing: 0.08em;
  margin-bottom: 18px;
}

.admin-login-brand {
  margin-bottom: 24px;
}

.admin-login-brand h1,
.admin-login-form-head h2 {
  margin: 0 0 10px;
}

.admin-login-brand .muted {
  color: rgba(239, 246, 255, 0.84);
}

.admin-login-highlights {
  display: grid;
  gap: 12px;
}

.admin-login-highlight {
  border: 1px solid rgba(191, 219, 254, 0.28);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.admin-login-highlight .summary-label {
  color: rgba(219, 234, 254, 0.82);
}

.admin-login-highlight .summary-value {
  color: #fff;
}

.admin-login-form-panel {
  border: 1px solid #dbeafe;
  border-radius: 16px;
  padding: 28px;
  background: #fff;
}

.admin-login-form-head {
  margin-bottom: 20px;
}

.login-status-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}

.login-status-banner.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.login-status-banner.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.login-debug-block {
  margin-top: 14px;
}

.admin-app-shell.is-hidden {
  display: none;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 16px;
}

.admin-main {
  min-width: 0;
}

.role-strip {
  display: grid;
  grid-template-columns: 180px 180px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.role-card {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 12px;
  background: #f8fbff;
}

.account-card {
  margin-bottom: 12px;
}

.role-capabilities-card {
  min-width: 0;
}

.capability-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.capability-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}

input[readonly] {
  background: #f8fafc;
  color: #475569;
}

select,
textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

button {
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

button.secondary {
  background: #475569;
}

button.secondary:hover {
  background: #334155;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f172a;
  color: #dbeafe;
  border-radius: 8px;
  padding: 12px;
  min-height: 80px;
}

.debug-block {
  margin-top: 12px;
}

.debug-block summary {
  cursor: pointer;
  color: #475569;
  font-weight: 700;
  margin-bottom: 8px;
}

.debug-block[open] summary {
  margin-bottom: 12px;
}

#products {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.product-item {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fbff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-item.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
  background: #eff6ff;
}

.product-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.product-title {
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.product-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  white-space: nowrap;
}

.product-inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: #334155;
  font-size: 12px;
  line-height: 1.4;
}

.product-inline-item {
  white-space: nowrap;
}

.product-inline-item strong {
  color: #0f172a;
}

.product-item .actions {
  margin-bottom: 0;
}

.product-item .actions button {
  padding: 8px 12px;
}

.order-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  background: #fff;
}

.order-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.notice {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  margin-right: 8px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  font-size: 14px;
  color: #475569;
}

.list-scroll {
  max-height: 420px;
  overflow: auto;
}

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

.section-nav,
.sub-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vertical-nav {
  flex-direction: column;
}

.nav-btn,
.sub-nav-btn {
  background: #e2e8f0;
  color: #334155;
}

.nav-btn:hover,
.sub-nav-btn:hover {
  background: #cbd5e1;
}

.nav-btn.active,
.sub-nav-btn.active {
  background: #2563eb;
  color: #fff;
}

.nav-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-group {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.sidebar-label {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 10px;
}

.sidebar-link {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
  margin-bottom: 8px;
}

.sidebar-link:hover {
  background: #eef2ff;
}

.badge {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.section-panel,
.subview-panel,
.detail-panel {
  display: none;
}

.section-panel.active,
.subview-panel.active,
.detail-panel.active {
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.compact-grid {
  margin-top: 12px;
}

.summary-item {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 12px;
  background: #f8fbff;
}

.summary-label {
  font-size: 13px;
  color: #475569;
  margin-bottom: 6px;
}

.summary-value {
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.detail-list-item {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  margin-bottom: 8px;
}

.audit-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.audit-detail-card {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
}

.audit-detail-card pre {
  margin: 0;
  min-height: 0;
  max-height: 180px;
  overflow: auto;
}

.activity-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.activity-meta {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 6px;
}

.activity-preview {
  color: #334155;
  word-break: break-word;
}

.workbench-group {
  margin-bottom: 16px;
}

.queue-action {
  margin-top: 8px;
}

.hidden-by-permission {
  display: none !important;
}

@media (max-width: 640px) {
  .container {
    padding: 16px;
  }

  input,
  button {
    width: 100%;
  }

  .row > *,
  .actions > * {
    width: 100%;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  #products {
    grid-template-columns: 1fr;
    max-height: 360px;
  }


  .audit-detail-grid {
    grid-template-columns: 1fr;
  }

  .role-strip {
    grid-template-columns: 1fr;
  }

  .admin-login-layout {
    grid-template-columns: 1fr;
  }

  .admin-login-brand-panel,
  .admin-login-form-panel {
    padding: 18px;
  }

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

  .admin-sidebar {
    position: static;
  }
}
