:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-alt: #f7faff;
    --surface-soft: #eef4ff;
    --line: #dbe7f5;
    --line-strong: #bfd3ef;
    --ink: #16324f;
    --muted: #68809c;
    --primary: #4b83d8;
    --primary-strong: #2d67c3;
    --primary-soft: #e8f0ff;
    --primary-soft-strong: #d5e5ff;
    --success-bg: #edf7ff;
    --success-ink: #235d98;
    --shadow-soft: 0 10px 28px rgba(84, 123, 179, 0.08);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", "SF Pro Text", "Helvetica Neue", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--primary-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

.app-shell {
    width: min(1120px, calc(100vw - 24px));
    margin: 0 auto;
    padding: max(16px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom));
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 0 18px;
}

.brand-block h1 {
    margin: 4px 0 0;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.eyebrow {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.site-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    padding: 8px;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 22px;
    position: sticky;
    top: 8px;
    z-index: 10;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 16px;
    color: var(--muted);
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.page {
    padding: 20px 0 36px;
}

.hero,
.panel,
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 20px;
    padding: 28px;
    margin-bottom: 18px;
}

.hero-copy {
    max-width: 640px;
}

.hero h2,
.section-heading h2,
.panel h2,
.panel h3 {
    margin: 6px 0 10px;
    letter-spacing: -0.03em;
}

.hero h2 {
    font-size: clamp(2rem, 3.4vw, 3rem);
}

.hero p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.03rem;
}

.hero-actions,
.actions {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
}

.card {
    padding: 22px;
}

.card-label {
    margin: 0 0 18px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.card h3 {
    margin: 0 0 4px;
    font-size: clamp(1.9rem, 5vw, 2.4rem);
    line-height: 1;
}

.card p:last-child {
    margin: 0;
    color: var(--muted);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 18px 0 14px;
}

.panel {
    padding: 22px;
    margin-bottom: 16px;
}

.panel-heading,
.timeline-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.panel-heading {
    margin-bottom: 18px;
}

.narrow {
    max-width: 520px;
    margin: 40px auto;
}

.grid.two-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.button:hover,
.button:focus-visible {
    background: var(--primary-strong);
}

.button.secondary {
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.button.secondary:hover,
.button.secondary:focus-visible {
    background: var(--primary-soft-strong);
}

.button.ghost {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--primary-strong);
}

.button.ghost:hover,
.button.ghost:focus-visible {
    background: var(--primary-soft);
}

.button.compact {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 0.92rem;
}

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

th,
td {
    text-align: left;
    padding: 14px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

tbody tr:last-child td {
    border-bottom: 0;
}

form p {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

label {
    font-weight: 600;
    color: var(--ink);
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--ink);
    font: inherit;
    appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(75, 131, 216, 0.14);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

dl {
    margin: 0;
}

dt {
    margin-top: 12px;
    font-weight: 700;
}

dt:first-child {
    margin-top: 0;
}

dd {
    margin: 4px 0 0;
    color: var(--muted);
}

.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.message {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border: 1px solid var(--line);
}

.message.success {
    background: var(--success-bg);
    color: var(--success-ink);
    border-color: #cfe5ff;
}

.message.warning {
    background: #f5f9ff;
    color: var(--primary-strong);
    border-color: #cfe0ff;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-alt);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill.info {
    background: var(--primary-soft);
    border-color: #cfe0ff;
    color: var(--primary-strong);
}

.status-pill.success {
    background: #eef7ff;
    border-color: #c8defc;
    color: #25548a;
}

.status-pill.danger {
    background: #fff3f3;
    border-color: #f0c9c9;
    color: #9d3c3c;
}

.status-pill.muted {
    background: var(--surface-alt);
    border-color: var(--line);
    color: var(--muted);
}

.inline-note,
.table-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

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

.table-actions form {
    margin: 0;
}

.timeline {
    display: grid;
    gap: 14px;
}

.timeline-item {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-alt);
}

.timeline-item p {
    margin: 8px 0 0;
    color: var(--muted);
}

code {
    padding: 0.15rem 0.4rem;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--primary-strong);
}

@media (max-width: 860px) {
    .site-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hero,
    .section-heading,
    .site-header {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 640px) {
    .app-shell {
        width: min(100vw - 16px, 100%);
    }

    .site-header {
        padding-top: 4px;
    }

    .site-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 8px;
        border-radius: 18px;
    }

    .site-nav a {
        min-height: 44px;
        font-size: 0.95rem;
    }

    .page {
        padding-top: 16px;
        padding-bottom: 28px;
    }

    .hero,
    .panel,
    .card {
        border-radius: 20px;
    }

    .hero,
    .panel,
    .card {
        box-shadow: none;
    }

    .panel-heading,
    .timeline-head {
        flex-direction: column;
    }

    .hero {
        padding: 20px;
    }

    .panel,
    .card {
        padding: 18px;
    }

    .button,
    input,
    select,
    textarea {
        min-height: 44px;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        padding: 12px 0;
        border-bottom: 1px solid var(--line);
    }

    tbody tr:last-child {
        border-bottom: 0;
    }

    td {
        padding: 4px 0;
        border-bottom: 0;
    }
}
