:root {
    --bg: #faf7ee;
    --surface: #ffffff;
    --surface-alt: #fff9ec;
    --text: #22291f;
    --muted: #6c7566;
    --border: #e6dfc9;
    --primary: #0b4d33;
    --primary-dark: #062f20;
    --primary-light: #16744a;
    --accent: #f0b429;
    --accent-dark: #c8901b;
    --terracotta: #c1440e;
    --success: #1a7f4b;
    --danger: #c0392b;
    --shadow: 0 4px 18px rgba(6, 47, 32, .08);
    --shadow-lg: 0 18px 40px rgba(6, 47, 32, .18);
    --radius: 12px;
    --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
    --font-body: "Inter", "Segoe UI", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slowZoom { from { transform: scale(1); } to { transform: scale(1.08); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; }
}

body {
    margin: 0;
    zoom: 90%;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    background-image:
        radial-gradient(circle at 100% 0%, rgba(240, 180, 41, .08), transparent 40%),
        radial-gradient(circle at 0% 100%, rgba(11, 77, 51, .06), transparent 40%);
    background-attachment: fixed;
}

a { color: var(--primary); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: .01em; }

/* ---------- Topbar ---------- */
.topbar {
    min-height: 68px;
    padding: 0 28px;
    background: linear-gradient(120deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 3px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: var(--shadow);
}

.brand {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 13px;
    font-size: 1.1rem;
    font-weight: 700;
}

.brand img {
    height: 46px;
    width: 46px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    transition: transform .3s ease;
}

.brand:hover img { transform: rotate(-8deg) scale(1.06); }

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    font-family: var(--font-display);
    font-size: 1.15rem;
}

.brand-text small {
    font-size: .7rem;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--accent);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.user-area { display: flex; align-items: center; gap: 14px; font-size: .9rem; }
.user-area span { background: rgba(255,255,255,.1); padding: 6px 12px; border-radius: 20px; }
.user-area form { margin: 0; }
.link-button { border: 0; padding: 6px 12px; color: var(--primary-dark); background: var(--accent); border-radius: 20px; cursor: pointer; text-decoration: none; font-weight: 600; transition: transform .15s ease, box-shadow .15s ease; }
.link-button:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.25); }

.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 68px); }

/* ---------- Sidebar ---------- */
.sidebar {
    padding: 24px 16px;
    background: linear-gradient(180deg, #0f3a26 0%, #0a2919 100%);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-label {
    color: rgba(238, 246, 241, .45);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 0 12px 10px;
}

.sidebar a {
    color: #eef6f1;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: .93rem;
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.sidebar .nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .07);
    font-size: 1rem;
    flex-shrink: 0;
    transition: background .15s ease, transform .2s ease;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, .08);
    transform: translateX(3px);
}

.sidebar a:hover .nav-icon { background: rgba(255, 255, 255, .14); transform: scale(1.08); }

.sidebar a.active {
    background: linear-gradient(90deg, rgba(240, 180, 41, .22), rgba(240, 180, 41, .08));
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar a.active .nav-icon { background: var(--accent); }

.content { padding: 30px; max-width: 1400px; width: 100%; animation: fadeIn .35s ease; }
.content-full { grid-column: 1 / -1; max-width: 480px; margin: 40px auto; }

/* ---------- Auth (split-screen) ---------- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}

.auth-visual {
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 48px;
    overflow: hidden;
}

.auth-visual::before {
    content: "";
    position: absolute;
    inset: -12px;
    background-image: linear-gradient(180deg, rgba(6,47,32,.35) 0%, rgba(6,47,32,.88) 100%), var(--auth-image);
    background-size: cover;
    background-position: center;
    animation: slowZoom 22s ease-in-out infinite alternate;
}

.auth-visual .auth-quote {
    position: relative;
    color: #fff;
    max-width: 440px;
}

.auth-visual .auth-quote span.tag {
    display: inline-block;
    background: var(--accent);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: .72rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 14px;
}

.auth-visual .auth-quote h2 {
    font-size: 1.9rem;
    line-height: 1.25;
    margin: 0 0 10px;
    color: #fff;
}

.auth-visual .auth-quote p { color: #dce8e0; margin: 0; }
.auth-visual .auth-quote { animation: fadeInUp .7s ease .1s both; }

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--surface);
}

.login-card { text-align: center; width: 100%; max-width: 380px; box-shadow: none; border: none; padding: 0; animation: fadeInUp .5s ease both; }
.login-card .logo { width: 84px; height: 84px; object-fit: cover; border-radius: 50%; margin: 0 auto 18px; display: block; border: 3px solid var(--accent); box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: 6px; font-size: 1.8rem; color: var(--primary-dark); }
.login-card .field { text-align: left; }

@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
}

/* ---------- Dashboard hero ---------- */
.hero-banner {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 220px;
    display: flex;
    align-items: center;
    padding: 36px 40px;
    margin-bottom: 26px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp .5s ease both;
}

.hero-banner::before {
    content: "";
    position: absolute;
    inset: -12px;
    background-image: linear-gradient(110deg, rgba(6,47,32,.92) 20%, rgba(6,47,32,.55) 60%, rgba(6,47,32,.2) 100%), var(--hero-image);
    background-size: cover;
    background-position: center;
    animation: slowZoom 24s ease-in-out infinite alternate;
}

.hero-banner .hero-content { position: relative; color: #fff; max-width: 640px; animation: fadeInUp .7s ease .15s both; }
.hero-banner .hero-content span.tag {
    display: inline-block;
    background: var(--accent);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: .72rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}
.hero-banner .hero-content h1 { font-size: 2.1rem; margin: 0 0 8px; color: #fff; }
.hero-banner .hero-content p { color: #dce8e0; margin: 0; font-size: 1rem; }

/* ---------- Page header / typography ---------- */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h1 { font-size: 1.65rem; margin: 0; color: var(--primary-dark); }
h2 { font-size: 1.2rem; margin: 0 0 14px; color: var(--primary-dark); }
h3 { font-size: 1rem; margin: 0 0 10px; }
.muted { color: var(--muted); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
label { font-size: .9rem; font-weight: 600; color: var(--primary-dark); }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--surface-alt);
    color: var(--text);
    font-family: var(--font-body);
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(11, 77, 51, .12);
    background: #fff;
}

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
input[type=checkbox] { width: auto; }
.check { display: flex; align-items: center; gap: 8px; }
.check label { font-weight: 400; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.button {
    display: inline-block;
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 9px 16px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-body);
    transition: transform .15s ease, box-shadow .15s ease;
}

.button:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(6, 47, 32, .28); }
.button:active { transform: translateY(0) scale(.97); }
.button.secondary { background: #fff; color: var(--primary); }
.button.accent { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); border-color: var(--accent-dark); color: var(--primary-dark); }
.button.small { padding: 6px 11px; font-size: .85rem; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; font-size: .92rem; }
th {
    background: var(--surface-alt);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--primary-dark);
    position: sticky;
    top: 0;
    z-index: 1;
}
tbody tr:nth-child(even) { background: rgba(11, 77, 51, .02); }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: rgba(240, 180, 41, .08); }
tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow: auto; max-height: 70vh; border-radius: var(--radius); border: 1px solid var(--border); }
.table-wrap table { border: none; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; background: #e7f6ed; color: var(--success); font-size: .78rem; font-weight: 600; }
.badge.off { background: #f3f4f6; color: #667085; }

.alert { padding: 13px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert.success { background: #e7f6ed; color: #075e36; border: 1px solid #b7e4c7; }
.alert.error, .validation-summary-errors { background: #fdecec; color: var(--danger); padding: 13px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid #f3c6c1; }
.validation-summary-valid { display: none; }

/* ---------- Admin module cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.cards a { text-decoration: none; color: var(--text); }
.cards .card {
    position: relative;
    padding-top: 26px;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}
.cards .card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--terracotta));
    opacity: 0;
    transition: opacity .18s ease;
}
.cards .card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-lg); transform: translateY(-5px); }
.cards .card:hover::before { opacity: 1; }
.cards .card .icon { font-size: 1.6rem; margin-bottom: 10px; display: block; transition: transform .25s ease; }
.cards .card:hover .icon { transform: scale(1.15) rotate(-4deg); }
.cards .card { animation: fadeInUp .5s ease both; }
.cards .card:nth-child(1) { animation-delay: .03s; }
.cards .card:nth-child(2) { animation-delay: .08s; }
.cards .card:nth-child(3) { animation-delay: .13s; }
.cards .card:nth-child(4) { animation-delay: .18s; }
.cards .card:nth-child(5) { animation-delay: .23s; }
.cards .card:nth-child(6) { animation-delay: .28s; }
.cards .card:nth-child(7) { animation-delay: .33s; }

pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-alt); padding: 12px; border-radius: 8px; }

@media (max-width: 760px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { flex-direction: row; overflow-x: auto; gap: 6px; }
    .sidebar-label { display: none; }
    .sidebar a span:not(.nav-icon) { display: none; }
    .sidebar a { padding: 8px; }
    .content { padding: 18px; }
    .grid, .grid-3, .cards { grid-template-columns: 1fr; }
    .topbar { padding: 0 14px; }
    .field-wide { grid-column: auto; }
    .brand-text { display: none; }
    .hero-banner { padding: 24px; min-height: 160px; }
    .hero-banner .hero-content h1 { font-size: 1.5rem; }
}
