:root {
    --sidebar-bg: #1f2a24;
    --sidebar-fg: #e7ede9;
    --sidebar-active: #3a7d44;
    --accent: #3a7d44;
    --accent-dark: #2c5f34;
    --bg: #f4f6f4;
    --card-bg: #ffffff;
    --border: #dde3de;
    --text: #1f2723;
    --text-muted: #6b7570;
    --danger: #b3261e;
    --success: #256d3b;
    --warning: #8a6d1f;
    font-size: 16px;
}

* { box-sizing: border-box; }

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

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

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

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
}

.sidebar-brand {
    font-size: 1.4rem;
    font-weight: 700;
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 0.5rem;
}

.sidebar nav { flex: 1; }

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar li a {
    display: block;
    padding: 0.7rem 1.25rem;
    color: var(--sidebar-fg);
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar li a:hover {
    background: rgba(255,255,255,0.06);
}

.sidebar li.active a {
    background: rgba(255,255,255,0.08);
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.25rem 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
}

.sidebar-user { margin-bottom: 0.5rem; }

.sidebar-footer a { color: #c8d3cc; }

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 20;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    border: none;
    border-radius: 6px;
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.1rem;
}

.content {
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 1100px;
}

.guest-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.login-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2.5rem;
    width: 320px;
    text-align: center;
}

.login-box h1 { margin: 0 0 0.25rem; }
.subtitle { color: var(--text-muted); margin-top: 0; margin-bottom: 1.5rem; }

h1 { margin-top: 0; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

th, td {
    text-align: left;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border);
}

th {
    background: #eef2ef;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-active { background: #e2f2e5; color: var(--success); }
.badge-inactive { background: #f2e2e2; color: var(--danger); }
.badge-warning { background: #f7edd6; color: var(--warning); }

.field { margin-bottom: 1.1rem; }
.field-label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.9rem; }
.field-input {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    background: #fff;
}
.field-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.field-hint { font-size: 0.8rem; color: var(--text-muted); margin: 0.25rem 0 0; }

.activity-changes { margin: 0.3rem 0 0; padding-left: 1.1rem; font-size: 0.85rem; color: var(--text-muted); }
.activity-changes li { margin-bottom: 0.15rem; }
.field-errors { color: var(--danger); font-size: 0.85rem; margin: 0.3rem 0 0; padding-left: 1.1rem; }

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    max-height: 260px;
    overflow-y: auto;
}
.checkbox-option { font-weight: normal; display: flex; gap: 0.4rem; align-items: center; }

.btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-block { width: 100%; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #eef2ef; }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn-danger { background: var(--danger); border-color: var(--danger); }

.actions-cell { display: flex; gap: 0.5rem; }

.flashes { margin-bottom: 1.25rem; }
.flash {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.92rem;
}
.flash-success { background: #e2f2e5; color: var(--success); }
.flash-danger { background: #f6e1e0; color: var(--danger); }
.flash-warning { background: #f7edd6; color: var(--warning); }

.search-form { margin-bottom: 1rem; display: flex; gap: 0.5rem; }
.search-form input { flex: 1; }

.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 3rem; margin-bottom: 0.5rem; }

.empty-state { color: var(--text-muted); padding: 1.5rem; text-align: center; }

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}
.attachment { text-align: center; }
.attachment img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.attachment-file {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    font-weight: 700;
    color: var(--text-muted);
}
.attachment .field-hint {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0.4rem 0;
}

@media (max-width: 800px) {
    .sidebar-toggle { display: block; }
    .sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        bottom: 0;
        transition: left 0.2s ease;
        z-index: 15;
    }
    .sidebar.open { left: 0; }
    .content { padding: 4rem 1.25rem 2rem; }
}
