:root {
    --blue: #0b3d91;
    --blue-dark: #062b66;
    --blue-soft: #eef6ff;
    --green: #17643a;
    --green-soft: #edf8f1;
    --amber: #915b09;
    --amber-soft: #fff8e8;
    --red: #a12626;
    --red-soft: #fff1f1;
    --ink: #172033;
    --muted: #617087;
    --line: #d9dfeb;
    --paper: #ffffff;
    --canvas: #f5f7fb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--blue);
}

.spaces-header {
    background: var(--blue);
    color: white;
    padding: 18px 24px;
}

.spaces-header-inner,
.spaces-main {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.spaces-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.spaces-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.spaces-brand img {
    width: 62px;
    height: 62px;
    object-fit: contain;
    border-radius: 14px;
    background: white;
    padding: 6px;
}

.spaces-brand h1 {
    margin: 0;
    font-size: clamp(21px, 3vw, 30px);
    line-height: 1.15;
}

.spaces-brand p {
    margin: 5px 0 0;
    color: #d8e8ff;
}

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

.spaces-header-nav a {
    display: inline-block;
    color: white;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.45);
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
}

.spaces-main {
    padding: 26px 0 60px;
}

.spaces-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 18px;
}

.spaces-tabs a {
    background: white;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 13px;
    text-decoration: none;
    font-weight: 700;
}

.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 3px 14px rgba(15, 35, 70, 0.05);
}

.panel h2,
.panel h3 {
    color: var(--blue);
    margin-top: 0;
}

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

.card {
    background: #fbfdff;
    border: 1px solid #dbe6f5;
    border-radius: 12px;
    padding: 17px;
}

.card h3,
.card h4 {
    margin: 0 0 9px;
}

.meta {
    color: var(--muted);
    font-size: 14px;
}

.badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
}

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

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

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

.notice {
    padding: 13px 15px;
    border-radius: 10px;
    background: var(--blue-soft);
    border-left: 4px solid #0b66c3;
    margin: 0 0 16px;
}

.notice.success {
    background: var(--green-soft);
    border-color: var(--green);
}

.notice.error {
    background: var(--red-soft);
    border-color: var(--red);
}

label {
    display: block;
    font-weight: 700;
    margin: 0 0 6px;
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
input[type="date"],
input[type="url"],
input[type="number"],
select,
textarea {
    width: 100%;
    border: 1px solid #bdc9d9;
    border-radius: 9px;
    padding: 10px 11px;
    font: inherit;
    background: white;
}

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

.field {
    margin-bottom: 14px;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 13px;
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 11px;
    background: white;
    border: 1px solid #dbe4ef;
    border-radius: 9px;
    margin: 7px 0;
}

.choice label {
    margin: 0;
    font-weight: 600;
}

button,
.button {
    display: inline-block;
    appearance: none;
    border: 0;
    border-radius: 9px;
    background: var(--blue);
    color: white;
    padding: 10px 15px;
    font-weight: 800;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--blue-dark);
}

.button.secondary,
button.secondary {
    background: #e8eef7;
    color: #17325d;
}

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

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

.compact-form {
    display: inline;
}

.compact-form button {
    padding: 7px 10px;
}

.progress-row {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) 3fr auto;
    gap: 10px;
    align-items: center;
    margin: 8px 0;
}

.progress-track {
    height: 10px;
    border-radius: 999px;
    background: #e7edf5;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--blue);
}

.material {
    border-left: 4px solid #90abd0;
}

.material.reply {
    margin-left: 34px;
    border-left-color: #7fa98d;
}

.material-body {
    white-space: pre-wrap;
}

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

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

th,
td {
    border-bottom: 1px solid #e1e7f0;
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

th {
    color: #3e506b;
    font-size: 13px;
}

.login-wrap {
    width: min(460px, calc(100% - 28px));
    margin: 50px auto;
}

.credentials {
    background: #102a52;
    color: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 18px;
}

.credentials code {
    color: #fff3a6;
    font-size: 16px;
}

.empty {
    color: var(--muted);
    font-style: italic;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 700px) {
    .spaces-header {
        padding: 15px 10px;
    }

    .spaces-header-inner {
        width: 100%;
        align-items: flex-start;
        flex-direction: column;
    }

    .spaces-brand img {
        width: 52px;
        height: 52px;
    }

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

    .spaces-main {
        width: min(100% - 20px, 1120px);
        padding-top: 16px;
    }

    .panel {
        padding: 16px;
        border-radius: 12px;
    }

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

    .material.reply {
        margin-left: 14px;
    }

    .progress-row {
        grid-template-columns: 1fr auto;
    }

    .progress-track {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}
