:root {
    --ink: #1c2430;
    --muted: #5c6775;
    --paper: #f3efe6;
    --card: #fffdf8;
    --line: #e2d9c8;
    --teal: #0f6e56;
    --teal-dark: #0b5341;
    --danger: #8d2f2f;
    --ok: #e5f4ee;
    --bad: #f8e6e6;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
    line-height: 1.45;
}

a { color: var(--teal-dark); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4rem; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 230px;
    flex: none;
    background: var(--ink);
    color: #f6f1e7;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.brand {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; }

.sidebar nav a {
    color: #f6f1e7;
    text-decoration: none;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
}

.sidebar nav a.is-active,
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.1); }

.logout { margin-top: auto; display: flex; flex-direction: column; gap: 0.35rem; }
.logout span { color: #c9c1b3; font-size: 0.85rem; }
.logout button {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.45rem 0.7rem;
    text-align: left;
    cursor: pointer;
}

.content, .public-main { padding: 1.5rem; width: 100%; max-width: 1100px; }

.public-bar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    background: var(--ink);
    color: #fff;
}

.public-bar a { color: #fff; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    margin: 0 0 1rem;
}

.narrow { max-width: 460px; }

.heading, .copy-row, .event-line, .actions, .inline-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.stack { display: flex; flex-direction: column; gap: 0.8rem; }

label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
label.check { flex-direction: row; align-items: center; font-weight: 500; }

input, select, button { font: inherit; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="file"],
select {
    width: 100%;
    padding: 0.65rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
}

.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    border: 0;
    background: var(--teal);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-weight: 650;
}

.btn:hover { background: var(--teal-dark); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.link {
    background: none;
    border: 0;
    color: var(--danger);
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.muted { color: var(--muted); font-weight: 500; font-size: 0.92rem; }

.alert { border-radius: 10px; padding: 0.75rem 0.9rem; margin-bottom: 1rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-ok { background: var(--ok); }
.alert-error { background: var(--bad); }

.stats { display: flex; gap: 1rem; margin-bottom: 1rem; }
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    min-width: 180px;
}
.stat span { display: block; color: var(--muted); }
.stat strong { font-size: 2rem; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.charts .card { margin: 0 0 1rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.82rem; color: var(--muted); }

.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--line); }
.photo { width: min(100%, 420px); border-radius: 12px; display: block; margin: 0.6rem 0; }
.qr svg { width: 220px; height: auto; }

.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin-bottom: 1rem; }
.filters label { min-width: 180px; flex: 1; }
.filters .btn, .filters button { min-width: 90px; }

.collab-row, .inline-form { align-items: end; }
.collab-row label, .inline-form input, .inline-form select { flex: 1; }
.inline-delete { margin: -0.4rem 0 0.8rem; }
.people { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.pager { display: flex; gap: 0.8rem; align-items: center; margin-top: 0.8rem; }
.pager-disabled { color: var(--muted); }

@media (max-width: 800px) {
    .shell { display: block; }
    .sidebar { width: auto; }
    .sidebar nav { flex-direction: row; overflow-x: auto; }
    .logout { margin-top: 0; }
    .charts { grid-template-columns: 1fr; }
    .content, .public-main { padding: 1rem; }
}
