:root {
    --accent: #f55036;
    --accent-hover: #e0442c;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-page: #fafafa;
    --bg-card: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --success: #22c55e;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    margin: 0;
}

/* ── Public layout (landing) ── */

.public-body {
    background: var(--bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.public-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.public-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    max-width: 1200px;
}

.public-header .brand {
    font-size: 2.35rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.brand {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand:hover {
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a,
.btn-link-nav {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-links a:hover,
.btn-link-nav:hover {
    color: var(--text-primary);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    margin-left: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    cursor: pointer;
}

.nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 1px;
    background: var(--text-primary);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav.is-nav-open .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav.is-nav-open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav.is-nav-open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.btn-primary-outline {
    border: 1px solid var(--accent);
    color: var(--accent);
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary-outline:hover {
    background: var(--accent);
    color: white;
}

.public-footer {
    margin-top: auto;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ── Hero ── */

.hero {
    padding: 5rem 0 4rem;
    text-align: center;
}

.hero-badge {
    display: inline-block;
    background: var(--border-light);
    color: var(--text-secondary);
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1.25rem;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.btn-hero-primary {
    background: var(--text-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-hero-primary:hover {
    background: #333;
    color: white;
}

.btn-hero-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    cursor: pointer;
}

.btn-hero-secondary:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.hero-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--danger); }

.status-sep { color: var(--border); }

/* ── Features ── */

.features {
    padding: 3rem 0;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
    height: 100%;
}

.feature-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.5;
}

/* ── Models section ── */

.models-section {
    padding: 3rem 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
}

.models-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.model-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.625rem 1rem;
}

.model-name {
    font-family: ui-monospace, monospace;
    font-size: 0.875rem;
}

.model-tag {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

/* ── CTA ── */

.cta-section {
    padding: 4rem 0 5rem;
}

.cta-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.cta-section p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ── Auth modal ── */

.auth-modal .modal-content {
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 0.5rem;
}

.auth-tabs {
    border: none;
    gap: 0.25rem;
}

.auth-tabs .nav-link {
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.auth-tabs .nav-link.active {
    background: var(--border-light);
    color: var(--text-primary);
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}

.btn-auth {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.btn-auth:hover {
    background: var(--accent-hover);
    color: white;
}

/* ── App layout (dashboard) ── */

.app-body {
    background: var(--bg-page);
    min-height: 100vh;
}

.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.app-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.breadcrumb-nav {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.breadcrumb-nav .sep {
    margin: 0 0.375rem;
}

.app-nav-links {
    display: flex;
    gap: 1.5rem;
}

.app-nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    padding-bottom: 0.25rem;
}

.app-nav-links a:hover {
    color: var(--text-primary);
}

.app-nav-links a.active {
    color: var(--accent);
}

.app-nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #86efac;
    color: #166534;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.app-main {
    max-width: 1200px;
}

/* ── Page components ── */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.page-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0;
    max-width: 600px;
}

.hero-compact {
    padding-top: 2.5rem;
    padding-bottom: 1.5rem;
}

.hero-compact .page-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.panel-title {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value-sm {
    font-size: 0.875rem;
    font-weight: 500;
}

.quick-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn-accent-outline {
    border: 1px solid var(--accent);
    color: var(--accent);
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-accent-outline:hover {
    background: var(--accent);
    color: white;
}

.model-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.model-list li {
    padding: 0.375rem 0;
}

.code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.8125rem;
    line-height: 1.6;
    margin: 0;
}

.code-block code {
    font-family: ui-monospace, 'Cascadia Code', monospace;
}

/* ── API Keys table (Groq-style) ── */

.api-keys-table {
    width: 100%;
}

.api-keys-header,
.api-keys-row {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 0.9fr 0.9fr 0.8fr 1fr 80px;
    align-items: center;
    padding: 0.875rem 1.5rem;
    gap: 0.5rem;
}

.api-keys-header {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.api-keys-row {
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.api-keys-row:last-child {
    border-bottom: none;
}

.api-keys-row .col-name {
    color: var(--text-primary);
    font-weight: 500;
}

.api-keys-row code {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.col-actions {
    display: flex;
    gap: 0.375rem;
    justify-content: flex-end;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--border-light);
}

.btn-icon.btn-delete:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: var(--accent);
}

.api-keys-empty {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.key-reveal {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--border-light);
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-top: 0.75rem;
}

.key-reveal code {
    flex: 1;
    word-break: break-all;
    font-size: 0.8125rem;
}

/* ── Docs ── */

.docs-public {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.docs-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
}

.docs-nav {
    position: sticky;
    top: 5rem;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.docs-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.375rem 0;
}

.docs-nav a:hover {
    color: var(--accent);
}

.docs-section {
    margin-bottom: 3rem;
}

.docs-section h2 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-top: 0.5rem;
}

.docs-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
}

.docs-section p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.endpoint-badge {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
}

.endpoint-badge code {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.endpoint-badge .method {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.endpoint-badge .method.post {
    background: #dbeafe;
    color: #1d4ed8;
}

.endpoint-badge .method.get {
    background: #dcfce7;
    color: #15803d;
}

.docs-note {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.docs-limits-summary {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 1rem 1.125rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.docs-limits-summary > strong {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.docs-limits-summary p {
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

.docs-limits-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin: 0.75rem 0;
}

.docs-limits-table th,
.docs-limits-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.docs-limits-table th {
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.6);
}

.docs-limits-table td code {
    font-size: 0.8125rem;
}

/* ── Public pricing (Together-style table) ── */

.pricing-page {
    padding-bottom: 4rem;
}

.pricing-hero {
    padding: 3rem 0 2rem;
    text-align: center;
}

.pricing-hero .page-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
}

.pricing-section-head {
    margin-bottom: 1.75rem;
}

.pricing-section-head h2 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.pricing-section-head p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0;
    max-width: 640px;
}

.pricing-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.pricing-search-form {
    flex: 1 1 420px;
    max-width: 640px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pricing-free-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    margin: 0;
}

.pricing-free-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.pricing-free-toggle-track {
    position: relative;
    width: 2.5rem;
    height: 1.375rem;
    border-radius: 999px;
    background: #d1d5db;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.pricing-free-toggle-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease;
}

.pricing-free-toggle-input:checked + .pricing-free-toggle-track {
    background: var(--accent);
}

.pricing-free-toggle-input:checked + .pricing-free-toggle-track::after {
    transform: translateX(1.125rem);
}

.pricing-free-toggle-input:focus-visible + .pricing-free-toggle-track {
    box-shadow: 0 0 0 3px rgba(245, 80, 54, 0.2);
}

.pricing-free-toggle-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.pricing-free-toggle-input:checked ~ .pricing-free-toggle-label {
    color: var(--text-primary);
}

.pricing-meta-sep {
    color: var(--border);
    margin: 0 0.25rem;
}

.pricing-meta-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.pricing-free-form {
    display: contents;
}

.pricing-search-clear[hidden] {
    display: none !important;
}

.pricing-search-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
}

.pricing-search-empty[hidden] {
    display: none !important;
}

.pricing-search-form .form-control {
    border-radius: 10px;
    border-color: var(--border);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
}

.pricing-search-form .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(232, 93, 76, 0.12);
}

.pricing-search-form .btn-auth,
.pricing-search-form .btn-hero-secondary {
    flex-shrink: 0;
    white-space: nowrap;
}

.pricing-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.pricing-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.pricing-provider-filter {
    position: sticky;
    top: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
}

.pricing-provider-filter-head {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.pricing-provider-filter-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.pricing-provider-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    max-height: min(70vh, 640px);
    overflow-y: auto;
}

.pricing-provider-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8125rem;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}

.pricing-provider-item:hover:not(.is-disabled) {
    background: #f8fafc;
}

.pricing-provider-item.is-active {
    background: var(--text-primary);
    color: #fff;
}

.pricing-provider-item.is-active .pricing-provider-avatar {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.pricing-provider-item.is-active .pricing-provider-count {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.pricing-provider-item.is-disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}

.pricing-provider-avatar {
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 6px;
    background: var(--border-light);
    color: var(--text-muted);
    font-size: 0.625rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pricing-provider-name {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pricing-provider-count {
    flex: 0 0 auto;
    font-size: 0.625rem;
    font-weight: 700;
    background: var(--border-light);
    color: var(--text-muted);
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    min-width: 1.25rem;
    text-align: center;
}

.pricing-main {
    min-width: 0;
}

.pricing-table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.pricing-unit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.pricing-unit-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.pricing-table-wrap {
    overflow-x: auto;
}

.pricing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.pricing-table thead th {
    padding: 0;
    border-bottom: 1px solid #d8e3f0;
    background: #e8eef6;
    white-space: nowrap;
}

.pricing-table-head-row th.col-price {
    width: 140px;
}

.pricing-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.12s ease, background 0.12s ease;
}

.pricing-sort-btn:hover,
.pricing-sort-btn.is-active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.45);
}

.pricing-sort-btn-end {
    justify-content: flex-end;
}

.pricing-sort-label {
    line-height: 1;
}

.pricing-sort-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #94a3b8;
}

.pricing-sort-btn.is-active .pricing-sort-icons {
    color: var(--text-secondary);
}

.pricing-sort-arrows {
    flex-shrink: 0;
    opacity: 0.85;
}

.pricing-sort-btn.is-asc .pricing-sort-up,
.pricing-sort-btn.is-desc .pricing-sort-down {
    opacity: 1;
}

.pricing-sort-btn.is-asc .pricing-sort-down,
.pricing-sort-btn.is-desc .pricing-sort-up {
    opacity: 0.25;
}

.pricing-sort-up,
.pricing-sort-down {
    opacity: 0.55;
}

.pricing-sort-az {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
}

.pricing-sort-az span {
    opacity: 0.55;
}

.pricing-sort-dollar {
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1;
}

.pricing-table thead th.col-price {
    text-align: right;
}

.pricing-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.12s ease;
}

.pricing-table tbody tr:last-child {
    border-bottom: none;
}

.pricing-table tbody tr:hover {
    background: #fafafa;
}

.pricing-table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

.pricing-table tbody td.col-price {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.pricing-model-name {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
}

.pricing-model-id {
    display: block;
    margin-top: 0.2rem;
    font-family: ui-monospace, 'Cascadia Code', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pricing-model-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.35rem;
}

.pricing-provider-tag {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 0.125rem 0.45rem;
    border-radius: 999px;
}

.pricing-free-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #166534;
    background: #dcfce7;
    padding: 0.125rem 0.45rem;
    border-radius: 999px;
}

.pricing-table-footer {
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.pricing-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
}

.pricing-empty p {
    margin: 0;
}

@media (max-width: 768px) {
    .pricing-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .pricing-search-form {
        max-width: none;
    }

    .pricing-layout {
        grid-template-columns: 1fr;
    }

    .pricing-provider-filter {
        position: static;
    }

    .pricing-provider-list {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        max-height: none;
        padding-bottom: 0.25rem;
    }

    .pricing-provider-item {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .pricing-provider-name {
        overflow: visible;
    }

    .pricing-table thead {
        display: none;
    }

    .pricing-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto auto;
        gap: 0.35rem 1rem;
        padding: 1rem 1.25rem;
    }

    .pricing-table tbody td {
        padding: 0;
        border: none;
    }

    .pricing-table tbody td:first-child {
        grid-column: 1 / -1;
    }

    .pricing-table tbody td.col-price::before {
        display: block;
        font-size: 0.6875rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--text-muted);
        margin-bottom: 0.15rem;
    }

    .pricing-table tbody td.col-price-input::before {
        content: "Input";
    }

    .pricing-table tbody td.col-price-output::before {
        content: "Output";
    }
}

/* ── Chat (existing) ── */

html {
    font-size: 14px;
}

.chat-card {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
}

.chat-messages {
    min-height: 420px;
    max-height: 60vh;
    overflow-y: auto;
    background: #fff;
}

.chat-message {
    margin-bottom: 1.25rem;
}

.chat-message-assistant .chat-meta {
    display: block;
    margin-bottom: 0.25rem;
    padding-left: 0;
}

.chat-message-assistant .chat-bubble {
    display: block;
    width: 100%;
}

.chat-message-user {
    text-align: right;
}

.chat-message-user .chat-bubble {
    display: inline-block;
    text-align: left;
    max-width: 100%;
}

.chat-bubble {
    max-width: 100%;
    padding: 0;
    line-height: 1.6;
    white-space: normal;
    word-break: break-word;
    background: transparent;
    border: none;
    border-radius: 0;
}

.chat-message-user .chat-bubble {
    color: var(--text-primary);
}

.chat-message-assistant .chat-bubble {
    color: var(--text-primary);
}

.chat-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.chat-message-streaming .chat-bubble {
    min-height: 1.5rem;
}

.chat-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background: var(--accent);
    animation: chat-cursor-blink 1s step-end infinite;
}

@keyframes chat-cursor-blink {
    50% { opacity: 0; }
}

pre code {
    font-size: 0.85rem;
}

/* ── Responsive ── */

.admin-header {
    border-bottom: 2px solid var(--accent);
}

/* ── User portal (registered API users) ── */

.user-portal-body {
    background: var(--bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.user-portal-body.chat-page {
    background: #fff;
}

.user-portal-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.user-portal-nav,
.admin-portal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.portal-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
}

.user-portal-links,
.admin-portal-links {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.user-portal-links a,
.admin-portal-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
}

.user-portal-links a:hover,
.admin-portal-links a:hover {
    color: var(--text-primary);
}

.user-portal-links a.active {
    color: var(--accent);
}

.user-portal-user,
.admin-portal-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.user-portal-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.user-portal-footer {
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
}

.user-portal-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.user-portal-footer a:hover {
    color: var(--accent);
}

/* ── Admin portal (site administrators) ── */

.admin-portal-body {
    background: #f4f4f6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-portal-header {
    background: #1e1e24;
    color: #f5f5f5;
    border-bottom: 3px solid var(--accent);
}

.admin-portal-header .brand {
    color: #fff;
}

.admin-portal-header .nav-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.admin-portal-header .nav-toggle-bar {
    background: #fff;
}

.admin-badge {
    background: rgba(232, 93, 76, 0.2);
    color: #ffb4a8;
}

.admin-portal-links a {
    color: #b0b0b8;
}

.admin-portal-links a:hover {
    color: #fff;
}

.admin-portal-links a.active {
    color: #ffb4a8;
}

.admin-portal-user .admin-link,
.admin-portal-user .btn-link-nav {
    color: #b0b0b8;
}

.admin-portal-user .admin-link:hover,
.admin-portal-user .btn-link-nav:hover {
    color: #fff;
}

.admin-user-label {
    font-size: 0.875rem;
    color: #b0b0b8;
}

.admin-portal-main {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

.admin-portal-footer {
    padding: 0.875rem 0;
    background: #1e1e24;
    border-top: 1px solid #333;
}

.admin-portal-footer a {
    color: #b0b0b8;
    text-decoration: none;
}

.admin-portal-footer a:hover {
    color: #fff;
}

/* ── Admin pricing engine ── */

.admin-pricing-page {
    padding-bottom: 2rem;
}

.admin-pricing-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
    padding: 1.75rem 2rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #1e1e24 0%, #2a2a32 55%, #1a1a20 100%);
    border: 1px solid #3a3a44;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.admin-pricing-eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ffb4a8;
}

.admin-pricing-title {
    margin: 0 0 0.625rem;
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
}

.admin-pricing-subtitle {
    margin: 0;
    max-width: 560px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #b0b0b8;
}

.admin-pricing-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.admin-pricing-alert {
    border-radius: 10px;
    margin-bottom: 1.25rem;
}

.admin-pricing-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-pricing-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.125rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.admin-pricing-stat-accent {
    border-color: rgba(232, 93, 76, 0.35);
    background: linear-gradient(180deg, #fff 0%, #fff8f7 100%);
}

.admin-pricing-stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.admin-pricing-stat-value {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.1;
}

.admin-pricing-stat-value-sm {
    font-size: 1.125rem;
}

.admin-pricing-stat-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.admin-pricing-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    height: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.admin-pricing-panel-table {
    padding: 0;
    overflow: hidden;
}

.admin-pricing-panel-title {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.admin-pricing-panel-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.admin-pricing-markup-field {
    margin-bottom: 1.25rem;
}

.admin-pricing-markup-input-wrap {
    position: relative;
    margin-top: 0.375rem;
}

.admin-pricing-markup-input {
    font-size: 1.25rem;
    font-weight: 600;
    padding-right: 2.5rem;
    border-radius: 10px;
}

.admin-pricing-markup-suffix {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

.admin-pricing-sync-note {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
}

.admin-pricing-sync-note-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.admin-pricing-sync-note p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.admin-pricing-table-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
}

.admin-pricing-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.admin-pricing-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.admin-pricing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.admin-pricing-dot.wholesale {
    background: #94a3b8;
}

.admin-pricing-dot.sell {
    background: var(--accent);
}

.admin-pricing-table-wrap {
    overflow-x: auto;
}

.admin-pricing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-pricing-table thead th {
    background: #eef2f7;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #dde4ec;
    white-space: nowrap;
}

.admin-pricing-table-group-row th.col-group {
    text-align: center;
    background: #e4eaf2;
    border-left: 1px solid #dde4ec;
}

.admin-pricing-table-subhead th {
    background: #f4f7fb;
    font-size: 0.625rem;
}

.admin-pricing-table thead th.col-wholesale,
.admin-pricing-table thead th.col-sell {
    text-align: right;
    min-width: 88px;
}

.admin-pricing-table thead th.col-sell {
    color: #9a3412;
}

.admin-pricing-table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.admin-pricing-table tbody tr:hover {
    background: #fafbfc;
}

.admin-pricing-table tbody td.col-wholesale,
.admin-pricing-table tbody td.col-sell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.admin-pricing-table tbody td.col-wholesale {
    color: var(--text-muted);
    font-weight: 500;
}

.admin-pricing-table tbody td.col-sell {
    color: var(--text-primary);
    font-weight: 600;
}

.admin-pricing-model-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

.admin-pricing-model-id {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    word-break: break-all;
}

.admin-pricing-free-pill {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #166534;
    background: #dcfce7;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

.admin-pricing-provider {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.admin-pricing-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.admin-pricing-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

.admin-pricing-pagination-meta {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.admin-pricing-pagination-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.admin-pricing-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.625rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.admin-pricing-page-btn:hover:not(.is-disabled):not(.is-active) {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: var(--text-primary);
}

.admin-pricing-page-btn.is-active {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: #fff;
}

.admin-pricing-page-btn.is-disabled {
    opacity: 0.45;
    cursor: default;
}

.admin-pricing-page-size {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.admin-pricing-page-size-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 0.25rem;
}

.admin-pricing-page-size-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
}

.admin-pricing-page-size-btn.is-active {
    background: rgba(232, 93, 76, 0.12);
    border-color: rgba(232, 93, 76, 0.35);
    color: var(--accent);
}

.admin-pricing-page-size-btn:hover:not(.is-active) {
    border-color: #cbd5e1;
    color: var(--text-primary);
}

@media (max-width: 1200px) {
    .admin-pricing-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-pricing-hero {
        padding: 1.25rem;
    }

    .admin-pricing-stats {
        grid-template-columns: 1fr;
    }

    .admin-pricing-table-head {
        padding: 1rem;
    }
}

.admin-table-header,
.admin-table-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr 0.7fr 0.7fr 0.6fr 0.7fr 1.4fr;
    gap: 0.5rem;
    align-items: center;
    padding: 0.875rem 1.5rem;
}

.admin-table-wide .admin-table-header,
.admin-table-wide .admin-table-row {
    grid-template-columns: 1fr 1.2fr 1.2fr 0.7fr 1fr 0.7fr 1fr;
}

.admin-table-usage {
    overflow-x: auto;
}

.admin-table-usage .admin-table-header,
.admin-table-usage .admin-table-row {
    grid-template-columns: 1.1fr 1fr 0.8fr 1.1fr 0.9fr 0.7fr 0.8fr 0.7fr 0.7fr 0.55fr 0.6fr;
    min-width: 72rem;
}

.admin-table-usage-summary .admin-table-header,
.admin-table-usage-summary .admin-table-row {
    grid-template-columns: 1.5fr 0.7fr 0.8fr 0.8fr 0.8fr 0.8fr;
}

.admin-table-usage-summary.has-wholesale .admin-table-header,
.admin-table-usage-summary.has-wholesale .admin-table-row {
    grid-template-columns: 1.5fr 0.7fr 0.8fr 0.8fr 0.8fr 0.8fr;
}

.admin-table-usage-summary.has-user-tokens .admin-table-header,
.admin-table-usage-summary.has-user-tokens .admin-table-row {
    grid-template-columns: 1.5fr 0.7fr 0.8fr 0.8fr 0.8fr 0.8fr;
}

.usage-summary-card {
    margin-bottom: 0;
}

.usage-summary-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.usage-summary-total {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 5rem;
}

.usage-summary-total-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.usage-summary-total-accent strong {
    color: var(--accent);
}

.panel-card-header {
    border-bottom: 0;
}

.admin-table-header {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.admin-table-row {
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.admin-actions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

@media (max-width: 992px) {
    .admin-table-header { display: none; }
    .admin-table-row,
    .admin-table-wide .admin-table-header,
    .admin-table-wide .admin-table-row,
    .admin-table-usage .admin-table-header,
    .admin-table-usage .admin-table-row,
    .admin-table-usage-summary .admin-table-header,
    .admin-table-usage-summary .admin-table-row {
        grid-template-columns: 1fr;
        min-width: 0;
        gap: 0.25rem;
    }

    .api-keys-header {
        display: none;
    }

    .api-keys-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
        padding: 1rem 1.5rem;
    }

    .col-actions {
        justify-content: flex-start;
        margin-top: 0.5rem;
    }

    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-nav {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        margin-bottom: 1.25rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border);
    }

    .app-nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .public-nav,
    .user-portal-nav,
    .admin-portal-nav {
        flex-wrap: wrap;
        row-gap: 0;
    }

    .public-nav .nav-links,
    .user-portal-links,
    .admin-portal-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        order: 20;
        padding: 0.5rem 0 0.75rem;
        border-top: 1px solid var(--border);
        margin-top: 0.5rem;
    }

    .admin-portal-links {
        border-top-color: rgba(255, 255, 255, 0.12);
    }

    .public-nav.is-nav-open .nav-links,
    .user-portal-nav.is-nav-open .user-portal-links,
    .admin-portal-nav.is-nav-open .admin-portal-links {
        display: flex;
    }

    .public-nav .nav-links a,
    .public-nav .nav-links .btn-link-nav,
    .public-nav .nav-links .btn-primary-outline,
    .user-portal-links a,
    .admin-portal-links a {
        display: flex;
        align-items: center;
        min-height: 44px;
        padding: 0.65rem 0;
        width: 100%;
        justify-content: flex-start;
    }

    .public-nav .nav-links .btn-primary-outline {
        justify-content: center;
        margin-top: 0.35rem;
    }

    .portal-badge {
        display: none;
    }

    .user-portal-main,
    .admin-portal-main {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .page-title {
        font-size: 1.375rem;
    }

    .docs-public {
        padding: 1.25rem 1rem 2rem;
    }

    .docs-limits-table,
    .code-block,
    pre {
        max-width: 100%;
        overflow-x: auto;
    }

    .stat-value {
        overflow-wrap: anywhere;
        word-break: break-word;
        font-size: 1.25rem;
    }

    .chat-card {
        max-width: 100%;
    }

    .chat-messages {
        min-height: 280px;
        max-height: 50vh;
    }

    #chatForm {
        flex-wrap: wrap;
    }

    #sendBtn {
        width: 100%;
    }

    .auth-modal .modal-dialog {
        margin: 0.75rem;
    }

    .admin-pricing-hero-actions {
        width: 100%;
    }

    .admin-pricing-hero-actions .btn,
    .admin-pricing-hero-actions form {
        width: 100%;
    }

    .admin-pricing-hero-actions .btn {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    html {
        overflow-x: clip;
    }

    body {
        overflow-x: clip;
    }

    .public-header .brand {
        font-size: 1.5rem;
    }

    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .panel-card {
        padding: 1.125rem;
    }

    .pricing-model-id,
    .mkt-model-id {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

/* ── Admin system monitor ── */

.sysmon-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sysmon-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.sysmon-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.sysmon-status[data-state="live"]::before {
    animation: sysmon-pulse 2s ease-in-out infinite;
}

.sysmon-status[data-state="paused"]::before {
    background: var(--text-muted);
}

.sysmon-status[data-state="error"]::before {
    background: var(--danger);
}

@keyframes sysmon-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.sysmon-interval {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
}

.sysmon-interval .form-select {
    width: auto;
}

.sysmon-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.sysmon-grid-secondary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sysmon-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    min-width: 0;
}

.sysmon-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.sysmon-card-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.sysmon-card-sub {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.sysmon-card-value {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.sysmon-chart {
    display: block;
    width: 100%;
    height: 140px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: linear-gradient(180deg, #fcfcfd 0%, #fff 100%);
}

.sysmon-card-foot {
    margin-top: 0.625rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.sysmon-cores {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem 1rem;
    margin-top: 0.875rem;
}

.sysmon-core {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.sysmon-core-name {
    color: var(--text-muted);
    min-width: 1.5rem;
}

.sysmon-core-track {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border-light);
    overflow: hidden;
}

.sysmon-core-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 3px;
    background: var(--success);
    transition: width 0.4s ease;
}

.sysmon-core-fill[data-level="medium"] {
    background: #f59e0b;
}

.sysmon-core-fill[data-level="high"] {
    background: var(--danger);
}

.sysmon-core-value {
    min-width: 2.25rem;
    text-align: right;
    color: var(--text-secondary);
}

.sysmon-facts {
    margin: 0.875rem 0 0;
}

.sysmon-facts > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4375rem 0;
    border-bottom: 1px solid var(--border-light);
}

.sysmon-facts > div:last-child {
    border-bottom: 0;
}

.sysmon-facts dt {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.sysmon-facts dd {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.sysmon-wrap {
    overflow-wrap: anywhere;
}

@media (max-width: 991.98px) {
    .sysmon-grid,
    .sysmon-grid-secondary {
        grid-template-columns: minmax(0, 1fr);
    }
}
