@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-subtle: #eff6ff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.03);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.08);
    --shadow-xl: 0 32px 72px rgba(15, 23, 42, 0.12);
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --page-content-max-width: 1440px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    font-weight: 400;
    letter-spacing: -0.01em;
}

h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container--narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Compact back control, matching the CRM's header navigation pattern. */
.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    position: relative;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    min-width: 100%;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition), border-color var(--transition);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 32px;
    width: 100%;
    box-sizing: border-box;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
    margin-left: auto;
}

/* Persistent client cabinet navigation: desktop header and mobile bottom bar. */
.client-cabinet-nav { display: flex; align-items: center; gap: 2px; margin-left: 28px; min-width: 0; }
.client-cabinet-nav-link { display: inline-flex; align-items: center; gap: 7px; padding: 9px 11px; border-radius: 9px; color: var(--text-secondary); font-size: .84rem; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap; }
.client-cabinet-nav-link:hover, .client-cabinet-nav-link.is-active { color: var(--accent); background: var(--accent-subtle); }
.client-cabinet-nav-icon { display: inline-flex; width: 18px; height: 18px; }
.client-cabinet-nav-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.client-cabinet-nav-create { color: #fff; background: var(--accent); box-shadow: 0 4px 10px rgba(37, 99, 235, .22); }
.client-cabinet-nav-create:hover, .client-cabinet-nav-create.is-active { color: #fff; background: #1d4ed8; }
.client-cabinet-nav-create .client-cabinet-nav-icon svg { stroke-width: 2.15; }
.client-bottom-nav, .client-bottom-nav-spacer { display: none; }

.header-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    min-width: 0;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-elevated);
    line-height: 1.15;
}

.header-user-name {
    max-width: 220px;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-user[data-client-header-user] {
    min-height: 38px;
    padding: 6px 12px;
}

.header-cabinet-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--accent);
    font-size: .84rem;
    font-weight: 650;
    text-decoration: none;
}

.header-cabinet-link:hover { border-color: #93c5fd; background: var(--accent-subtle); }

.header-user-role {
    margin-top: 2px;
    color: var(--text-tertiary);
    font-size: 0.7rem;
    white-space: nowrap;
}

.profile-menu {
    position: relative;
}

.profile-menu .header-user {
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.profile-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 4px 8px 4px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    text-align: right;
    transition: background var(--transition), border-color var(--transition);
}

.profile-menu-trigger:hover,
.profile-menu.is-open .profile-menu-trigger {
    border-color: #93c5fd;
    background: var(--accent-subtle);
}

.profile-menu-trigger:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .2);
    outline-offset: 2px;
}

.profile-menu-summary {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.15;
}

.profile-menu-name {
    max-width: 160px;
    overflow: hidden;
    font-size: .88rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu-role {
    margin-top: 2px;
    color: var(--text-tertiary);
    font-size: .7rem;
    white-space: nowrap;
}

.profile-menu-chevron {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: var(--text-tertiary);
    transition: transform var(--transition);
}

.profile-menu.is-open .profile-menu-chevron {
    transform: rotate(180deg);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 200;
    width: min(280px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
    animation: profile-dropdown-in .16s ease-out;
}

.profile-dropdown[hidden] {
    display: none;
}

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

.profile-dropdown-user {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.profile-dropdown-user strong {
    overflow: hidden;
    font-size: .9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-dropdown-user span {
    color: var(--text-tertiary);
    font-size: .75rem;
}

.profile-dropdown-links,
.profile-dropdown-footer {
    display: grid;
    padding: 6px;
}

.profile-dropdown-links a,
.profile-dropdown-footer a {
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: .84rem;
    font-weight: 500;
    text-decoration: none;
}

.profile-dropdown-links a:hover,
.profile-dropdown-links a.is-active {
    background: var(--bg-tertiary);
    color: var(--accent);
}

.profile-dropdown-footer {
    border-top: 1px solid var(--border);
}

.profile-dropdown-footer .profile-logout {
    color: #dc2626;
}

.profile-dropdown-footer .profile-logout:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.profile-page {
    max-width: 680px;
}

.profile-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.profile-details > div {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

.profile-details dt {
    margin-bottom: 4px;
    color: var(--text-tertiary);
    font-size: .75rem;
}

.profile-details dd {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    overflow: visible;
}

.logo-mark img {
    display: block;
    width: 144px;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0px;
    line-height: 1.1;
}

.logo-wordmark {
    font-weight: 700;
    letter-spacing: -0.03em;
}

.logo-accent {
    color: var(--accent);
}

.header-tagline {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.01em;
    white-space: nowrap;
    display: none;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

@media (min-width: 900px) {
    .header-tagline {
        display: block;
    }
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    min-width: 0;
}

.nav a {
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.nav a:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
}

.nav a.nav-cta {
    margin-left: 4px;
    padding: 8px 13px;
    border: 1px solid var(--accent);
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .18);
}

.nav a.nav-cta:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
    box-shadow: 0 5px 14px rgba(37, 99, 235, .24);
}

.nav a.nav-outline {
    margin-left: 2px;
    padding: 7px 13px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.nav a.nav-outline:hover {
    border-color: #93c5fd;
    background: var(--accent-subtle);
    color: var(--accent);
}

.nav-mobile-account {
    display: none;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.menu-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

@media (max-width: 899px) {
    .header-tagline {
        display: none;
    }
    .menu-toggle {
        display: inline-flex;
    }
    .nav {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border);
        padding: 12px;
        flex-direction: column;
        gap: 4px;
        box-shadow: var(--shadow-lg);
    }
    .nav.open {
        display: flex;
    }
    .nav a {
        width: 100%;
        padding: 12px 16px;
        border-radius: var(--radius-sm);
    }
    .nav a.nav-cta {
        margin-left: 0;
        margin-top: 8px;
    }
    .nav-mobile-account {
        display: grid;
        width: 100%;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border);
        gap: 4px;
    }
    .nav-mobile-account .nav-mobile-logout {
        margin-top: 4px;
        border-top: 1px solid var(--border);
        color: #dc2626;
    }
    .nav-mobile-account .nav-mobile-logout:hover {
        background: #fef2f2;
        color: #b91c1c;
    }
    .header--landing .profile-menu {
        display: none;
    }
    .header-inner {
        position: relative;
    }
    .header-inner > .client-cabinet-nav { display: none; }
    .client-bottom-nav {
        display: block;
        position: fixed;
        z-index: 150;
        right: 0;
        bottom: 0;
        left: 0;
        padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
        border-top: 1px solid var(--border);
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
    .client-bottom-nav .client-cabinet-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; max-width: 620px; margin: 0 auto; }
    .client-bottom-nav .client-cabinet-nav-link { min-width: 0; flex-direction: column; justify-content: center; gap: 3px; padding: 6px 2px; color: var(--text-tertiary); font-size: .62rem; font-weight: 600; }
    .client-bottom-nav .client-cabinet-nav-link:hover, .client-bottom-nav .client-cabinet-nav-link.is-active { background: transparent; color: var(--accent); }
    .client-bottom-nav .client-cabinet-nav-icon { width: 21px; height: 21px; }
    .client-bottom-nav .client-cabinet-nav-create { position: relative; color: var(--accent); background: transparent; box-shadow: none; }
    .client-bottom-nav .client-cabinet-nav-create .client-cabinet-nav-icon { width: 32px; height: 32px; margin-top: -18px; padding: 6px; border: 3px solid var(--bg-primary); border-radius: 11px; color: #fff; background: var(--accent); box-shadow: 0 5px 14px rgba(37, 99, 235, .3); }
    .client-bottom-nav .client-cabinet-nav-create-label { font-size: 0; }
    .client-bottom-nav .client-cabinet-nav-create-label::after { content: attr(data-mobile-label); font-size: .62rem; }
    .client-bottom-nav .client-cabinet-nav-create:hover, .client-bottom-nav .client-cabinet-nav-create.is-active { color: var(--accent); background: transparent; }
    .client-bottom-nav .client-cabinet-nav-create:hover .client-cabinet-nav-icon, .client-bottom-nav .client-cabinet-nav-create.is-active .client-cabinet-nav-icon { color: #fff; background: #1d4ed8; }
    .client-bottom-nav-spacer { display: block; height: calc(68px + env(safe-area-inset-bottom)); }
}

@media (min-width: 900px) {
    .header-inner { position: relative; }
    .header-inner > .client-cabinet-nav {
        position: absolute;
        left: 50%;
        margin-left: 0;
        transform: translateX(-50%);
    }
    .menu-toggle {
        display: none;
    }
    .nav {
        display: flex !important;
    }
}

@media (max-width: 640px) {
    .header-inner {
        padding: 0 16px;
        height: 64px;
    }
    .header-actions {
        gap: 8px;
    }
    .header-user {
        max-width: 150px;
        padding: 5px 9px;
    }
    .header-user-name {
        max-width: 130px;
        font-size: 0.8rem;
    }
    .header-user-role {
        font-size: 0.65rem;
    }
    .profile-menu-trigger {
        padding: 7px 8px;
    }
    .profile-menu-name {
        display: none;
    }
    .profile-menu-role {
        margin-top: 0;
        font-size: .72rem;
    }
    .profile-dropdown {
        top: calc(100% + 7px);
        right: -4px;
    }
    .profile-details {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.925rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    font-family: inherit;
    letter-spacing: -0.01em;
}

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

.btn-primary:hover {
    background: #000;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--accent-subtle);
    color: var(--accent);
}

.btn-secondary:hover {
    background: #dbeafe;
}

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

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

/* Hero */
.hero {
    position: relative;
    background: linear-gradient(160deg, #1a202c 0%, #2d3748 55%, #374151 100%);
    color: #ffffff;
    padding: 100px 0 40px;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 40%, rgba(37, 99, 235, 0.25), transparent 55%),
        radial-gradient(circle at 75% 55%, rgba(6, 182, 212, 0.18), transparent 55%);
}

.hero::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
    align-items: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #e2e8f0;
    margin-bottom: 20px;
    width: fit-content;
}

.hero-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.hero-content {
    text-align: left;
}

.hero h1 {
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.6px;
    margin: 0 0 18px;
    color: #ffffff;
}

.hero-text {
    font-size: 1.125rem;
    line-height: 1.7;
    color: #cbd5e1;
    margin: 0 0 28px;
    max-width: 520px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    justify-items: center;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hero-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #ffffff;
}

.hero-stat-label {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 4px;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-card {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    padding: 0;
    overflow: hidden;
    backdrop-filter: blur(14px);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}

.hero-card-preview {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.hero-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-card-content {
    padding: 24px 28px 28px;
}

.hero-card-content h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
}

.hero-card-content p {
    margin: 0;
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.6;
}

.hero-diagram {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 64px 0 80px;
    background: #ffffff;
    border-top: 1px solid var(--border);
}

.process-snake {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

.process-snake::before {
    content: "";
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 50%;
    width: 2px;
    background: linear-gradient(180deg, rgba(16,185,129,0.6), rgba(16,185,129,0.15));
    transform: translateX(-50%);
    border-radius: 2px;
}

.process-step {
    position: relative;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 40px 1fr;
    align-items: start;
    gap: 0;
}

.process-step.is-left .process-body {
    grid-column: 1;
    grid-row: 1;
    text-align: right;
    justify-self: end;
    transform: translateX(8px);
}

.process-step.is-left .process-dot {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
}

.process-step.is-right .process-dot {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
}

.process-step.is-right .process-body {
    grid-column: 3;
    grid-row: 1;
    justify-self: start;
    transform: translateX(-8px);
}

@media (max-width: 720px) {
    .process-step,
    .process-step.is-left,
    .process-step.is-right {
        grid-template-columns: 24px 1fr;
        grid-column-gap: 12px;
    }
    .process-step .process-body {
        grid-column: 2 !important;
        grid-row: 1 !important;
        text-align: left !important;
        justify-self: start !important;
        transform: none !important;
    }
    .process-step .process-dot {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }
    .process-snake {
        padding: 0 10px;
    }
}

.process-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #10b981;
    margin-top: 8px;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.process-dot.active {
    background: #34d399;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.35);
}

.process-body {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    cursor: pointer;
}

.process-body:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.process-step.is-left .process-body:hover {
    transform: translateX(8px) translateY(-3px);
}

.process-step.is-right .process-body:hover {
    transform: translateX(-8px) translateY(-3px);
}

/* The reveal state is added by JavaScript only, so the process remains readable
   if scripts are unavailable. */
.process-snake.has-scroll-reveal .process-step .process-body {
    opacity: 0;
    transition: opacity 1.15s ease, transform 1.15s cubic-bezier(.16, 1, .3, 1), box-shadow .25s ease, border-color .25s ease;
}

.process-snake.has-scroll-reveal .process-step .process-dot {
    opacity: 0;
    transform: scale(.55);
    transition: opacity .7s ease .2s, transform .75s cubic-bezier(.16, 1, .3, 1) .2s, box-shadow .25s ease;
}

.process-snake.has-scroll-reveal .process-step.is-left .process-body {
    transform: translateX(-20px);
}

.process-snake.has-scroll-reveal .process-step.is-right .process-body {
    transform: translateX(20px);
}

.process-snake.has-scroll-reveal .process-step.is-revealed .process-body {
    opacity: 1;
}

.process-snake.has-scroll-reveal .process-step.is-left.is-revealed .process-body {
    transform: translateX(8px);
}

.process-snake.has-scroll-reveal .process-step.is-right.is-revealed .process-body {
    transform: translateX(-8px);
}

.process-snake.has-scroll-reveal .process-step.is-revealed .process-dot {
    opacity: 1;
    transform: scale(1);
}

.process-snake.has-scroll-reveal .process-step.is-left.is-revealed .process-body:hover {
    transform: translateX(8px) translateY(-3px);
}

.process-snake.has-scroll-reveal .process-step.is-right.is-revealed .process-body:hover {
    transform: translateX(-8px) translateY(-3px);
}

@media (max-width: 720px) {
    .process-snake.has-scroll-reveal .process-step .process-body,
    .process-snake.has-scroll-reveal .process-step.is-left .process-body,
    .process-snake.has-scroll-reveal .process-step.is-right .process-body {
        transform: translateY(18px) !important;
    }

    .process-snake.has-scroll-reveal .process-step.is-revealed .process-body {
        transform: translateY(0) !important;
    }

    .process-snake.has-scroll-reveal .process-step.is-revealed .process-body:hover {
        transform: translateY(-3px) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .process-snake.has-scroll-reveal .process-step .process-body,
    .process-snake.has-scroll-reveal .process-step .process-dot {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

.process-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.process-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.process-time {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
    opacity: 0.9;
}

.process-connector {
    display: none;
}

/* Sections */
.section {
    padding: 80px 0;
}

/* Keep anchor targets clear of the sticky site header. */
#services,
#why,
#order {
    scroll-margin-top: 88px;
}

.section-alt {
    background: var(--bg-secondary);
}

.section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #374151;
    margin-bottom: 0;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.4px;
    margin: 0 0 12px;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.65;
    text-align: center;
}

.section-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 40px;
}

.why-header-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 52px;
}

.purpose-card {
    position: relative;
    display: flex;
    min-height: 225px;
    overflow: hidden;
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
}

.purpose-card--mission {
    background: linear-gradient(135deg, #eff6ff 0%, #fff 72%);
}

.purpose-card--goal {
    background: linear-gradient(135deg, #f0fdf4 0%, #fff 72%);
}


.purpose-card--goal { color: rgba(5, 150, 105, .13); }

.purpose-content { position: relative; z-index: 1; max-width: 48ch; }
.purpose-eyebrow { display:block; margin-bottom:12px; color:var(--accent); font-size:.72rem; font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.purpose-card--goal .purpose-eyebrow { color:#059669; }
.purpose-content h2 { margin:0 0 12px; color:var(--text-primary); font-size:clamp(1.25rem, 2vw, 1.55rem); line-height:1.22; }
.purpose-content p { margin:0; color:var(--text-secondary); font-size:.95rem; line-height:1.65; }

@media (max-width: 860px) {
    .purpose-card { min-height: 0; }
}

@media (max-width: 860px) {
    .why-header-row {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

/* Services gallery */
.services-gallery-shell { position: relative; width: 100vw; margin-left: calc(50% - 50vw); }
.services-gallery {
    width: 100vw;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 0 12px;
}

.services-gallery::-webkit-scrollbar { display: none; }

.services-gallery-controls {
    position: absolute;
    z-index: 5;
    top: 50%;
    left: 0;
    display: flex;
    width: 100vw;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%);
    transition: opacity .2s ease;
}

.services-gallery-shell:hover .services-gallery-controls,
.services-gallery-shell:focus-within .services-gallery-controls { opacity: 1; pointer-events: auto; }

.services-gallery-arrow {
    display: flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 50%;
    background: rgba(15, 23, 42, .7);
    box-shadow: var(--shadow-md);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 1.3rem;
    transition: transform var(--transition), background var(--transition);
}

.services-gallery-arrow:hover { background: var(--accent); transform: scale(1.08); }

.services-gallery-track {
    display: flex;
    width: max-content;
    gap: 24px;
}

.service-card {
    position: relative;
    display: block;
    flex: 0 0 auto;
    width: min(432px, 33.75vw);
    aspect-ratio: 4 / 3;
    margin: 0;
    min-height: 0;
    background: var(--bg-tertiary);
    border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
    border-radius: 12px;
    overflow: hidden;
    isolation: isolate;
    transition: box-shadow var(--transition-slow), border-color var(--transition-slow);
}

.service-card:hover {
    border-color: color-mix(in srgb, var(--primary) 58%, var(--border));
    box-shadow: var(--shadow-lg);
}

.service-preview {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.service-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(.88) contrast(1.04);
    transition: filter .35s ease;
}

.service-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 18, 34, .03) 22%, rgba(8, 18, 34, .88) 100%);
    z-index: 1;
}

.service-card:hover .service-preview img {
    filter: saturate(1) contrast(1.06);
}

.service-card-overlay {
    position: absolute;
    z-index: 2;
    inset: auto 0 0;
    padding: 22px;
    color: #fff;
    transform: translateY(4px);
    transition: transform var(--transition-base);
}

.service-card:hover .service-card-overlay {
    transform: translateY(0);
}

.service-card-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .25);
    color: rgba(255, 255, 255, .92);
    font-weight: 700;
    font-size: 0.75rem;
    margin-bottom: 12px;
}

.service-card h3 {
    margin: 0 0 7px;
    color: #fff;
    font-size: clamp(1.05rem, 1.8vw, 1.36rem);
    line-height: 1.22;
    text-wrap: balance;
}

.service-card p {
    max-width: 58ch;
    color: rgba(255, 255, 255, .82);
    font-size: .86rem;
    line-height: 1.48;
    margin: 0;
}

@media (max-width: 960px) {
    .service-card { width: min(432px, 55vw); }
}

@media (max-width: 580px) {
    .services-gallery-track { gap: 16px; }
    .service-card { width: 76vw; }
    .service-card-overlay { padding: 20px 18px 18px; }
    .service-card p { font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
    .service-card { transition: none; }
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

@media (max-width: 1200px) {
    .features { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
    .features { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 540px) {
    .features { grid-template-columns: 1fr; }
}

.feature {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 22px 24px;
    transition: all var(--transition-slow);
    position: relative;
}

.feature:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(37, 99, 235, .14);
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.feature-icon svg {
    width: 22px;
    height: 22px;
    stroke: #2563eb;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.feature strong {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 1rem;
    text-align: center;
}

.feature span {
    color: var(--text-secondary);
    font-size: 0.925rem;
    line-height: 1.6;
    text-align: center;
}

/* Form Section */
.form-section {
    background: var(--bg-primary);
    position: relative;
}

.form-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-hover), transparent);
}

.form-map-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}

.form-map-row .form-wrap {
    max-width: none;
    margin: 0;
}

.map-wrap {
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    min-height: 500px;
}

.map-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

@media (max-width: 860px) {
    .form-map-row {
        grid-template-columns: 1fr;
    }
    .map-wrap {
        min-height: 300px;
    }
}

.form-hint {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.925rem;
}

.lead-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-field span {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-field input,
.form-field textarea,
.form-field select {
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--bg-primary);
    font-family: inherit;
    transition: all var(--transition);
    color: var(--text-primary);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--text-tertiary);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.form-field input.is-invalid {
    border-color: #dc2626;
    background: #fffafa;
}

.form-field-help {
    color: var(--text-tertiary);
    font-size: .76rem;
    line-height: 1.35;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    background: #FAFBFD;
    width: 100%;
    box-sizing: border-box;
    transition: background var(--transition), border-color var(--transition);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1.8fr) minmax(150px, 1fr) minmax(160px, 1.1fr);
    gap: 32px;
    padding: 32px 0 22px;
}

/* Brand column */
.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.footer-logo-mark img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: block;
}

.footer-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.footer-wordmark {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.footer-accent {
    color: var(--accent);
}

.footer-tagline {
    margin-top: 3px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.footer-about {
    margin-top: 13px;
    max-width: 300px;
    color: var(--text-secondary);
    font-size: 0.925rem;
    line-height: 1.65;
}

.footer-socials {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.footer-social-icon {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.footer-social-icon svg {
    width: 17px;
    height: 17px;
}

.footer-social-icon:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}

/* Column heading */
.footer-heading {
    margin-bottom: 13px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.footer-col {
    min-width: 0;
}

/* Navigation column */
.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-nav a {
    width: fit-content;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.925rem;
    font-weight: 500;
    transition: color var(--transition);
}

.footer-nav a:hover {
    color: var(--accent);
}

.footer-contact-list { display:flex; flex-direction:column; gap:8px; color:var(--text-secondary); font-size:.875rem; line-height:1.4; }
.footer-contact-phone { display:flex; flex-wrap:wrap; gap:5px 10px; align-items:baseline; }
.footer-contact-phone > span { color:var(--text-tertiary); font-size:.78rem; }
.footer-contact-phone a, .footer-contact-link { color:var(--text-primary); font-weight:600; text-decoration:none; }
.footer-contact-phone a:hover, .footer-contact-link:hover { color:var(--accent); }
.footer-contact-address { color:var(--text-tertiary); }

/* Bottom bar */
.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 0 16px;
    border-top: 1px solid var(--border);
}

.footer-copy {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.footer-legal {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.footer-legal a {
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color var(--transition);
}

.footer-legal a:hover {
    color: var(--accent);
}

@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px 32px;
        padding: 34px 0 26px;
    }
    .footer-col--brand {
        grid-column: 1 / -1;
    }

    .footer-about {
        max-width: 440px;
    }
}

@media (max-width: 560px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* Messages */
.messages {
    margin-bottom: 20px;
}

.message {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-size: 0.925rem;
    font-weight: 500;
}

.message--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.message--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Contact */
.contact-section {
    padding: 64px 0;
    background: var(--bg-secondary);
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .contact-grid { grid-template-columns: 1fr; }
}

.contact-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: all var(--transition-slow);
}

.contact-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.contact-card-icon {
    font-size: 1.75rem;
    margin-bottom: 12px;
}

.contact-card-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 6px;
}

.contact-card-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.contact-card a {
    color: var(--accent);
    font-weight: 500;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero h1,
.hero-text,
.hero-actions,
.hero-stats,
.service-card,
.feature,
.form-wrap,
.contact-card {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.hero h1 { animation-delay: 0.05s; }
.hero-text { animation-delay: 0.12s; }
.hero-actions { animation-delay: 0.18s; }
.hero-stats { animation-delay: 0.24s; }
.service-card { animation-delay: 0.08s; }
.service-card:nth-child(2) { animation-delay: 0.13s; }
.service-card:nth-child(3) { animation-delay: 0.18s; }
.service-card:nth-child(4) { animation-delay: 0.23s; }
.service-card:nth-child(5) { animation-delay: 0.28s; }
.service-card:nth-child(6) { animation-delay: 0.33s; }
.feature { animation-delay: 0.1s; }
.feature:nth-child(2) { animation-delay: 0.15s; }
.feature:nth-child(3) { animation-delay: 0.2s; }
.feature:nth-child(4) { animation-delay: 0.25s; }
.form-wrap { animation-delay: 0.15s; }
.contact-card { animation-delay: 0.1s; }
.contact-card:nth-child(2) { animation-delay: 0.15s; }
.contact-card:nth-child(3) { animation-delay: 0.2s; }

/* Cabinet */
.cabinet {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 264px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
}

.sidebar-brand {
    padding: 22px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    text-decoration: none;
    display: inline-block;
}

.sidebar-logo span {
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
}

.sidebar-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.sidebar-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    opacity: 0.8;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
}

.sidebar-link--logout {
    color: #ef4444;
}

.sidebar-link--logout:hover {
    background: #fef2f2;
    color: #dc2626;
}

.main {
    flex: 1;
    margin-left: 0;
    min-width: 0;
    background: var(--bg-secondary);
}

.topbar {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
}

.topbar-subtitle {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin: 3px 0 0;
    font-weight: 400;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px 6px 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: all var(--transition);
}

.topbar-user:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.topbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.topbar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.topbar-user-role {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    line-height: 1.2;
}

.content {
    width: 100%;
    max-width: var(--page-content-max-width);
    margin-inline: auto;
    padding: 28px 32px 48px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}

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

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .page-grid { grid-template-columns: 1fr; }
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.04), transparent);
}

.stat-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 4px;
    line-height: 1;
}

.stat-label {
    font-size: 0.825rem;
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.section-block {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 4px;
}

.detail-section {
    padding: 8px;
}

.detail-section .table-wrap {
    margin-top: 6px;
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.page-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 150px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.page-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.page-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 1.25rem;
}

.page-card-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.page-card-desc {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    line-height: 1.45;
}

.page-card--orders {
    grid-column: span 2;
}

.page-card-preview {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-primary);
}

.preview-row {
    display: grid;
    grid-template-columns: 0.8fr 1.4fr 1fr;
    gap: 8px;
    padding: 7px 9px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.preview-row:last-child {
    border-bottom: 0;
}

.preview-row--header {
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.preview-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-empty {
    padding: 10px;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.section-block:hover {
    border-color: var(--border-hover);
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}

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

.section-header .section-title {
    margin: 0;
    text-align: left;
}

.detail-section .section-header {
    display: block;
    justify-content: flex-start !important;
}

.section-block.detail-section .section-title {
    padding-left: 6px;
}

.works-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
}
.operations-delivery-layout {
    display: block;
}

.two-col-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}
.comments-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
}
.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tooth-chart-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tooth-arch {
    margin-bottom: 10px;
}

.tooth-arch span {
    display: block;
    margin-bottom: 6px;
    color: var(--text-tertiary);
    font-size: 0.72rem;
    font-weight: 600;
}

.tooth-row {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
}

.tooth-button {
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.tooth-button.is-selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.tooth-chart-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.tooth-selected {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.section-block.detail-section {
    padding: 6px !important;
}

.section-block.detail-section .section-header {
    margin-bottom: 6px;
}

.section-block.detail-section .table-wrap {
    margin-top: 4px;
}

.section-block.detail-section .table th {
    padding: 6px 8px;
    font-size: 0.68rem;
}

.section-block.detail-section .table td {
    padding: 7px 8px;
}

.works-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.technician-operations {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.technician-operations-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.technician-operations .section-title {
    margin: 0;
    font-size: 0.9rem;
}

.technician-operations-header span {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.link-more {
    font-size: 0.825rem;
    color: var(--accent);
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--transition);
}

.link-more:hover {
    background: var(--accent-subtle);
}

.status-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.875rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.04);
}

.status-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.85rem;
}

.status-count {
    color: var(--text-tertiary);
    font-weight: 600;
    font-size: 0.75rem;
    background: var(--bg-primary);
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--border);
    min-width: 24px;
    text-align: center;
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    width: auto;
    text-align: left;
    padding: 8px 10px;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    font-family: inherit;
}

.table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    background: var(--bg-primary);
}

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

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

.table tbody tr:hover td {
    background: var(--bg-secondary);
}

.table-link {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.875rem;
    transition: color var(--transition);
}

.table-link:hover {
    color: var(--accent-hover);
}

.page-content {
    width: 100%;
    max-width: none;
    padding: 20px 20px 40px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0 0 6px;
}

.page-header p {
    margin: 0;
    color: var(--text-tertiary);
}

.page-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.page-actions {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.page-summary strong {
    color: var(--text-primary);
    font-size: 1.25rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
}

.list-add-row {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.pagination-current {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.row-index {
    display: block;
    margin-top: 3px;
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
}

.inline-edit-form {
    min-width: 150px;
}

.work-edit-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.work-inline-form {
    display: grid;
    grid-template-columns: minmax(220px, 2.2fr) minmax(70px, 0.55fr) minmax(90px, 0.8fr) minmax(90px, 0.8fr) minmax(220px, 2fr) minmax(118px, auto);
    gap: 8px;
    align-items: center;
}

.work-inline-form .form-control {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 0.82rem;
}

.work-total {
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
}

.work-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    min-width: 118px;
}

.work-edit-grid {
    display: grid;
    grid-template-columns: 2fr 0.7fr 1fr 2fr;
    gap: 8px;
    align-items: start;
}

.work-add-grid {
    grid-template-columns: 2fr 0.7fr 1fr auto;
    margin-bottom: 8px;
}

.work-add-actions {
    display: flex;
    align-items: end;
}

.operation-add-form {
    margin-bottom: 8px;
}

.operation-add-grid {
    display: grid;
    grid-template-columns: 1.6fr 1.4fr 1fr 1.4fr auto;
    gap: 8px;
    align-items: end;
}

.operation-add-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
}

.work-control-form {
    min-width: 0;
}

.work-control-form .compact-select,
.work-control-form .compact-input,
.work-add-form .compact-select,
.work-add-form .compact-input {
    width: 100%;
}

.work-edit-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
}

.work-edit-grid .compact-input,
.work-edit-grid .compact-select {
    width: 100%;
}

.inline-edit-form .compact-input,
.inline-edit-form .compact-select {
    width: 100%;
    min-width: 120px;
}

.status-select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 7px 9px;
    font: inherit;
    font-size: 0.8rem;
}

.btn-small {
    padding: 7px 10px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

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

.btn-danger {
    background: #ffffff;
    color: #dc2626;
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.btn-icon {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: 5px;
    font-size: 0.75rem !important;
    font-weight: 700;
    line-height: 1;
}

.section-header .btn-icon {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    font-size: 1.2rem !important;
}

.order-number {
    font-weight: 700;
}

.actions-cell {
    text-align: right;
}

.compact-form {
    min-width: 190px;
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.back-link {
    display: inline-flex;
    margin-bottom: 8px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.detail-header h1 {
    margin: 0 0 4px;
    font-size: 1.6rem;
}

.detail-header p {
    margin: 0;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-total {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    font-size: 1.25rem;
    font-weight: 700;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.detail-card {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
}

.detail-card span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-tertiary);
    font-size: 0.72rem;
}

.detail-card strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
}

.detail-card .inline-form {
    margin-top: 10px;
    min-width: 0;
}

.status-form {
    margin-top: 10px;
}

.detail-card .status-select,
.detail-card .status-select--full {
    width: 100%;
    font-size: 1rem;
    padding: 2px 0;
}

.detail-card .status-select {
    font-size: 1rem;
    padding: 2px 0;
}

.detail-columns {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 12px;
    margin-top: 12px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Keep long order histories readable without extending the detail page endlessly. */
#comments .comments-list--scrollable {
    max-height: 360px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-width: thin;
}

@media (max-width: 640px) {
    #comments .comments-list--scrollable {
        max-height: 320px;
    }
}

.comment-item {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

.comment-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.comment-meta span {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.comment-item p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    resize: vertical;
    font: inherit;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.is-open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

body.modal-lock {
    overflow: hidden;
}

.add-card {
    margin-top: 22px;
    padding: 18px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.full-span {
    grid-column: 1 / -1;
}

.form-control,
.form-control select,
.form-control textarea,
.form-control input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 9px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
}

.form-control input {
    padding: 7px 9px;
}

.implant-cell {
    max-width: 240px;
    white-space: normal;
    vertical-align: top;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.orders-table {
    min-width: 1180px;
}

.resizable-table {
    table-layout: fixed;
}

.resizable-table th {
    position: relative;
}

.table-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    touch-action: none;
}

.table-resize-handle:hover {
    background: rgba(37, 99, 235, 0.16);
}

.orders-table th:nth-child(3) {
    white-space: normal;
    vertical-align: top;
    line-height: 1.25;
}

.comment-cell {
    max-width: 220px;
}

.comment-cell strong,
.comment-cell span,
.comment-cell em {
    display: block;
}

.comment-cell span {
    margin: 3px 0;
    color: var(--text-secondary);
}

.comment-cell em {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-style: normal;
}

.muted {
    color: var(--text-tertiary);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}

.badge--status {
    margin-left: 8px;
    color: #92400e;
    background: #fef3c7;
    border-color: #fde68a;
}

.badge--payment {
    margin-left: 8px;
    color: #14532d;
    background: #dcfce7;
    border-color: #bbf7d0;
}

.badge--field {
    margin-left: 8px;
    color: #1e3a8a;
    background: #dbeafe;
    border-color: #bfdbfe;
}

.badge--work {
    margin-left: 8px;
    color: #7c2d12;
    background: #ffedd5;
    border-color: #fed7aa;
}

.badge--operation {
    margin-left: 8px;
    color: #581c87;
    background: #f3e8ff;
    border-color: #e9d5ff;
}

.empty-state {
    color: var(--text-tertiary);
    font-size: 0.925rem;
    text-align: center;
    padding: 48px 24px;
    font-weight: 400;
}

.messages--cabinet {
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.message--success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.message--error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    .main {
        margin-left: 240px;
    }
    .detail-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .detail-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .sidebar {
        display: none;
    }
    .main {
        margin-left: 0;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .page-header,
    .detail-header {
        flex-direction: column;
    }
    .detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .work-inline-form {
        grid-template-columns: 1fr;
    }
    .work-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 540px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .content {
        padding: 20px 16px 40px;
    }
    .topbar {
        padding: 16px 20px;
    }
    .hero h1 {
        font-size: 2rem;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.compact-input[readonly],
.compact-select:disabled,
.compact-input:disabled {
    background-color: var(--bg-secondary);
    cursor: not-allowed;
    opacity: 0.72;
}

/* ===== Mobile: prevent sideways scroll + polish hero on small screens ===== */
html, body { overflow-x: clip; }              /* clip (not hidden) keeps the sticky header working */
.hero-content, .hero h1, .hero-text, .hero-actions, .hero-stats { max-width: 100%; min-width: 0; }
.hero-stat { min-width: 0; width: 100%; text-align: center; }
.hero-stat-label { overflow-wrap: anywhere; }
.hero h1 { overflow-wrap: anywhere; }
/* A 1fr grid track = minmax(auto,1fr); its min-content (a long word / the stats)
   can blow past the viewport. minmax(0,1fr) lets the column shrink to fit. */
@media (max-width: 960px) {
    .hero-inner { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    .hero h1 { font-size: 2rem; letter-spacing: -0.3px; hyphens: auto; }
    .hero-text { font-size: 1rem; }
    .hero-stats { gap: 10px; margin-top: 36px; }
    .hero-stat-value { font-size: 1.4rem; }
    .hero-stat-label { font-size: 0.78rem; line-height: 1.25; }
    .nav { top: 64px; }                        /* match the shorter mobile header */
}

/* Hamburger dropdown: center every item (plain links were left-aligned) */
@media (max-width: 899px) {
    .nav a { text-align: center; justify-content: center; }
}
