/* ============================================
   AutoBooky — Fresh Design
   ============================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.6; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; border: none; background: none; }
input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

/* --- Theme Variables --- */
:root, [data-theme="light"] {
    --bg: #f4f6fa;
    --bg-card: #fafbfd;
    --bg-input: #eef2f8;
    --bg-hover: #e4eaf3;
    --text: #0f1520;
    --text-muted: #3d4a60;
    --text-subtle: #7b8ca0;
    --border: #c2cee0;
    --border-focus: #3b82f6;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;
    --accent-text: #ffffff;
    --success: #059669;
    --success-light: #d1fae5;
    --error: #dc2626;
    --error-light: #fee2e2;
    --warning: #d97706;
    --shadow-sm: 0 1px 3px rgba(25,40,80,0.08),
                 0 0 0 1px rgba(25,40,80,0.04);
    --shadow: 0 1px 3px rgba(25,40,80,0.10),
              0 1px 2px rgba(25,40,80,0.06),
              0 0 0 1px rgba(25,40,80,0.04);
    --shadow-md: 0 4px 16px rgba(25,40,80,0.10),
                 0 1px 4px rgba(25,40,80,0.06),
                 0 0 0 1px rgba(25,40,80,0.04);
    --shadow-lg: 0 12px 40px rgba(25,40,80,0.12),
                 0 2px 8px rgba(25,40,80,0.06),
                 0 0 0 1px rgba(25,40,80,0.04);
    --toggle-off: #b8c4d6;
    --toggle-on: #22c55e;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --bg-card: #181b22;
    --bg-input: #1e222b;
    --bg-hover: #252a35;
    --text: #e8eaf0;
    --text-muted: #8b95a8;
    --text-subtle: #5a6478;
    --border: #282e3a;
    --border-focus: #6a9fd4;
    --accent: #6a9fd4;
    --accent-hover: #5a8ebd;
    --accent-light: #1a2a3a;
    --accent-text: #ffffff;
    --success: #34d399;
    --success-light: #0d3324;
    --error: #f87171;
    --error-light: #3b1111;
    --warning: #fbbf24;
    --toggle-off: #3d4a5c;
    --toggle-on: #4ade80;
    --shadow-sm: 0 0 0 1px rgba(100,140,210,0.08);
    --shadow: 0 1px 3px rgba(0,0,0,0.4),
              0 0 0 1px rgba(100,140,210,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.4),
                 0 0 0 1px rgba(100,140,210,0.06);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5),
                 0 0 0 1px rgba(100,140,210,0.06);
}

body {
    background: var(--bg);
    color: var(--text);
}

/* --- Layout --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Header --- */
.site-header, .dashboard-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
[data-theme="light"] .site-header,
[data-theme="light"] .dashboard-header {
    box-shadow: 0 1px 3px rgba(25,40,80,0.06);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}
.logo-img {
    width: 28px;
    height: 28px;
}
.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: color 0.15s;
}
.nav-link:hover { color: var(--text); }
.user-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.nav-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 0.25rem;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}
.nav-icon-link:hover { color: var(--accent); background: var(--bg-hover); }
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 0.375rem;
    border-radius: var(--radius);
    transition: background 0.15s;
}
.nav-hamburger:hover { background: var(--bg-hover); }

/* --- Mobile Menu Drawer --- */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 85vw);
    height: 100vh;
    height: 100dvh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 200;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 199;
}
.mobile-menu-backdrop.open { display: block; }
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.375rem;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}
.nav-close:hover { color: var(--text); background: var(--bg-hover); }
.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 1rem;
    color: var(--text);
    transition: background 0.15s, color 0.15s;
}
.mobile-nav-link:hover { background: var(--bg-hover); color: var(--accent); }
.mobile-menu-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.mobile-menu-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.user-email-mobile {
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: 4rem;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.footer-nav { display: flex; gap: 1.5rem; }
.footer-nav a:hover { color: var(--text); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.15s;
}
.btn-primary {
    background: var(--accent);
    color: var(--accent-text);
}
.btn-primary:hover { background: var(--accent-hover); }
[data-theme="light"] .btn-primary {
    box-shadow: 0 1px 3px rgba(37,99,235,0.3),
                0 0 0 1px rgba(37,99,235,0.08);
}
[data-theme="light"] .btn-primary:hover {
    box-shadow: 0 2px 6px rgba(37,99,235,0.35),
                0 0 0 1px rgba(37,99,235,0.10);
}
.btn-outline {
    border: 1px solid var(--border);
    color: var(--text);
    background: transparent;
}
.btn-outline:hover { background: var(--bg-hover); }
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: all 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger {
    background: var(--error);
    color: #fff;
}
.btn-danger:hover { opacity: 0.9; }
.btn-ghost {
    color: var(--text-muted);
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
[data-theme="light"] .card {
    box-shadow: var(--shadow);
}
.card-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1rem;
}
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}
.form-input, .form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.875rem;
    transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.form-input::placeholder { color: var(--text-subtle); }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-error {
    font-size: 0.75rem;
    color: var(--error);
    margin-top: 0.25rem;
}

/* --- Alerts --- */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success);
}
.alert-error {
    background: var(--error-light);
    color: var(--error);
    border: 1px solid var(--error);
}

/* --- Landing Page --- */
.hero {
    text-align: center;
    padding: 5rem 1.5rem 3rem;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%);
    opacity: 0.7;
    pointer-events: none;
}
[data-theme="dark"] .hero::before {
    opacity: 0.5;
}
.hero .container { position: relative; }
.hero-badge {
    display: inline-block;
    padding: 0.375rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius-full);
    margin-bottom: 1.5rem;
    letter-spacing: 0.01em;
}
.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
[data-theme="dark"] .hero-title {
    background: linear-gradient(135deg, #2c5f8a, #6a9fd4);
    -webkit-background-clip: text;
    background-clip: text;
}
.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 540px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}
.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Section Titles --- */
.section-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

/* --- Stats Section --- */
.stats-section {
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--border);
}
.stats-grid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}
.stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--accent);
}
.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}
.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

/* --- How It Works --- */
.how-it-works {
    padding: 4rem 0;
}
.steps-grid {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
}
.step-card {
    flex: 1;
    max-width: 280px;
    text-align: center;
    padding: 1.5rem;
}
.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}
.step-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.step-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
}
.step-connector {
    display: flex;
    align-items: center;
    padding-top: 2rem;
    color: var(--border);
}

/* --- Features --- */
.features {
    padding: 4rem 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
[data-theme="light"] .features {
    background: linear-gradient(180deg, #eaf0f8 0%, #f4f6fa 100%);
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.feature-card {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s;
}
.feature-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}
.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}
.feature-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* --- CTA Section --- */
.cta-section {
    padding: 4rem 0;
}
.cta-card {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, var(--accent-light), transparent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
}
[data-theme="light"] .cta-card {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 50%, #fafbfd 100%);
    box-shadow: var(--shadow-md);
}
.cta-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.cta-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* --- Email Signup --- */
.signup-section {
    text-align: center;
    padding: 3rem 0 4rem;
}
.signup-form {
    display: flex;
    gap: 0.75rem;
    max-width: 420px;
    margin: 1rem auto 0;
}
.signup-form .form-input {
    flex: 1;
}

/* --- Dashboard --- */
.dashboard-main {
    padding: 2rem 0;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.welcome-card {
    animation: fadeOut 0.5s ease 5s forwards;
}
@keyframes fadeOut {
    to { opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; border: 0; }
}

/* --- Registration Steps --- */
.register-container {
    max-width: 640px;
    margin: 2rem auto;
}
.steps-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.step-dot {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.3s;
}
.step-dot.active { background: var(--accent); }
.step-dot.done { background: var(--success); }

/* --- Business Hours Table --- */
.hours-table {
    width: 100%;
    border-collapse: collapse;
}
.hours-table th, .hours-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.hours-table th {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* --- Services List --- */
.service-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}
.service-item .service-name { flex: 1; font-weight: 500; }
.service-item .service-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Booking Widget --- */
.widget-body {
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.widget-container {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.widget-header {
    text-align: center;
    padding: 1.5rem 0 1rem;
}
.widget-header h1 {
    font-size: 1.125rem;
    font-weight: 700;
}
.widget-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.chat-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    line-height: 1.5;
    animation: slideIn 0.2s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-bubble.bot {
    background: var(--bg-card);
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.chat-bubble.user {
    background: var(--accent);
    color: var(--accent-text);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.chat-option-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
}
.chat-option-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* --- Date Picker --- */
.date-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-top: 0.5rem;
}
.date-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}
.date-cell:hover { background: var(--accent-light); color: var(--accent); }
.date-cell.disabled { opacity: 0.3; pointer-events: none; }
.date-cell.today { font-weight: 700; }

/* --- Time Slots --- */
.time-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.time-slot {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}
.time-slot:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* --- Status Badges --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.status-badge.confirmed { background: var(--success-light); color: var(--success); }
.status-badge.failed    { background: var(--error-light);   color: var(--error);   }
.status-badge.abandoned { background: var(--bg-hover);      color: var(--text-muted); }
.status-badge.pending   { background: var(--accent-light);  color: var(--accent);  }

/* --- Messages --- */
.messages-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    height: calc(100vh - 60px - 80px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
}
.messages-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-tab {
    flex: 1;
    padding: 0.625rem;
    font-size: 0.8rem;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s, border-color 0.15s;
}
.sidebar-tab:hover, .sidebar-tab.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}
.conversation-list {
    flex: 1;
    overflow-y: auto;
}
.session-row-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.conversation-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.conversation-item:hover, .conversation-item.active {
    background: var(--bg-hover);
}
.conversation-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}
.conversation-info { flex: 1; min-width: 0; }
.conversation-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conversation-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conversation-time {
    font-size: 0.65rem;
    color: var(--text-subtle);
    flex-shrink: 0;
}
.message-thread {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.thread-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}
.thread-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.message-row {
    display: flex;
}
.message-row.sent { justify-content: flex-end; }
.message-row.received { justify-content: flex-start; }
.message-content {
    max-width: 70%;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
}
.message-row.sent .message-content {
    background: var(--accent);
    color: var(--accent-text);
    border-bottom-right-radius: 4px;
}
.message-row.received .message-content {
    background: var(--bg-input);
    border-bottom-left-radius: 4px;
}
.message-time {
    font-size: 0.65rem;
    color: var(--text-subtle);
    margin-top: 0.125rem;
}
.thread-input {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
}
.thread-input .form-input { flex: 1; }
.thread-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --- Legal Pages --- */
.legal-page {
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}
.legal-page h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}
.legal-page h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}
.legal-page p, .legal-page li {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.7;
}
.legal-page ul { padding-left: 1.5rem; }

/* --- Error Page --- */
.error-page {
    text-align: center;
    padding: 6rem 1.5rem;
}
.error-page h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.error-page p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* --- Toggle Switch --- */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--toggle-off);
    border-radius: var(--radius-full);
    transition: 0.2s;
    cursor: pointer;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--toggle-on); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* --- Utility --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.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; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.hidden { display: none; }
.w-full { width: 100%; }

/* --- HTMX Loading --- */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-block;
}
.htmx-request.htmx-indicator {
    display: inline-block;
}
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Form Builder --- */
.form-field-row {
    display: flex; gap: 0.5rem; align-items: center;
    margin-bottom: 0.5rem; padding: 0.5rem;
    background: var(--bg-hover); border-radius: 6px;
}
.form-field-row input[type="text"],
.form-field-row select {
    padding: 0.4rem; font-size: 0.9rem;
    background: var(--bg-input); color: var(--text);
    border: 1px solid var(--border); border-radius: 4px;
}
.form-field-row input[type="text"] { flex: 2; }
.form-field-row select { flex: 1; }
.form-field-row label {
    display: flex; align-items: center; gap: 0.25rem;
    font-size: 0.85rem; white-space: nowrap;
}
.form-field-row .btn-remove-field {
    background: none; border: none; cursor: pointer;
    font-size: 1.2rem; color: var(--error);
}

/* --- Responsive --- */

/* Tablet */
@media (max-width: 768px) {
    .container { padding: 0 1rem; }

    /* Header */
    .header-inner { height: 56px; padding: 0; }
    .header-nav { display: none; }
    .nav-hamburger { display: flex; }
    .user-email { display: none; }
    .logo { font-size: 1.1rem; }
    .logo-img { width: 24px; height: 24px; }
    .btn-sm, .btn-outline.btn-sm { padding: 0.375rem 0.625rem; font-size: 0.75rem; }

    /* Dashboard */
    .dashboard-main { padding: 1rem 0; }
    .dashboard-grid { grid-template-columns: 1fr; gap: 1rem; }
    .card { padding: 1.25rem; }
    .stat-value { font-size: 1.25rem; }

    /* Forms */
    .form-row { grid-template-columns: 1fr; }
    .form-input, .form-select { font-size: 1rem; padding: 0.75rem; }

    /* Registration steps */
    .register-container { margin: 1rem auto; }

    /* Hours table: scrollable */
    .hours-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .hours-table th, .hours-table td { padding: 0.5rem; font-size: 0.8rem; white-space: nowrap; }

    /* Services */
    .service-item { flex-wrap: wrap; gap: 0.5rem; }

    /* Form builder field rows */
    .form-field-row { flex-wrap: wrap !important; }
    .form-field-row input[type="text"] { flex: 1 1 100% !important; }
    .form-field-row select { flex: 1 1 45% !important; }
    .form-field-row label { flex: 1 1 45% !important; }

    /* QR section */
    .qr-section { flex-direction: column !important; align-items: center !important; }

    /* Messages */
    .messages-layout { grid-template-columns: 1fr; height: auto; }
    .messages-sidebar { border-right: none; border-bottom: 1px solid var(--border); max-height: 50vh; }
    .conversation-list { max-height: 40vh; }
    .thread-messages { min-height: 40vh; }

    /* Landing */
    .hero { padding: 3rem 1rem 2rem; }
    .hero-badge { font-size: 0.75rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .hero-actions .btn { width: 100%; max-width: 300px; }
    .stats-grid { flex-direction: column; gap: 1.25rem; }
    .stat-divider { width: 60px; height: 1px; }
    .steps-grid { flex-direction: column; align-items: center; }
    .step-connector { transform: rotate(90deg); padding: 0; }
    .step-card { max-width: 100%; }
    .features { padding: 2rem 0; }
    .features-grid { grid-template-columns: 1fr; }
    .cta-card { padding: 2rem 1.5rem; }
    .cta-card h2 { font-size: 1.25rem; }
    .signup-form { flex-direction: column; }

    /* Time slots */
    .time-slots { grid-template-columns: repeat(2, 1fr); }

    /* Footer */
    .footer-inner { flex-direction: column; gap: 0.75rem; text-align: center; }
    .footer-nav { justify-content: center; }

    /* Embed code */
    .embed-code { font-size: 0.7rem; padding: 0.625rem; }

    /* Buttons: bigger touch targets */
    .btn { min-height: 44px; padding: 0.75rem 1.25rem; }
    .btn-sm { min-height: 36px; }
    .chat-option-btn { padding: 0.625rem 1rem; font-size: 0.875rem; min-height: 44px; }
}

/* Small phones */
@media (max-width: 380px) {
    .container { padding: 0 0.75rem; }
    .header-nav { gap: 0.25rem; }
    .nav-link { font-size: 0.75rem; }
    .card { padding: 1rem; }
    .hero-title { font-size: 1.75rem; }
    .dashboard-grid { gap: 0.75rem; }
    .date-grid { grid-template-columns: repeat(7, 1fr); gap: 0.125rem; }
    .date-cell { font-size: 0.7rem; }
}

/* --- Dialog / Modal --- */
dialog {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 90%;
}
dialog::backdrop {
    background: rgba(15,21,32,0.45);
}

/* --- Embed Code --- */
.embed-code {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-family: monospace;
    font-size: 0.75rem;
    word-break: break-all;
    color: var(--text-muted);
}
.widget-link {
    color: var(--accent);
    text-decoration: none;
}
.widget-link:hover {
    text-decoration: underline;
}
.embed-copyable {
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}
.embed-copyable:hover {
    background: var(--bg-hover, var(--bg-input));
}
.copy-toast {
    display: none;
    position: absolute;
    top: -2rem;
    right: 0.5rem;
    background: var(--accent);
    color: var(--accent-text);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-family: sans-serif;
    font-size: 0.75rem;
}
.copy-toast.show {
    display: block;
}


/* Logo upload */
.logo-preview {
    max-width: 180px;
    max-height: 80px;
    object-fit: contain;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-input, #f9fafb);
    padding: 0.25rem;
}

/* Booking widget logo */
.widget-logo {
    max-width: 120px;
    max-height: 56px;
    object-fit: contain;
    display: block;
    margin: 0 auto 0.75rem;
}
