/* ==============================================================================
   ALL AI SOUTH AFRICA — CORE APPLICATION STYLESHEET (app.css)
   All styling is driven strictly by CSS variables for rapid theme swapping.
   ============================================================================== */

:root {
    /* Brand & Accent Tokens — Crisp Royal Blue Primary */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-subtle: #eff6ff;
    --color-primary-contrast: #ffffff;

    /* Surface & Background — Nice Clean Greyish Background */
    --color-bg: #f1f5f9;
    --color-bg-alt: #e2e8f0;
    --color-surface: #ffffff;
    --color-surface-elevated: #f8fafc;
    --color-surface-subtle: #f1f5f9;

    /* Typography / Text — Slate Contrast */
    --color-text: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #64748b;
    --color-text-inverse: #ffffff;

    /* Borders */
    --color-border: #e2e8f0;
    --color-border-hover: #cbd5e1;
    --color-border-subtle: #f1f5f9;

    /* Feedback / Status Tokens */
    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-success-border: #bbf7d0;

    --color-warning: #d97706;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;

    --color-danger: #dc2626;
    --color-danger-bg: #fef2f2;
    --color-danger-border: #fecaca;

    --color-info: #0284c7;
    --color-info-bg: #f0f9ff;

    /* Dimensions & Spacing */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

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

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

html, body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

code, pre {
    font-family: var(--font-mono);
}

pre {
    background-color: #0f172a;
    color: #f8fafc;
    border-radius: var(--radius-md);
    padding: var(--space-4);
    overflow-x: auto;
}

code {
    background-color: var(--color-surface-elevated);
    color: var(--color-primary);
    padding: 0.15rem 0.35rem;
    border-radius: var(--radius-sm);
    font-size: 0.875em;
    border: 1px solid var(--color-border);
}

pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==============================================================================
   Public Layout (templates/public/base.html)
   ============================================================================== */
.public-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.public-header {
    height: var(--header-height);
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 40;
}
.public-header-inner {
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-text);
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none !important;
}
.brand-logo-img {
    height: 36px;
    width: auto;
    border-radius: var(--radius-sm);
}
.public-nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-5);
}
.public-nav-link {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: color var(--transition-fast);
}
.public-nav-link:hover, .public-nav-link.active {
    color: var(--color-primary);
}
.public-content-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-6) var(--space-4);
    flex: 1;
}

.public-footer {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: var(--space-8) var(--space-4);
    color: var(--color-text-muted);
    font-size: 0.85rem;
}
.public-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
}
.public-footer-links {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.public-footer-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
}
.public-footer-links a:hover {
    color: var(--color-text);
    text-decoration: underline;
}

/* ==============================================================================
   Logged-In App Shell (templates/app/base.html)
   ============================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--color-bg);
}

/* Sidebar (Desktop) */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    overflow-y: auto;
    transition: transform var(--transition-fast);
}

.sidebar-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

/* Account Card at top of sidebar */
.account-card {
    background-color: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-top: var(--space-3);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.account-card:hover, .account-card:focus-visible {
    border-color: var(--color-border-hover);
    background-color: var(--color-surface-subtle);
    outline: none;
}
.account-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.account-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), #3b82f6);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.account-meta {
    overflow: hidden;
    flex: 1;
}
.account-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.account-email {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.account-funds-row {
    margin-top: var(--space-3);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.funds-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-success);
    background: var(--color-success-bg);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

/* Navigation List */
.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.6rem var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: all var(--transition-fast);
}
.sidebar-link:hover {
    color: var(--color-text);
    background-color: var(--color-surface-elevated);
}
.sidebar-link.active {
    color: var(--color-primary);
    background-color: var(--color-primary-subtle);
    border-left: 3px solid var(--color-primary);
    font-weight: 600;
}
.sidebar-icon {
    font-size: 1.1rem;
    line-height: 1;
    width: 20px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-size: 0.8rem;
}
.footer-nav-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    color: var(--color-text-muted);
}
.footer-nav-row a {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}
.footer-nav-row a:hover {
    color: var(--color-text-secondary);
}

/* Main Content Area */
.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.app-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-6) var(--space-6);
    flex: 1;
}

/* Mobile Top Bar (<900px) */
.mobile-topbar {
    display: none;
    height: var(--header-height);
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 45;
    padding: 0 var(--space-4);
    align-items: center;
    justify-content: space-between;
}
.mobile-hamburger-btn {
    background: transparent;
    border: none;
    color: var(--color-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 48;
}

@media (max-width: 899.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .mobile-backdrop.open {
        display: block;
    }
    .app-main {
        margin-left: 0;
    }
    .mobile-topbar {
        display: flex;
    }
    .app-content {
        padding: var(--space-4);
    }
}

/* ==============================================================================
   Native <dialog> Settings Drawer
   ============================================================================== */
dialog.settings-drawer {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    max-height: 100vh;
    width: 420px;
    max-width: 100%;
    z-index: 100;
}
dialog.settings-drawer::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
}
.drawer-container {
    height: 100%;
    background-color: var(--color-surface);
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.drawer-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.drawer-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
}
.drawer-close-btn {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: var(--space-1);
    line-height: 1;
}
.drawer-close-btn:hover {
    color: var(--color-text);
}
.drawer-body {
    flex: 1;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}
.drawer-section {
    border-bottom: 1px solid var(--color-border-subtle);
    padding-bottom: var(--space-4);
}
.drawer-section:last-child {
    border-bottom: none;
}
.drawer-section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
}

@media (max-width: 599.98px) {
    dialog.settings-drawer {
        width: 100%;
    }
}

/* ==============================================================================
   Flash Messages
   ============================================================================== */
.messages-container {
    margin-bottom: var(--space-6);
}
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.alert-success {
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    color: #15803d;
}
.alert-danger, .alert-error {
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    color: #b91c1c;
}
.alert-warning {
    background-color: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    color: #b45309;
}
.alert-info {
    background-color: var(--color-info-bg);
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

/* ==============================================================================
   Cards, Badges, Buttons & Forms
   ============================================================================== */
.card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
}
.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-secondary { background: var(--color-surface-elevated); color: var(--color-text-secondary); }

/* ==============================================================================
   2026 Modern Button System (Universal Reset & High-End Visuals)
   ============================================================================== */
button,
.btn,
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-danger,
.btn-sm,
input[type="button"],
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none !important;
    white-space: nowrap;
    user-select: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

button:focus-visible,
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
}

button:disabled,
.btn:disabled,
.btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Primary Button — 2026 Polished Blue with Layered Depth */
.btn-primary,
button.btn-primary,
input[type="submit"] {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    border: 1px solid #1d4ed8;
    color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover:not(:disabled),
button.btn-primary:hover:not(:disabled),
input[type="submit"]:hover:not(:disabled) {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1e40af;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.btn-primary:active:not(:disabled),
button.btn-primary:active:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

/* Secondary Button — Crisp Elevated White / Light Grey */
.btn-secondary,
button.btn-secondary {
    background: #ffffff;
    color: #1e293b !important;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover:not(:disabled),
button.btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
    background: #f1f5f9;
    transform: translateY(0);
}

/* Outline Button — Sleek Bordered Style with Blue Accent Hover */
.btn-outline,
button.btn-outline {
    background: #ffffff;
    color: #334155 !important;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-outline:hover:not(:disabled),
button.btn-outline:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #2563eb;
    color: #2563eb !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.btn-outline:active:not(:disabled) {
    background: #eff6ff;
    transform: translateY(0);
}

/* Danger Button — Vivid Coral / Crimson */
.btn-danger,
button.btn-danger {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    border: 1px solid #b91c1c;
    color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

.btn-danger:hover:not(:disabled),
button.btn-danger:hover:not(:disabled) {
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
    border-color: #991b1b;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
    transform: translateY(-1px);
    color: #ffffff !important;
}

/* Success Button */
.btn-success,
button.btn-success {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    border: 1px solid #047857;
    color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(180deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    color: #ffffff !important;
}

/* Button Sizes */
.btn-sm,
button.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 6px;
    gap: 0.35rem;
}

.btn-lg,
button.btn-lg {
    padding: 0.75rem 1.6rem;
    font-size: 1rem;
    border-radius: 10px;
}

/* ==============================================================================
   Modals (dashboard.html & popups)
   ============================================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active {
    display: flex;
}
.modal-box {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 90%;
    padding: 2rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.form-group {
    margin-bottom: var(--space-4);
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-1);
}
.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: 0.9rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-help {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table.app-table, table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
table.app-table th, table.data-table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    background-color: var(--color-surface-elevated);
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
}
table.app-table td, table.data-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}
table.app-table tr:hover td, table.data-table tr:hover td {
    background-color: var(--color-surface-elevated);
}

/* Placeholder Panel for Stubs */
.placeholder-panel {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    background-color: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    margin: var(--space-6) 0;
}
.placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
    color: var(--color-primary);
}
.placeholder-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}
.placeholder-subtitle {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    max-width: 520px;
    margin: 0 auto var(--space-6);
}

/* ===== Auth & onboarding forms ===== */
.auth-wrap { max-width: 480px; margin: 2rem auto; padding: 0 1rem; }
.auth-wrap.wide { max-width: 560px; }
.auth-card { background: var(--color-surface, #fff); border: 1px solid var(--color-border); border-radius: 16px; padding: 2rem; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06); }
.auth-card h1 { font-size: 1.5rem; font-weight: 800; margin: 0 0 .25rem; letter-spacing: -.02em; }
.auth-sub { color: var(--color-text-secondary); font-size: .92rem; margin: 0 0 1.5rem; }
.af-field { margin-bottom: 1rem; }
.af-field[hidden] { display: none; }
.af-field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .3rem; color: var(--color-text); }
.af-field input[type=text], .af-field input[type=email], .af-field input[type=password], .af-field input[type=tel], .af-field select { width: 100%; box-sizing: border-box; padding: .65rem .8rem; border: 1px solid var(--color-border); border-radius: 10px; font: inherit; background: #fff; color: var(--color-text); }
.af-field input:focus, .af-field select:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; border-color: var(--color-primary); }
.af-field input.is-invalid, .af-field select.is-invalid { border-color: var(--color-danger); }
.af-field input:disabled { background: var(--color-surface-elevated, #f1f5f9); color: var(--color-text-muted); }
.af-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.af-error { color: var(--color-danger); font-size: .8rem; margin: .3rem 0 0; min-height: 0; }
.af-error[hidden] { display: none; }
.af-form-error { background: var(--color-danger-bg); color: var(--color-danger); border-radius: 10px; padding: .65rem .85rem; font-size: .88rem; margin-bottom: 1rem; }
.af-form-error[hidden] { display: none; }
.af-hint { color: var(--color-text-muted); font-size: .78rem; margin: .3rem 0 0; }
.af-hint[data-level="0"], .af-hint[data-level="1"] { color: var(--color-danger); }
.af-hint[data-level="2"] { color: var(--color-warning); }
.af-hint[data-level="3"], .af-hint[data-level="4"], .af-hint[data-level="5"] { color: var(--color-success); }
.af-pw { position: relative; }
.af-pw input { padding-right: 4.5rem; }
.af-pw button { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--color-primary); font-weight: 600; font-size: .82rem; cursor: pointer; padding: .3rem .5rem; border-radius: 6px; }
.af-check { display: flex; gap: .5rem; align-items: center; font-size: .88rem; margin-bottom: 1rem; }
.af-check input { width: 1rem; height: 1rem; }
.af-link-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
.af-link-pill { display: inline-block; padding: .35rem .75rem; border-radius: 999px; background: var(--color-surface-elevated, #f1f5f9); color: var(--color-primary); font-weight: 600; font-size: .82rem; text-decoration: none; }
.af-divider { display: flex; align-items: center; gap: .75rem; color: var(--color-text-muted); font-size: .8rem; margin: 1.25rem 0; }
.af-divider::before, .af-divider::after { content: ""; flex: 1; border-top: 1px solid var(--color-border); }
.af-legal { font-size: .78rem; color: var(--color-text-muted); text-align: center; margin: .9rem 0 0; }
.af-foot { text-align: center; font-size: .88rem; margin-top: 1.25rem; color: var(--color-text-secondary); }
.af-foot a, .af-legal a { color: var(--color-primary); font-weight: 600; }
.af-badge { display: inline-block; background: var(--color-success-bg); color: var(--color-success); border-radius: 999px; font-size: .72rem; font-weight: 700; padding: .15rem .55rem; margin-left: .4rem; }
.af-pin { letter-spacing: .5em; text-align: center; font-size: 1.6rem; font-weight: 700; }
.af-resend { text-align: center; margin-top: 1rem; font-size: .85rem; color: var(--color-text-secondary); }
.af-resend button { background: none; border: 0; color: var(--color-primary); font-weight: 600; cursor: pointer; font: inherit; }
.af-resend button:disabled { color: var(--color-text-muted); cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }
.btn-github { background: #24292f; color: #fff; border: 1px solid #24292f; display: flex; align-items: center; justify-content: center; gap: .6rem; }
.btn-github:hover { background: #1b1f23; color: #fff; }
@media (max-width: 480px) { .auth-card { padding: 1.4rem 1.1rem; border-radius: 12px; } .af-row { grid-template-columns: 1fr; } }
