:root {
    --app-bg: #f4f7fb;
    --app-surface: #ffffff;
    --app-border: #d7dfeb;
    --app-primary: #0f4c81;
    --app-primary-soft: #dce8f5;
    --app-text: #17202a;
    --app-muted: #5a6978;
    --app-success: #2f7d4a;
    --app-danger: #a83b32;
    --app-radius: 16px;
    --app-shadow: 0 20px 40px rgba(15, 76, 129, 0.08);
    --app-font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--app-font);
    background: linear-gradient(180deg, #eef4fb 0%, #f8fafc 100%);
    color: var(--app-text);
}

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

a:hover {
    text-decoration: underline;
}

.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #0a2238;
    color: #fff;
    padding: 18px 24px;
}

.topbar__inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.topbar__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: #fff;
    text-decoration: none;
}

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

.brand__logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    padding: 6px;
}

.brand__name {
    display: block;
    max-width: 320px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}

.topbar__nav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.topbar__nav a {
    color: #d8e7f5;
    font-size: 0.95rem;
}

.page {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

.hero,
.card,
.status-grid__item,
.notice {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.hero {
    padding: 28px;
    margin-bottom: 24px;
}

.hero h1,
.card h2,
.card h3 {
    margin-top: 0;
}

.hero p,
.card p,
.card li,
.notice {
    color: var(--app-muted);
    line-height: 1.6;
}

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

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

.card {
    padding: 24px;
}

.list {
    margin: 0;
    padding-left: 18px;
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: var(--app-primary);
    color: #fff;
    font-weight: 600;
}

.button--secondary {
    background: var(--app-primary-soft);
    border-color: #b7cbe2;
    color: var(--app-primary);
}

.button:hover {
    text-decoration: none;
    opacity: 0.94;
}

.notice {
    padding: 16px 18px;
    margin-bottom: 18px;
}

.notice--success {
    border-color: #bedbc6;
    color: var(--app-success);
    background: #eef8f1;
}

.notice--danger {
    border-color: #e4c1bc;
    color: var(--app-danger);
    background: #fcf0ee;
}

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

.status-grid__item {
    padding: 18px;
}

.status-grid__label {
    display: block;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-muted);
    margin-bottom: 8px;
}

.status-grid__value {
    font-size: 1.05rem;
    font-weight: 700;
}

.form {
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-weight: 600;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 12px 14px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: #fff;
    color: var(--app-text);
}

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

.field--checkbox {
    gap: 12px;
}

.field--checkbox > label,
.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
}

.field--checkbox input[type="checkbox"],
.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.checkbox-list {
    display: grid;
    gap: 10px;
}

.code {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef4fb;
    border: 1px solid #d4e1ef;
    color: #214766;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9rem;
}

.cards-stack {
    display: grid;
    gap: 16px;
}

.mini-card {
    padding: 18px;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fbfdff;
}

.mini-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.preformatted {
    margin: 0;
    padding: 16px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: #f8fbff;
    color: var(--app-text);
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

body.modal-open {
    overflow: hidden;
}

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 34, 56, 0.62);
}

.modal__panel {
    position: relative;
    width: min(960px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    margin: 24px auto;
    padding: 24px;
    overflow-y: auto;
    border-radius: 20px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    box-shadow: 0 30px 60px rgba(10, 34, 56, 0.22);
}

.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.modal__header h2 {
    margin: 0 0 8px;
}

.modal__header p {
    margin: 0;
    color: var(--app-muted);
}

.modal__body {
    display: grid;
    gap: 18px;
}

.manual-section {
    padding: 18px;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fbfdff;
}

.manual-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.manual-list {
    margin: 0;
    padding-left: 20px;
    color: var(--app-muted);
    line-height: 1.7;
}

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

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

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

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

.table th {
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.badge--success {
    background: #eef8f1;
    border-color: #bedbc6;
    color: var(--app-success);
}

.badge--danger {
    background: #fcf0ee;
    border-color: #e4c1bc;
    color: var(--app-danger);
}

.badge--warning {
    background: #fff8e8;
    border-color: #f1d58b;
    color: #8f6400;
}

.badge--info {
    background: #eef4fb;
    border-color: #c8d8eb;
    color: #214766;
}

.actions--tight {
    gap: 8px;
}

.actions--tight form {
    margin: 0;
}

@media (max-width: 640px) {
    .topbar__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .brand__name {
        max-width: none;
    }

    .page {
        padding: 24px 16px 40px;
    }

    .hero,
    .card {
        padding: 20px;
    }

    .modal__panel {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        margin: 10px auto;
        padding: 18px;
    }

    .modal__header {
        flex-direction: column;
    }
}
