:root {
    --p1: #00594e;
    --p1-deep: #003e36;
    --p1-soft: #0a7163;
    --p2: #b5a160;
    --p2-bright: #d4c178;
    --ink: #0e1f1c;
    --muted: #5c6b67;
    --line: rgba(0, 89, 78, .12);
    --bg: #eef2f0;
    --card: #ffffff;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(8, 40, 35, .08);
    --ok: #047857;
    --warn: #b45309;
    --err: #b91c1c;
    --info: #1d4ed8;
}

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

body {
    font-family: "Montserrat", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .side__brand span { font-family: "Sora", "Montserrat", sans-serif; letter-spacing: -.01em; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ===== Gate ===== */
.gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(60% 55% at 50% 30%, rgba(0, 185, 163, .25), transparent 70%),
        linear-gradient(135deg, #00251f, #00594e 60%, #001f1a);
}

.gate__card {
    width: min(420px, 92vw);
    background: rgba(255, 255, 255, .96);
    border-radius: 24px;
    padding: 40px 34px;
    text-align: center;
    box-shadow: 0 40px 100px rgba(0, 0, 0, .4);
}

.gate__logo { width: 64px; height: 64px; object-fit: contain; margin-bottom: 16px; }
.gate__title { font-size: 1.5rem; color: var(--p1-deep); margin-bottom: 8px; }
.gate__sub { color: var(--muted); font-size: .94rem; margin-bottom: 26px; }

.gate__btn {
    display: inline-flex; align-items: center; gap: 10px;
    width: 100%; justify-content: center;
    padding: 13px; border: none; border-radius: 12px;
    background: var(--p1); color: #fff; font-weight: 700; font-size: .95rem;
    transition: background .2s, transform .15s;
}
.gate__btn:hover { background: var(--p1-soft); transform: translateY(-1px); }

.gate__denied { margin-top: 22px; color: var(--err); }
.gate__denied i { font-size: 1.6rem; }
.gate__denied p { margin: 8px 0 12px; font-weight: 600; font-size: .9rem; }
.gate__link { background: none; border: none; color: var(--p1); font-weight: 700; text-decoration: underline; }

/* ===== App layout ===== */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.side {
    background: linear-gradient(180deg, var(--p1-deep), var(--p1) 70%, var(--p1-soft));
    color: #fff;
    display: flex; flex-direction: column;
    padding: 20px 14px;
    position: sticky; top: 0; height: 100vh;
}

.side__brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.side__brand img { width: 34px; height: 34px; }
.side__brand span { font-weight: 800; font-size: 1.05rem; }
.side__brand b { color: var(--p2-bright); }
.side__brand em { font-style: normal; font-weight: 600; opacity: .7; font-size: .8rem; }

.side__nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side__nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 11px;
    color: rgba(255, 255, 255, .82); font-weight: 600; font-size: .92rem;
    transition: background .18s, color .18s;
}
.side__nav a i { width: 20px; text-align: center; opacity: .9; }
.side__nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side__nav a.is-active { background: rgba(255, 255, 255, .16); color: #fff; }
.side__nav a.is-active i { color: var(--p2-bright); }

.side__home { display: flex; align-items: center; gap: 9px; padding: 12px 14px; font-size: .85rem; color: rgba(255, 255, 255, .6); }
.side__home:hover { color: #fff; }

/* ===== Topbar ===== */
.main { display: flex; flex-direction: column; min-width: 0; }

.top {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 16px;
    height: 68px; padding: 0 24px;
    background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.top__menu { display: none; background: none; border: none; font-size: 1.2rem; color: var(--p1); }
.top__title { font-size: 1.3rem; color: var(--p1-deep); flex: 1; }
.top__user { display: flex; align-items: center; gap: 12px; }
.top__name { font-weight: 600; font-size: .88rem; color: var(--muted); }
.top__avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--p1); }
.top__out { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--err); }
.top__out:hover { background: #fff5f5; }

/* ===== View ===== */
.view { padding: 26px 24px 60px; }
.loading { color: var(--muted); padding: 40px; text-align: center; font-weight: 600; }

/* Cards / grids */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat {
    background: var(--card); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 16px;
}
.stat__ic { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; background: linear-gradient(150deg, rgba(0, 89, 78, .1), rgba(181, 161, 96, .14)); color: var(--p1); flex: none; }
.stat__n { font-family: "Sora", sans-serif; font-size: 1.9rem; font-weight: 800; color: var(--p1-deep); line-height: 1; }
.stat__l { font-size: .8rem; color: var(--muted); font-weight: 600; margin-top: 4px; }

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 22px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel__head h3 { font-size: 1.1rem; color: var(--p1-deep); }
.panel__sub { font-size: .82rem; color: var(--muted); }

/* Table */
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: rgba(0, 89, 78, .03); }
.tbl-wrap { overflow-x: auto; }

.u-cell { display: flex; align-items: center; gap: 10px; }
.u-ava { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--p1); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.u-mail { font-size: .78rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(0, 89, 78, .1); color: var(--p1); display: inline-flex; align-items: center; gap: 5px; }
.chip.admin { background: rgba(181, 161, 96, .2); color: #8a7424; }
.chip i { cursor: pointer; opacity: .6; }
.chip i:hover { opacity: 1; color: var(--err); }

/* Buttons / forms */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: none; font-weight: 700; font-size: .86rem; transition: background .2s, transform .15s, box-shadow .2s; }
.btn-primary { background: var(--p1); color: #fff; }
.btn-primary:hover { background: var(--p1-soft); transform: translateY(-1px); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--p1); }
.btn-ghost:hover { border-color: var(--p1); }
.btn-sm { padding: 7px 12px; font-size: .8rem; }
.btn-danger { background: #fff; border: 1px solid rgba(185, 28, 28, .3); color: var(--err); }
.btn-danger:hover { background: #fff5f5; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line);
    font-family: inherit; font-size: .9rem; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--p1); box-shadow: 0 0 0 3px rgba(0, 89, 78, .1); }
.field textarea { resize: vertical; min-height: 80px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.empty { text-align: center; color: var(--muted); padding: 30px; font-size: .9rem; }
.empty i { font-size: 1.8rem; opacity: .35; display: block; margin-bottom: 10px; }

/* Notif/list item */
.nlist { display: flex; flex-direction: column; gap: 8px; }
.nrow { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; align-items: flex-start; }
.nrow__ic { width: 38px; height: 38px; border-radius: 10px; flex: none; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; padding: 6px; }
.nrow__ic img { width: 100%; height: 100%; object-fit: contain; }
.nrow__b { flex: 1; min-width: 0; }
.nrow__top { display: flex; gap: 8px; align-items: center; }
.nrow__app { font-size: .64rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--p2); }
.nrow__t { font-size: .68rem; color: var(--muted); }
.nrow__title { font-weight: 700; font-size: .9rem; margin: 2px 0; }
.nrow__msg { font-size: .82rem; color: var(--muted); }
.type-dot { width: 8px; height: 8px; border-radius: 50%; }
.type-dot.info { background: var(--info); } .type-dot.success { background: var(--ok); } .type-dot.warn { background: var(--warn); } .type-dot.error { background: var(--err); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(8, 30, 26, .55); }
.modal[hidden] { display: none; }
.modal__card { width: min(440px, 94vw); background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); max-height: 90vh; overflow-y: auto; }
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal__head h3 { font-size: 1.15rem; color: var(--p1-deep); }
.modal__x { background: none; border: none; font-size: 1.2rem; color: var(--muted); }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* Toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 500; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #fff; border-left: 4px solid var(--p1); border-radius: 10px; padding: 12px 16px; box-shadow: 0 12px 30px rgba(8, 40, 35, .2); font-size: .86rem; font-weight: 600; min-width: 220px; animation: tin .25s ease; }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--err); }
@keyframes tin { from { opacity: 0; transform: translateX(20px); } }

/* Responsive */
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .side { position: fixed; left: 0; top: 0; z-index: 120; width: 248px; transform: translateX(-100%); transition: transform .25s ease; }
    .app.nav-open .side { transform: none; }
    .top__menu { display: block; }
    .grid2 { grid-template-columns: 1fr; }
    .top__name { display: none; }
}
