/* SEC EDGAR Financials - Clean Theme */

/* Screen reader only - hidden visually but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root {
    --color-primary: #0066cc;
    --color-primary-dark: #004d99;
    --color-secondary: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #17a2b8;
    
    --color-bg: #f8f9fa;
    --color-bg-card: #ffffff;
    --color-border: #dee2e6;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-text-light: #868e96;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    
    --radius: 6px;
    --radius-lg: 12px;
    
    --font-mono: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo:hover {
    text-decoration: none;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.logo-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav a {
    color: var(--color-text-muted);
    font-size: 14px;
    padding: 6px 0;
}

.nav a:hover,
.nav a.active {
    color: var(--color-primary);
    text-decoration: none;
}

/* Search */
.search-container {
    flex: 1;
    max-width: 320px;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 14px;
    background: var(--color-bg);
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-bg-card);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--color-bg);
}

.search-result-ticker {
    font-weight: 600;
    color: var(--color-primary);
}

.search-result-name {
    color: var(--color-text);
    margin-left: 10px;
}

.search-result-exchange {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Main Content */
.main {
    padding: 24px 0;
}

/* Cards */
.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--color-bg);
}

tr:hover td {
    background: rgba(0, 102, 204, 0.02);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Filing Links */
.filing-link {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    font-size: 11px;
    text-decoration: none;
    background: var(--color-primary);
    color: white;
    border-radius: 3px;
    vertical-align: middle;
    transition: background 0.15s ease, transform 0.1s ease;
}

.filing-link:hover {
    background: var(--color-primary-dark);
    text-decoration: none;
    transform: translateY(-1px);
}

th .filing-link {
    font-weight: 500;
}

/* Numbers */
.number {
    font-family: var(--font-mono);
    font-size: 13px;
}

.number-positive {
    color: var(--color-secondary);
}

.number-negative {
    color: var(--color-danger);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    text-decoration: none;
}

.btn-secondary {
    background: var(--color-bg);
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover {
    background: var(--color-border);
    text-decoration: none;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    text-transform: uppercase;
}

.badge-primary {
    background: rgba(0, 102, 204, 0.1);
    color: var(--color-primary);
}

.badge-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--color-secondary);
}

.badge-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
}

.badge-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--color-danger);
}

.badge-muted {
    background: var(--color-bg);
    color: var(--color-text-muted);
}

/* Company Header */
.company-header {
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    padding: 24px 0;
}

.company-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.company-ticker {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
}

.company-name {
    font-size: 18px;
    color: var(--color-text-muted);
}

.company-meta {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.company-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.metric-card {
    padding: 16px;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.metric-label {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 20px;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Company Profile Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.info-item {
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.info-label {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.info-value {
    font-size: 14px;
    color: var(--color-text);
}

.card-body.collapsed {
    display: none;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    font-size: 14px;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--color-text);
}

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236c757d' 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;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
}

.pagination a:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.pagination .active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--color-text-muted);
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 8px;
    color: var(--color-text);
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        gap: 8px 12px;
        align-items: center;
    }

    .logo {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
        font-size: 16px;
        white-space: nowrap;
    }

    .logo-image {
        width: 28px;
        height: 28px;
    }

    .user-nav {
        order: 1;
        margin-left: 0;
        flex: 0 0 auto;
        gap: 8px;
    }

    .user-nav .btn {
        padding: 6px 10px;
        white-space: nowrap;
    }

    .nav {
        order: 2;
        flex: 1 0 100%;
        gap: 14px;
        overflow-x: auto;
        padding: 2px 0 0;
        scrollbar-width: none;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .nav a {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    
    .search-container {
        order: 3;
        flex: 1 0 100%;
        max-width: 100%;
        width: 100%;
        margin-top: 2px;
    }

    .search-box input {
        min-height: 42px;
        font-size: 16px;
    }

    .search-results {
        max-height: 60vh;
    }
    
    .company-title {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .company-meta {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    th, td {
        padding: 10px 12px;
    }
}

@media (max-width: 420px) {
    .container {
        padding: 0 12px;
    }

    .header {
        padding: 8px 0;
    }

    .logo {
        font-size: 15px;
    }

    .user-nav {
        gap: 6px;
    }

    .user-nav .btn {
        padding: 6px 8px;
        font-size: 12px;
    }
}

/* Utilities */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-secondary); }
.text-warning { color: #e6a700; }
.text-danger { color: var(--color-danger); }

/* Derived label for calculated/computed fields */
.derived-label {
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: normal;
}

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* Compare Bucket Widget */
.compare-bucket-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 280px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
}

.bucket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-primary);
    color: white;
}

.bucket-title {
    font-weight: 600;
    font-size: 14px;
}

.bucket-header-buttons {
    display: flex;
    gap: 4px;
}

.bucket-minimize,
.bucket-clear {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}

.bucket-minimize:hover,
.bucket-clear:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

.compare-bucket-widget.minimized {
    width: auto;
    min-width: 180px;
}

.bucket-items {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}

.bucket-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--color-bg);
    border-radius: var(--radius);
    margin-bottom: 4px;
}

.bucket-item:last-child {
    margin-bottom: 0;
}

.bucket-ticker {
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}

.bucket-ticker:hover {
    text-decoration: underline;
}

.bucket-remove {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.15s;
}

.bucket-remove:hover {
    background: var(--color-danger);
    color: white;
}

.bucket-compare-btn {
    display: block;
    margin: 12px;
    text-align: center;
}

/* Add to bucket button styles */
.btn-add-bucket {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    padding: 4px 10px;
    font-size: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-add-bucket:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.btn-add-bucket.in-bucket {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: white;
}

.btn-add-bucket.in-bucket:hover {
    background: var(--color-danger);
    border-color: var(--color-danger);
}

/* User Navigation */
.user-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
}

.user-email {
    font-size: 13px;
    color: var(--color-text-muted);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text-muted);
}

.user-badge.admin {
    background: var(--color-primary);
    color: white;
}

.user-badge.paid {
    background: var(--color-secondary);
    color: white;
}

.btn-text {
    background: transparent;
    color: var(--color-text-muted);
}

.btn-text:hover {
    color: var(--color-text);
    text-decoration: none;
}

/* Auth Forms */
.auth-container {
    max-width: 400px;
    margin: 60px auto;
}

.auth-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow);
}

.auth-title {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin: 0 0 8px 0;
}

.auth-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin: 0 0 30px 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 500;
    font-size: 13px;
    color: var(--color-text);
}

.form-group input {
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-group input.error {
    border-color: var(--color-danger);
}

.form-error {
    font-size: 12px;
    color: var(--color-danger);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-checkbox input {
    width: 16px;
    height: 16px;
}

.form-checkbox label {
    font-weight: normal;
    font-size: 14px;
}

.auth-submit {
    margin-top: 10px;
}

.auth-submit .btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.auth-links a {
    color: var(--color-primary);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.auth-divider span {
    color: var(--color-text-muted);
    font-size: 13px;
}

/* Alert Messages */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Admin Tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.admin-table th {
    background: var(--color-bg);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--color-bg);
}

.admin-actions {
    display: flex;
    gap: 8px;
}

.admin-actions .btn {
    padding: 4px 10px;
    font-size: 12px;
}

/* Profile Page */
.profile-section {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.profile-section h2 {
    font-size: 18px;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.profile-info {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
}

.profile-label {
    font-weight: 500;
    color: var(--color-text-muted);
}

.profile-value {
    color: var(--color-text);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(-20px);
    transition: transform 0.2s;
}

.modal-backdrop.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text);
    transition: all 0.15s;
}

.user-dropdown-toggle:hover {
    background: var(--color-bg);
    border-color: var(--color-text-muted);
}

.user-dropdown-toggle .user-email {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown-toggle svg {
    color: var(--color-text-muted);
    transition: transform 0.15s;
}

.user-dropdown-menu.active + .user-dropdown-toggle svg,
.user-dropdown:has(.user-dropdown-menu.active) .user-dropdown-toggle svg {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.15s;
    z-index: 200;
}

.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-section {
    padding: 8px;
}

.dropdown-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-muted);
    padding: 4px 10px;
    margin-bottom: 4px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: var(--color-text);
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.1s;
}

.dropdown-item:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.dropdown-item span {
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.dropdown-item-danger {
    color: var(--color-danger);
}

.dropdown-item-danger:hover {
    background: #fee2e2;
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 0;
}

/* Feedback Button */
.feedback-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 16px;
    border-radius: var(--radius);
    background: #4b5563;
    border: 1px solid #6b7280;
    color: #f3f4f6;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 999;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
}

.feedback-btn:hover {
    background: #374151;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    color: #fff;
}

.feedback-btn:active {
    transform: translateY(0);
}

.feedback-btn svg {
    flex-shrink: 0;
}

/* Feedback Form Styles */
.feedback-form .form-group {
    margin-bottom: 16px;
}

.feedback-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--color-text);
}

.feedback-form .form-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.feedback-form .readonly-field {
    background: var(--color-bg);
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.feedback-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}

.feedback-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Radio Button Group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

.radio-option:hover {
    background: var(--color-bg-card);
    border-color: var(--color-primary);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-option.selected {
    background: rgba(0, 102, 204, 0.08);
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 500;
}

.radio-option span {
    font-size: 14px;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: var(--color-secondary);
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--color-danger);
}

/* Notification Badge */
.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    background: var(--color-danger);
    color: white;
    border-radius: 9px;
    margin-left: 6px;
}

/* Admin Feedback Table */
.feedback-row {
    cursor: pointer;
    transition: background 0.15s;
}

.feedback-row:hover {
    background: var(--color-bg);
}

.feedback-row.unread {
    font-weight: 500;
}

.feedback-row.unread td:first-child::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
    margin-right: 8px;
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 10px;
    text-transform: uppercase;
}

.status-badge.unread {
    background: rgba(0, 102, 204, 0.1);
    color: var(--color-primary);
}

.status-badge.read {
    background: rgba(40, 167, 69, 0.1);
    color: var(--color-secondary);
}

.status-badge.archived {
    background: rgba(108, 117, 125, 0.1);
    color: var(--color-text-muted);
}

/* Button Variants */
.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    text-decoration: none;
}

/* CFS Cash Warning Indicator */
.cash-warning-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--color-warning);
    border-radius: 50%;
    cursor: help;
    position: relative;
}

.cash-warning-indicator::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #f9fafb;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    white-space: pre-line;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
    z-index: 100;
    margin-bottom: 6px;
    font-family: var(--font-mono);
}

.cash-warning-indicator:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Blog
   ========================================================================== */

/* --- Blog Hero --- */

.blog-hero {
    position: relative;
    background: linear-gradient(160deg, #002244 0%, #004d99 50%, #0066cc 100%);
    color: #fff;
    padding: 6rem 0 3rem;
    overflow: hidden;
}

.blog-hero__pattern {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.03) 0%, transparent 40%);
    pointer-events: none;
}

.blog-hero__content {
    position: relative;
    max-width: 640px;
    z-index: 1;
}

.blog-hero__divider {
    width: 48px;
    height: 3px;
    margin-bottom: 1.5rem;
    background: linear-gradient(90deg, #28a745, #5dd685);
    border-radius: 2px;
}

.blog-hero__content h1 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 2.75rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
}

.blog-hero__content p {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.6;
}

.blog-separator {
    border-bottom: 1px solid var(--color-border);
}

/* --- Blog Listing --- */

.blog-listing {
    padding: 3rem 0 5rem;
}

.blog-listing__empty {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 1.125rem;
    padding: 3rem 0;
}

.blog-listing__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
}

/* --- Blog Card --- */

.blog-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    background: var(--color-bg-card);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 102, 204, 0.1);
    text-decoration: none;
}

.blog-card__image {
    aspect-ratio: 1200 / 630;
    overflow: hidden;
    background: var(--color-bg);
}

.blog-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.blog-card:hover .blog-card__image img {
    transform: scale(1.03);
}

.blog-card__body {
    padding: 1.25rem 1.5rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card__meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--color-text-light);
    margin-bottom: 0.75rem;
}

.blog-card__dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-text-light);
    flex-shrink: 0;
}

.blog-card__title {
    margin-bottom: 0.75rem;
}

.blog-card__title a {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    line-height: 1.35;
    text-decoration: none;
    transition: color 0.2s;
}

.blog-card__title a:hover {
    color: var(--color-secondary);
    text-decoration: none;
}

.blog-card__excerpt {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 1.25rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.blog-card__author {
    font-size: 0.875rem;
    color: var(--color-text);
    font-weight: 500;
}

.blog-card__read {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.blog-card__read span {
    display: inline-block;
    transition: transform 0.2s;
}

.blog-card:hover .blog-card__read {
    color: #1e7e34;
}

.blog-card:hover .blog-card__read span {
    transform: translateX(2px);
}

/* --- Blog Article --- */

body.blog-post-page .main .container { max-width: 100%; padding: 0; }

.blog-article {
    padding: 2rem 0 3rem;
}

.blog-article__inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1rem;
}

.blog-article__hero {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.06);
    margin-bottom: 2rem;
}

.blog-article__title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    line-height: 1.25;
    margin-bottom: 1rem;
}

.blog-article__byline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 2.5rem;
}

.blog-article__byline a {
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
}

.blog-article__byline a:hover {
    color: var(--color-secondary);
}

/* --- Blog Prose (article body) --- */

.blog-prose {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.1875rem;
    line-height: 1.75;
    color: #333;
}

.blog-prose h2 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.625rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.blog-prose h3 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    line-height: 1.35;
}

.blog-prose p {
    margin-bottom: 1rem;
}

.blog-prose a {
    color: var(--color-secondary);
    text-decoration: underline;
    text-decoration-color: rgba(40,167,69,0.3);
    text-underline-offset: 2px;
}

.blog-prose a:hover {
    color: #1e7e34;
    text-decoration-color: var(--color-secondary);
}

.blog-prose strong {
    font-weight: 600;
    color: #1e293b;
}

.blog-prose ul, .blog-prose ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.blog-prose li {
    margin-bottom: 0.5rem;
}

.blog-prose ol { list-style: decimal; }
.blog-prose ul { list-style: disc; }

.blog-prose code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: #f0f7ff;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: var(--color-primary);
}

.blog-prose pre {
    position: relative;
    background: #0d1117;
    padding: 2.5rem 1.5rem 1.25rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.blog-prose pre code {
    background: none;
    padding: 0;
    color: #e2e8f0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.blog-prose pre code.has-line-numbers {
    display: block;
    counter-reset: blog-line;
    padding-left: 3.25rem;
    white-space: normal;
}

.blog-prose pre code.has-line-numbers .code-line {
    display: block;
    position: relative;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-height: 1.4em;
}

.blog-prose pre code.has-line-numbers .code-line::before {
    counter-increment: blog-line;
    content: counter(blog-line);
    position: absolute;
    left: -3.25rem;
    width: 2.5rem;
    text-align: right;
    color: #6b7280;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.blog-prose pre .copy-code-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.75rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.blog-prose pre:hover .copy-code-btn,
.blog-prose pre .copy-code-btn:focus {
    opacity: 1;
}

.blog-prose pre .copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.blog-prose pre .copy-code-btn.copied {
    opacity: 1;
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.4);
}

.blog-prose pre .copy-code-btn svg {
    width: 14px;
    height: 14px;
}

.blog-prose pre code.hljs {
    background: transparent;
    padding: 0;
    color: #f8f8f2;
}

.blog-prose table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9375rem;
}

.blog-prose thead { background: #f0f7ff; }

.blog-prose th {
    font-weight: 600;
    color: var(--color-primary-dark);
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--color-border);
}

.blog-prose td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

@media (max-width: 640px) {
    .blog-prose table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
}

.blog-prose td code { font-size: 0.8rem; }

.blog-prose figure {
    margin: 1.5rem 0;
}

.blog-prose figure img {
    width: 100%;
    border-radius: var(--radius-lg);
    cursor: zoom-in;
}

.blog-prose figcaption {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--color-text-light);
    margin-top: 0.5rem;
    font-style: italic;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.blog-prose dfn {
    font-style: normal;
    font-weight: 600;
    color: var(--color-primary-dark);
    border-bottom: 1px dotted var(--color-primary);
}

/* --- Definition Block (AEO) --- */

.blog-dfn-block {
    background: #f0f7ff;
    border-left: 4px solid var(--color-primary);
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
    line-height: 1.65;
}

.blog-dfn-block dt {
    font-weight: 600;
    color: var(--color-primary-dark);
    margin-top: 0.5rem;
}

.blog-dfn-block dt:first-child { margin-top: 0; }

.blog-dfn-block dd {
    margin: 0.25rem 0 0 0;
    color: var(--color-text-muted);
}

/* --- Inline CTA --- */

.blog-inline-cta {
    background: #f0f7ff;
    border-left: 4px solid var(--color-primary);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 1.25rem 0;
    font-style: italic;
    color: var(--color-text-muted);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
}

/* --- Blog FAQ --- */

.blog-faq {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.blog-faq h2 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin-bottom: 1.5rem;
}

.blog-faq h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.blog-faq p {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #333;
    margin: 0 0 1rem;
}

.blog-faq code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: #f0f7ff;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: var(--color-primary);
}

/* --- Blog CTA --- */

.blog-cta {
    max-width: 720px;
    margin: 2.5rem auto 0;
    padding: 2rem 2.5rem;
    background: linear-gradient(135deg, #f0fdf4, #f0f7ff);
    border-radius: var(--radius-lg);
    text-align: center;
}

.blog-cta h3 {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin: 0 0 0.75rem;
}

.blog-cta p {
    font-size: 1rem;
    color: var(--color-text-muted);
    max-width: 520px;
    margin: 0 auto 1.25rem;
    line-height: 1.5;
}

.blog-cta__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.blog-cta__note {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin: 0.75rem 0 0;
}

/* --- Blog Lightbox --- */

.blog-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.blog-lightbox.active {
    display: flex;
}

.blog-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 16, 32, 0.85);
    cursor: pointer;
}

.blog-lightbox__content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.blog-lightbox__img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.blog-lightbox__close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
}

.blog-lightbox__close:hover {
    opacity: 1;
}

/* --- Blog Responsive --- */

@media (max-width: 768px) {
    .blog-listing__grid {
        grid-template-columns: 1fr;
    }
    .blog-hero__content h1 {
        font-size: 2.25rem;
    }
    .blog-hero {
        padding: 4rem 0 2rem;
    }
    .blog-article__title {
        font-size: 1.75rem;
    }
    .blog-cta {
        padding: 1.5rem;
    }
}
