:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --line: #d7dde5;
    --text: #17202a;
    --muted: #5f6b7a;
    --primary: #14532d;
    --primary-hover: #0f3f22;
    --danger: #a11717;
    --success-bg: #e9f7ef;
    --error-bg: #fdecec;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

.topbar {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    min-height: 60px;
    padding: 0 28px;
}

.brand {
    align-items: center;
    color: var(--text);
    display: inline-flex;
    font-size: 18px;
    font-weight: 700;
    gap: 10px;
}

.brand img {
    border-radius: 4px;
    height: 34px;
    object-fit: cover;
    object-position: center 28%;
    width: 34px;
}

.nav {
    align-items: center;
    display: flex;
    gap: 18px;
}

.nav form {
    margin: 0;
}

.link-button {
    background: none;
    border: 0;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.page {
    margin: 0 auto;
    max-width: 1180px;
    padding: 32px 24px;
}

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 19px;
}

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

.heading-row {
    align-items: center;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 22px;
}

.narrow,
.auth-panel,
.export-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 24px;
}

.narrow {
    max-width: 760px;
}

.auth-panel {
    margin: 60px auto;
    max-width: 420px;
}

.login-shell {
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
    margin: 44px auto;
    max-width: 980px;
    min-height: 520px;
    overflow: hidden;
}

.login-shell .auth-panel {
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    margin: 0;
    max-width: none;
    padding: 44px;
}

.login-image {
    background: #111827;
    min-height: 360px;
}

.login-image img {
    display: block;
    height: 100%;
    object-fit: cover;
    object-position: center;
    width: 100%;
}

.form {
    display: grid;
    gap: 18px;
    margin-top: 22px;
}

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

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

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

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

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

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

.button.primary:hover {
    background: var(--primary-hover);
    text-decoration: none;
}

.actions,
.inline-form {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.inline-form label {
    min-width: 180px;
}

.search-bar {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(240px, 1fr) 180px 150px auto;
    margin-bottom: 18px;
}

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

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

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

th {
    background: #eef2f6;
    color: #334155;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.empty {
    color: var(--muted);
    padding: 28px;
    text-align: center;
}

.messages {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.message {
    border-radius: 6px;
    padding: 12px 14px;
}

.message-success {
    background: var(--success-bg);
    color: #14532d;
}

.message-error {
    background: var(--error-bg);
    color: var(--danger);
}

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

.summary-grid div {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 16px;
}

.summary-grid span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.summary-grid strong {
    display: block;
    font-size: 18px;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.export-panel {
    margin-bottom: 18px;
}

.export-panel h2 {
    margin-bottom: 14px;
}

.pagination {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 18px;
}

ul.errorlist {
    color: var(--danger);
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 760px) {
    .topbar,
    .heading-row,
    .nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar {
        gap: 12px;
        padding: 16px;
    }

    .page {
        padding: 22px 14px;
    }

    .grid.two,
    .search-bar,
    .summary-grid,
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-shell {
        margin: 0 auto;
        min-height: 0;
    }

    .login-shell .auth-panel {
        border-left: 0;
        border-top: 1px solid var(--line);
        padding: 24px;
    }

    .login-image {
        min-height: 240px;
    }
}
