:root {
    --bg: #f5efe8;
    --surface: #ffffff;
    --surface-2: #faf6f0;
    --text: #2f2f2f;
    --muted: #777;
    --primary: #8B5E3C;
    --primary-dark: #6d472d;
    --accent: #D4AF37;
    --border: #e8dfd4;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f8f2eb 0%, #efe1cf 100%);
    color: var(--text);
}

.dashboard-shell {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #1f1917;
    color: white;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: white;
}

.brand h2 {
    margin: 0;
    font-size: 1.15rem;
}

.brand p {
    margin: 2px 0 0;
    color: #d7c2b0;
    font-size: .9rem;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a {
    color: #efe2d6;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: .25s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(212, 175, 55, .16);
    color: white;
}

.sidebar-footer {
    margin-top: 24px;
}

.ghost-btn,
.primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border-radius: 999px;
    padding: 12px 16px;
    font-weight: 600;
    transition: .25s ease;
}

.ghost-btn {
    color: white;
    background: rgba(255,255,255,.08);
}

.primary-btn {
    background: var(--primary);
    color: white;
}

.primary-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.main-panel {
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: .24em;
    color: var(--accent);
    font-size: .78rem;
    font-weight: 700;
}

.topbar h1 {
    margin: 0;
    font-size: 1.8rem;
}

.subtext {
    margin: 6px 0 0;
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 14px;
    min-width: 220px;
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    padding: 18px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,.04);
}

.stat-card.accent {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(139, 94, 60, .12);
    color: var(--primary);
}

.stat-card.accent .stat-icon {
    background: rgba(255,255,255,.18);
    color: white;
}

.stat-card h3 {
    margin: 0;
    font-size: 1.25rem;
}

.stat-card p {
    margin: 4px 0 0;
    color: var(--muted);
}

.stat-card.accent p {
    color: rgba(255,255,255,.88);
}

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.lower-grid {
    grid-template-columns: 1fr 1fr;
}

.panel {
    background: var(--surface);
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 10px 25px rgba(0,0,0,.04);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.05rem;
}

.panel-header a {
    color: var(--primary);
    font-size: .9rem;
    text-decoration: none;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    font-size: .95rem;
}

th {
    color: var(--muted);
    font-weight: 600;
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-btn,
.table-action-button {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: .85rem;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.filter-btn {
    background: var(--surface-2);
    color: var(--text);
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
}

.table-action-button {
    background: #f5f5f5;
    color: var(--text);
}

.table-action-button:hover {
    background: #eef2ff;
}

.table-action-button.delete-request {
    background: #fee7e1;
    color: #b02b15;
}

.consultation-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,.05);
}

.consultation-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.consultation-card-header h3 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.consultation-meta {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
}

.consultation-card-body {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.consultation-field {
    display: grid;
    gap: 4px;
}

.consultation-field strong {
    color: var(--text);
}

.consultation-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.status {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 600;
}

.status.pending {
    background: #fff4d8;
    color: #8a6500;
}

.status.completed {
    background: #e6f7e8;
    color: #1e7a2f;
}

.status.review {
    background: #e9edff;
    color: #3f5ee3;
}

.status.pending {
    background: #fff4d8;
    color: #8a6500;
}

.status.completed {
    background: #e6f7e8;
    color: #1e7a2f;
}

.status.review {
    background: #e9edff;
    color: #3f5ee3;
}

.actions-list {
    display: grid;
    gap: 10px;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.simple-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: grid;
    gap: 12px;
}

.simple-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--muted);
    align-items: center;
}

.subscriber-table {
    width: 100%;
    border-collapse: collapse;
}

.subscriber-table th,
.subscriber-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: .95rem;
}

.subscriber-table th {
    background: var(--surface-2);
    color: var(--text);
    font-weight: 600;
}

.subscriber-controls {
    margin-bottom: 16px;
}

.subscriber-controls input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    font: inherit;
    background: var(--surface);
}

.subscriber-table td:last-child {
    white-space: nowrap;
}

.subscriber-table tr:hover {
    background: rgba(216, 189, 150, .12);
}

.list-item-content {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.list-item-actions {
    display: flex;
    gap: 6px;
}

.list-item-actions button {
    border: none;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font-weight: 600;
}

.list-item-actions .edit-btn {
    background: #f5f1ec;
    color: var(--primary);
}

.list-item-actions .delete-btn {
    background: #fee7e1;
    color: #b02b15;
}

.subscriber-delete-btn {
    padding: 8px 12px;
    font-size: .85rem;
}

.simple-list strong {
    color: var(--text);
}

.admin-form {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    background: #fff;
}

.admin-form button {
    border: none;
    background: var(--primary);
    color: white;
    padding: 12px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}

.admin-form button:hover {
    background: var(--primary-dark);
}

.progress-list {
    display: grid;
    gap: 12px;
}

.progress-item {
    display: grid;
    gap: 6px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: .95rem;
}

.progress-bar {
    height: 8px;
    border-radius: 999px;
    background: #eee2d3;
    overflow: hidden;
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--primary));
}

@media (max-width: 980px) {
    .dashboard-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 16px;
    }

    .stats-grid,
    .content-grid,
    .lower-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    body {
        font-size: 15px;
    }

    .main-panel {
        padding: 14px;
    }

    .topbar {
        align-items: flex-start;
        margin-bottom: 16px;
    }

    .topbar,
    .topbar-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .topbar-actions .primary-btn,
    .topbar-actions .search-box {
        width: 100%;
    }

    .stats-grid,
    .content-grid,
    .lower-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card,
    .panel {
        padding: 14px;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .simple-list li,
    .action-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-form button,
    .filter-btn,
    .table-action-button {
        width: 100%;
        justify-content: center;
    }

    .filter-group {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
    }

    .search-box {
        min-width: 100%;
    }
}

/* Mobile menu toggle and off-canvas sidebar */
.menu-toggle {
    display: none;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1.1rem;
    padding: 8px;
    border-radius: 8px;
}

@media (max-width: 980px) {
    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: white;
        background: rgba(255,255,255,0.04);
        margin-right: 8px;
    }

    .dashboard-shell {
        position: relative;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        transform: translateX(-110%);
        transition: transform .28s ease;
        z-index: 1200;
    }

    .dashboard-shell.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 0 20px 40px rgba(0,0,0,.28);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.36);
        opacity: 0;
        pointer-events: none;
        transition: opacity .28s ease;
        z-index: 1100;
    }

    .dashboard-shell.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }

    .consultation-table {
        min-width: 760px;
    }

    .consultation-table th,
    .consultation-table td {
        font-size: 0.85rem;
        padding: 8px 6px;
    }
}

/* Simple view hiding utility */
.hidden { display: none !important; }

.panel[data-views="overview messages"] {
    display: block;
}
