/* === Gotenberg Manager — Dashboard CSS === */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d2e;
    --bg-card: #1e2235;
    --bg-card-hover: #252a40;
    --bg-sidebar: #141625;
    --border: #2a2f45;
    --text-primary: #e8eaf0;
    --text-secondary: #8b90a5;
    --text-muted: #5c6178;
    --accent-primary: #7c5cfc;
    --accent-secondary: #5e9cff;
    --accent-gradient: linear-gradient(135deg, #7c5cfc 0%, #5e9cff 100%);
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 8px 32px rgba(124, 92, 252, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* === Sidebar === */

.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(124, 92, 252, 0.5));
}

.logo-text {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text small {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.7;
    -webkit-text-fill-color: var(--text-secondary);
}

.nav-links {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-link.active {
    background: rgba(124, 92, 252, 0.15);
    color: var(--accent-primary);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.version {
    font-size: 11px;
    color: var(--text-muted);
}

/* === Main Content === */

.content {
    margin-left: 240px;
    padding: 32px 40px;
    flex: 1;
    max-width: 1200px;
}

/* === Page Header === */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.back-link {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 8px;
    display: inline-block;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--accent-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.count-badge {
    font-size: 16px;
    background: var(--bg-card);
    padding: 2px 10px;
    border-radius: 20px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* === Health Banner === */

.health-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.health-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

.health-banner.status-healthy .health-indicator {
    background: var(--success);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

.health-banner.status-degraded .health-indicator {
    background: var(--warning);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.health-banner.status-unhealthy .health-indicator {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.health-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.health-info strong {
    font-size: 14px;
    text-transform: capitalize;
}

.health-info span {
    font-size: 12px;
    color: var(--text-secondary);
}

/* === Stats Grid === */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

.stat-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.stat-card.accent {
    background: var(--accent-gradient);
    border-color: transparent;
}

.stat-card.accent .stat-label {
    color: rgba(255, 255, 255, 0.7);
}

.stat-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 92, 252, 0.1);
    border-radius: var(--radius-sm);
}

.stat-card.accent .stat-icon {
    background: rgba(255, 255, 255, 0.15);
}

.stat-body {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === Dashboard Grid === */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* === Cards === */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-body.no-padding {
    padding: 0;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* === Tables === */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table.full-width {
    width: 100%;
}

.data-table thead th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(42, 47, 69, 0.5);
    color: var(--text-primary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.clickable-row {
    cursor: pointer;
    transition: var(--transition);
}

.clickable-row:hover {
    background: var(--bg-card-hover);
}

/* === Badges === */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-free {
    background: rgba(139, 144, 165, 0.15);
    color: var(--text-secondary);
}

.badge-starter {
    background: rgba(94, 156, 255, 0.15);
    color: var(--accent-secondary);
}

.badge-pro {
    background: rgba(124, 92, 252, 0.15);
    color: var(--accent-primary);
}

.badge-enterprise {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.badge-lg {
    padding: 5px 14px;
    font-size: 12px;
}

/* === Status === */

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.dot-green {
    background: var(--success);
    box-shadow: 0 0 4px rgba(52, 211, 153, 0.4);
}

.dot-red {
    background: var(--danger);
    box-shadow: 0 0 4px rgba(248, 113, 113, 0.4);
}

.status-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.status-inactive {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

/* === Progress Bars === */

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-lg {
    width: 100%;
    height: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.5s ease;
    min-width: 2px;
}

/* === API Key === */

.api-key {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    background: var(--bg-primary);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--accent-secondary);
    border: 1px solid var(--border);
}

.api-key-full {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    background: var(--bg-primary);
    padding: 6px 10px;
    border-radius: 4px;
    color: var(--accent-secondary);
    border: 1px solid var(--border);
    word-break: break-all;
    display: block;
    margin-top: 4px;
}

/* === Detail Rows === */

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(42, 47, 69, 0.5);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* === Forms === */

.form-card {
    max-width: 560px;
}

.client-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b90a5' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(94, 156, 255, 0.08);
    border: 1px solid rgba(94, 156, 255, 0.2);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.info-icon {
    flex-shrink: 0;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
}

/* === Buttons === */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 8px;
}

.btn-primary {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 92, 252, 0.35);
}

.btn-secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.2);
}

/* === Empty State === */

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

.empty-state a {
    color: var(--accent-primary);
    text-decoration: none;
}

.empty-card {
    text-align: center;
    padding: 60px 40px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* === Code === */

code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--accent-secondary);
}

/* === Responsive === */

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .logo-text,
    .nav-link span:not(.nav-icon),
    .sidebar-footer {
        display: none;
    }

    .nav-link {
        justify-content: center;
        padding: 12px;
    }

    .content {
        margin-left: 60px;
        padding: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
    }
}

/* ============================== */
/* ===  CLIENT PORTAL STYLES  === */
/* ============================== */

/* --- Login Page --- */

.portal-login-body {
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(124, 92, 252, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(94, 156, 255, 0.06) 0%, transparent 50%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: var(--shadow-card), 0 0 80px rgba(124, 92, 252, 0.06);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.login-logo-icon {
    font-size: 36px;
    filter: drop-shadow(0 0 12px rgba(124, 92, 252, 0.5));
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: -2px;
}

.login-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    justify-content: center;
    margin-top: 4px;
}

.login-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--danger);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--success);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.login-footer p {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Portal Layout --- */

.portal-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

.portal-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 60px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.portal-nav-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.portal-brand-icon {
    font-size: 24px;
    filter: drop-shadow(0 0 8px rgba(124, 92, 252, 0.5));
}

.portal-brand-text {
    font-size: 15px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.portal-brand-text small {
    font-size: 10px;
    font-weight: 400;
    -webkit-text-fill-color: var(--text-secondary);
    display: block;
}

.portal-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.portal-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.portal-nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.portal-nav-link.active {
    background: rgba(124, 92, 252, 0.15);
    color: var(--accent-primary);
}

.portal-nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.portal-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.portal-user-avatar {
    font-size: 18px;
}

.portal-content {
    flex: 1 1 auto;
    margin-top: 60px;
    padding: 32px 40px;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* --- Quota Card --- */

.portal-quota-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.portal-quota-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.portal-quota-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.portal-quota-counter {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
}

.portal-quota-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.progress-fill.progress-warning {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.progress-fill.progress-danger {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

/* --- Alerts --- */

.alert {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.5;
}

.alert-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--danger);
}

.alert-error a {
    color: #fff;
    text-decoration: underline;
}

.alert-error a:hover {
    color: var(--text-primary);
}

.alert-error ul {
    margin: 0;
    padding-left: 20px;
}

.alert-error li {
    margin: 4px 0;
}

.portal-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
}

.portal-alert-danger {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--danger);
}

.portal-alert-success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: var(--success);
}

/* --- Tabs --- */

.portal-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.portal-tab {
    flex: 1 1 0%;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.portal-tab:hover {
    color: var(--text-primary);
}

.portal-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* --- Textarea --- */

.portal-textarea {
    resize: vertical;
    min-height: 200px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- File Drop Zone --- */

.portal-file-drop {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-primary);
}

.portal-file-drop:hover,
.portal-file-drop.drag-over {
    border-color: var(--accent-primary);
    background: rgba(124, 92, 252, 0.03);
}

.portal-file-drop-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
}

.portal-file-drop p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* --- Status Pills --- */

.status-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.status-error {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

/* --- Subscription: Current Plan Card --- */

.portal-plan-current {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.portal-plan-badge-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.portal-plan-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.portal-plan-stats {
    display: flex;
    gap: 40px;
}

.portal-plan-stat {
    display: flex;
    flex-direction: column;
}

.portal-plan-stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.portal-plan-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* --- Plan Comparison Grid --- */

.portal-plans-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: stretch;
}

.portal-plan-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.portal-plan-card:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.portal-plan-active {
    border-color: var(--accent-primary);
    background: rgba(124, 92, 252, 0.05);
    box-shadow: 0 0 20px rgba(124, 92, 252, 0.1);
}

.portal-plan-card-header {
    margin-bottom: 16px;
}

.portal-plan-card-body {
    margin-bottom: 16px;
}

.portal-plan-limit {
    font-size: 32px;
    font-weight: 700;
    display: block;
    letter-spacing: -1px;
}

.portal-plan-unit {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
    margin-top: 4px;
}

.portal-plan-card-footer {
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.portal-plan-current-tag {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-primary);
}

/* --- Portal Responsive --- */

@media (max-width: 768px) {
    .portal-navbar {
        padding: 0 12px;
    }

    .portal-nav-links {
        display: none;
    }

    .portal-content {
        padding: 20px 16px;
    }

    .portal-plan-stats {
        flex-direction: column;
        gap: 16px;
    }

    .portal-plans-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .portal-tabs {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .token-metadata {
        gap: 8px;
    }

    .token-detail-actions {
        flex-direction: column;
        gap: 8px;
    }

    .token-stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .token-detail-grid {
        grid-template-columns: 1fr 1fr;
    }

    .token-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================== */
/* ===  MODAL STYLES          === */
/* ============================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-card), 0 0 60px rgba(0, 0, 0, 0.4);
}

.modal-content h2 {
    font-size: 20px;
    margin-bottom: 16px;
    font-weight: 600;
}

.modal-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.modal-content .warning {
    color: var(--warning);
    font-size: 13px;
    margin-top: 12px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.text-muted {
    color: var(--text-muted);
}

.form-inline {
    display: inline;
}

/* ============================== */
/* ===  TOKEN MANAGEMENT      === */
/* ============================== */

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.token-count {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(42, 47, 69, 0.5);
    color: var(--text-primary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--bg-card-hover);
}

.table td.actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-warning {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
    color: var(--warning);
}

.btn-warning:hover {
    background: rgba(251, 191, 36, 0.2);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--warning);
}

.api-docs-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.api-docs-section h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
}

.api-docs-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 12px;
}

.api-docs-section h4 {
    font-size: 15px;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 8px;
}

.api-docs-section p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.api-docs-section pre {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    overflow-x: auto;
    margin: 12px 0 20px 0;
}

.api-docs-section pre code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--accent-secondary);
    line-height: 1.6;
}

.api-docs-section ul {
    list-style: none;
    padding-left: 0;
    margin: 12px 0;
}

.api-docs-section ul li {
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.api-docs-section ul li code {
    font-size: 13px;
    padding: 2px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent-secondary);
}

.endpoint {
    margin-bottom: 24px;
}

.form-group small {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* ============================== */
/* ===  TOKEN CREATED PAGE    === */
/* ============================== */

.token-created-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 40px 20px;
}

.token-created-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 40px;
    max-width: 700px;
    width: 100%;
    box-shadow: var(--shadow-card), 0 0 80px rgba(124, 92, 252, 0.08);
    backdrop-filter: blur(10px);
}

.success-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.success-icon svg {
    color: var(--success);
    filter: drop-shadow(0 0 12px rgba(52, 211, 153, 0.4));
}

.token-created-header {
    text-align: center;
    margin-bottom: 32px;
}

.token-created-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.token-created-header .subtitle {
    font-size: 15px;
    color: var(--text-secondary);
}

.token-warning-alert {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: var(--radius-sm);
    margin-bottom: 28px;
}

.token-warning-alert svg {
    color: var(--warning);
    margin-top: 2px;
    flex-shrink: 0;
}

.token-warning-alert strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--warning);
    margin-bottom: 4px;
}

.token-warning-alert p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.token-display-section {
    margin-bottom: 28px;
}

.token-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.token-display-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: var(--bg-primary);
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 20px rgba(124, 92, 252, 0.15);
}

.token-value {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: var(--accent-secondary);
    word-break: break-all;
    line-height: 1.6;
}

.btn-copy {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-copy:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 92, 252, 0.35);
}

.btn-copy:active {
    transform: translateY(0);
}

.btn-copy.copied {
    background: var(--success);
}

.token-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.token-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px;
    background: rgba(124, 92, 252, 0.05);
    border: 1px solid rgba(124, 92, 252, 0.15);
    border-radius: var(--radius-sm);
    margin-bottom: 28px;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metadata-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.metadata-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.metadata-value code {
    font-size: 13px;
    color: var(--accent-secondary);
}

.token-usage-section {
    margin-bottom: 32px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.token-usage-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.token-usage-section p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.token-usage-section code {
    font-size: 12px;
    padding: 2px 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.code-example {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    overflow-x: auto;
    margin: 0;
}

.code-example code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--accent-secondary);
    line-height: 1.6;
    background: none;
    border: none;
    padding: 0;
}

.token-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Token Created Page - Responsive */
@media (max-width: 768px) {
    .token-created-card {
        padding: 32px 24px;
    }

    .token-display-box {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-copy {
        justify-content: center;
    }

    .token-actions {
        flex-direction: column;
    }

    .token-metadata {
        grid-template-columns: 1fr;
    }
}

/* ============================== */
/* ===  TOKEN DETAIL PAGE     === */
/* ============================== */

.token-detail-card {
    margin-bottom: 24px;
}

.token-detail-actions {
    display: flex;
    gap: 8px;
}

.token-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.token-prefix-code {
    font-size: 13px;
}

.token-stats-grid {
    margin-bottom: 24px;
}

.recent-conversions-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.endpoint-code {
    font-size: 12px;
}

.empty-state-icon {
    opacity: 0.4;
    margin-bottom: 16px;
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
}

.modal-warning-text {
    color: var(--warning);
    font-size: 13px;
    margin-top: 12px;
}

.modal-danger-text {
    color: var(--danger);
    font-size: 13px;
    margin-top: 12px;
}

.btn svg {
    margin-right: 4px;
}
