:root {
    --bg: #f5f5f2;
    --card: #ffffff;
    --text: #1e1e1e;
    --muted: #666;
    --brand: #1f5f3b;
    --brand-dark: #163f29;
    --border: #deded8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
    background: var(--brand-dark);
    color: white;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.topbar span {
    display: block;
    font-size: 13px;
    opacity: .85;
}

.topbar a {
    color: white;
    text-decoration: none;
    margin-right: 10px;
    font-weight: 600;
}

.logout-form {
    display: inline;
}

.logout-form button {
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,.5);
    padding: 6px 10px;
    border-radius: 8px;
}

.container {
    width: min(1180px, 96%);
    margin: 22px auto;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 4px 16px rgba(0,0,0,.04);
}

.grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    display: block;
    font-size: 24px;
    margin-top: 6px;
}

.btn {
    display: inline-block;
    background: #eee;
    color: #111;
    padding: 10px 13px;
    border-radius: 10px;
    border: 1px solid var(--border);
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.btn.primary {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
}

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

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

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

th {
    background: #f0f0ec;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
}

form p {
    margin-bottom: 14px;
}

label {
    font-weight: 700;
}

.hint {
    color: var(--muted);
}

.messages .msg {
    padding: 12px;
    border-radius: 10px;
    background: #e7f4ea;
    margin-bottom: 10px;
}

.login-card {
    max-width: 420px;
    margin: 40px auto;
}

@media (max-width: 850px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
    .topbar nav { width: 100%; }
    table { font-size: 14px; }
    th, td { padding: 8px; }
}

@media (max-width: 520px) {
    .grid { grid-template-columns: 1fr; }
    .topbar a { display: inline-block; margin: 4px 8px 4px 0; }
    .container { width: 94%; }
}
