:root {
    color-scheme: light;
    --ink: #1c2430;
    --muted: #697386;
    --line: #d9dee8;
    --soft: #f3f5f8;
    --paper: #ffffff;
    --accent: #145c55;
    --accent-dark: #0d403b;
    --danger: #b42318;
    --success: #177245;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: #eef1f5;
    font-family: Arial, Helvetica, sans-serif;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(100%, 420px);
    padding: 32px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(28, 36, 48, 0.12);
}

.login-header {
    display: grid;
    justify-items: center;
    margin-bottom: 24px;
    text-align: center;
}

.login-logo {
    display: block;
    width: min(230px, 80%);
    height: auto;
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: 30px;
}

h2 {
    margin-bottom: 10px;
    font-size: 18px;
}

p {
    color: var(--muted);
    line-height: 1.5;
}

.login-form {
    display: grid;
    gap: 10px;
}

label {
    font-weight: 700;
    font-size: 14px;
}

input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}

select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    font: inherit;
}

textarea {
    width: 100%;
    min-height: 150px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    resize: vertical;
    font: inherit;
}

input:focus {
    outline: 3px solid rgba(20, 92, 85, 0.18);
    border-color: var(--accent);
}

select:focus,
textarea:focus {
    outline: 3px solid rgba(20, 92, 85, 0.18);
    border-color: var(--accent);
}

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

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

.button.secondary {
    color: var(--accent);
    background: #e7f0ee;
}

.button.secondary:hover {
    background: #d6e6e3;
}

button.danger,
.button.danger {
    color: #ffffff;
    background: var(--danger);
}

button.danger:hover,
.button.danger:hover {
    background: #861a12;
}

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

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

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

.alert {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 6px;
    font-weight: 700;
}

.alert.error {
    color: var(--danger);
    background: #fff0ee;
}

.alert.success {
    color: var(--success);
    background: #edf8f2;
}

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

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

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--accent);
}

.brand-logo {
    display: block;
    width: 150px;
    max-width: 42vw;
    height: auto;
}

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

.nav-links .logout {
    color: var(--danger);
}

.container {
    width: min(1120px, calc(100% - 40px));
    margin: 34px auto;
}

.dashboard-header {
    margin-bottom: 24px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

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

.card {
    min-height: 150px;
    padding: 22px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.empty-state,
.client-card,
.form-panel,
.table-wrap {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.empty-state {
    padding: 28px;
}

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

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

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

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

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

.form-panel {
    padding: 24px;
}

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

.field {
    display: grid;
    gap: 8px;
}

.field-wide {
    grid-column: span 3;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
}

.client-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: -8px 0 18px;
}

.client-menu a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    color: var(--accent);
    background: #e7f0ee;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
}

.client-menu a:hover {
    background: #d6e6e3;
}

.client-card {
    margin-bottom: 22px;
    padding: 22px;
}

.history-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin: 28px 0 14px;
}

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

.sort-links a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    color: var(--accent);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
}

.sort-links a.active {
    color: #ffffff;
    background: var(--accent);
    border-color: var(--accent);
}

.action-list {
    display: grid;
    gap: 12px;
}

.action-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.action-main {
    min-width: 0;
}

.action-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.action-meta strong,
.action-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 9px;
    background: var(--soft);
    border-radius: 6px;
    font-size: 13px;
}

.action-meta strong {
    color: var(--accent);
}

.actions-cell {
    display: flex;
    gap: 12px;
    white-space: nowrap;
}

.danger-zone {
    border-color: #f1b4ae;
}

.client-summary {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 10px 18px;
    margin: 18px 0 24px;
}

.client-summary dt {
    color: var(--muted);
    font-weight: 700;
}

.client-summary dd {
    margin: 0;
}

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

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

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .page-header,
    .history-header,
    .action-item,
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .field-wide {
        grid-column: span 1;
    }

    .client-summary {
        grid-template-columns: 1fr;
    }
}
