:root {
    --bg: #0c1117;
    --bg-soft: #131a22;
    --surface: #ffffff;
    --surface-soft: #f4f5f7;
    --surface-tint: #f8f8fb;
    --text: #11151c;
    --text-soft: #5a6472;
    --line: #e5e7eb;
    --danger: #b42318;
    --danger-soft: #fde8e6;
    --primary: #c1121f;
    --primary-dark: #7d0c14;
    --primary-soft: #fff1f2;
    --success: #16794a;
    --success-soft: #e7f7ee;
    --warning: #a25b03;
    --warning-soft: #fff4dd;
    --info: #164c96;
    --info-soft: #eaf2ff;
    --shadow: 0 24px 60px rgba(8, 15, 26, 0.08);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --shell: 1200px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(193, 18, 31, 0.12), transparent 26%),
        radial-gradient(circle at top right, rgba(17, 21, 28, 0.08), transparent 24%),
        linear-gradient(180deg, #f6f7fb 0%, #eef1f6 100%);
}

body.public-body {
    background:
        radial-gradient(circle at top left, rgba(193, 18, 31, 0.18), transparent 24%),
        radial-gradient(circle at bottom right, rgba(17, 21, 28, 0.08), transparent 20%),
        linear-gradient(180deg, #fff5f6 0%, #f2f4f8 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
textarea,
select {
    font: inherit;
}

textarea {
    resize: vertical;
}

.app-frame {
    min-height: 100vh;
}

.shell {
    width: min(calc(100% - 32px), var(--shell));
    margin: 0 auto;
}

.stack-xl > * + *,
.stack-lg > * + *,
.stack-md > * + * {
    margin-top: 16px;
}

.stack-xl > * + * {
    margin-top: 24px;
}

.stack-lg > * + * {
    margin-top: 18px;
}

.stack-md > * + * {
    margin-top: 12px;
}

.topbar {
    width: min(calc(100% - 32px), var(--shell));
    margin: 18px auto 0;
    padding: 14px 18px;
    border-radius: 999px;
    background: rgba(12, 17, 23, 0.9);
    box-shadow: 0 16px 50px rgba(12, 17, 23, 0.26);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    position: sticky;
    top: 12px;
    z-index: 20;
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-family: 'Sora', sans-serif;
}

.brand span {
    display: flex;
    flex-direction: column;
}

.brand strong {
    font-size: 0.98rem;
}

.brand small {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #ef233c, #80111d);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topnav a,
.user-chip {
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.86);
}

.topnav a:hover,
.topnav .is-active,
.user-chip {
    background: rgba(255, 255, 255, 0.1);
}

.link-muted {
    color: rgba(255, 255, 255, 0.7);
}

.nav-toggle {
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
}

.footer-shell {
    margin-top: 32px;
    padding: 30px 0 36px;
}

.footer-copy {
    width: min(calc(100% - 32px), var(--shell));
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.flash-stack {
    margin-top: 18px;
}

.flash-banner {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    color: #fff;
    box-shadow: var(--shadow);
}

.flash-banner.success {
    background: linear-gradient(135deg, #1f8f58, #16653f);
}

.flash-banner.danger {
    background: linear-gradient(135deg, #c1121f, #8d0c17);
}

.flash-banner.info {
    background: linear-gradient(135deg, #1f5ca8, #123d74);
}

.page-head,
.section-title,
.split-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.page-head h1,
.section-title h2,
.split-head h2,
.hero-copy h1,
.auth-card h1,
.customer-hero h1 {
    margin: 8px 0 10px;
    line-height: 1.08;
    font-family: 'Sora', sans-serif;
}

.page-head h1 {
    font-size: clamp(2rem, 3vw, 3.1rem);
}

.section-title h2,
.split-head h2 {
    font-size: 1.35rem;
}

.page-head p,
.hero-copy p,
.auth-card p,
.customer-hero p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.65;
}

.eyebrow {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
}

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

.card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.hero-card {
    background:
        radial-gradient(circle at top left, rgba(193, 18, 31, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.94));
}

.hero-grid,
.install-grid,
.panel-grid,
.feature-grid,
.stats-grid {
    display: grid;
    gap: 20px;
}

.hero-grid,
.install-grid {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: stretch;
}

.panel-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr);
}

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

.stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stats-grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card,
.feature-card {
    padding: 22px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(229, 231, 235, 0.95);
    box-shadow: var(--shadow);
}

.stat-card span,
.feature-card h3 {
    color: var(--text-soft);
}

.stat-card strong {
    display: block;
    margin: 10px 0 8px;
    font-size: 1.85rem;
    font-family: 'Sora', sans-serif;
}

.stat-card small,
.feature-card p {
    color: var(--text-soft);
    line-height: 1.55;
}

.hero-points,
.head-actions,
.inline-actions,
.consent-row,
.check-grid,
.summary-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.cta-band {
    padding: 22px 26px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: linear-gradient(135deg, #11151c, #242c38);
    color: #fff;
    box-shadow: 0 24px 60px rgba(17, 21, 28, 0.24);
}

.cta-band p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.72);
}

.search-card h2 {
    margin: 10px 0;
    font-family: 'Sora', sans-serif;
}

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

.field span {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-soft);
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='date'],
input[type='datetime-local'],
textarea,
select,
.inline-search input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #dce1e7;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: 160ms border-color, 160ms box-shadow, 160ms transform;
}

input:focus,
textarea:focus,
select:focus,
.inline-search input:focus {
    border-color: rgba(193, 18, 31, 0.5);
    box-shadow: 0 0 0 4px rgba(193, 18, 31, 0.1);
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.94rem;
    color: var(--text);
}

.check-row input {
    width: 18px;
    height: 18px;
}

.align-end {
    align-self: end;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field-span-2 {
    grid-column: 1 / -1;
}

.field-actions {
    justify-content: end;
}

.field-actions .btn,
.field-actions .inline-actions {
    margin-top: auto;
}

.btn {
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 18px;
    border-radius: 16px;
    font-weight: 700;
    transition: 160ms transform, 160ms box-shadow, 160ms opacity;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #d21c2c, #8c1019);
    color: #fff;
    box-shadow: 0 18px 36px rgba(193, 18, 31, 0.22);
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid #dce1e7;
}

.btn-soft {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.btn-block {
    width: 100%;
}

.badge,
.chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
}

.badge {
    background: #edf0f3;
    color: #45505c;
}

.badge.neutral {
    background: #eceff4;
    color: #384252;
}

.badge.warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge.success {
    background: var(--success-soft);
    color: var(--success);
}

.badge.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge.info,
.chip {
    background: var(--info-soft);
    color: var(--info);
}

.summary-bar {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(229, 231, 235, 0.9);
}

.table-wrap {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid #edf0f3;
    vertical-align: top;
}

.data-table th {
    font-size: 0.88rem;
    color: var(--text-soft);
    font-weight: 700;
}

.data-table td strong,
.document-item strong,
.note-card strong,
.timeline-item strong {
    display: block;
    margin-bottom: 4px;
}

.data-table td small,
.document-item small,
.note-card small,
.timeline-item small {
    color: var(--text-soft);
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline.compact {
    gap: 14px;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #d21c2c, #7f1018);
    margin-top: 6px;
    flex: 0 0 auto;
}

.timeline-dot.subtle {
    background: #c6ccd5;
}

.timeline-item p,
.note-card p,
.muted-box p {
    margin: 0 0 6px;
    color: var(--text-soft);
    line-height: 1.55;
}

.note-card,
.muted-box {
    padding: 16px;
    border-radius: 18px;
    background: var(--surface-tint);
    border: 1px solid #e8ebef;
}

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

.document-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--surface-tint);
    border: 1px solid #e8ebef;
}

.doc-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #11151c, #39414e);
    color: #fff;
    font-weight: 800;
    font-size: 0.82rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.photo-card {
    overflow: hidden;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #e8ebef;
}

.photo-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.photo-card span {
    display: block;
    padding: 12px 14px;
    font-size: 0.9rem;
    color: var(--text-soft);
}

.detail-list,
.detail-grid {
    display: grid;
    gap: 12px;
}

.detail-list div,
.detail-grid div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #edf0f3;
}

.detail-list span,
.detail-grid span {
    color: var(--text-soft);
}

.detail-list strong,
.detail-grid strong {
    text-align: right;
}

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

.top-divider,
.top-gap {
    margin-top: 18px;
}

.inline-form,
.inline-search {
    display: flex;
    gap: 12px;
    align-items: center;
}

.inline-form select,
.inline-form input,
.inline-search input {
    flex: 1 1 auto;
}

.auth-shell,
.landing-shell,
.customer-shell {
    padding: 34px 0 20px;
}

.auth-shell,
.customer-shell {
    min-height: calc(100vh - 180px);
}

.auth-card {
    width: min(100%, 560px);
    margin: 0 auto;
}

.customer-hero,
.search-card {
    align-self: start;
}

.lookup-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lookup-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--surface-tint);
    border: 1px solid #e8ebef;
}

.lookup-item button {
    flex-shrink: 0;
}

.mode-section[hidden] {
    display: none;
}

.wrap {
    flex-wrap: wrap;
}

@media (max-width: 1080px) {
    .stats-grid,
    .stats-grid.four,
    .stats-grid.three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .panel-grid,
    .hero-grid,
    .install-grid,
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .shell,
    .topbar {
        width: min(calc(100% - 22px), var(--shell));
    }

    .topbar {
        border-radius: 28px;
        align-items: flex-start;
        padding: 14px;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .topnav {
        width: 100%;
        display: none;
        padding-top: 8px;
        flex-direction: column;
        align-items: stretch;
    }

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

    .topnav a,
    .user-chip {
        width: 100%;
        text-align: left;
    }

    .page-head,
    .section-title,
    .split-head,
    .cta-band,
    .footer-copy,
    .inline-form,
    .inline-search {
        flex-direction: column;
        align-items: stretch;
    }

    .card,
    .stat-card,
    .feature-card {
        padding: 20px;
        border-radius: 22px;
    }

    .form-grid,
    .detail-grid,
    .photo-grid,
    .stats-grid,
    .stats-grid.four,
    .stats-grid.three {
        grid-template-columns: 1fr;
    }

    .field-span-2 {
        grid-column: auto;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        border-bottom: 1px solid #edf0f3;
        padding: 10px 0;
    }

    .data-table td {
        padding: 8px 0;
        border-bottom: none;
    }

    .data-table td:last-child {
        padding-top: 12px;
    }
}

@media print {
    .topbar,
    .footer-shell,
    .btn,
    .flash-stack {
        display: none !important;
    }

    body,
    body.public-body {
        background: #fff;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
