* { box-sizing: border-box; }

:root {
    --bg: #f6f3ee;
    --surface: #ffffff;
    --text: #1d1b18;
    --muted: #716c63;
    --border: #e6e0d7;
    --accent: #6f2b2b;
    --accent-dark: #542020;
    --success: #eaf7ee;
    --danger: #fff0ef;
}

html, body { margin: 0; min-height: 100%; }

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

a { color: inherit; text-decoration: none; }

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

.brand {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .12em;
}

.topbar-user {
    display: flex;
    gap: 18px;
    align-items: center;
    color: var(--muted);
    font-size: 14px;
}

.topbar-user a { color: var(--accent); font-weight: 700; }

.auth-page {
    min-height: calc(100vh - 68px);
    display: grid;
    place-items: center;
    padding: 32px 20px;
}

.login-card {
    width: min(430px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 38px;
    box-shadow: 0 18px 50px rgba(40, 30, 20, .07);
}

.logo-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    letter-spacing: .04em;
}

.eyebrow {
    margin: 18px 0 7px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
}

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

h1 { margin-bottom: 8px; font-size: 30px; letter-spacing: -.03em; }
h2 { font-size: 20px; }

.muted { color: var(--muted); line-height: 1.6; }

form { margin-top: 26px; }

label {
    display: block;
    margin: 16px 0 7px;
    font-size: 13px;
    font-weight: 700;
}

input {
    width: 100%;
    height: 46px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    outline: none;
    font: inherit;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(111, 43, 43, .10);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 17px;
    border-radius: 9px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    transition: .18s ease;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }

.btn-secondary {
    background: #fff;
    border-color: var(--border);
}

.btn-full { width: 100%; margin-top: 22px; }

.alert, .success {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 9px;
    font-size: 13px;
}

.alert { background: var(--danger); color: #8a2720; }
.success { background: var(--success); color: #176b38; }

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 68px);
}

.sidebar {
    background: #211d1a;
    color: #fff;
    padding: 28px 16px;
}

.sidebar-title {
    padding: 0 12px 22px;
    font-weight: 750;
    letter-spacing: .02em;
}

.sidebar nav {
    display: grid;
    gap: 5px;
}

.sidebar nav a {
    padding: 11px 12px;
    border-radius: 8px;
    color: #cfc8bf;
    font-size: 14px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255,255,255,.09);
    color: #fff;
}

.content {
    padding: 38px;
    max-width: 1400px;
    width: 100%;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-card, .empty-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 28px;
    letter-spacing: -.03em;
}

.empty-card {
    margin-top: 18px;
}

@media (max-width: 800px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { padding: 14px; }
    .sidebar nav { display: flex; overflow-x: auto; }
    .sidebar nav a { white-space: nowrap; }
    .content { padding: 22px 16px; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .topbar { padding: 0 16px; }
    .topbar-user span { display: none; }
    .login-card { padding: 28px 22px; }
}
