:root {
    --bg: #f4f7f6;
    --panel: #ffffff;
    --text: #1c2623;
    --muted: #63716c;
    --line: #dce5e1;
    --primary: #176b5b;
    --primary-dark: #0f5145;
    --danger: #b42318;
    --badge: #e7f4ef;
}

* {
    box-sizing: border-box;
}

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

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 36px auto;
}

.login-page {
    min-height: calc(100vh - 72px);
    display: grid;
    place-items: center;
}

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

.narrow {
    width: min(760px, calc(100% - 32px));
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.navbar strong {
    color: var(--primary-dark);
}

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

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

.eyebrow {
    margin: 0 0 4px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.15;
}

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

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

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

.button.ghost {
    color: var(--muted);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

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

.notice.success {
    border-color: #a8d8bf;
    color: #145c35;
}

.notice.danger {
    border-color: #f2b8b5;
    color: var(--danger);
}

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

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

.stat {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.stat span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

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

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.spaced {
    margin-top: 18px;
}

.filters,
.form {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.filters {
    grid-template-columns: minmax(180px, 1fr) 220px auto auto;
    align-items: end;
}

.client-filters {
    grid-template-columns: minmax(180px, 1fr) auto auto;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-label input {
    width: auto;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    color: var(--text);
    font: inherit;
    background: #fff;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(23, 107, 91, 0.16);
    border-color: var(--primary);
}

.help {
    min-height: 18px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

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

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

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

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

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

.badge {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--badge);
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.actions {
    width: 140px;
    white-space: nowrap;
}

td.actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

td.actions form {
    margin: 0;
}

.link {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

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

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

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

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

@media (max-width: 760px) {
    .page {
        margin: 22px auto;
    }

    .header,
    .navbar,
    .nav-actions,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .filters,
    .client-filters,
    .stats-grid,
    .two-columns {
        grid-template-columns: 1fr;
    }
}
