* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f8f9fa;
    color: #1a1a1a;
    line-height: 1.5;
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 0 24px 24px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
}

.sidebar-logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}

.sidebar-logo p {
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
}

.sidebar-nav {
    padding: 0 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #4b5563;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-item:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.nav-item.active {
    background: #1a1a1a;
    color: #fff;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.nav-item.active svg {
    opacity: 1;
}

.nav-item.admin-link {
    margin-top: 16px;
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
    color: #e94560;
}

.nav-item.admin-link:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* Main Content */
.main {
    flex: 1;
    margin-left: 240px;
    padding: 32px 40px;
    max-width: 1400px;
}

/* Page Header */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.page-header p {
    color: #6b7280;
    font-size: 15px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px 24px;
}

.stat-card .label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
}

.stat-card .value.hot {
    color: #ef4444;
}

.stat-card .value.warm {
    color: #f59e0b;
}

.stat-card .value.cold {
    color: #3b82f6;
}

/* Cards */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Forms */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    flex: 1;
}

.form-group.small {
    flex: 0 0 140px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #1a1a1a;
    background: #fff;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1a1a1a;
}

.form-group input::placeholder {
    color: #9ca3af;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1a1a1a;
}

.checkbox-group label {
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: #1a1a1a;
    color: #fff;
    width: 100%;
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    background: #fff;
    color: #374151;
    border-color: #e5e7eb;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-danger {
    background: #fff;
    color: #ef4444;
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fef2f2;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

td {
    padding: 16px;
    font-size: 14px;
    color: #1a1a1a;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

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

tr:hover {
    background: #f9fafb;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
}

.badge-hot {
    background: #fef2f2;
    color: #dc2626;
}

.badge-warm {
    background: #fffbeb;
    color: #d97706;
}

.badge-cold {
    background: #eff6ff;
    color: #2563eb;
}

/* Links */
a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Company info in table */
.company-name {
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.company-address {
    font-size: 13px;
    color: #6b7280;
}

/* Rating display */
.rating {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.rating-score {
    font-weight: 500;
}

.rating-count {
    font-size: 13px;
    color: #6b7280;
}

/* Problems list */
.problems {
    font-size: 13px;
    color: #6b7280;
    max-width: 200px;
}

/* Phone */
.phone {
    font-size: 13px;
    white-space: nowrap;
}

/* Socials */
.socials {
    font-size: 13px;
}

.social-link {
    display: inline-block;
    padding: 2px 8px;
    background: #f3f4f6;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
    text-decoration: none;
    margin: 2px;
}

.social-link:hover {
    background: #e5e7eb;
    text-decoration: none;
}

/* Actions */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* How it works section */
.how-it-works {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 16px;
}

.step {
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

.step-number {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.step-title {
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.step-desc {
    font-size: 14px;
    color: #6b7280;
}

/* Categories section */
.categories {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 16px;
}

.category-item {
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

.category-badge {
    margin-bottom: 12px;
}

.category-desc {
    font-size: 14px;
    color: #6b7280;
}

/* Progress bar */
.progress-bar {
    display: flex;
    height: 24px;
    border-radius: 6px;
    overflow: hidden;
    background: #e5e7eb;
}

.progress-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

.progress-hot {
    background: #ef4444;
}

.progress-warm {
    background: #f59e0b;
}

.progress-cold {
    background: #3b82f6;
}

/* Distribution legend */
.distribution-legend {
    margin-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-hot { background: #ef4444; }
.legend-warm { background: #f59e0b; }
.legend-cold { background: #3b82f6; }

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 16px;
}

.back-link:hover {
    color: #1a1a1a;
    text-decoration: none;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state h3 {
    font-size: 16px;
    color: #374151;
    margin-bottom: 8px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

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

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.auth-header p {
    color: #6b7280;
    font-size: 15px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.auth-footer p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}

.auth-footer a {
    color: #1a1a1a;
    font-weight: 500;
}

.trial-info {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    margin-bottom: 24px;
}

.trial-badge {
    display: inline-block;
    background: #22c55e;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.trial-info p {
    font-size: 13px;
    color: #16a34a;
    margin: 0;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.btn-full {
    width: 100%;
}

/* User Info in Sidebar */
.sidebar-user {
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.user-profile-link {
    flex: 1;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-profile-link:hover {
    background: #f3f4f6;
}

.user-email {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.user-tokens {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.logout-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.logout-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .how-it-works,
    .categories {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main {
        margin-left: 0;
        padding: 20px;
    }

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

    .form-row {
        flex-direction: column;
    }

    .form-group.small {
        flex: 1;
    }
}

/* ============================================================
   PROFILE PAGE
   ============================================================ */

.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.profile-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.profile-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.profile-card .card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.profile-card .card-body {
    padding: 24px;
}

.profile-field {
    margin-bottom: 20px;
}

.profile-field:last-child {
    margin-bottom: 0;
}

.profile-field label {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
}

.profile-field .field-value {
    font-size: 15px;
    color: #1a1a1a;
}

.profile-field .field-value.editable {
    display: flex;
    gap: 12px;
}

.profile-field .field-value.editable input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.profile-field .field-value.editable input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.btn-save {
    padding: 10px 20px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save:hover {
    background: #333;
}

/* Plan Badge */
.plan-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.plan-badge.trial {
    background: #fef3c7;
    color: #b45309;
}

.plan-badge.paid {
    background: #d1fae5;
    color: #065f46;
}

.plan-badge.unlimited {
    background: #dbeafe;
    color: #1d4ed8;
}

/* Tokens Display */
.tokens-display {
    text-align: center;
    padding: 24px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 24px;
}

.tokens-value {
    font-size: 48px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1;
}

.tokens-label {
    font-size: 14px;
    color: #6b7280;
    margin-top: 8px;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-badge.trial {
    background: #fef3c7;
    color: #b45309;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

/* Profile Form */
.profile-card .form-group {
    margin-bottom: 16px;
}

.profile-card .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.profile-card .form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.profile-card .form-group input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.profile-card .btn-primary {
    width: 100%;
    padding: 12px 24px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.profile-card .btn-primary:hover {
    background: #333;
}

/* Usage Info */
.usage-info {
    background: #f9fafb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.usage-info p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 8px 0;
}

.usage-info p:last-child {
    margin-bottom: 0;
}

/* Subtitle */
.subtitle {
    color: #6b7280;
    font-size: 15px;
    margin-top: 8px;
}

/* Profile Page Responsive */
@media (max-width: 900px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}
