:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: #dce5ef;
    --brand: #115e7a;
    --brand-2: #16a085;
    --danger: #c2410c;
    --warn: #b7791f;
    --ok: #147a52;
    --shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Open Sans", Arial, sans-serif;
    font-size: 14px;
}

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

svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    background: #102333;
    color: #d8e7ef;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    color: #fff;
    text-decoration: none;
    padding: 6px 8px 22px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--brand-2);
    color: #fff;
    font-weight: 800;
}

.brand small {
    display: block;
    margin-top: 2px;
    color: #a9c2d0;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    color: #c8d7e1;
    text-decoration: none;
    border-radius: 8px;
}

.nav a.active,
.nav a:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.nav b {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--brand-2);
    color: #fff;
    font-size: 12px;
}

.workspace {
    min-width: 0;
}

.topbar {
    min-height: 92px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 22px 30px;
    background: rgba(244, 247, 251, .92);
    border-bottom: 1px solid var(--line);
}

.topbar p {
    margin: 0 0 4px;
    color: var(--muted);
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.content {
    padding: 28px 30px 48px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.metric,
.panel,
.login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 18px;
}

.metric-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #e7f5f1;
    color: var(--brand);
}

.metric strong {
    display: block;
    font-size: 22px;
    line-height: 1.15;
}

.metric p,
.metric small {
    margin: 2px 0 0;
    color: var(--muted);
}

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

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

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

.panel h2 {
    margin: 0 0 16px;
    font-size: 18px;
    line-height: 1.25;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.panel-head h2 {
    margin: 0;
}

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

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

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

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button.primary {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.button.ghost {
    background: #f8fafc;
}

.wide-button {
    width: 100%;
    margin-top: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stack-form,
.compact-form {
    display: grid;
    gap: 12px;
}

.compact-form {
    grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
    align-items: end;
    margin-top: 16px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 10px;
    color: var(--text);
    font: inherit;
}

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

.wide {
    grid-column: 1 / -1;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.check input {
    width: auto;
    min-height: 0;
}

.form-actions,
.actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef2f6;
    color: #344054;
    font-weight: 700;
    font-size: 12px;
}

.badge.active,
.badge.finalized,
.badge.answered,
.badge.accepted {
    background: #e7f6ee;
    color: var(--ok);
}

.badge.late,
.badge.missing,
.badge.rejected {
    background: #fff1e7;
    color: var(--danger);
}

.badge.in_review,
.badge.open,
.badge.pending,
.badge.unclear {
    background: #fff7db;
    color: var(--warn);
}

.storage {
    min-width: 160px;
}

.storage > div {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e9eef5;
}

.storage span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--brand-2);
}

.storage p {
    margin: 7px 0 0;
    color: var(--muted);
}

.upload-row {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(180px, 1fr) minmax(140px, .8fr) minmax(220px, 1.4fr);
    gap: 10px;
}

.secret-value {
    display: inline-block;
    max-width: 280px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

.inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 6px;
}

.inline-form input,
.inline-form select {
    width: auto;
    min-width: 130px;
}

.doc-comments {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.doc-comments p {
    margin: 4px 0;
    color: var(--muted);
}

details summary {
    cursor: pointer;
    color: var(--brand);
    font-weight: 700;
}

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

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

.message {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.message header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
}

.message p {
    margin: 10px 0;
    line-height: 1.55;
}

.notifications {
    display: grid;
    gap: 10px;
}

.notification {
    display: block;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

.notification.unread {
    border-color: var(--brand-2);
    background: #f0fbf8;
}

.notification p {
    margin: 6px 0;
    color: var(--muted);
}

.notification span,
.muted {
    color: var(--muted);
}

.alert {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.alert.success {
    border-color: #b7e4cd;
    background: #f0fbf5;
    color: var(--ok);
}

.alert.error {
    border-color: #ffd1be;
    background: #fff7f2;
    color: var(--danger);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background: #eef4f8;
}

.login-card {
    width: min(440px, 100%);
    padding: 28px;
}

.login-brand {
    margin-bottom: 22px;
}

.login-brand h1 {
    margin: 14px 0 6px;
    font-size: 28px;
}

.login-brand p {
    margin: 0;
    color: var(--muted);
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 88px minmax(0, 1fr);
    }

    .brand span:last-child,
    .nav span,
    .nav b {
        display: none;
    }

    .nav a {
        justify-content: center;
    }

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

@media (max-width: 760px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        height: auto;
    }

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

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .content {
        padding: 18px;
    }

    .metrics,
    .grid.two,
    .form-grid,
    .compact-form,
    .upload-row {
        grid-template-columns: 1fr;
    }
}
