:root {
    --ink: #172029;
    --muted: #667085;
    --line: #d8e0e7;
    --surface: #ffffff;
    --soft: #f4f7f8;
    --primary: #116b67;
    --primary-dark: #0c514e;
    --accent: #c6563d;
    --warning: #b7791f;
    --sidebar: #18242f;
}

* {
    box-sizing: border-box;
}

body {
    color: var(--ink);
    background: var(--soft);
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: .45rem;
    background: var(--primary);
    color: #fff;
}

.sidebar-logo,
.clinic-cell img,
.clinic-logo-preview {
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--line);
}

.sidebar-logo {
    width: 2rem;
    height: 2rem;
    border-radius: .45rem;
}

.public-nav {
    min-height: 72px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid rgba(23, 32, 41, .08);
}

.public-nav .nav-link {
    color: var(--ink);
}

.hero-section {
    position: relative;
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    background-image: url("https://images.unsplash.com/photo-1576091160550-2173dba999ef?auto=format&fit=crop&w=1800&q=80");
    background-size: cover;
    background-position: center;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(13, 23, 30, .86), rgba(13, 23, 30, .46), rgba(13, 23, 30, .12));
}

.hero-content {
    position: relative;
    z-index: 1;
    padding-top: 4rem;
    padding-bottom: 8rem;
}

.hero-copy {
    max-width: 720px;
    color: #fff;
}

.hero-copy h1 {
    font-size: clamp(3rem, 7vw, 6.5rem);
    line-height: .95;
    font-weight: 900;
    margin: .5rem 0 1rem;
}

.hero-copy p {
    max-width: 640px;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, .9);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1.5rem;
}

.content-band,
.page-section {
    padding: 4rem 0;
}

.page-section h1 {
    max-width: 760px;
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.narrow {
    max-width: 820px;
}

.eyebrow {
    display: inline-block;
    color: var(--accent);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.metric-strip,
.feature-grid,
.pricing-grid,
.metric-grid,
.split-grid {
    display: grid;
    gap: 1rem;
}

.metric-strip {
    grid-template-columns: repeat(4, 1fr);
}

.metric-strip div,
.feature-tile,
.plan-card,
.metric-card,
.form-panel,
.data-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: .5rem;
    box-shadow: 0 10px 24px rgba(23, 32, 41, .05);
}

.metric-strip div {
    padding: 1.25rem;
}

.metric-strip strong,
.metric-card strong {
    display: block;
    font-size: 1.8rem;
}

.metric-strip span,
.metric-card span,
.feature-tile p,
.plan-card p,
small {
    color: var(--muted);
}

.feature-grid,
.pricing-grid {
    grid-template-columns: repeat(3, 1fr);
}

.feature-tile,
.plan-card {
    padding: 1.5rem;
}

.feature-tile i {
    color: var(--primary);
    font-size: 1.8rem;
}

.feature-tile h2,
.plan-card h2,
.section-heading h2 {
    margin-top: .75rem;
    font-size: 1.05rem;
    font-weight: 800;
}

.form-panel {
    padding: 1.25rem;
}

.debug-box {
    margin-top: 1rem;
    padding: 1rem;
    color: #7f1d1d;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: .5rem;
    white-space: pre-wrap;
}

.site-footer {
    padding: 2rem 0;
    color: var(--muted);
    background: #fff;
    border-top: 1px solid var(--line);
}

.app-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 260px minmax(0, 1fr);
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.25rem;
    color: #d9e3ea;
    background: var(--sidebar);
}

.app-brand {
    color: #fff;
}

.workspace-name {
    margin: 1.25rem 0;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: .5rem;
    background: rgba(255, 255, 255, .05);
}

.workspace-name small,
.workspace-name strong {
    display: block;
}

.workspace-name small {
    color: #a8b7c2;
}

.side-nav {
    display: grid;
    gap: .35rem;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 42px;
    padding: .65rem .75rem;
    color: #d9e3ea;
    text-decoration: none;
    border-radius: .45rem;
}

.side-nav a:hover {
    background: rgba(255, 255, 255, .09);
}

.app-main {
    min-width: 0;
    padding: 1.25rem;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.app-topbar h1 {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 850;
}

.metric-grid {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 1.25rem;
}

.metric-card {
    padding: 1.25rem;
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1.5rem;
    color: #fff;
    background: linear-gradient(135deg, #0f4f4b, #1f6f68 58%, #a94c37);
    border-radius: .5rem;
}

.dashboard-hero h2 {
    margin: .25rem 0;
    font-size: 1.65rem;
    font-weight: 850;
}

.dashboard-hero p {
    max-width: 720px;
    margin: 0;
    color: rgba(255, 255, 255, .86);
}

.dashboard-hero .eyebrow {
    color: #ffd6c9;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
}

.dashboard-table {
    border-left: 4px solid var(--primary);
}

.form-section,
.data-section {
    margin-bottom: 1.25rem;
}

.data-section {
    padding: 1rem;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .8rem;
}

.section-heading h2 {
    margin: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: .15rem .55rem;
    color: var(--primary-dark);
    background: #e6f3f1;
    border: 1px solid #c4dfdc;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
}

.status-select {
    width: 130px;
}

.payment-input {
    width: 110px;
}

.search-form {
    max-width: 280px;
}

.split-grid {
    grid-template-columns: repeat(2, 1fr);
}

.clinic-cell {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.clinic-cell img {
    width: 42px;
    height: 42px;
    border-radius: .45rem;
}

.clinic-logo-preview {
    display: block;
    width: 120px;
    height: 80px;
    margin-bottom: 1rem;
    border-radius: .5rem;
}

.map-panel {
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: .5rem;
}

.map-panel iframe {
    width: 100%;
    min-height: 260px;
    border: 0;
    border-radius: .45rem;
}

.reset-form,
.share-form {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) auto;
    gap: .4rem;
}

.share-form {
    grid-template-columns: minmax(130px, 1fr) minmax(160px, 1fr) auto;
    min-width: 340px;
}

.login-note {
    display: grid;
    gap: .25rem;
}

.pos-shell {
    margin-bottom: 1.25rem;
}

.pos-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1rem;
}

.pos-catalog,
.pos-ticket,
.chart-card {
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: .5rem;
    box-shadow: 0 10px 24px rgba(23, 32, 41, .05);
}

.pos-button-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.pos-item {
    display: grid;
    gap: .35rem;
    min-height: 88px;
    padding: .8rem;
    text-align: left;
    color: var(--ink);
    background: #f9fbfb;
    border: 1px solid var(--line);
    border-radius: .5rem;
}

.pos-item:hover,
.pos-item:focus {
    border-color: var(--primary);
    background: #edf7f5;
}

.pos-item span {
    color: var(--muted);
    font-size: .86rem;
}

.pos-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #102a2a;
    color: #fff;
    border-radius: .5rem;
}

.pos-total strong {
    font-size: 1.4rem;
}

.lab-result-form {
    display: grid;
    grid-template-columns: 130px minmax(120px, 1fr) minmax(120px, 1fr) auto;
    gap: .5rem;
}

@media (max-width: 992px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
        height: auto;
    }

    .side-nav {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric-grid,
    .metric-strip,
    .feature-grid,
    .pricing-grid,
    .split-grid,
    .pos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .pos-button-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .hero-section {
        min-height: 88vh;
    }

    .metric-grid,
    .metric-strip,
    .feature-grid,
    .pricing-grid,
    .split-grid,
    .side-nav {
        grid-template-columns: 1fr;
    }

    .app-topbar,
    .section-heading,
    .dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .lab-result-form {
        grid-template-columns: 1fr;
    }

    .pos-button-grid,
    .reset-form,
    .share-form {
        grid-template-columns: 1fr;
    }
}
