/* ==========================================================================
   articloud billing — panel styles.
   Tokens (colours, fonts, radii, shadows) come from tokens.css, shared with articloud.net.
   No inline styles in templates: CSP is style-src 'self'. Use the classes below.
   Sections: base · layout · components · pages · utilities
   ========================================================================== */

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}
body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text-primary);
}
p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color 0.18s ease;
}
a:hover { color: var(--brand-primary-hover); }
:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
}
[hidden] { display: none !important; }

/* ===== Layout ===== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}
.app-header {
    background-color: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    min-height: 4.25rem;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-primary);
    flex-shrink: 0;
}
.logo:hover { color: var(--brand-primary); }
.brand-logo-svg {
    width: auto;
    height: 40px;
    display: block;
}
.logo-svg-text { font-family: var(--font-display); }
.logo-billing-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    background: var(--brand-soft);
    border: 1px solid rgba(14, 165, 233, 0.24);
    color: var(--brand-primary);
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.user-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-link {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}
.nav-link:hover, .nav-link.is-active { color: var(--brand-primary); }
.user-name {
    font-weight: 500;
    color: var(--text-muted);
}
.logout-form { display: inline; margin: 0; }

/* Admin sub-navigation (layout.php, shown on /admin pages) */
.admin-nav {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}
.admin-nav-list {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.admin-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.admin-nav-link:hover { color: var(--text-primary); }
.admin-nav-link.is-active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.main-content {
    padding: 32px 20px;
    min-height: calc(100vh - 140px);
}
.app-footer {
    padding: 24px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Page header: title on the left, actions on the right */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}
.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}
.page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}
.back-link {
    display: inline-block;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== Components ===== */

/* --- Cards --- */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-subtle);
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
}
.card-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.card-body { padding: 1.25rem; }
.card-body-flush { padding: 0; }
.card-narrow { max-width: 600px; }
.stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- Buttons: .btn + one variant (+ .btn-sm / .btn-block) --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
}
.btn:disabled, .btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
}
.btn-block { display: flex; width: 100%; }

.btn-primary {
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25);
}
.btn-primary:hover:not(:disabled) {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.34);
}
.btn-outline {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-strong);
}
.btn-outline:hover:not(:disabled) {
    background: var(--bg-subtle);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover:not(:disabled) { background: var(--success-text); color: #fff; }
.btn-warning {
    background: var(--warning-soft);
    color: var(--warning-text);
    border-color: rgba(217, 119, 6, 0.35);
}
.btn-warning:hover:not(:disabled) { background: var(--warning); color: #fff; }
.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.35);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-dark {
    background: var(--bg-dark-elevated);
    color: var(--text-inverse);
}
.btn-dark:hover:not(:disabled) { background: var(--bg-dark); color: #fff; }
/* On dark surfaces (VNC toolbar) */
.btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-inverse);
    border-color: rgba(255, 255, 255, 0.12);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* Icon spacing inside buttons (View::icon(..., 'icon-gap')) — .btn already has gap */
.icon-gap { margin-right: 4px; }
.icon-gap-lg { margin-right: 6px; }
.btn .icon-gap, .btn .icon-gap-lg { margin-right: 0; }

/* Segmented toggle (dashboard grid/list) */
.view-toggle {
    display: inline-flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.view-btn {
    display: inline-flex;
    padding: 0.45rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.view-btn + .view-btn { border-left: 1px solid var(--border-color); }
.view-btn:hover { color: var(--text-primary); }
.view-btn.active { color: var(--brand-primary); background: var(--brand-soft); }

/* --- Forms --- */
.form-group { margin-bottom: 1rem; }
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0 1rem;
}
label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}
.form-control {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: var(--focus-ring);
}
.form-control:disabled { background: var(--bg-muted); cursor: not-allowed; }
.form-control-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.875rem;
}
.form-control-auto { width: auto; }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
}
.form-section-title {
    margin: 1.25rem 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
}
.form-panel {
    margin: 0.5rem 0 1.25rem;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
}
.form-panel > .form-section-title:first-child { margin-top: 0; }
.form-total {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--brand-primary);
}
.form-actions { margin-top: 1rem; }
.inline-form { display: inline; margin: 0; }
.inline-form-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin: 0;
}
.inline-form-row .form-control { max-width: 160px; }

/* --- Alerts (persistent messages in the page) --- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}
.alert-danger { background: var(--danger-soft); color: var(--danger-text); border-color: rgba(220, 38, 38, 0.2); }
.alert-success { background: var(--success-soft); color: var(--success-text); border-color: rgba(5, 150, 105, 0.2); }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); border-color: rgba(217, 119, 6, 0.25); }
.alert-info { background: var(--info-soft); color: var(--info-text); border-color: rgba(37, 99, 235, 0.2); }

/* --- Badges & tags --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge-success { background: var(--success-soft); color: var(--success-text); border-color: rgba(5, 150, 105, 0.25); }
.badge-info { background: var(--info-soft); color: var(--info-text); border-color: rgba(37, 99, 235, 0.25); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); border-color: rgba(217, 119, 6, 0.3); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); border-color: rgba(220, 38, 38, 0.25); }
.badge-brand { background: var(--brand-soft); color: var(--brand-primary-hover); border-color: rgba(14, 165, 233, 0.3); }
.tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--brand-soft);
    color: var(--brand-primary-hover);
}
.tag-muted {
    font-size: 0.8125rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    background: var(--bg-muted);
    color: var(--text-secondary);
}

/* --- VM status pill (View::statusBadge, app.js, admin.js) --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--bg-muted);
    color: var(--text-secondary);
    white-space: nowrap;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}
.status-running { background: var(--success-soft); color: var(--success-text); }
.status-running .status-dot { background: var(--success); box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2); }
.status-stopped { background: var(--danger-soft); color: var(--danger-text); }
.status-stopped .status-dot { background: var(--danger); box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2); }
.status-transitioning { background: var(--warning-soft); color: var(--warning-text); }
.status-transitioning .status-dot {
    background: var(--warning);
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* --- Progress bars (width set from data-percent by app.js) --- */
.progress-track {
    background: var(--border-color);
    border-radius: var(--radius-pill);
    height: 8px;
    overflow: hidden;
}
.progress-fill {
    width: 0;
    height: 100%;
    border-radius: var(--radius-pill);
    transition: width 0.5s ease-out;
}
.progress-blue { background: var(--brand-primary); }
.progress-green { background: var(--success); }
.progress-orange { background: var(--warning); }
.progress-red { background: var(--danger); }

/* --- Tables (admin) --- */
.modern-table-container {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 2rem;
}
.table-header-title {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.125rem;
    font-weight: 600;
}
.table-responsive { overflow-x: auto; }
.modern-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}
.modern-table th {
    background: var(--bg-subtle);
    padding: 0.85rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.modern-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.modern-table tr:last-child td { border-bottom: none; }
.modern-table tbody tr:hover td { background: var(--bg-subtle); }
.modern-table .col-actions { text-align: right; }
.table-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.col-actions .table-actions { justify-content: flex-end; }

/* --- Toasts (JS feedback, window.showToast) --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* --- Empty state --- */
.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

/* ===== Pages ===== */

/* --- Login --- */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 220px);
}
.login-card {
    width: 100%;
    max-width: 420px;
    padding: 36px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}
.login-header {
    text-align: center;
    margin-bottom: 24px;
}
.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}
.subtitle { color: var(--text-secondary); }

/* --- Dashboard (VM cards, grid/list view) --- */
.vm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}
.vm-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.vm-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.vm-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--border-strong);
}
.vm-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.vm-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.vm-title {
    font-size: 1.125rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vm-id {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.vm-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}
.vm-spec-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.vm-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}
.paid-until {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.paid-until::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}
.paid-until.text-success::before { background: var(--success); }
.paid-until.text-warning::before { background: var(--warning); }
.paid-until.text-danger::before { background: var(--danger); }
@media (min-width: 992px) {
    .vm-list .vm-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.5rem;
    }
    .vm-list .vm-header {
        margin-bottom: 0;
        width: 250px;
        flex-shrink: 0;
        align-items: center;
    }
    .vm-list .vm-specs {
        display: flex;
        margin-bottom: 0;
        justify-content: center;
        gap: 2rem;
    }
    .vm-list .vm-footer {
        gap: 1.5rem;
        flex-shrink: 0;
        padding-top: 0;
        border-top: none;
    }
}

/* Coloured resource icons (dashboard + VM page) */
.spec-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.spec-icon-sm { width: 24px; height: 24px; border-radius: 6px; }
.icon-cpu { background: var(--info-soft); color: var(--info); }
.icon-ram { background: var(--success-soft); color: var(--success); }
.icon-disk { background: var(--violet-soft); color: var(--violet); }
.icon-traffic { background: var(--warning-soft); color: var(--warning); }
.icon-os { background: var(--bg-muted); color: var(--text-secondary); }

/* --- VM detail --- */
.vm-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: start;
}
.resource-item { margin-bottom: 1.5rem; }
.resource-item:last-child { margin-bottom: 0; }
.resource-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}
.resource-header span:first-child { font-weight: 500; color: var(--text-secondary); }
.resource-header span:last-child { font-weight: 600; text-align: right; }
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.chart-title {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
}
.chart-box {
    position: relative;
    height: 180px;
}
.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.power-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}
.power-grid .btn-vnc { grid-column: 1 / -1; }

.spec-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color);
}
.spec-item:last-child { border-bottom: none; padding-bottom: 0; }
.spec-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}
.spec-value {
    font-weight: 600;
    font-size: 0.9375rem;
    text-align: right;
    overflow-wrap: anywhere;
}

/* Plan & billing card */
.billing-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.billing-section:last-child { border-bottom: none; }
.billing-section-muted {
    background: var(--bg-page);
    border-bottom-style: dashed;
}
.billing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}
.billing-row-top { align-items: flex-start; }
.billing-plan-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
    font-size: 1.125rem;
}
.billing-plan-specs {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}
.billing-plan-price {
    font-weight: 600;
    font-size: 1.125rem;
    white-space: nowrap;
}
.billing-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.billing-subtitle {
    margin-bottom: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.addon-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}
.addon-row:last-child { margin-bottom: 0; }
.addon-row-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}
.addon-row-label svg { color: var(--brand-primary); }
.addon-row-price { font-weight: 600; color: var(--text-secondary); }
.billing-total { margin-bottom: 1.25rem; }
.billing-total-label {
    font-weight: 600;
    color: var(--text-secondary);
}
.billing-total-value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.75rem;
}
.invoice-box {
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(5, 150, 105, 0.2);
    background: var(--success-soft);
    color: var(--success-text);
}
.invoice-box.is-expired {
    border-color: rgba(220, 38, 38, 0.2);
    background: var(--danger-soft);
    color: var(--danger-text);
}
.invoice-box-head { margin-bottom: 0.25rem; }
.invoice-box-label { font-size: 0.875rem; font-weight: 500; }
.invoice-box-state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--success);
}
.invoice-box.is-expired .invoice-box-state { color: var(--danger); }
.invoice-box-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

/* AI-Sysadmin chat (vm_detail.php + public/js/ai-chat.js) */
.ai-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.ai-title-icon { font-size: 1.25rem; line-height: 1; }
.ai-ws-status.is-online { background: var(--success-soft); color: var(--success-text); border-color: rgba(5, 150, 105, 0.25); }
.ai-ws-status.is-offline { background: var(--danger-soft); color: var(--danger-text); border-color: rgba(220, 38, 38, 0.25); }
.ai-status-banner {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-left: 4px solid var(--brand-accent);
    border-radius: 4px;
    background: var(--bg-subtle);
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.ai-approval {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: var(--radius-sm);
    background: var(--danger-soft);
    color: var(--danger-text);
}
.ai-approval-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}
.ai-approval-reason {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}
.ai-command {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    background: var(--bg-dark);
    color: var(--text-inverse);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    word-break: break-all;
}
.ai-command-prompt { color: #22c55e; }
.ai-approval-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.ai-terminal {
    height: 260px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--bg-dark-elevated);
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.825rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}
.t-muted { color: var(--text-muted); }
.t-stdout { color: #e2e8f0; }
.t-stderr { color: #f87171; }
.t-cmd { color: #38bdf8; font-weight: 700; }
.t-assistant { color: #4ade80; font-weight: 500; }
.ai-input-row {
    display: flex;
    gap: 0.6rem;
}
.ai-input-row .form-control { flex: 1; }

/* --- Admin --- */
.plan-name {
    display: block;
    font-weight: 600;
    font-size: 0.9375rem;
}
.plan-id { font-size: 0.75rem; color: var(--text-muted); }
.plan-price { font-weight: 700; color: var(--brand-primary); font-size: 1.125rem; }
.price-period { color: var(--text-muted); font-size: 0.75rem; }
.resource-badges, .addon-capsules {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.addon-capsule {
    display: inline-flex;
    flex-direction: column;
    padding: 0.25rem 0.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: 4px;
    background: var(--bg-subtle);
    font-size: 0.7rem;
    line-height: 1.2;
    color: var(--text-secondary);
}
.addon-capsule .val { font-weight: 600; color: var(--text-primary); }

/* --- VNC console (standalone page, vnc.php) --- */
.vnc-page {
    margin: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #000;
    color: var(--text-inverse);
}
.vnc-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--bg-dark-elevated);
    flex-shrink: 0;
}
.vnc-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    font-weight: 600;
}
.vnc-title .brand-logo-svg { height: 28px; }
.vnc-back {
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
}
.vnc-back:hover { color: #fff; }
.vnc-vm-name {
    font-family: var(--font-display);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vnc-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.12);
}
.vnc-status.connected { background: var(--success); }
.vnc-status.disconnected { background: var(--danger); }
.vnc-status.connecting { background: var(--warning); }
.vnc-actions {
    display: flex;
    gap: 0.5rem;
}
#vnc-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    position: relative;
}
#vnc-container canvas { outline: none; }
.vnc-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10;
}
.vnc-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--brand-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.vnc-error { color: #f87171; }

/* ===== Utilities ===== */
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
    .brand-logo-svg { height: 48px; }
}
@media (max-width: 992px) {
    .layout-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .container { padding: 0 14px; }
    .main-content { padding: 20px 14px; }
    .page-title { font-size: 1.4rem; }
    .user-name { display: none; }
    .user-nav { gap: 0.6rem; }
    .nav-link { font-size: 0.875rem; }
    .brand-logo-svg { height: 34px; }
    .logo-billing-tag { display: none; }
    .charts-grid { grid-template-columns: 1fr; }
    .vm-grid { grid-template-columns: 1fr; }
    .ai-input-row { flex-direction: column; }
    .vnc-actions .btn { padding: 0.3rem 0.55rem; }
}
