:root {
    --bg: #f3f1ec;
    --surface: #fffdf8;
    --ink: #1c1b19;
    --muted: #5f5a52;
    --line: #d8d0c4;
    --accent: #c45c26;
    --accent-dark: #9a4318;
    --danger: #a12828;
    --ok: #1f6b3a;
    --shadow: 0 10px 30px rgba(40, 30, 20, 0.08);
    --radius: 14px;
    --font: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 500px at 10% -10%, #ffe7d2 0%, transparent 55%),
        radial-gradient(900px 400px at 100% 0%, #e7efe8 0%, transparent 50%),
        var(--bg);
    min-height: 100vh;
}
a { color: inherit; }
.container { width: min(1100px, calc(100% - 2rem)); margin: 0 auto; }
.topbar {
    border-bottom: 1px solid var(--line);
    background: rgba(255, 253, 248, 0.9);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.brand img { display: block; height: 42px; width: auto; }
.nav { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.nav a { text-decoration: none; font-size: 0.95rem; }
main.container { padding: 1.75rem 0 3rem; }
.footer {
    border-top: 1px solid var(--line);
    padding: 1rem 0 2rem;
    color: var(--muted);
    font-size: 0.9rem;
}
.footer a { color: var(--accent-dark); }

h1 { margin: 0 0 0.35rem; font-size: clamp(1.6rem, 2vw, 2rem); letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.page-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 0.55rem 1rem;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.92rem;
}
.btn:hover { border-color: #b9b0a2; }
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: #e2b4b4; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.inline { display: inline; margin: 0; }

.flash {
    padding: 0.8rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    background: #fff;
}
.flash-success { border-color: #b7d8c2; background: #eef8f1; color: var(--ok); }
.flash-error { border-color: #e2b4b4; background: #fff1f1; color: var(--danger); }

.login-card {
    max-width: 420px;
    margin: 3rem auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.stack { display: grid; gap: 0.9rem; }
label {
    display: grid;
    gap: 0.35rem;
    font-size: 0.92rem;
    font-weight: 600;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="file"],
textarea,
input:not([type]) {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    font: inherit;
    background: #fff;
}
textarea { resize: vertical; }
.check { font-weight: 500; display: flex; align-items: center; gap: 0.4rem; }

.search-bar {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.search-bar input { flex: 1; min-width: 220px; }

.table-wrap {
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.85rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; white-space: nowrap; }
.empty {
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
fieldset {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 1rem;
    display: grid;
    gap: 0.75rem;
    box-shadow: var(--shadow);
}
fieldset.full { grid-column: 1 / -1; }
legend {
    padding: 0 0.35rem;
    font-weight: 700;
}
.form-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    padding-top: 0.25rem;
}

@media (max-width: 800px) {
    .form-grid { grid-template-columns: 1fr; }
    .page-head, .topbar-inner { flex-direction: column; align-items: stretch; }
    .actions { justify-content: flex-start; }
}
