:root {
    color-scheme: light;
    --ink: #18212f;
    --muted: #667085;
    --line: #d9dee8;
    --paper: #f7f8fb;
    --panel: #ffffff;
    --accent: #0f766e;
    --accent-dark: #0b5f59;
    --danger: #b42318;
    --ok: #067647;
}

* {
    box-sizing: border-box;
}

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

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 58px;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.brand {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 14px;
}

nav a,
td a {
    color: var(--accent-dark);
    text-decoration: none;
}

.user {
    margin-left: auto;
    color: var(--muted);
    font-size: 14px;
}

main {
    width: min(1280px, calc(100% - 32px));
    margin: 24px auto;
}

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

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

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

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

h2 {
    font-size: 18px;
}

label {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    color: #344054;
    font-size: 14px;
    font-weight: 700;
}

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

textarea {
    resize: vertical;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    padding: 0 16px;
    color: #fff;
    background: var(--accent);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

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

.secondary {
    color: var(--ink);
    background: #e9edf5;
}

.secondary:hover {
    background: #dce3ee;
}

.toolbar {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.search {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 220px auto auto;
    gap: 10px;
}

.counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.counts span {
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

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

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

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

th {
    position: sticky;
    top: 0;
    background: #f1f4f8;
    font-size: 13px;
}

.amount {
    text-align: right;
    white-space: nowrap;
}

.editor {
    margin-bottom: 18px;
}

.form-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

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

.flash {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #eff8ff;
    border: 1px solid #b2ddff;
}

.flash.error {
    color: var(--danger);
    background: #fffbfa;
    border-color: #fecdca;
}

.flash.success {
    color: var(--ok);
    background: #ecfdf3;
    border-color: #abefc6;
}

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

.activity {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    color: var(--muted);
}

@media (max-width: 760px) {
    .topbar {
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .user {
        width: 100%;
        margin-left: 0;
    }

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

    .form-head {
        display: grid;
    }
}
