:root {
    --bg: #f8f7f1;
    --card: #ffffff;
    --text: #2d2f29;
    --muted: #6f746a;
    --accent: #e8a94c;
    --green: #5f7f3b;
    --danger: #c7463d;
    --border: #e4dfd3;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: linear-gradient(180deg, #f6f4ec 0%, #f9f8f3 100%);
    color: var(--text);
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
}
.app-shell { max-width: 1280px; margin: 0 auto; padding: 20px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.brand-title { font-size: 28px; font-weight: 800; color: #7b3fcf; }
.brand-subtitle { color: #7b3fcf; }
.admin-top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.content { display: grid; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: 0 6px 20px rgba(87,92,74,0.08); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.grid-form { display: grid; gap: 10px; max-width: 420px; }
label { display: grid; gap: 6px; font-size: 14px; }
input, select { border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 14px; background: #fff; }
.btn { border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer; font-weight: 600; background: #ece8db; color: var(--text); }
.btn-primary { background: var(--green); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-info { background: #2f6fb0; color: #fff; }
.btn-subsection { background: #e8a94c; color: #fff; }
.toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar-subsections { width: 100%; display: flex; gap: 8px; margin-top: 8px; }
.table-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.table-title-actions { display: flex; align-items: center; gap: 8px; }
.table-meta { margin: 8px 0 6px; font-weight: 700; color: #413b2e; }
.table-view-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.table-wrap { overflow: auto; }
table { width: max-content; min-width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { border-bottom: 1px solid var(--border); text-align: left; padding: 10px 8px; vertical-align: top; }
th { background: #faf8f2; position: sticky; top: 0; }
.sortable-th { cursor: pointer; user-select: none; }
.sortable-th:hover { background: #f2eee2; }
.th-label { display: inline-flex; align-items: center; gap: 6px; }
.sort-indicator { color: #7a755e; font-size: 12px; }
.filter-row th { background: #fff; top: 42px; }
.column-filter {
    width: 100%;
    min-width: 110px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 13px;
}
.columns-panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 10px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.columns-panel label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
@media (max-width: 920px) {
    .columns-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 620px) {
    .columns-panel {
        grid-template-columns: 1fr;
    }
}
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(26, 28, 22, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-card {
    width: min(520px, calc(100vw - 24px));
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
    padding: 14px;
}
.modal-head h4 {
    margin: 0 0 10px;
    font-size: 18px;
}
.modal-body {
    display: grid;
    gap: 10px;
}
.modal-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.group-table-title { margin: 14px 0 8px; font-weight: 700; color: #5b4a2d; }
.children-group-table {
    width: 100%;
    min-width: 1080px;
    table-layout: fixed;
}
.children-group-table th,
.children-group-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.children-group-table .actions-cell {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}
.yes-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dff1d5;
    border: 1px solid #a6cf95;
    color: #1f5b24;
    font-weight: 700;
}
.matkap-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}
.matkap-pill-blue {
    background: #dff1ff;
    border: 1px solid #97c8ef;
    color: #144a73;
}
.matkap-pill-yellow {
    background: #fff3d8;
    border: 1px solid #e3c27a;
    color: #6b4f1a;
}
.matkap-pill-green {
    background: #dff1d5;
    border: 1px solid #a6cf95;
    color: #1f5b24;
}
.child-name-alert-start {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    background: #dff1d5;
    border: 1px solid #a6cf95;
}
.child-name-alert-end {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    background: #f8dfdf;
    border: 1px solid #e3a3a3;
}
.toast { position: fixed; right: 20px; bottom: 20px; background: #4d6930; color: #fff; padding: 10px 14px; border-radius: 10px; }
