/* Shared components and theme tokens */
:root {
  --bg-base: #0a0b10;
  --bg-surface: rgba(20, 22, 33, 0.6);
  --bg-surface-opaque: #141621;
  --bg-card: rgba(30, 33, 50, 0.4);
  --border-glow: rgba(99, 102, 241, 0.15);
  --border-glow-hover: rgba(99, 102, 241, 0.35);
  --divider-border: rgba(255, 255, 255, 0.05);
  --accent-color: #6366f1; /* Indigo */
  --copper-accent: #f59e0b; /* Amber/Copper */
  --coral-accent: #ff477e;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.05) 0%, transparent 40%);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: #272a3d;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  margin-bottom: 2rem;
  box-shadow: var(--glass-shadow);
  position: relative;
  z-index: 100;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 260px;
  min-width: 0;
}

.logo-link {
  display: inline-flex;
  align-items: center;
}

.logo-icon {
  font-size: 2.2rem;
  animation: pigeon-bob 3s ease-in-out infinite;
  display: inline-block;
}

.logo-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.logo-text h1 {
  font-family: var(--font-title);
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  font-weight: 800;
  background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 50%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.user-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  flex-wrap: wrap;
  min-width: 0;
}

header .user-controls form {
  display: flex;
  align-items: center;
  min-width: 0;
}

header .user-controls select {
  max-width: 150px;
}

header .user-controls .btn {
  height: 2.75rem;
  line-height: 1.2;
  justify-content: center;
  white-space: nowrap;
}

.logo-text p { text-align: center; margin: 0; }

.plan-subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  margin-top: 2px;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.06);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.4;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  align-self: center;
  font-style: italic;
}

.plan-subtitle.coder {
  color: var(--copper-accent);
  background: linear-gradient(135deg, rgba(245,158,11,0.12), rgba(245,158,11,0.03));
  border-color: rgba(245,158,11,0.18);
  box-shadow: 0 0 18px rgba(245,158,11,0.08), inset 0 1px 0 rgba(255,255,255,0.06);
}

.plan-subtitle.aspiring {
  color: #60a5fa;
  background: linear-gradient(135deg, rgba(59,130,246,0.14), rgba(59,130,246,0.04));
  border-color: rgba(59,130,246,0.25);
  box-shadow: 0 0 18px rgba(59,130,246,0.08), inset 0 1px 0 rgba(255,255,255,0.06);
}

.plan-subtitle.tinkerer {
  color: var(--text-secondary);
  background: linear-gradient(135deg, rgba(148,163,184,0.08), rgba(148,163,184,0.02));
  border-color: rgba(148,163,184,0.16);
}

@media (max-width:760px) {
.plan-subtitle { display: inline-block; }
}

.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--font-body);
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-glow);
}

.btn-secondary:hover {
  background: rgba(30, 33, 50, 0.7);
  border-color: var(--border-glow-hover);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-pin {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-pin:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.4);
}

.btn-pin-active {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.btn-pin-active:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}

.btn-pin-loading {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.messages-container {
  margin-bottom: 2rem;
}

.alert {
  padding: 1rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (max-width:1024px) {
.dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

header {
    padding: 1.2rem 1.5rem;
  }

.user-controls {
    justify-content: flex-start;
    gap: 10px;
  }
}

.card {
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  padding: 1.8rem 1.2rem;
  box-shadow: var(--glass-shadow);
  transition: border-color 0.3s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  border-color: var(--border-glow-hover);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1rem;
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header-actions {
  display: flex;
  gap: 10px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--font-title);
  color: var(--text-primary);
}

.stat-value.limit-warning {
  color: var(--warning);
}

.stat-value.limit-danger {
  color: var(--coral-accent);
}

.stat-inline {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  font-family: var(--font-title);
}

.stat-inline.limit-warning {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.stat-inline.limit-danger {
  color: var(--coral-accent);
  background: rgba(239, 68, 68, 0.1);
}

.delivery-policy-section {
  /* Match the other resource panels. */
  grid-column: auto;
}

.policy-avatar {
  font-size: 3.5rem;
  width: 40px;
  height: 40px;
  background: rgba(99, 102, 241, 0.1);
  border: 2px solid var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 5px;
}

.item-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.item-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(3px);
}

.item-row.item-row-warning {
  border-color: color-mix(in srgb, var(--warning) 65%, transparent);
  background: color-mix(in srgb, var(--warning) 7%, transparent);
}

.item-row.item-row-warning:hover {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
}

.letter-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 65%;
}

.letter-name {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.method-tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  text-transform: uppercase;
  align-self: center;
  display: inline-flex;
  align-items: center;
}

.method-tag.get { background: rgba(16, 185, 129, 0.15); color: var(--success); }

.method-tag.post { background: rgba(6, 180, 212, 0.15); color: var(--info); }

.method-tag.put { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

.method-tag.delete { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.letter-url {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.letter-meta {
  display: flex;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  align-items: center;
}

.meta-pill {
  background: rgba(255, 255, 255, 0.03);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.region-pill {
  color: var(--info);
  border-color: rgba(6, 182, 212, 0.45);
  background: rgba(6, 182, 212, 0.08);
}

.meta-pill.warning-pill {
  color: var(--warning);
  border-color: var(--warning);
}

.letter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.letter-actions-stacked {
  flex-direction: column;
  align-items: flex-end;
}

#delivery-policies-list > .item-row {
  flex-direction: row;
  gap: 0.75rem;
}

#delivery-policies-list .letter-info {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  width: auto;
}

#delivery-policies-list .letter-actions {
  flex: 0 0 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-end;
  width: auto;
}

.letter-action-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.letter-action-row .btn,
.response-action-row .btn,
.response-right .letter-action-row .btn {
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
}

.btn-dispatch:disabled {
  opacity: .4;
  cursor: not-allowed;
  filter: grayscale(.7);
  box-shadow: none;
}

.btn-dispatch:disabled:hover {
  transform: none;
  box-shadow: none;
}

.response-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  transition: all 0.3s ease;
}

.response-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(3px);
}

.response-pinned {
  border-color: rgba(139, 92, 246, 0.35) !important;
  background: rgba(139, 92, 246, 0.06) !important;
}

.response-pinned:hover {
  background: rgba(139, 92, 246, 0.1) !important;
  border-color: rgba(139, 92, 246, 0.5) !important;
}

.response-left {
  display: flex;
  align-items: center;
  gap: 15px;
  max-width: 75%;
}

.status-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.status-badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.status-badge.error-http {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.error-network {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.status-badge.badge-cond {
  background: rgba(129, 140, 248, 0.1);
  color: #818cf8;
  border: 1px solid rgba(129, 140, 248, 0.3);
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.1);
  font-size: 0.8rem;
}

.response-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.response-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.response-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.response-time-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  min-width: 1.6rem;
  padding: 1px 5px;
}

.response-modal-heading {
  --response-pill-height: 1.8rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  min-width: 0;
}

.response-modal-badges .meta-pill {
  height: var(--response-pill-height);
  display: inline-flex;
  align-items: center;
}

.flowchart-status-indicator {
  width: var(--response-pill-height);
  height: var(--response-pill-height);
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.flowchart-status-indicator[hidden] { display: none; }

.delivery-policy-dependencies { margin-top: 1rem; max-height: 260px; overflow-y: auto; }

.delivery-policy-dependencies ul { padding-left: 1.3rem; margin: .4rem 0 .8rem; }

.response-timestamp { color: var(--text-muted); font-size: .8rem; margin-bottom: 1rem; }

.response-modal-heading .card-title {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.response-modal-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.response-modal-badges [hidden] {
  display: none;
}

.response-modal-footer {
  justify-content: space-between;
  align-items: center;
}

.response-modal-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-left: auto;
}

.response-modal-timezone {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.response-modal-timezone-label {
  font-size: 0.7rem;
}

.response-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.5rem;
}

.response-actions-stacked {
  align-items: flex-end;
}

.response-action-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.response-right .btn,
.response-right form {
  display: inline-flex;
}

.response-right .btn {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
}

.response-metrics {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  border: 2px dashed rgba(255, 255, 255, 0.05);
  border-radius: 16px;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface-opaque);
  border: 1px solid var(--border-glow-hover);
  border-radius: 20px;
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  animation: modal-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--divider-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.response-viewer-section {
  margin-bottom: 1.2rem;
}

.viewer-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  font-weight: 600;
}

.viewer-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.85rem;
  overflow-x: auto;
  max-height: 250px;
  color: #a5b4fc;
}

.viewer-box.error {
  color: var(--coral-accent);
  background: rgba(239, 68, 68, 0.03);
}

.form-card {
  max-width: 800px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width:600px) {
.form-row {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: white;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

input[type="datetime-local"] {
  min-width: 0;
  min-height: 46px;
  color-scheme: dark;
}

[data-theme="light"] input[type="datetime-local"] {
  color-scheme: light;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
  background: rgba(0, 0, 0, 0.5);
}

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

.help-text {
  font-size: 0.79rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 1.5rem;
  border-top: 1px solid var(--divider-border);
  padding-top: 1.5rem;
}

.revoke-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modal-slide-in 0.15s ease;
}

.revoke-confirm-overlay[hidden] {
  display: none;
}

.revoke-confirm-box {
  background: var(--bg-surface-opaque);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modal-slide-in 0.18s ease;
}

.revoke-confirm-box p {
  margin: 0 0 0.25rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.3rem 0.85rem;
  min-height: 32px;
}

@keyframes pigeon-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(2deg); }
}

@keyframes pigeon-fly {
  0% { transform: translateY(0) scale(1) rotate(-3deg); }
  100% { transform: translateY(-10px) scale(1.05) rotate(3deg); }
}

@keyframes modal-slide-in {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

input[type="password"] {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: white;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-errors,
.field-errors {
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font-size: 0.82rem;
}

.form-errors {
  margin-bottom: 1rem;
}

.field-errors {
  margin-top: 0.5rem;
}

.help-text ul {
  margin-left: 1rem;
}

#proceed-delete-account:disabled {
  background: #353946;
  color: #a6a9b3;
  border-color: #4b5060;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
  transform: none;
}

[data-theme="light"] #proceed-delete-account:disabled {
  background: #e5e7eb;
  color: #6b7280;
  border-color: #d1d5db;
}

.logo-link {
  color: inherit;
  text-decoration: none;
}

.logo-link:hover .logo-text h1 {
  text-decoration: none;
}

.concept-desc {
  margin-top: 0.9rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.65;
}

.concept-feature-list {
  margin-top: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  list-style: none;
}

.concept-feature-list li {
  position: relative;
  padding-left: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.55;
}

.concept-feature-list li strong {
  color: var(--text-primary);
}

.concept-feature-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0.1rem;
  color: var(--accent-color);
  font-weight: 800;
  font-size: 0.95rem;
}

.concept-action {
  margin-top: 1.75rem;
}

.concept-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #818cf8;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.concept-link:hover {
  color: #c7d2fe;
  transform: translateX(4px);
}

.concept-image-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(13, 16, 25, 0.70);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.40);
}

.concept-image-card img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  aspect-ratio: 2.05 / 1;
  max-height: 340px;
  transition: transform 0.5s ease;
}

.concept-image-card:hover img {
  transform: scale(1.02);
}

.plan-pricing [hidden] { display: none !important; }

.plan-currency-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 0.75rem;
  margin-top: 1.5rem;
}

.plan-currency-control label { margin: 0; }
.plan-currency-control select { width: auto; max-width: 100%; margin: 0; }
.plan-pricing-notice { margin: 0.75rem 0 0; }
.plan-base-price { display: block; margin-top: 0.35rem; font-size: 0.75rem; color: var(--text-secondary); }

.plan-comparison-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin-top: 1.5rem;
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  background: var(--bg-surface);
}

.plan-comparison-scroll:focus-visible {
  outline: 2px solid var(--copper-accent);
  outline-offset: 3px;
}

.plan-comparison-table {
  width: 100%;
  min-width: 660px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

.plan-comparison-feature { width: 22%; }

.plan-comparison-tier { width: 18%; }

.plan-comparison-description { width: 42%; }

.plan-comparison-table th,
.plan-comparison-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--divider-border);
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.plan-comparison-table th {
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
}

.plan-comparison-table td {
  color: var(--text-primary);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.plan-comparison-table thead th {
  background: var(--bg-card);
}

.plan-comparison-table .plan-comparison-plan {
  text-align: center;
}

.plan-comparison-table .plan-comparison-featured {
  background: color-mix(in srgb, var(--copper-accent) 10%, var(--bg-card));
}

.plan-comparison-name,
.plan-comparison-price {
  display: block;
  font-family: var(--font-title);
  font-weight: 700;
}

.plan-comparison-name { font-size: 1rem; }

.plan-comparison-price { margin-top: 0.35rem; font-size: 1.4rem; }

.plan-comparison-price small { font: 400 0.75rem var(--font-body); color: var(--text-secondary); }

.plan-comparison-table .plan-comparison-note {
  color: var(--text-secondary);
  text-align: left;
}

.plan-comparison-table tbody tr:hover { background: var(--bg-card); }

.plan-comparison-table tfoot th,
.plan-comparison-table tfoot td { border-bottom: 0; }

.plan-comparison-table tfoot form { margin: 0; }

.plan-comparison-action {
  width: 100%;
  justify-content: center;
  padding: 0.6rem 0.5rem;
  white-space: normal;
  font-size: 0.8rem;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 10;
}

.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.hamburger-icon {
  position: relative;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.hamburger-icon::before {
  top: -7px;
}

.hamburger-icon::after {
  top: 7px;
}

.mobile-nav-open .hamburger-icon {
  background: transparent;
}

.mobile-nav-open .hamburger-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.mobile-nav-open .hamburger-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

@media (max-width:760px) {
.mobile-menu-toggle {
    display: block;
  }

header {
    flex-wrap: wrap;
    padding: 1rem 1.2rem;
    border-radius: 14px;
    gap: 0;
    position: relative;
  }

header .logo-section {
    flex: 1;
    min-width: 0;
  }

header .user-controls {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    background: var(--bg-surface-opaque);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: var(--glass-shadow);
    gap: 10px;
    z-index: 1000;
  }

header.mobile-nav-open .user-controls {
    display: flex;
  }

header .user-controls .btn,
header .user-controls .btn-secondary {
    width: 100%;
    text-align: center;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }

header .user-controls form[style*="display: inline"] {
    display: block !important;
    width: 100%;
  }

header .user-controls form[style*="display: inline"] button {
    width: 100%;
  }

.app-container {
    padding: 0.75rem;
  }

.modal-content {
    max-width: 95vw !important;
    padding: 1.25rem !important;
    margin: 0.5rem !important;
    max-height: 90vh !important;
  }

.modal-body {
    flex-direction: column !important;
  }

.modal-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

.modal-footer {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }

.modal-footer.response-modal-footer {
    flex-direction: row;
    align-items: center;
  }

.modal-footer .btn {
    width: 100%;
    text-align: center;
  }

.response-modal-footer .btn {
    width: auto;
  }

.form-card {
    max-width: 100% !important;
  }

.card-header {
    gap: 0.75rem;
  }

.letter-meta {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

.schedule-layout {
    grid-template-columns: 1fr !important;
  }

.upcoming-panel {
    position: static !important;
  }
}

@media (max-width:480px) {
.app-container {
    padding: 0.4rem;
  }

header {
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
  }

.logo-icon {
    font-size: 1.6rem;
  }

.logo-text h1 {
    font-size: 1.1rem;
  }

.logo-text p {
    font-size: 0.65rem;
  }

.item-row {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.9rem;
  }

.item-row .letter-info {
    max-width: 100%;
    width: 100%;
  }

.item-row .letter-actions {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

.item-row .letter-actions .btn {
    flex: 0 0 auto;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
  }

.response-item {
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.9rem;
  }

.response-item .response-left {
    max-width: 100%;
    width: 100%;
  }

.response-item .response-right {
    width: 100%;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
  }

.card {
    padding: 0.9rem;
  }

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

.btn {
    font-size: 0.78rem;
    padding: 0.45rem 0.75rem;
  }

.meta-pill {
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
  }

.empty-state {
    padding: 1.5rem 1rem;
  }

.form-group [style*="display: flex"][style*="gap: 10px"][style*="align-items: center"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

.form-group [style*="display: flex"][style*="gap: 10px"][style*="align-items: center"] > div[style*="flex: 1"],
.form-group [style*="display: flex"][style*="gap: 10px"][style*="align-items: center"] > div[style*="flex: 2"] {
    flex: none !important;
    width: 100% !important;
  }

.viewer-box {
    max-height: 180px;
  }

.form-row {
    grid-template-columns: 1fr !important;
  }

.policy-avatar {
    width: 55px;
    height: 55px;
    font-size: 1.6rem;
  }
}

[data-theme="light"] {
  /* ── Core palette ─────────────────────────────────── */
  --bg-base: #fdfbf5;                                    /* egg-shell white  */
  --bg-surface: rgba(245, 237, 218, 0.72);               /* warm straw       */
  --bg-surface-opaque: #f5edd8;
  --bg-card: rgba(237, 226, 200, 0.55);                  /* nest interior    */
  --border-glow: rgba(184, 146, 80, 0.28);               /* straw edge       */
  --border-glow-hover: rgba(184, 146, 80, 0.50);
  --accent-color: #d97706;                               /* golden yolk      */
  --copper-accent: #ca8a04;                              /* deeper yolk      */
  --coral-accent: #dc2626;                               /* comb red         */
  --text-primary: #3b2712;                               /* dark wood brown  */
  --text-secondary: #6b4f36;
  --text-muted: #9a7e62;
  --success: #4d7c0f;                                    /* fresh grass      */
  --success-glow: rgba(77, 124, 15, 0.18);
  --danger: #dc2626;
  --warning: #ea580c;
  --info: #0284c7;
  --glass-shadow: 0 8px 32px 0 rgba(120, 90, 50, 0.12);
}

[data-theme="light"] body {
  background-image:
    radial-gradient(circle at 10% 20%, rgba(217, 119, 6, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(184, 146, 80, 0.05) 0%, transparent 40%);
}

[data-theme="light"] ::-webkit-scrollbar-track {
  background: var(--bg-base);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #cdbfa4;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

[data-theme="light"] .logo-text h1 {
  background: linear-gradient(135deg, #eab308 0%, #d97706 50%, #c2410c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .btn-primary {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #3b2712;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}

[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.55);
}

[data-theme="light"] .btn-secondary {
  background: rgba(184, 146, 80, 0.12);
  color: var(--text-primary);
  border: 1px solid var(--border-glow);
}

[data-theme="light"] .btn-secondary:hover {
  background: rgba(184, 146, 80, 0.22);
  border-color: var(--border-glow-hover);
}

[data-theme="light"] .btn-danger {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

[data-theme="light"] .btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

[data-theme="light"] .btn-pin {
  background: rgba(120, 90, 50, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(120, 90, 50, 0.15);
}

[data-theme="light"] .btn-pin:hover {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  border-color: rgba(139, 92, 246, 0.3);
}

[data-theme="light"] .btn-pin-active {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

[data-theme="light"] .btn-pin-active:hover {
  background: rgba(139, 92, 246, 0.2);
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="url"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="datetime-local"],
[data-theme="light"] input[type="password"],
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(184, 146, 80, 0.30);
  color: var(--text-primary);
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.20);
  background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
  color: var(--text-muted);
}

[data-theme="light"] .card {
  background: rgba(245, 237, 218, 0.65);
  border: 1px solid rgba(184, 146, 80, 0.25);
  box-shadow: 0 6px 24px rgba(120, 90, 50, 0.10);
}

[data-theme="light"] .card:hover {
  border-color: rgba(184, 146, 80, 0.45);
}

[data-theme="light"] .card-header {
  border-bottom: 1px solid rgba(120, 90, 50, 0.12);
}

[data-theme="light"] .item-row {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(184, 146, 80, 0.20);
}

[data-theme="light"] .item-row:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(184, 146, 80, 0.38);
}

[data-theme="light"] .item-row.item-row-warning {
  border-color: color-mix(in srgb, var(--warning) 60%, white);
  background: color-mix(in srgb, var(--warning) 9%, white);
}

[data-theme="light"] .item-row.item-row-warning:hover {
  border-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 15%, white);
}

[data-theme="light"] .stat-inline {
  color: var(--text-secondary);
  background: rgba(184, 146, 80, 0.10);
}

[data-theme="light"] .policy-avatar {
  background: rgba(217, 119, 6, 0.10);
  border-color: var(--accent-color);
  box-shadow: 0 0 16px rgba(217, 119, 6, 0.15);
}

[data-theme="light"] .meta-pill {
  background: rgba(184, 146, 80, 0.10);
  border: 1px solid rgba(184, 146, 80, 0.20);
  color: var(--text-secondary);
}

[data-theme="light"] .response-item {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(184, 146, 80, 0.20);
}

[data-theme="light"] .response-item:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(184, 146, 80, 0.38);
}

[data-theme="light"] .response-pinned {
  border-color: rgba(124, 58, 237, 0.30) !important;
  background: rgba(124, 58, 237, 0.06) !important;
}

[data-theme="light"] .response-pinned:hover {
  background: rgba(124, 58, 237, 0.10) !important;
  border-color: rgba(124, 58, 237, 0.42) !important;
}

[data-theme="light"] .status-badge.success {
  background: rgba(77, 124, 15, 0.10);
  color: var(--success);
  border: 1px solid rgba(77, 124, 15, 0.30);
}

[data-theme="light"] .status-badge.error-http {
  background: rgba(234, 88, 12, 0.08);
  color: var(--warning);
  border: 1px solid rgba(234, 88, 12, 0.28);
}

[data-theme="light"] .status-badge.error-network {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.28);
}

[data-theme="light"] .status-badge.badge-cond {
  background: rgba(99, 102, 241, 0.08);
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

[data-theme="light"] .method-tag.get { background: rgba(77, 124, 15, 0.12); color: #3f6212; }

[data-theme="light"] .method-tag.post { background: rgba(2, 132, 199, 0.10); color: #0369a1; }

[data-theme="light"] .method-tag.put { background: rgba(217, 119, 6, 0.12); color: #b45309; }

[data-theme="light"] .method-tag.delete { background: rgba(220, 38, 38, 0.10); color: #b91c1c; }

[data-theme="light"] .empty-state {
  border: 2px dashed rgba(184, 146, 80, 0.30);
  color: var(--text-muted);
}

[data-theme="light"] .modal-overlay {
  background: rgba(59, 39, 18, 0.55);
}

[data-theme="light"] .modal-content {
  background: #faf5e8;
  border: 1px solid rgba(184, 146, 80, 0.35);
  box-shadow: 0 10px 50px rgba(100, 70, 30, 0.25);
}

[data-theme="light"] .modal-footer {
  border-top: 1px solid rgba(120, 90, 50, 0.12);
}

[data-theme="light"] .viewer-box {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(184, 146, 80, 0.18);
  color: var(--text-primary);
}

[data-theme="light"] .viewer-box.error {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.04);
}

[data-theme="light"] {
  --divider-border: rgba(120, 90, 50, 0.10);
}

[data-theme="light"] .form-errors,
[data-theme="light"] .field-errors {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.22);
  color: #991b1b;
}

[data-theme="light"] .alert-success {
  background: rgba(77, 124, 15, 0.08);
  color: #3f6212;
  border-color: rgba(77, 124, 15, 0.22);
}

[data-theme="light"] .alert-error {
  background: rgba(220, 38, 38, 0.06);
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.20);
}

[data-theme="light"] .concept-image-card {
  border-color: rgba(184, 146, 80, 0.20);
  background: rgba(255, 255, 255, 0.70);
  box-shadow: 0 16px 40px rgba(120, 90, 50, 0.12);
}

[data-theme="light"] .concept-link {
  color: #4f46e5;
}

[data-theme="light"] .concept-link:hover {
  color: #3730a3;
}

[data-theme="light"] .spinner {
  border-color: rgba(120, 90, 50, 0.15);
  border-top-color: var(--accent-color);
}

[data-theme="light"] .modal-body hr {
  border-top-color: rgba(120, 90, 50, 0.12) !important;
}

[data-theme="light"] header {
  background: rgba(245, 237, 218, 0.72);
  border-color: rgba(184, 146, 80, 0.25);
}

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

.api-doc-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 2rem;
  padding: 0.85rem 1rem;
  background: var(--manual-panel);
  border: 1px solid var(--manual-border);
  border-radius: 12px;
}

.api-toc-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 120ms ease;
  min-height: 36px;
}

.api-toc-item:hover {
  color: var(--text-primary);
  border-color: var(--copper-accent);
  background: rgba(245, 158, 11, 0.08);
}

.api-method-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  line-height: 1;
}

.api-method-badge.get {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.api-method-badge.post {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.api-method-badge.patch {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.api-method-badge.delete {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.api-endpoint-card {
  margin-bottom: 2.5rem;
  border: 1px solid var(--manual-border);
  border-radius: 16px;
  background: var(--manual-panel-strong);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.api-endpoint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--manual-border);
}

.api-endpoint-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.api-endpoint-uri {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.api-endpoint-uri .uri-param {
  color: var(--copper-accent);
}

.api-endpoint-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 0;
}

.api-spec-col {
  padding: 1.25rem;
  border-right: 1px solid var(--manual-border);
}

.api-console-col {
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.api-spec-subtitle {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--copper-accent);
  margin: 1.25rem 0 0.5rem 0;
}

.api-spec-subtitle:first-child {
  margin-top: 0;
}

.api-param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.84rem;
}

.api-param-table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--manual-border);
}

.api-param-table td {
  padding: 0.55rem 0.5rem;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.api-param-name {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.82rem;
}

.api-param-type {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.35rem;
}

.api-param-badge-req {
  font-size: 0.68rem;
  color: #f87171;
  font-weight: 700;
  margin-left: 0.3rem;
}

.api-param-desc {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.4;
}

.api-response-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.4rem 0;
  font-size: 0.84rem;
}

.api-status-code {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.api-status-code.code-200,
.api-status-code.code-204 {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.api-status-code.code-302 {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.api-status-code.code-400,
.api-status-code.code-401,
.api-status-code.code-404 {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.api-code-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.api-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.api-code-copy-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 120ms ease;
}

.api-code-copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--copper-accent);
  background: rgba(245, 158, 11, 0.1);
}

.api-code-content {
  padding: 0.85rem;
  margin: 0;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #f8fafc;
  background: #0b1220;
  border: 1px solid #334155;
  overflow-x: auto;
  white-space: pre;
}

@media (max-width:900px) {
.api-endpoint-body {
    grid-template-columns: 1fr;
  }

.api-spec-col {
    border-right: none;
    border-bottom: 1px solid var(--manual-border);
  }
}

[data-theme="light"] .api-endpoint-header {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .api-console-col {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .api-code-card {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="light"] .api-code-header {
  background: #0f172a;
  color: #94a3b8;
  border-color: #334155;
}

[data-theme="light"] .api-code-content {
  color: #f8fafc;
  background: #1e293b;
  border-color: #334155;
}

@media (max-width:560px) {
.api-doc-toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
    padding: 0.75rem;
  }

.api-toc-item,
.api-endpoint-card,
.api-endpoint-header,
.api-endpoint-body,
.api-spec-col,
.api-console-col,
.api-code-card {
    min-width: 0;
    max-width: 100%;
  }

.api-toc-item {
    width: 100%;
    justify-content: flex-start;
    padding: 0.6rem 0.7rem;
    font-size: 0.8rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }

.api-endpoint-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.9rem 1rem;
  }

.api-endpoint-title-group {
    width: 100%;
    min-width: 0;
  }

.api-endpoint-uri {
    font-size: 0.78rem;
    overflow-wrap: anywhere;
  }

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

.api-spec-col {
    border-right: none;
    border-bottom: 1px solid var(--manual-border);
  }

.api-console-col,
.api-spec-col {
    padding: 1rem;
  }

.api-param-table {
    table-layout: fixed;
  }

.api-param-table th,
.api-param-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

.api-response-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

.api-code-content {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    white-space: pre;
    word-break: normal;
  }
}

.api-doc-toc {
  display: block;
  padding: 0;
  overflow: hidden;
}

.api-toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--manual-border);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.api-toc-toggle:hover,
.api-toc-toggle:focus-visible {
  background: rgba(245, 158, 11, 0.08);
  outline: none;
}

.api-toc-toggle:focus-visible {
  box-shadow: inset 0 0 0 2px var(--copper-accent);
}

.api-toc-toggle-icon {
  color: var(--copper-accent);
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 160ms ease;
}

.api-doc-toc.is-collapsed .api-toc-toggle {
  border-bottom: 0;
}

.api-doc-toc.is-collapsed .api-toc-toggle-icon {
  transform: rotate(-90deg);
}

.api-doc-toc-list {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
}

.api-doc-toc.is-collapsed .api-doc-toc-list {
  display: none;
}

.api-toc-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width:560px) {
.api-doc-toc {
    display: block;
    padding: 0;
  }

.api-doc-toc-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

.api-code-content .uri-param {
  color: #fbbf24;
}

.api-code-card .api-code-content {
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
}

.dashboard-search-heading {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.dashboard-search-heading .dashboard-search-title,
.dashboard-search-heading .stat-inline {
  max-width: 30rem;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width .24s ease, opacity .2s ease, transform .24s ease, margin .24s ease;
}

.dashboard-search-badge { flex: 0 0 auto; font-size: 1.4rem; line-height: 1; transition: transform .24s ease; }

.dashboard-search-heading.is-search-active .dashboard-search-badge { transform: scale(1.04); }

.dashboard-search-heading.is-search-active { gap: 0 !important; }

.dashboard-search-heading.is-search-active .dashboard-search-title,
.dashboard-search-heading.is-search-active .stat-inline {
  max-width: 0;
  opacity: 0;
  margin: 0;
  transform: scaleX(.8);
}

.dashboard-search-heading.is-search-active .stat-inline { padding-left: 0; padding-right: 0; }

.dashboard-search {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex: 0 1 0;
  min-width: 0;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: flex-basis .28s ease, max-width .28s ease, opacity .2s ease, margin .28s ease;
}

.dashboard-search-heading.is-search-active .dashboard-search {
  flex: 1 1 16rem;
  max-width: 28rem;
  opacity: 1;
  gap: .5rem;
  margin-inline: 1rem;
  border: 1px solid var(--border-glow);
  border-radius: 9px;
  background: var(--bg-surface);
}

.letterbox-search-active .dashboard-search-heading { width: 100%; flex: 1 1 100%; }

.letterbox-search-active .dashboard-search-heading.is-search-active #letterbox-search {
  flex: 1 1 0;
  max-width: none;
  margin-inline: .75rem 0;
}

.dashboard-search-input {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  height: 2.4rem;
  padding: .4rem .65rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
}

.dashboard-search-submit,
.dashboard-search-close { flex: 0 0 auto; padding: .35rem .55rem; border: 0; background: transparent; color: var(--text-secondary); font: inherit; cursor: pointer; }

.dashboard-search-close { display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0; font-size: 1rem; line-height: 1; }

.dashboard-search-submit:hover,
.dashboard-search-close:hover { color: var(--text-primary); }

.dashboard-search-open { flex: 0 0 auto; padding: .4rem .6rem; }

.dashboard-search-heading.is-search-active .dashboard-search-open { display: none; }

.dashboard-search-empty { margin: .8rem 0; }

.dashboard-search-empty[hidden] { display: none; }

.letterbox-search-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  padding: 0 .2rem 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-glow);
}

.letterbox-search-filters[hidden],
#clear-box-form[hidden] { display: none; }

.letterbox-search-filters label { min-width: 0; font-size: .8rem; color: var(--text-secondary); }

.letterbox-search-filters input,
.letterbox-search-filters select {
  width: 100%;
  min-width: 0;
  margin: .3rem 0 0;
  padding: .55rem .65rem;
  font: inherit;
  color: var(--text-primary);
  background: var(--bg-surface-opaque);
  border: 1px solid var(--border-glow);
  border-radius: 8px;
  color-scheme: dark;
}

[data-theme="light"] .letterbox-search-filters input,
[data-theme="light"] .letterbox-search-filters select { color-scheme: light; }

.letterbox-date-field { position: relative; display: block; margin-top: .3rem; }

.letterbox-date-field input[type="text"] { margin: 0; padding-right: 2.5rem; }

.letterbox-date-icon { position: absolute; top: 50%; right: .65rem; transform: translateY(-50%); pointer-events: none; }

.letterbox-date-field .letterbox-date-picker {
  position: absolute;
  inset: 0 0 0 auto;
  width: 2.3rem;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.letterbox-date-picker::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; cursor: pointer; }

.letterbox-date-field:focus-within { outline: 2px solid var(--copper-accent); outline-offset: 2px; border-radius: 8px; }

.letterbox-filter-footer { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }

.letterbox-filter-footer > span { font-size: .75rem; color: var(--text-muted); }

.letterbox-filter-footer .btn { padding: .4rem .65rem; font-size: .8rem; }

.letterbox-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--border-glow);
}

.letterbox-pagination[hidden] { display: none; }

.letterbox-page-actions { display: flex; align-items: center; gap: .5rem; }

.letterbox-page-summary { color: var(--text-muted); font-size: .85rem; text-align: center; }

.letterbox-page-actions .btn { padding: .4rem .65rem; font-size: .82rem; }

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

@media (max-width:640px) {
.dashboard-search-heading { width: 100%; max-width: 100%; gap: .4rem !important; }

.dashboard-search-heading.is-search-active .dashboard-search { flex-basis: 8rem; }

.letterbox-pagination { justify-content: center; }

.letterbox-page-summary { flex: 1 0 100%; order: 3; }
}

@keyframes auth-footprint-fade {
  0% { opacity: 0; }
  5%, 30% { opacity: var(--footprint-opacity); }
  100% { opacity: 0; }
}

.policy-avatar { flex: 0 0 auto; font-size: 1.2rem; }

#active-deliveries-list { list-style: none; margin: 0; padding: 0; }

/* Keep protocol applicability beside each Delivery Policy setting. */
.delivery-policy-form .policy-retry-options {
  min-width: 0;
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
}

.delivery-policy-form .policy-retry-options > legend {
  padding: 0;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 600;
}

.delivery-policy-form .policy-protocol-guide {
  margin: 0 0 1.5rem;
}

.delivery-policy-form .policy-setting-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}

.delivery-policy-form .policy-setting-label > span:first-child {
  min-width: 0;
}

.delivery-policy-form .policy-protocol-hint {
  flex: 0 0 auto;
  margin-inline-start: auto;
  color: var(--text-secondary);
  font-size: .75rem;
  font-weight: 400;
  white-space: nowrap;
}
