*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #ece8e3;
    --bg-card: #ffffff;
    --text: #3a352f;
    --text-muted: #7a7368;
    --accent: #4a6741;
    --accent-hover: #3a5233;
    --link: #4a7a8c;
    --border: #d5cfc7;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 8px;
    --sidebar-width: 220px;
    --sidebar-bg: #3d3632;
    --sidebar-text: #c8c0b8;
    --sidebar-active: #4a6741;
    --topbar-height: 48px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== App Shell (sidebar layout) ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
}
.sidebar-brand {
    padding: 1.25rem 1rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    display: block;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    line-height: 1.3;
}
.sidebar-brand-sub {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.03em;
}
.sidebar-section {
    padding: 0.75rem 0 0.25rem;
}
.sidebar-section-title {
    padding: 0 1rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    margin-bottom: 0.25rem;
}
.sidebar-nav {
    list-style: none;
}
.sidebar-nav a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.88rem;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
}
.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: #fff;
}
.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
}

/* Top bar */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--sidebar-bg);
    border-bottom: 1px solid rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 1.25rem;
    z-index: 99;
    font-size: 0.85rem;
}
.topbar-user { color: #8cb88a; }
.topbar a {
    color: #f0ede8;
    text-decoration: none;
    margin-left: 1rem;
    background: var(--accent);
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.8rem;
}
.topbar a:hover { background: var(--accent-hover); }

/* Main content area */
.app-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 1.5rem;
    flex: 1;
    min-height: calc(100vh - var(--topbar-height));
}

/* ===== Landing page (no sidebar) ===== */
.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    padding-bottom: 10vh;
}
.site-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}
.site-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Card */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}
.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--text);
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--link);
    box-shadow: 0 0 0 3px rgba(74,122,140,0.12);
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn-full { width: 100%; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; min-width: 4.5rem; min-height: 2rem; text-align: center; line-height: 1.2; }
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #a93226; }
.btn-secondary { background: #888; }
.btn-secondary:hover { background: #666; }

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: #fdecea; color: #c0392b; }
.alert-success { background: #eafaf1; color: #27ae60; }

/* Table */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
th {
    background: #f8f8f8;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}
tr:last-child td { border-bottom: none; }

/* Utilities */
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.actions { display: flex; gap: 0.4rem; }

/* Page header */
.page-header {
    margin-bottom: 1.25rem;
}
.page-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
}

/* Footer */
.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #444;
    color: #bbb;
    font-size: 0.7rem;
    padding: 0.4rem 1rem;
    text-align: center;
}
.footer-inner { max-width: 960px; margin: 0 auto; }

/* Carousel */
.carousel {
    position: relative;
    display: inline-block;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.carousel-track { position: relative; }
.carousel-slide {
    display: none;
}
.carousel-slide.active {
    display: block;
}
.carousel-slide img {
    max-width: 100%;
    max-height: 500px;
    display: block;
    border-radius: var(--radius);
}
.carousel-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.6rem 1rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
}
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.35);
    color: #fff;
    border: none;
    font-size: 2rem;
    line-height: 1;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
    z-index: 2;
}
.carousel-btn:hover { background: rgba(0,0,0,0.6); }
.carousel-prev { left: 0.5rem; }
.carousel-next { right: 0.5rem; }
.carousel-dots {
    position: absolute;
    bottom: 0.6rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.4rem;
    z-index: 2;
}
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: background 0.15s;
}
.carousel-dot.active,
.carousel-dot:hover { background: #fff; }

/* Photo admin grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.photo-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.photo-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}
.photo-card-form {
    padding: 0.5rem;
}

/* News */
.news-latest {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem 2rem;
}
.news-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.news-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.news-body {
    font-size: 0.95rem;
    line-height: 1.7;
}

/* Org chart */
.org-section {
    margin-bottom: 2rem;
}
.org-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--border);
}
.org-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}
.org-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    text-align: center;
    border-top: 3px solid var(--border);
}
.org-card-primary {
    border-top-color: var(--accent);
}
.org-role {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.org-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--link);
    text-decoration: none;
}
.org-name:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s;
    }
    .sidebar.open { transform: translateX(0); }
    .topbar { left: 0; }
    .app-main { margin-left: 0; }
    .site-title { font-size: 1.6rem; }
    .card { padding: 1.5rem; }
    th, td { padding: 0.5rem 0.6rem; }
}
