/* Shared by every portal page: tokens, reset, layout, sidebar, topbar, card, table, badge, button */
:root {
    --bg: #f1f7f7;
    --surface: #fff;
    --ink: #1f2d33;
    --muted: #7a8f94;
    --line: #e1eded;
    --primary: #0d7f77;
    --primary-soft: #dff3f1;
    --rose: #d6527a;
    --rose-soft: #fde8ee;
    --sage: #2f8f61;
    --sage-soft: #e3f3ea;
    --amber: #b9761a;
    --amber-soft: #fff1da;
    --radius: 18px;
    --shadow: 0 6px 24px rgba(13, 90, 85, .08);
    --font: "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: 0;
    background: none;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Layout */
.layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    padding: 24px 18px;
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    padding: 0 8px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 500;
    transition: background .15s, color .15s;
}

.nav a:hover {
    background: var(--bg);
    color: var(--ink);
}

.nav a.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.nav .ico {
    width: 20px;
    text-align: center;
}

.user-card {
    margin-top: auto;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-card .who {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-card strong {
    display: block;
    font-size: 14px;
    line-height: 1.3;
}

.user-card small {
    color: var(--muted);
    font-size: 12px;
}

.logout {
    text-align: center;
    padding: 9px;
    border-radius: 10px;
    background: var(--surface);
    color: var(--rose);
    font-weight: 600;
    font-size: 14px;
}

.logout:hover {
    background: var(--rose-soft);
}

.main {
    padding: 28px 32px 48px;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.menu-btn {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 18px;
}

.greeting h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.greeting p {
    color: var(--muted);
    font-size: 14px;
}

.top-actions {
    margin-left: auto;
    display: flex;
    gap: 12px;
}

/* Components */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.card-head h2 {
    font-size: 17px;
    font-weight: 700;
}

.card-head a {
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
}

.btn {
    padding: 11px 18px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(13, 127, 119, .3);
}

.btn-primary:hover {
    background: #0a6b64;
}

.btn-soft {
    background: var(--primary-soft);
    color: var(--primary);
}

.search {
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 14px;
    width: 260px;
    max-width: 100%;
}

.search:focus {
    border-color: var(--primary);
    outline: none;
}

.search::placeholder {
    color: var(--muted);
}

.note {
    background: var(--amber-soft);
    color: var(--amber);
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 18px;
}

.avatar, .dot {
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    flex-shrink: 0;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--rose-soft);
    color: var(--rose);
}

.dot {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.c1 {
    background: var(--primary-soft);
    color: var(--primary);
}

.c2 {
    background: var(--rose-soft);
    color: var(--rose);
}

.c3 {
    background: var(--sage-soft);
    color: var(--sage);
}

.c4 {
    background: var(--amber-soft);
    color: var(--amber);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

th {
    text-align: left;
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    padding: 0 10px 12px;
}

td {
    padding: 14px 10px;
    border-top: 1px solid var(--line);
    font-size: 14px;
}

.person {
    display: flex;
    align-items: center;
    gap: 12px;
}

.person small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.badge {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.b-confirmed {
    background: var(--primary-soft);
    color: var(--primary);
}

.b-done {
    background: var(--sage-soft);
    color: var(--sage);
}

.b-pending {
    background: var(--amber-soft);
    color: var(--amber);
}

.b-noshow {
    background: var(--rose-soft);
    color: var(--rose);
}

/* Mobile menu: close button + backdrop */
.sidebar-close {
    display: none;
    margin-left: auto;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg);
    color: var(--ink);
    font-size: 16px;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 45, 48, .4);
    z-index: 15;
}

body.no-scroll {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 860px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 20;
        width: min(270px, 84vw);
        transform: translateX(-100%);
        transition: transform .2s;
        box-shadow: var(--shadow);
        overflow-y: auto;
    }

    .sidebar.open {
        transform: none;
    }

    .sidebar-close {
        display: block;
    }

    .overlay.show {
        display: block;
    }

    .menu-btn {
        display: block;
    }

    .main {
        padding: 20px 16px 40px;
    }
}

@media (max-width: 520px) {
    .greeting h1 {
        font-size: 20px;
    }

    .greeting {
        flex: 1;
        min-width: 0;
    }

    .top-actions {
        width: 100%;
        margin-left: 0;
    }

    .top-actions .btn {
        flex: 1;
    }

    .card {
        padding: 18px;
    }

    .search {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}