:root {
    --app-font-stack: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --text-strong: #172033;
    --text-body: #334155;
    --text-soft: #64748b;
    --surface-line: rgba(23, 32, 51, 0.12);
    --surface-soft: rgba(255, 255, 255, 0.72);
    --surface-soft-strong: rgba(255, 255, 255, 0.92);
    --status-bg: rgba(20, 33, 61, 0.07);
    --status-text: #1f3a56;
    --status-success-bg: rgba(15, 118, 110, 0.12);
    --status-success-text: #0f766e;
    --status-warn-bg: rgba(255, 122, 24, 0.14);
    --status-warn-text: #b45309;
    --status-danger-bg: rgba(185, 28, 28, 0.12);
    --status-danger-text: #b91c1c;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--app-font-stack);
    font-size: 1rem;
    line-height: 1.65;
    letter-spacing: -0.01em;
    color: var(--text-body);
    text-rendering: optimizeLegibility;
    min-width: 320px;
}

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

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6,
.display-6 {
    color: var(--text-strong);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

h1,
.h1,
.display-6 {
    font-size: clamp(2rem, 1.6rem + 1.3vw, 2.85rem);
}

h2,
.h2 {
    font-size: clamp(1.55rem, 1.3rem + 0.8vw, 2.15rem);
}

h3,
.h3 {
    font-size: clamp(1.3rem, 1.15rem + 0.55vw, 1.7rem);
}

h4,
.h4 {
    font-size: 1.2rem;
}

h5,
.h5 {
    font-size: 1.02rem;
}

h6,
.h6 {
    font-size: 0.9rem;
}

p,
li,
td,
label,
.form-text,
.alert,
.nav-link,
.navbar-brand {
    font-size: 0.97rem;
}

.lead {
    font-size: 1.06rem;
    line-height: 1.72;
    color: var(--text-soft);
}

.small,
small {
    font-size: 0.84rem !important;
    line-height: 1.5;
}

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

.navbar-brand {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.nav-link {
    font-weight: 600;
}

.form-label {
    margin-bottom: 0.45rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.form-control,
.form-select {
    min-height: 3rem;
    border-radius: 14px;
    border-color: var(--surface-line);
    font-size: 0.97rem;
    color: var(--text-strong);
    padding: 0.7rem 0.9rem;
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 122, 24, 0.14);
    border-color: rgba(255, 122, 24, 0.4);
}

textarea.form-control {
    min-height: 7rem;
}

.btn {
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 0.72rem 1.05rem;
}

.btn-sm {
    border-radius: 12px;
    font-size: 0.84rem;
    padding: 0.48rem 0.78rem;
}

.btn-lg {
    font-size: 1rem;
    padding: 0.9rem 1.2rem;
}

th {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-soft);
}

td {
    vertical-align: middle;
}

.table > :not(caption) > * > * {
    padding: 0.95rem 1rem;
}

.card,
.alert {
    border-radius: 18px;
}

.table-responsive,
.table-shell {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-shell .table {
    min-width: 760px;
}

.page-shell {
    padding-bottom: 3rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    min-height: 2rem;
    padding: 0.4rem 0.72rem;
    border-radius: 999px;
    background: var(--status-bg);
    color: var(--status-text);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.3;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.status-success {
    background: var(--status-success-bg);
    color: var(--status-success-text);
}

.status-warn {
    background: var(--status-warn-bg);
    color: var(--status-warn-text);
}

.status-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger-text);
}

.status-cell {
    min-width: 10rem;
}

.responsive-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-subgrid {
    display: grid;
    gap: 1rem;
}

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

.detail-card {
    padding: 1rem 1.05rem;
    border: 1px solid var(--surface-line);
    border-radius: 18px;
    background: var(--surface-soft-strong);
}

.detail-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.detail-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-strong);
    overflow-wrap: anywhere;
}

.mono-wrap {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sticky-summary {
    position: sticky;
    top: 1.5rem;
}

code {
    font-size: 0.88em;
}

@media (max-width: 768px) {
    body {
        font-size: 0.96rem;
    }

    .lead {
        font-size: 1rem;
    }

    .table > :not(caption) > * > * {
        padding: 0.8rem 0.85rem;
    }

    .table-shell .table {
        min-width: 680px;
    }

    .status-cell {
        min-width: 8.5rem;
    }

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

@media (max-width: 576px) {
    .page-shell {
        padding-bottom: 2rem;
    }

    .toolbar-grid {
        grid-template-columns: 1fr !important;
    }

    .responsive-actions > * {
        width: 100%;
    }

    .table-shell .table {
        min-width: 620px;
    }
}
