:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #1d2430;
    --muted: #667085;
    --line: #d9dee7;
    --brand: #116a74;
    --brand-dark: #0d4f57;
    --warn: #b93815;
    --warn-bg: #fff0e8;
    --ok-bg: #eaf7f1;
}

* {
    box-sizing: border-box;
}

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

a {
    color: inherit;
}

.topbar {
    align-items: center;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.brand {
    color: var(--brand-dark);
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

nav a,
.button,
button {
    background: var(--brand);
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    min-height: 38px;
    padding: 9px 13px;
    text-decoration: none;
}

nav a {
    background: transparent;
    color: var(--ink);
    font-weight: 600;
}

nav a:hover {
    background: #eef3f4;
}

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

.button.warn {
    background: var(--warn);
}

.table-link {
    color: var(--brand-dark);
    font-weight: 800;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.shell {
    margin: 0 auto;
    max-width: 1280px;
    padding: 28px;
}

.notice,
.empty,
.warning {
    background: var(--ok-bg);
    border: 1px solid #bddfce;
    border-radius: 8px;
    margin-bottom: 18px;
    padding: 14px 16px;
}

.warning {
    background: var(--warn-bg);
    border-color: #e88965;
    color: #842b12;
    font-weight: 700;
}

.login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 8vh auto;
    max-width: 440px;
    padding: 28px;
}

h1,
h2 {
    margin: 0 0 14px;
}

p {
    color: var(--muted);
    margin: 0 0 18px;
}

form {
    margin: 0;
}

label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    font-weight: 700;
    gap: 6px;
    margin-bottom: 14px;
}

input,
select {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font: inherit;
    min-height: 38px;
    padding: 8px 10px;
    width: 100%;
}

.demo {
    color: var(--muted);
    font-size: 13px;
    margin-top: 18px;
}

.hero {
    align-items: stretch;
    background: linear-gradient(135deg, #0f5961, #287d6f);
    border-radius: 8px;
    color: #fff;
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr 190px;
    margin-bottom: 24px;
    padding: 26px;
}

.hero p {
    color: #e9fbf7;
    max-width: 720px;
}

.stat {
    align-items: center;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 8px;
    display: grid;
    justify-items: center;
    padding: 18px;
}

.stat span {
    color: #d8f5ef;
    font-size: 13px;
    font-weight: 700;
}

.stat strong {
    font-size: 44px;
}

.grid.two {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
}

article,
.editor,
.profile {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

.editor.nested {
    margin: 18px 0;
}

.cards {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.card {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    min-height: 94px;
    padding: 16px;
    text-decoration: none;
}

.card:hover {
    border-color: var(--brand);
}

.card span {
    font-weight: 800;
}

.card small {
    color: var(--muted);
}

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

.page-title {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.page-title p {
    margin-bottom: 0;
}

.page-title form {
    align-items: end;
    display: flex;
    gap: 8px;
}

.page-title input {
    width: 110px;
}

.table-wrap {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: auto;
}

.table-wrap.narrow {
    max-width: 980px;
}

.filters {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 16px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
}

.tabs a {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    min-width: 48px;
    padding: 8px 10px;
    text-align: center;
    text-decoration: none;
}

.tabs a.active,
.tabs a:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

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

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

thead th {
    background: #eef3f4;
    font-size: 13px;
    z-index: 2;
}

tbody th {
    font-weight: 800;
    white-space: nowrap;
}

tr.has-collision td,
tr.has-collision th {
    background: var(--warn-bg);
}

.cell-groups {
    display: grid;
    gap: 8px;
    min-width: 170px;
}

.cell-group strong {
    color: var(--brand-dark);
    display: block;
    font-size: 13px;
    margin-bottom: 3px;
}

.cell-group ul {
    margin: 0;
    padding-left: 18px;
}

.cell-group li {
    margin: 2px 0;
}

.risk-person {
    background: #ffd8c7;
    border: 1px solid #e88965;
    border-radius: 5px;
    color: #842b12;
    font-weight: 800;
    line-height: 1.35;
    list-style-position: outside;
    padding: 2px 5px;
}

.form-grid {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-grid button {
    align-self: end;
    margin-bottom: 14px;
}

.check {
    align-items: center;
    display: flex;
    gap: 8px;
    min-height: 38px;
}

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

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

.detail-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.detail-list div {
    background: #f6f7f9;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    gap: 2px;
    padding: 8px;
}

.detail-list span {
    color: var(--muted);
    font-size: 13px;
}

.row-actions {
    min-width: 250px;
}

.row-actions > form {
    margin-top: 8px;
}

.edit-form {
    background: #f6f7f9;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding: 12px;
}

.edit-form button {
    justify-content: center;
}

.link {
    background: transparent;
    color: var(--brand);
    min-height: 0;
    padding: 0;
}

.link.danger {
    color: var(--warn);
}

.group-field {
    display: none;
}

body.group-mode .group-field {
    display: grid;
}

body.group-mode .person-field {
    display: none;
}

@media (max-width: 760px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: 14px 18px;
    }

    nav {
        justify-content: flex-start;
    }

    .shell {
        padding: 18px;
    }

    .hero,
    .grid.two {
        grid-template-columns: 1fr;
    }

}
