:root {
    --ink: #17312b;
    --muted: #6c7c77;
    --line: #dfe8e4;
    --paper: #ffffff;
    --canvas: #f3f7f5;
    --brand: #15803d;
    --brand-dark: #0f5f2d;
    --accent: #e7f5ef;
    --orange: #f97316;
    --orange-dark: #c2410c;
    --orange-soft: #fff1e7;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(31, 66, 55, .09);
    --bs-primary: #15803d;
    --bs-primary-rgb: 21, 128, 61;
    --bs-secondary: #f97316;
    --bs-secondary-rgb: 249, 115, 22;
    --bs-link-color: #15803d;
    --bs-link-hover-color: #0f5f2d;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.55rem, 2vw, 2.1rem); letter-spacing: -.035em; }
h2 { margin-bottom: .35rem; font-size: 1.3rem; letter-spacing: -.025em; }
small { display: block; color: var(--muted); }
.muted { color: var(--muted); }
.compact { margin-bottom: .8rem; }
.eyebrow {
    margin-bottom: .3rem;
    color: var(--orange-dark);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.brand-mark {
    display: grid;
    width: 58px;
    height: 58px;
    margin-bottom: 1rem;
    place-items: center;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(145deg, var(--brand), var(--brand-dark));
    font-weight: 900;
    box-shadow: 0 12px 30px rgba(21, 128, 61, .25);
}
.brand-mark.small { width: 42px; height: 42px; margin: 0; border-radius: 13px; font-size: .8rem; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 440px); padding: 38px; border: 1px solid var(--line); border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
.stack { display: grid; gap: 1rem; }
label, .field-title { display: grid; gap: .4rem; color: #304a43; font-size: .86rem; font-weight: 700; }
input, select, textarea {
    width: 100%;
    padding: .78rem .9rem;
    border: 1px solid #cad8d3;
    border-radius: 10px;
    outline: none;
    color: var(--ink);
    background: #fff;
    font: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(21,128,61,.11); }
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 1rem;
    border: 1px solid var(--brand);
    border-radius: 10px;
    color: #fff;
    background: var(--brand);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
button:hover, .button:hover { background: var(--brand-dark); color: white; }
.ghost { padding: .48rem .7rem; color: var(--brand); background: #fff; }
.danger { border-color: #efc7c2; color: var(--danger); background: #fff; }
.danger:hover { color: #fff; background: var(--danger); }
.alert { margin-bottom: 1rem; padding: .8rem 1rem; border-radius: 10px; font-weight: 650; }
.alert.success { color: #116149; background: #dcf5e9; }
.alert.error { color: #8d2118; background: #fee9e7; }
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    width: 260px;
    height: 100vh;
    padding: 24px 18px;
    overflow: hidden;
    color: #eaf6f1;
    background: linear-gradient(180deg, #14532d, #0f3d23);
}
.sidebar-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: .8rem; padding: 0 8px 24px; }
.brand strong, .brand small { display: block; color: #fff; }
.brand small { color: #a7c8bd; font-size: .7rem; }
.sidebar-close { display: none; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px; color: #fff; background: rgba(255,255,255,.1); font-size: 1.6rem; font-weight: 400; line-height: 1; }
.sidebar nav {
    display: grid;
    flex: 1;
    align-content: start;
    gap: .35rem;
    min-height: 0;
    padding-right: 4px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.24) transparent;
}
.sidebar nav::-webkit-scrollbar { width: 5px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(255,255,255,.24); }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .72rem .8rem; border-radius: 10px; color: #cce1da; font-weight: 700; }
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,.09); }
.sidebar nav a.active { color: #fff; background: rgba(255,255,255,.13); }
.sidebar nav a.active .menu-icon { background: var(--orange); }
.sidebar-group summary { display: flex; align-items: center; gap: .7rem; padding: .72rem .8rem; border-radius: 10px; color: #cce1da; font-weight: 800; cursor: pointer; list-style: none; }
.sidebar-group summary::-webkit-details-marker { display: none; }
.sidebar-group summary:hover { color: #fff; background: rgba(255,255,255,.09); }
.group-arrow { margin-left: auto; transition: transform .2s ease; }
.sidebar-group[open] .group-arrow { transform: rotate(180deg); }
.sidebar-submenu { display: grid; gap: .2rem; margin: .25rem 0 .35rem 1.1rem; padding-left: .65rem; border-left: 1px solid rgba(255,255,255,.14); }
.sidebar-submenu a { padding-block: .55rem !important; font-size: .86rem; }
.sidebar-submenu .menu-icon { width: 24px; height: 24px; font-size: .68rem; }
.menu-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: #fff; background: rgba(249,115,22,.82); }
.sidebar-user { display: grid; gap: .2rem; margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-user span { color: #a7c8bd; font-size: .8rem; }
.sidebar-user a { margin-top: .5rem; color: #fff; font-weight: 750; }
.content-shell { min-width: 0; margin-left: 260px; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 28px 34px 18px; }
.sidebar-toggle { display: none; position: relative; align-items: center; justify-content: center; flex-direction: column; gap: 4px; width: 46px; height: 46px; padding: 0; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; box-shadow: 0 5px 18px rgba(31,66,55,.06); }
.sidebar-toggle span { display: block; width: 19px; height: 2px; border-radius: 99px; background: var(--brand-dark); }
.sidebar-toggle b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.sidebar-overlay { display: none; }
.content { padding: 0 34px 40px; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 30px rgba(31,66,55,.045); }
.welcome { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.role-pill { display: inline-flex; padding: .38rem .65rem; border-radius: 999px; color: var(--orange-dark); background: var(--orange-soft); font-size: .76rem; font-weight: 800; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.stat-card span { color: var(--muted); font-weight: 700; }
.stat-card strong { display: block; margin-top: .2rem; font-size: 2rem; letter-spacing: -.04em; }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.module-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.module-card > span { display: grid; width: 44px; height: 44px; margin-bottom: 1rem; place-items: center; border-radius: 13px; color: var(--orange-dark); background: var(--orange-soft); font-size: 1.1rem; font-weight: 900; }
.module-card p { min-height: 48px; color: var(--muted); }
.module-card a { color: var(--brand); font-weight: 800; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.split-grid { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(480px, 1.2fr); gap: 20px; align-items: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.content-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.content-editor-grid .editor-wide { grid-column: 1 / -1; }
.permission-groups { display: grid; gap: 10px; max-height: 430px; padding-right: 5px; overflow: auto; }
fieldset { padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
legend { padding: 0 5px; color: var(--brand); font-weight: 850; text-transform: capitalize; }
.check-row { display: flex; grid-template-columns: none; align-items: flex-start; gap: .65rem; padding: .52rem; border-radius: 8px; font-weight: 600; cursor: pointer; }
.check-row:hover { background: var(--canvas); }
.check-row input { width: auto; margin-top: .25rem; }
.check-row span { display: block; }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-height: 320px; overflow: auto; }
.role-list { display: grid; gap: 10px; }
.role-list article { display: flex; justify-content: space-between; gap: 15px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.role-list article:last-child { border: 0; }
.role-list p { margin: .2rem 0; color: var(--muted); }
.row-actions { display: flex; align-items: center; gap: 7px; }
.row-actions form { margin: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .85rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
td small { margin-top: .15rem; }
.empty { padding: 2rem; color: var(--muted); text-align: center; }
.status { display: inline-flex; padding: .28rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.status.active { color: #116149; background: #dcf5e9; }
.status.inactive { color: #8d2118; background: #fee9e7; }
.enquiry-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.enquiry-meta span { padding: 14px; border-radius: 12px; background: var(--canvas); color: var(--muted); }
.enquiry-meta strong { display: block; margin-bottom: 3px; color: var(--ink); }
.enquiry-message { margin-bottom: 22px; padding: 18px; border-left: 4px solid var(--orange); border-radius: 0 12px 12px 0; background: #fff8f2; color: #4f665e; line-height: 1.75; }
.appointment-admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.appointment-admin-grid span { padding: 14px; border-radius: 12px; background: var(--canvas); color: var(--muted); }
.appointment-admin-grid strong { display: block; margin-bottom: 3px; color: var(--ink); }
.pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; }
.pagination-bar p { margin: 0; color: var(--muted); font-size: .84rem; }
.admin-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.admin-pagination a, .admin-pagination span { display: grid; min-width: 36px; height: 36px; padding: 0 .65rem; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: .82rem; font-weight: 750; }
.admin-pagination a:hover { border-color: var(--brand); color: var(--brand); }
.admin-pagination a.active { border-color: var(--brand); color: #fff; background: var(--brand); }
.admin-pagination a.disabled { opacity: .45; pointer-events: none; }
.admin-pagination span { border-color: transparent; background: transparent; }

@media (max-width: 1100px) {
    body.sidebar-open { overflow: hidden; }
    .sidebar {
        width: min(310px, 88vw);
        transform: translateX(-105%);
        transition: transform .25s ease;
        box-shadow: 20px 0 50px rgba(8,45,31,.22);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-close { display: grid; flex: 0 0 38px; place-items: center; }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 999;
        display: block;
        visibility: hidden;
        opacity: 0;
        background: rgba(8,33,25,.48);
        backdrop-filter: blur(2px);
        transition: opacity .25s ease, visibility .25s ease;
    }
    body.sidebar-open .sidebar-overlay { visibility: visible; opacity: 1; }
    .content-shell { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; flex: 0 0 46px; }
    .split-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .module-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .topbar { padding: 18px 16px 14px; }
    .content { padding: 0 16px 32px; }
    .topbar h1 { font-size: 1.45rem; }
    .topbar .eyebrow { margin-bottom: .15rem; }
    .stat-grid, .form-grid, .checkbox-grid, .content-editor-grid, .module-grid { grid-template-columns: 1fr; }
    .enquiry-meta { grid-template-columns: 1fr; }
    .appointment-admin-grid { grid-template-columns: 1fr; }
    .pagination-bar { align-items: flex-start; flex-direction: column; }
    .auth-card { padding: 26px; }
}
