:root {
    --bg: #f3f6fb;
    --bg-accent: #e9f0fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --surface-strong: #edf4ff;
    --text: #172131;
    --text-strong: #0e1726;
    --muted: #5f6b7d;
    --border: #d6e1ef;
    --border-strong: #c2d0e2;
    --primary: #0b5cab;
    --primary-strong: #08457f;
    --success: #12673d;
    --success-soft: #ecf8f1;
    --warning: #8a610a;
    --warning-soft: #fff7e3;
    --danger: #a12739;
    --danger-soft: #fff1f3;
    --info-soft: #eef5ff;
    --shadow-sm: 0 10px 30px rgba(19, 35, 66, 0.06);
    --shadow-md: 0 18px 40px rgba(16, 28, 51, 0.10);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --container: 1240px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(27, 93, 171, 0.10), transparent 34%),
        radial-gradient(circle at top right, rgba(18, 103, 61, 0.06), transparent 26%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
    line-height: 1.5;
}

body.app-shell {
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

a,
button,
input,
select,
textarea,
summary {
    transition: all 0.18s ease;
}

img {
    max-width: 100%;
}

code,
pre,
kbd {
    font-family: ui-monospace, SFMono-Regular, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.container {
    width: min(100%, var(--container));
    margin: 0 auto;
    padding: 0 24px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(214, 225, 239, 0.75);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 76px;
}

.site-header__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.site-header__eyebrow {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.site-header__tagline {
    font-size: 0.95rem;
    color: var(--muted);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: var(--text-strong);
    font-weight: 800;
    min-width: 0;
}

.brand:hover {
    text-decoration: none;
}

.brand img {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    box-shadow: 0 10px 22px rgba(11, 92, 171, 0.18);
    flex: 0 0 auto;
}

.brand__text {
    min-width: 0;
}

.brand__name {
    display: block;
    font-size: 1rem;
    line-height: 1.15;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.nav a,
.nav button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid transparent;
    color: var(--text);
    background: transparent;
    text-decoration: none;
}

.nav a:hover,
.nav button:hover {
    background: rgba(11, 92, 171, 0.08);
    text-decoration: none;
}

.nav form.inline {
    display: inline-flex;
    margin: 0;
}

main.container {
    flex: 1 0 auto;
    padding-top: 30px;
    padding-bottom: 40px;
}

.site-footer {
    padding: 18px 0 36px;
    color: var(--muted);
    font-size: 0.9rem;
}

.site-footer__inner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin: 0 0 26px;
}

.page-header__main {
    max-width: 860px;
}

.page-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--primary);
}

.page-title {
    margin: 0;
    color: var(--text-strong);
    font-size: clamp(2rem, 2.4vw, 2.8rem);
    line-height: 1.08;
}

.page-lead {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 1.02rem;
    max-width: 76ch;
}

.page-header__meta {
    min-width: 260px;
    max-width: 360px;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.header-meta-card {
    padding: 18px 20px;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.96));
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-meta-card__label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.header-meta-card__value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-strong);
}

.header-meta-card__note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.card {
    margin-bottom: 24px;
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-sm);
}

.card--soft {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,251,255,0.98));
}

.card--accent {
    background: linear-gradient(135deg, rgba(238,245,255,0.92), rgba(255,255,255,0.98));
    border-color: rgba(11, 92, 171, 0.18);
}

.card--success {
    background: linear-gradient(135deg, rgba(236,248,241,0.98), rgba(255,255,255,0.98));
    border-color: rgba(18, 103, 61, 0.18);
}

.card--warning {
    background: linear-gradient(135deg, rgba(255,247,227,0.98), rgba(255,255,255,0.98));
    border-color: rgba(138, 97, 10, 0.18);
}

.card h2,
.card h3,
.card h4 {
    margin: 0 0 14px;
    color: var(--text-strong);
}

.card h2 {
    font-size: 1.35rem;
}

.card h3 {
    font-size: 1.08rem;
}

.card > :last-child {
    margin-bottom: 0;
}

.grid {
    display: grid;
    gap: 24px;
}

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

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

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

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

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

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
}

.actions--spread {
    justify-content: space-between;
}

.button,
button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: var(--primary);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    line-height: 1.1;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(11, 92, 171, 0.16);
    text-decoration: none;
}

.button:hover,
button:hover {
    background: var(--primary-strong);
    text-decoration: none;
    transform: translateY(-1px);
}

.button.secondary,
button.secondary {
    background: #ffffff;
    color: var(--primary);
    border-color: rgba(11, 92, 171, 0.18);
    box-shadow: none;
}

.button.secondary:hover,
button.secondary:hover {
    background: var(--info-soft);
}

.button.ghost,
button.ghost {
    background: rgba(11, 92, 171, 0.08);
    color: var(--primary);
    box-shadow: none;
}

.button.danger,
button.danger {
    background: var(--danger);
}

.button.danger:hover,
button.danger:hover {
    background: #851e2f;
}

button[disabled],
.button[aria-disabled="true"] {
    opacity: 0.54;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.is-loading,
.button.is-loading {
    opacity: 0.78;
    pointer-events: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: #eef3f9;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1;
}

.badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.85;
}

.badge.neutral {
    background: #eef3f9;
    color: #556274;
}

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

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

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

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

.badge.dark {
    background: rgba(23, 33, 49, 0.08);
    color: var(--text-strong);
}

.badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kv,
.definition-list {
    display: grid;
    gap: 0;
    grid-template-columns: minmax(180px, 240px) 1fr;
}

.kv div,
.definition-list div {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.kv strong,
.definition-list strong {
    color: var(--muted);
    font-weight: 700;
}

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

.info-stat {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,249,253,0.98));
}

.info-stat__label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.info-stat__value {
    display: block;
    font-size: 1.38rem;
    font-weight: 800;
    color: var(--text-strong);
}

.info-stat__hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.9rem;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

table,
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

thead th {
    position: sticky;
    top: 0;
    background: #f8fbff;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

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

tbody tr:hover {
    background: rgba(11, 92, 171, 0.03);
}

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

.row-title {
    display: block;
    color: var(--text-strong);
    font-weight: 700;
    line-height: 1.3;
}

.row-subtitle,
.row-meta,
.table-note {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.92rem;
}

.section-note,
.muted {
    color: var(--muted);
}

.inline-note {
    font-size: 0.92rem;
    color: var(--muted);
}

.files-list,
.list-reset {
    margin: 0;
    padding: 0;
    list-style: none;
}

.files-list li + li,
.list-reset li + li {
    margin-top: 12px;
}

.file-item,
.document-item,
.log-item {
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.file-item__title,
.document-item__title,
.log-item__title {
    display: block;
    font-weight: 700;
    color: var(--text-strong);
}

.file-item__meta,
.document-item__meta,
.log-item__meta {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.92rem;
}

.flash-list {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.flash {
    position: relative;
    padding: 16px 48px 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.flash__title {
    display: block;
    margin-bottom: 4px;
    font-weight: 800;
}

.flash.success {
    border-color: rgba(18, 103, 61, 0.18);
    background: linear-gradient(180deg, rgba(236,248,241,0.95), rgba(255,255,255,0.98));
    color: var(--success);
}

.flash.error {
    border-color: rgba(161, 39, 57, 0.22);
    background: linear-gradient(180deg, rgba(255,241,243,0.96), rgba(255,255,255,0.98));
    color: var(--danger);
}

.flash.info {
    border-color: rgba(11, 92, 171, 0.18);
    background: linear-gradient(180deg, rgba(238,245,255,0.95), rgba(255,255,255,0.98));
    color: var(--primary);
}

.flash.warning {
    border-color: rgba(138, 97, 10, 0.22);
    background: linear-gradient(180deg, rgba(255,247,227,0.96), rgba(255,255,255,0.98));
    color: var(--warning);
}

.flash-dismiss {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: inherit;
    box-shadow: none;
}

.flash-dismiss:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: none;
}

.form-message {
    margin-bottom: 22px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #ffffff;
}

.form-message--error {
    border-color: rgba(161, 39, 57, 0.22);
    background: linear-gradient(180deg, rgba(255,241,243,0.96), rgba(255,255,255,0.98));
}

.form-message__title {
    margin: 0 0 10px;
    font-size: 1rem;
    color: var(--danger);
}

.errors {
    margin: 0;
    padding-left: 20px;
    color: var(--danger);
}

.errors li + li {
    margin-top: 6px;
}

form.inline {
    display: inline;
    margin: 0;
}

.form-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.field label,
.field legend {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-strong);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    background: #ffffff;
    color: var(--text);
    font: inherit;
    box-shadow: inset 0 1px 2px rgba(17, 26, 39, 0.02);
}

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

.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: #b7c8dd;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: rgba(11, 92, 171, 0.42);
    box-shadow: 0 0 0 4px rgba(11, 92, 171, 0.10);
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
    border-color: rgba(161, 39, 57, 0.46);
    box-shadow: 0 0 0 4px rgba(161, 39, 57, 0.10);
}

.field-hint {
    color: var(--muted);
    font-size: 0.88rem;
}

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

.form-section {
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,251,255,0.98));
}

.form-section + .form-section {
    margin-top: 18px;
}

.form-section__header {
    margin-bottom: 18px;
}

.form-section__title {
    margin: 0;
    font-size: 1.08rem;
}

.form-section__lead {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.form-actions {
    position: sticky;
    bottom: 14px;
    z-index: 8;
    margin-top: 24px;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid rgba(214, 225, 239, 0.92);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
}

.form-actions__row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.form-actions__note {
    color: var(--muted);
    font-size: 0.92rem;
}

.consent-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 22px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(11, 92, 171, 0.14);
    background: linear-gradient(180deg, rgba(238,245,255,0.95), rgba(255,255,255,0.98));
}

.consent-row input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.consent-row__title {
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
    color: var(--text-strong);
}

.consent-row__text {
    color: var(--muted);
}

.state-panel {
    padding: 28px;
    border-radius: 28px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,251,255,0.98));
    box-shadow: var(--shadow-sm);
}

.state-panel__eyebrow {
    display: inline-flex;
    margin-bottom: 14px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(17, 33, 49, 0.06);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.state-panel__title {
    margin: 0;
    font-size: clamp(1.8rem, 2.2vw, 2.45rem);
    line-height: 1.1;
    color: var(--text-strong);
}

.state-panel__message {
    margin: 14px 0 0;
    max-width: 70ch;
    color: var(--muted);
    font-size: 1rem;
}

.state-panel__diagnostics {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(255,255,255,0.84);
    border: 1px dashed rgba(95, 107, 125, 0.28);
}

.state-panel__diagnostics ul {
    margin: 0;
    padding-left: 18px;
}

.state-panel__actions {
    margin-top: 22px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.state-panel--success {
    border-color: rgba(18, 103, 61, 0.18);
    background: linear-gradient(135deg, rgba(236,248,241,0.98), rgba(255,255,255,0.98));
}

.state-panel--warning {
    border-color: rgba(138, 97, 10, 0.20);
    background: linear-gradient(135deg, rgba(255,247,227,0.98), rgba(255,255,255,0.98));
}

.state-panel--danger {
    border-color: rgba(161, 39, 57, 0.20);
    background: linear-gradient(135deg, rgba(255,241,243,0.98), rgba(255,255,255,0.98));
}

.state-panel--info {
    border-color: rgba(11, 92, 171, 0.18);
    background: linear-gradient(135deg, rgba(238,245,255,0.98), rgba(255,255,255,0.98));
}

details {
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #ffffff;
    overflow: hidden;
}

details + details {
    margin-top: 12px;
}

summary {
    cursor: pointer;
    list-style: none;
    padding: 14px 16px;
    font-weight: 700;
    color: var(--text-strong);
    background: rgba(248, 251, 255, 0.92);
}

summary::-webkit-details-marker {
    display: none;
}

details[open] summary {
    border-bottom: 1px solid var(--border);
}

details > *:not(summary) {
    margin: 0;
    padding: 16px;
}

pre.log,
pre {
    margin: 0;
    padding: 16px;
    border-radius: 16px;
    overflow-x: auto;
    border: 1px solid var(--border);
    background: #0f1726;
    color: #e9eef7;
    font-size: 0.9rem;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 22px 0;
}

.code-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(17, 33, 49, 0.06);
    color: var(--text-strong);
    font-size: 0.92rem;
    font-weight: 700;
}

.empty-state {
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px dashed rgba(95, 107, 125, 0.28);
    background: rgba(248, 251, 255, 0.86);
    color: var(--muted);
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 220px);
}

.auth-card {
    width: min(100%, 560px);
    padding: 30px;
}

.auth-card__lead {
    margin: 10px 0 0;
    color: var(--muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.main-shell .site-header__eyebrow {
    color: var(--primary);
}

.public-shell .site-header {
    background: rgba(255, 255, 255, 0.92);
}

.admin-shell {
    background:
        radial-gradient(circle at top right, rgba(11, 92, 171, 0.10), transparent 24%),
        linear-gradient(180deg, #f4f7fb 0%, #eef3f8 100%);
}

.admin-shell .site-header {
    background: rgba(11, 22, 39, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.admin-shell .brand,
.admin-shell .nav a,
.admin-shell .nav button,
.admin-shell .site-header__tagline,
.admin-shell .site-header__eyebrow,
.admin-shell .brand__name {
    color: #f5f8fc;
}

.admin-shell .nav a:hover,
.admin-shell .nav button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.admin-shell .button.secondary,
.admin-shell button.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.18);
}

@media (max-width: 1080px) {
    .grid.two,
    .grid.three {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header__meta {
        max-width: none;
    }

    .header-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .site-header .container {
        min-height: auto;
        padding-top: 14px;
        padding-bottom: 14px;
        align-items: flex-start;
        flex-direction: column;
    }

    main.container {
        padding-top: 22px;
    }

    .nav {
        justify-content: flex-start;
    }

    .kv,
    .definition-list {
        grid-template-columns: 1fr;
    }

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

    .card,
    .form-section,
    .state-panel {
        padding: 20px;
        border-radius: 20px;
    }

    .form-actions {
        position: static;
    }

    .site-footer__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-wrap {
        border-radius: 14px;
    }

    th,
    td {
        padding: 12px 12px;
    }
}
