/* ──────────────────────────────────────────────
   Belvieu Digital — Client Portal Design System
   Clean, minimal, black & white.
   ────────────────────────────────────────────── */

/* --- Design Tokens --- */
:root {
    /* Neutral palette */
    --gray-50:  #fafafa;
    --gray-100: #f0f0f0;
    --gray-200: #e0e0e0;
    --gray-300: #c4c4c4;
    --gray-400: #999999;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #3d3d3d;
    --gray-800: #262626;
    --gray-900: #171717;

    /* Brand — near-black primary */
    --indigo-50:  #f5f5f5;
    --indigo-100: #e8e8e8;
    --indigo-500: #3d3d3d;
    --indigo-600: #171717;
    --indigo-700: #0a0a0a;

    /* Semantic */
    --green-50:  #f0fdf4;
    --green-100: #dcfce7;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --green-700: #15803d;
    --yellow-50: #fffbeb;
    --yellow-100: #fef3c7;
    --yellow-500: #f59e0b;
    --yellow-700: #a16207;
    --red-50:    #fef2f2;
    --red-100:   #fee2e2;
    --red-500:   #ef4444;
    --red-600:   #dc2626;
    --red-700:   #b91c1c;
    --blue-50:   #eff6ff;
    --blue-100:  #dbeafe;
    --blue-500:  #3b82f6;
    --blue-700:  #1d4ed8;

    /* Surfaces */
    --color-bg:       #fafafa;
    --color-surface:  #ffffff;
    --color-text:     var(--gray-900);
    --color-text-secondary: var(--gray-500);
    --color-text-tertiary:  var(--gray-400);
    --color-border:   var(--gray-200);
    --color-border-light: var(--gray-100);
    --color-primary:  var(--gray-900);
    --color-primary-hover: #0a0a0a;
    --color-primary-light: var(--gray-50);

    /* Radii */
    --radius-sm: 6px;
    --radius:    8px;
    --radius-lg: 10px;
    --radius-xl: 12px;

    /* Shadows — minimal, border-driven design */
    --shadow-xs:  none;
    --shadow-sm:  none;
    --shadow-md:  none;
    --shadow-lg:  none;
    --shadow-ring: 0 0 0 3px rgba(0, 0, 0, 0.06);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;

    /* Layout */
    --max-width: 1080px;
    --nav-height: 56px;

    /* Transitions */
    --transition: 0.15s ease;
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--gray-700);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--gray-900);
    text-decoration: underline;
}

img { max-width: 100%; }

::selection {
    background: var(--gray-200);
    color: var(--gray-900);
}

/* ─── Navigation ─── */
.nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.92);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    padding: 0 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--color-text);
}
.nav-brand:hover {
    text-decoration: none;
    color: var(--color-text);
}

.nav-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.nav-brand-text {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.nav-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

.nav-links a:hover {
    color: var(--color-text);
    background: var(--gray-100);
    text-decoration: none;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: var(--color-border);
    margin: 0 0.5rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
}

.nav-link-subtle {
    font-size: 13px;
    color: var(--color-text-tertiary) !important;
    font-weight: 400 !important;
}
.nav-link-subtle:hover {
    color: var(--color-text-secondary) !important;
}

/* ─── Main Content ─── */
.main {
    flex: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* ─── Footer ─── */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-text-tertiary);
    font-size: 12px;
    border-top: 1px solid var(--color-border-light);
}

/* ─── Page Headers ─── */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.page-header p {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* ─── Flash Messages ─── */
.flash-container {
    margin-bottom: 1.5rem;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    animation: flash-in 0.25s ease-out;
}

@keyframes flash-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flash-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flash-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.flash-success { background: var(--green-50);  color: var(--green-700);  border-color: var(--green-100); }
.flash-error   { background: var(--red-50);    color: var(--red-700);    border-color: var(--red-100); }
.flash-warning { background: var(--yellow-50); color: var(--yellow-700); border-color: var(--yellow-100); }
.flash-info    { background: var(--blue-50);   color: var(--blue-700);   border-color: var(--blue-100); }

.flash-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    padding: 0 0.25rem;
    line-height: 1;
    transition: opacity var(--transition);
}
.flash-close:hover { opacity: 0.8; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    line-height: 1.4;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #fff;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--color-text);
}

.btn-danger {
    background: var(--red-500);
    color: #fff;
    border-color: var(--red-500);
}
.btn-danger:hover {
    background: var(--red-600);
    border-color: var(--red-600);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--color-text);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 12px;
}

.btn-lg {
    padding: 0.65rem 1.5rem;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
}

.btn-full {
    width: 100%;
}

.btn-icon {
    padding: 0.45rem;
}

/* ─── Cards ─── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-compact {
    padding: 1.25rem;
}

.card-header {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header .badge {
    margin-left: auto;
}

.card-header-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.card-value {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--color-text);
    line-height: 1.2;
    margin-top: 0.25rem;
}

.card-description {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 0.35rem;
}

/* ─── Stats Grid (Stripe-style metric cards) ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--color-text);
    line-height: 1.2;
}

.stat-detail {
    font-size: 13px;
    color: var(--color-text-tertiary);
    margin-top: 0.25rem;
}

/* ─── Content Grid ─── */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.content-grid-wide {
    grid-column: 1 / -1;
}

/* ─── Forms ─── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 0.4rem;
    color: var(--color-text);
}

.form-hint {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-top: 0.3rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-ring);
}

.form-control:read-only {
    background: var(--gray-50);
    color: var(--color-text-secondary);
}

.form-control::placeholder {
    color: var(--color-text-tertiary);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3e%3cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25em;
    padding-right: 2.25rem;
    cursor: pointer;
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-active,
.badge-full      { background: var(--green-50); color: var(--green-700); }
.badge-active .badge-dot,
.badge-full .badge-dot { background: var(--green-500); }

.badge-trialing  { background: var(--blue-50); color: var(--blue-700); }
.badge-trialing .badge-dot { background: var(--blue-500); }

.badge-past-due,
.badge-read-only { background: var(--yellow-50); color: var(--yellow-700); }
.badge-past-due .badge-dot,
.badge-read-only .badge-dot { background: var(--yellow-500); }

.badge-canceled,
.badge-blocked   { background: var(--red-50); color: var(--red-700); }
.badge-canceled .badge-dot,
.badge-blocked .badge-dot { background: var(--red-500); }

.badge-paused    { background: var(--gray-100); color: var(--gray-600); }
.badge-paused .badge-dot { background: var(--gray-400); }

.badge-demo      { background: var(--gray-100); color: var(--gray-700); }
.badge-demo .badge-dot { background: var(--gray-500); }

.badge-open      { background: var(--blue-50); color: var(--blue-700); }
.badge-open .badge-dot { background: var(--blue-500); }

.badge-in-progress { background: var(--yellow-50); color: var(--yellow-700); }
.badge-in-progress .badge-dot { background: var(--yellow-500); }

.badge-done      { background: var(--green-50); color: var(--green-700); }
.badge-done .badge-dot { background: var(--green-500); }

.badge-waiting   { background: var(--gray-100); color: var(--gray-600); }
.badge-waiting .badge-dot { background: var(--gray-400); }

.badge-owner     { background: var(--gray-900); color: #fff; }
.badge-member    { background: var(--gray-100); color: var(--gray-700); }

/* ─── Edit Usage Bar ─── */
.edit-usage-bar-container {
    width: 100%;
    height: 6px;
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
}
.edit-usage-bar {
    height: 100%;
    background: var(--gray-900);
    border-radius: 3px;
    transition: width 0.3s ease;
    min-width: 0;
}
.edit-usage-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
}
.edit-usage-compact .edit-usage-bar-container {
    width: 48px;
    height: 4px;
}

/* ─── Admin Tabs ─── */
.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
}
.admin-tab {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.admin-tab:hover {
    color: var(--color-text);
}
.admin-tab.active {
    color: var(--gray-900);
    border-bottom-color: var(--gray-900);
}
.admin-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: var(--gray-900);
    border-radius: 9px;
    margin-left: 0.35rem;
    vertical-align: middle;
}
.admin-tab-panel {
    display: none;
}
.admin-tab-panel.active {
    display: block;
}

/* ─── Tables ─── */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    background: var(--gray-50);
    border-bottom: 1px solid var(--color-border);
}

.table th:first-child { border-top-left-radius: var(--radius-lg); }
.table th:last-child  { border-top-right-radius: var(--radius-lg); }

.table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: background var(--transition);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table-link {
    color: var(--color-text);
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition);
}
.table-link:hover {
    color: var(--gray-600);
    text-decoration: none;
}

/* ─── Alert / Banner ─── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.alert-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-warning {
    background: var(--yellow-50);
    color: var(--yellow-700);
    border-color: var(--yellow-100);
}

.alert-danger {
    background: var(--red-50);
    color: var(--red-700);
    border-color: var(--red-100);
}

.alert-info {
    background: var(--blue-50);
    color: var(--blue-700);
    border-color: var(--blue-100);
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    color: var(--color-text-tertiary);
    margin: 0 auto 1rem;
}

.empty-state h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.empty-state p {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 1.25rem;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Pricing Cards (Subscribe page) ─── */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    text-align: center;
    position: relative;
}

.pricing-card-featured {
    border-color: var(--color-primary);
    border-width: 2px;
}

.pricing-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 0.2rem 0.75rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pricing-plan-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.pricing-price {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.pricing-price span {
    font-size: 16px;
    font-weight: 400;
    color: var(--color-text-secondary);
}

.pricing-description {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.pricing-features {
    list-style: none;
    text-align: left;
    margin-bottom: 1.5rem;
    padding: 0;
}

.pricing-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0;
    font-size: 13px;
    color: var(--color-text);
}

.pricing-check {
    width: 16px;
    height: 16px;
    color: var(--green-500);
    flex-shrink: 0;
    margin-top: 1px;
}

/* ─── Suspended / CTA Pages ─── */
.cta-page {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 520px;
    margin: 0 auto;
}

.cta-page-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.5rem;
    color: var(--color-text-tertiary);
}

.cta-page h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.cta-page p {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.cta-page .btn {
    margin-top: 0.5rem;
}

/* ─── Dashboard Specific ─── */
.dashboard-welcome {
    margin-bottom: 2rem;
}

.dashboard-welcome h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
}

.dashboard-welcome p {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.subscription-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.subscription-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.subscription-plan {
    font-weight: 600;
    font-size: 15px;
}

.subscription-renewal {
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* ─── Auth Pages ─── */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 4rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-xl);
}

.auth-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.auth-footer a {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
}
.auth-footer a:hover {
    text-decoration: underline;
}

.auth-error-state {
    text-align: center;
    padding: 1rem 0;
}

.form-check {
    margin-bottom: 1.25rem;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    color: var(--color-text-secondary);
}

.check-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--gray-900);
    border-radius: 3px;
    cursor: pointer;
}

/* ─── Error Pages ─── */
.error-page {
    text-align: center;
    padding: 5rem 1rem;
}

.error-page-code {
    font-size: 80px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
    letter-spacing: -0.04em;
    line-height: 1;
}

.error-page h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.error-page p {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    font-size: 14px;
    line-height: 1.6;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.error-page-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    color: var(--gray-300);
}

/* ─── Ticket List ─── */
.ticket-row-subject {
    font-weight: 500;
}

.ticket-row-meta {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-top: 0.15rem;
}

.ticket-row-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
    text-decoration: none;
    color: inherit;
    transition: all var(--transition);
}
.ticket-row-link:hover {
    text-decoration: none;
}
.ticket-row-link:hover .ticket-row-subject {
    color: var(--gray-600);
}

/* ─── Ticket Filters ─── */
.ticket-filters {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0;
}

.ticket-filter-tab {
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition), border-color var(--transition);
}
.ticket-filter-tab:hover {
    color: var(--color-text);
    text-decoration: none;
}
.ticket-filter-tab.active {
    color: var(--gray-900);
    border-bottom-color: var(--gray-900);
}

/* ─── Ticket Detail ─── */
.ticket-header {
    margin-bottom: 1.5rem;
}

.ticket-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.ticket-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.ticket-badges {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.ticket-meta {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.ticket-meta-sep {
    margin: 0 0.35rem;
    color: var(--color-text-tertiary);
}

/* ─── Ticket Thread ─── */
.ticket-thread {
    margin-bottom: 1.5rem;
}

.ticket-message {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}

.ticket-message-admin {
    border-left: 3px solid var(--gray-900);
}

.ticket-message-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.ticket-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.ticket-message-avatar-admin {
    background: var(--gray-900);
    color: #fff;
}

.ticket-message-author {
    font-weight: 500;
    font-size: 13px;
    display: block;
}

.ticket-message-time {
    font-size: 12px;
    color: var(--color-text-tertiary);
    display: block;
}

.ticket-message-body {
    font-size: 14px;
    line-height: 1.65;
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ─── Ticket Internal Notes (admin view) ─── */
.ticket-message-internal {
    background: var(--yellow-50);
    border-color: var(--yellow-100);
    border-left: 3px solid var(--yellow-500);
}

/* ─── Ticket Reply ─── */
.ticket-reply {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.ticket-reply-closed {
    text-align: center;
    padding: 1.5rem;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
}

.ticket-reply-closed p {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

/* ─── Back Link ─── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 13px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
    margin-bottom: 1.5rem;
}
.back-link:hover {
    color: var(--color-text);
    text-decoration: none;
}
.back-link svg {
    width: 14px;
    height: 14px;
}

/* ─── Admin Layout ─── */
.admin-pipeline-list {
    display: flex;
    flex-direction: column;
}

.admin-pipeline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--color-border-light);
    transition: all var(--transition);
}
.admin-pipeline-row:last-child {
    border-bottom: none;
}
.admin-pipeline-row:hover {
    text-decoration: none;
    background: var(--gray-50);
    margin: 0 -1.5rem;
    padding: 0.55rem 1.5rem;
}

.admin-pipeline-count {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text);
    min-width: 28px;
    text-align: right;
}

.admin-actions-list {
    display: flex;
    flex-direction: column;
}

.admin-pending-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.admin-activity-feed {
    max-height: 400px;
    overflow-y: auto;
}

.admin-activity-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border-light);
}
.admin-activity-item:last-child {
    border-bottom: none;
}

.admin-activity-action {
    margin-bottom: 0.2rem;
}

.admin-activity-meta {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ─── Admin Detail Rows ─── */
.admin-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0;
    font-size: 13px;
    border-bottom: 1px solid var(--color-border-light);
}
.admin-detail-row:last-child {
    border-bottom: none;
}

.admin-detail-label {
    color: var(--color-text-secondary);
    font-weight: 500;
    min-width: 100px;
    flex-shrink: 0;
}

/* ─── Admin Invite Link Box ─── */
.admin-invite-link-box {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.admin-invite-link-box .form-control {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--gray-50);
}

/* ─── Admin Ticket Filters ─── */
.admin-ticket-filters {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-ticket-filters .ticket-filters {
    margin-bottom: 0;
}

.admin-assignee-filter {
    flex-shrink: 0;
    padding-bottom: 1px;
}

.admin-status-actions {
    display: flex;
    flex-direction: column;
}

/* ─── Admin Badge Colors for Pipeline ─── */
.badge-researching  { background: var(--blue-50); color: var(--blue-700); }
.badge-researching .badge-dot { background: var(--blue-500); }

.badge-site_built   { background: var(--blue-50); color: var(--blue-700); }
.badge-site_built .badge-dot { background: var(--blue-500); }

.badge-pitched      { background: var(--yellow-50); color: var(--yellow-700); }
.badge-pitched .badge-dot { background: var(--yellow-500); }

.badge-converted    { background: var(--green-50); color: var(--green-700); }
.badge-converted .badge-dot { background: var(--green-500); }

.badge-declined     { background: var(--red-50); color: var(--red-700); }
.badge-declined .badge-dot { background: var(--red-500); }

/* ─── Admin Badge Colors for Source ─── */
.badge-google_maps  { background: var(--blue-50); color: var(--blue-700); }
.badge-facebook     { background: var(--blue-50); color: var(--blue-700); }
.badge-referral     { background: var(--green-50); color: var(--green-700); }
.badge-other        { background: var(--gray-100); color: var(--gray-600); }

/* ─── Admin Badge Colors for Priority ─── */
.badge-low     { background: var(--gray-100); color: var(--gray-600); }
.badge-normal  { background: var(--blue-50); color: var(--blue-700); }
.badge-high    { background: var(--red-50); color: var(--red-700); }

/* ─── Admin Badge Colors for Plans ─── */
.badge-basic   { background: var(--blue-50); color: var(--blue-700); }
.badge-pro     { background: var(--gray-900); color: #fff; }

/* font-mono utility */
.font-mono     { font-family: var(--font-mono); }

/* ─── Billing Processing ─── */
.billing-processing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 0;
}

.billing-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--gray-900);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Site Info Card ─── */
.site-info-item {
    margin-bottom: 1rem;
}
.site-info-item:last-child {
    margin-bottom: 0;
}

.site-info-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
    margin-bottom: 0.2rem;
}

.site-info-value {
    font-size: 14px;
    color: var(--color-text);
    font-weight: 500;
}

.site-info-value a {
    font-weight: 400;
    font-size: 13px;
}

.external-link-icon {
    width: 12px;
    height: 12px;
    vertical-align: middle;
    margin-left: 2px;
}

/* ─── Utility ─── */
.text-muted     { color: var(--color-text-secondary); }
.text-tertiary  { color: var(--color-text-tertiary); }
.text-sm        { font-size: 12px; }
.text-xs        { font-size: 11px; }
.font-medium    { font-weight: 500; }
.font-semibold  { font-weight: 600; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.divider {
    border: none;
    border-top: 1px solid var(--color-border-light);
    margin: 1.5rem 0;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 380px;
    }

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

    .subscription-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .ticket-header-top {
        flex-direction: column;
    }

    .ticket-badges {
        flex-wrap: wrap;
    }

    .admin-ticket-filters {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .main { padding: 1rem; }

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

    .nav-user-name {
        display: none;
    }

    .nav-links {
        gap: 0;
    }

    .auth-container {
        padding-top: 2rem;
    }

    .cta-page {
        padding: 2.5rem 1rem;
    }

    .ticket-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .ticket-filters::-webkit-scrollbar {
        display: none;
    }
}
