:root {
    --ink: #26312b;
    --muted: #69736d;
    --border: #dfe5e1;
    --canvas: #f4f7f5;
    --surface: #ffffff;
    --green: #567341;
    --green-dark: #3f5e31;
    --green-soft: #e9f0e3;
    --blue: #3c6f91;
    --blue-soft: #e6f0f6;
    --coral: #aa554f;
    --coral-soft: #fae9e7;
    --gold: #8b6b25;
    --gold-soft: #f7efd8;
    --shadow: 0 18px 50px rgba(37, 54, 44, 0.1);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: 'DM Sans', Arial, sans-serif;
    letter-spacing: 0;
}

button,
input,
select {
    font: inherit;
    letter-spacing: 0;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--green);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.login-view {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 0.95fr) minmax(500px, 1.05fr);
}

.login-brand {
    min-height: 100vh;
    padding: clamp(40px, 6vw, 88px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background:
        linear-gradient(rgba(47, 77, 41, 0.88), rgba(35, 61, 34, 0.95)),
        url('assets/children.png') center / cover;
}

.brand-mark img,
.mobile-brand img,
.sidebar-brand img {
    display: block;
    object-fit: contain;
    background: #fff;
}

.brand-mark img {
    width: 150px;
    height: 70px;
    padding: 8px;
    border-radius: 6px;
}

.brand-copy {
    max-width: 560px;
}

.brand-copy .eyebrow {
    color: #dce9d3;
}

.brand-copy h1 {
    margin: 0 0 20px;
    max-width: 520px;
    font-size: clamp(2.4rem, 4.3vw, 4.5rem);
    line-height: 1.04;
}

.brand-copy>p:last-child {
    margin: 0;
    max-width: 510px;
    color: #e6eee2;
    font-size: 1.06rem;
    line-height: 1.7;
}

.brand-feature {
    display: flex;
    gap: 14px;
    align-items: center;
}

.feature-icon,
.login-icon,
.stat-icon,
.state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.feature-icon {
    width: 42px;
    height: 42px;
    color: #f7fff1;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

.feature-icon svg {
    width: 20px;
}

.brand-feature strong,
.brand-feature span {
    display: block;
}

.brand-feature strong {
    margin-bottom: 3px;
}

.brand-feature span {
    color: #d7e3d3;
    font-size: 0.84rem;
}

.login-panel {
    min-height: 100vh;
    padding: 40px;
    display: grid;
    place-items: center;
    background: var(--surface);
}

.login-card {
    width: min(100%, 420px);
}

.mobile-brand {
    display: none;
}

.login-heading {
    margin-bottom: 34px;
}

.login-icon {
    width: 46px;
    height: 46px;
    margin-bottom: 22px;
    color: var(--green-dark);
    background: var(--green-soft);
    border-radius: 6px;
}

.login-icon svg {
    width: 22px;
}

.login-heading h2 {
    margin: 0 0 8px;
    font-size: 2rem;
}

.login-heading>p:last-child {
    margin: 0;
    color: var(--muted);
}

.login-card label {
    display: block;
    margin: 0 0 8px;
    font-size: 0.84rem;
    font-weight: 700;
}

.input-wrap {
    position: relative;
    margin-bottom: 20px;
}

.input-wrap>svg {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 18px;
    color: #7a8580;
    transform: translateY(-50%);
    pointer-events: none;
}

.input-wrap input,
.search-wrap input {
    width: 100%;
    color: var(--ink);
    background: #fbfcfb;
    border: 1px solid var(--border);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap input {
    height: 50px;
    padding: 0 48px 0 44px;
    border-radius: 6px;
}

.input-wrap input:focus,
.search-wrap input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(86, 115, 65, 0.12);
}

.icon-button {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 6px;
}

.icon-button:hover {
    color: var(--ink);
    background: #edf1ee;
}

.icon-button svg {
    width: 19px;
    height: 19px;
}

.input-action {
    position: absolute;
    right: 5px;
    top: 5px;
}

.form-error {
    min-height: 20px;
    margin: -6px 0 12px;
    color: #a63f3a;
    font-size: 0.84rem;
}

.primary-button,
.secondary-button,
.danger-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 17px;
    border-radius: 6px;
    font-weight: 700;
    border: 1px solid transparent;
}

.primary-button {
    width: 100%;
    height: 50px;
    color: #fff;
    background: var(--green);
}

.primary-button:hover {
    background: var(--green-dark);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.primary-button svg,
.secondary-button svg,
.danger-button svg {
    width: 17px;
}

.secondary-button {
    color: var(--ink);
    background: #fff;
    border-color: var(--border);
}

.secondary-button:hover {
    background: #f5f7f5;
}

.danger-button {
    color: #fff;
    background: var(--coral);
}

.danger-button:hover {
    background: #8d433e;
}

.back-link {
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.86rem;
    text-decoration: none;
}

.back-link:hover {
    color: var(--green);
}

.back-link svg {
    width: 16px;
}

.dashboard-view {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 248px;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    color: #e8eee9;
    background: #26362d;
}

.sidebar-brand {
    height: 54px;
    margin: 0 8px 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
}

.sidebar-brand img {
    width: 48px;
    height: 48px;
    padding: 3px;
    border-radius: 5px;
}

.sidebar-brand span,
.sidebar-brand strong,
.sidebar-brand small,
.admin-profile span,
.admin-profile strong,
.admin-profile small {
    min-width: 0;
    display: block;
}

.sidebar-brand strong {
    font-size: 1.08rem;
}

.sidebar-brand small {
    margin-top: 3px;
    color: #aebbb2;
    font-size: 0.7rem;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.nav-item {
    min-height: 46px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #bdc9c0;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
    color: #fff;
    background: #435b48;
}

.nav-item svg {
    width: 19px;
}

.nav-item b {
    min-width: 22px;
    height: 22px;
    margin-left: auto;
    padding: 0 6px;
    display: grid;
    place-items: center;
    color: #29402d;
    background: #dcead4;
    border-radius: 11px;
    font-size: 0.7rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-profile {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    display: grid !important;
    place-items: center;
    color: #2c472f;
    background: #cfe1c4;
    border-radius: 50%;
    font-weight: 700;
}

.admin-profile strong {
    overflow: hidden;
    color: #fff;
    font-size: 0.82rem;
    text-overflow: ellipsis;
}

.admin-profile small {
    margin-top: 2px;
    color: #9eada2;
    font-size: 0.68rem;
}

.sidebar-footer .icon-button {
    color: #bdc9c0;
}

.sidebar-footer .icon-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.dashboard-main {
    min-height: 100vh;
    margin-left: 248px;
}

.topbar {
    min-height: 92px;
    padding: 18px clamp(22px, 4vw, 48px);
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.topbar h1 {
    margin: 0;
    font-size: 1.55rem;
}

.topbar .eyebrow {
    margin-bottom: 4px;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.last-updated {
    color: var(--muted);
    font-size: 0.75rem;
}

.menu-button {
    display: none;
}

.dashboard-content {
    width: min(1480px, 100%);
    margin: auto;
    padding: 28px clamp(22px, 4vw, 48px) 50px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 14px;
}

.stat-card {
    min-height: 104px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 6px;
}

.stat-icon svg {
    width: 21px;
}

.stat-card span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.stat-card strong {
    margin-top: 5px;
    display: block;
    font-size: 1.7rem;
}

.stat-total .stat-icon {
    color: var(--green-dark);
    background: var(--green-soft);
}

.stat-new .stat-icon {
    color: var(--coral);
    background: var(--coral-soft);
}

.stat-contacted .stat-icon {
    color: var(--blue);
    background: var(--blue-soft);
}

.stat-resolved .stat-icon {
    color: var(--gold);
    background: var(--gold-soft);
}

.inquiries-section {
    margin-top: 20px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
}

.section-toolbar {
    min-height: 76px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}

.search-wrap {
    width: min(420px, 100%);
    position: relative;
}

.search-wrap svg {
    position: absolute;
    left: 13px;
    top: 50%;
    width: 17px;
    color: var(--muted);
    transform: translateY(-50%);
}

.search-wrap input {
    height: 42px;
    padding: 0 14px 0 39px;
    border-radius: 6px;
}

.filter-tabs {
    margin-left: auto;
    display: flex;
    padding: 3px;
    background: #edf1ee;
    border-radius: 6px;
}

.filter-tab {
    min-height: 34px;
    padding: 0 14px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 700;
}

.filter-tab.active {
    color: var(--ink);
    background: #fff;
    box-shadow: 0 1px 4px rgba(30, 50, 38, 0.1);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    table-layout: fixed;
}

th {
    padding: 12px 16px;
    color: var(--muted);
    background: #fafbfa;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
}

th:nth-child(1) {
    width: 17%;
}

th:nth-child(2) {
    width: 20%;
}

th:nth-child(3) {
    width: 25%;
}

th:nth-child(4) {
    width: 14%;
}

th:nth-child(5) {
    width: 14%;
}

th:nth-child(6) {
    width: 10%;
}

td {
    height: 82px;
    padding: 13px 16px;
    border-bottom: 1px solid #e9edea;
    vertical-align: middle;
    font-size: 0.82rem;
}

tbody tr {
    transition: background 0.15s;
}

tbody tr:hover {
    background: #fafcf9;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.person-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.person-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: #355237;
    background: #e2eddb;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 700;
}

.person-cell strong,
.person-cell span,
.contact-cell a {
    overflow: hidden;
    display: block;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-cell strong {
    font-size: 0.83rem;
}

.person-cell span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.68rem;
}

.contact-cell a {
    color: var(--ink);
    text-decoration: none;
}

.contact-cell a:hover {
    color: var(--green);
    text-decoration: underline;
}

.contact-cell span {
    margin-top: 5px;
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
}

.message-preview {
    overflow: hidden;
    display: -webkit-box;
    color: #4d5752;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.date-cell strong,
.date-cell span {
    display: block;
}

.date-cell strong {
    font-weight: 600;
}

.date-cell span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.7rem;
}

.status-select {
    width: 112px;
    height: 34px;
    padding: 0 27px 0 10px;
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: none;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: capitalize;
}

.status-select.status-new {
    color: #95443f;
    background: var(--coral-soft);
    border-color: #efcbc8;
}

.status-select.status-contacted {
    color: #335f7c;
    background: var(--blue-soft);
    border-color: #c8dce8;
}

.status-select.status-resolved {
    color: #5b743c;
    background: var(--green-soft);
    border-color: #cfdfc5;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 2px;
}

.row-actions .danger-action:hover {
    color: var(--coral);
    background: var(--coral-soft);
}

.state-panel {
    min-height: 350px;
    padding: 48px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.state-panel strong {
    margin: 16px 0 6px;
}

.state-panel p {
    max-width: 390px;
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.state-icon {
    width: 48px;
    height: 48px;
    color: var(--green);
    background: var(--green-soft);
    border-radius: 6px;
}

.state-icon.error {
    color: var(--coral);
    background: var(--coral-soft);
}

.loader {
    width: 30px;
    height: 30px;
    border: 3px solid #dfe8da;
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.result-summary {
    padding: 12px 18px;
    color: var(--muted);
    background: #fafbfa;
    border-top: 1px solid var(--border);
    font-size: 0.74rem;
}

.drawer {
    position: fixed;
    inset: 0;
    z-index: 60;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(22, 32, 26, 0.42);
    border: 0;
}

.drawer-panel {
    position: absolute;
    inset: 0 0 0 auto;
    width: min(520px, 100%);
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: -20px 0 50px rgba(25, 40, 31, 0.15);
    animation: drawer-in 0.24s ease-out;
}

@keyframes drawer-in {
    from {
        transform: translateX(100%);
    }
}

.drawer-header {
    min-height: 92px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.drawer-header h2 {
    margin: 0;
    font-size: 1.35rem;
}

.drawer-content {
    padding: 24px;
    overflow-y: auto;
}

.drawer-person {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.drawer-person .person-avatar {
    width: 48px;
    height: 48px;
}

.drawer-person h3 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.drawer-person p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.detail-grid {
    margin: 22px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-item {
    min-width: 0;
    padding: 14px;
    background: #f6f8f6;
    border-radius: 6px;
}

.detail-item span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-item a,
.detail-item strong {
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: 0.8rem;
    text-decoration: none;
}

.detail-item a:hover {
    color: var(--green);
    text-decoration: underline;
}

.message-block {
    padding: 18px;
    color: #414c46;
    background: #f6f8f6;
    border-left: 3px solid var(--green);
    border-radius: 0 6px 6px 0;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.drawer-actions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
}

.drawer-actions a {
    flex: 1;
    text-decoration: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(22, 32, 26, 0.5);
}

.modal-card {
    position: relative;
    width: min(420px, 100%);
    padding: 28px;
    background: #fff;
    border-radius: 7px;
    box-shadow: var(--shadow);
}

.modal-card h2 {
    margin: 18px 0 8px;
    font-size: 1.25rem;
}

.modal-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.modal-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.toast-region {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 100;
    display: grid;
    gap: 8px;
}

.toast {
    min-width: 260px;
    max-width: 380px;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    background: #2d4033;
    border-radius: 6px;
    box-shadow: var(--shadow);
    font-size: 0.82rem;
    animation: toast-in 0.2s ease-out;
}

.toast.error {
    background: #8d433e;
}

.toast svg {
    width: 18px;
    flex: 0 0 auto;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(22, 32, 26, 0.4);
}

@media (max-width: 1050px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .last-updated {
        display: none;
    }
}

@media (max-width: 820px) {
    .login-view {
        grid-template-columns: 1fr;
    }

    .login-brand {
        display: none;
    }

    .login-panel {
        padding: 28px 20px;
        background: var(--canvas);
    }

    .login-card {
        padding: 28px 22px;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 7px;
        box-shadow: var(--shadow);
    }

    .mobile-brand {
        margin-bottom: 34px;
        display: flex;
        align-items: center;
        gap: 10px;
        font-weight: 700;
    }

    .mobile-brand img {
        width: 55px;
        height: 40px;
        padding: 3px;
        border-radius: 4px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .dashboard-main {
        margin-left: 0;
    }

    .menu-button {
        display: inline-grid;
    }

    .topbar {
        min-height: 80px;
    }

    .section-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .search-wrap {
        width: 100%;
    }

    .filter-tabs {
        margin-left: 0;
        overflow-x: auto;
    }

    .filter-tab {
        flex: 1;
    }
}

@media (max-width: 560px) {
    .topbar {
        padding: 14px 16px;
    }

    .topbar h1 {
        font-size: 1.2rem;
    }

    .topbar .eyebrow {
        display: none;
    }

    .dashboard-content {
        padding: 18px 14px 38px;
    }

    .stats-grid {
        gap: 9px;
    }

    .stat-card {
        min-height: 90px;
        padding: 13px;
        gap: 10px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
    }

    .stat-icon svg {
        width: 18px;
    }

    .stat-card span {
        font-size: 0.66rem;
    }

    .stat-card strong {
        font-size: 1.35rem;
    }

    .inquiries-section {
        margin-top: 14px;
    }

    .section-toolbar {
        padding: 12px;
    }

    .filter-tab {
        padding: 0 10px;
    }

    .drawer-panel {
        top: 36px;
        border-radius: 7px 7px 0 0;
    }

    .drawer-header,
    .drawer-content {
        padding-left: 18px;
        padding-right: 18px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .drawer-actions {
        flex-direction: column;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions button {
        width: 100%;
    }

    .toast-region {
        right: 12px;
        bottom: 12px;
        left: 12px;
    }

    .toast {
        min-width: 0;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}