/* ==========================================================================
   Merci E — Admin design system
   Light blue theme derived from the brand logo
   Brand blue  : #0355A7
   Brand slate : #4A4C49
   ========================================================================== */

:root {
    --blue-50:  #eef5fd;
    --blue-100: #d6e7fa;
    --blue-200: #aecff4;
    --blue-300: #7fb2ec;
    --blue-400: #3f88de;
    --blue-500: #0f66c4;
    --blue-600: #0355a7;
    --blue-700: #024a92;
    --blue-800: #033c76;
    --blue-900: #06325e;

    --slate-900: #26282a;
    --slate-800: #33363a;
    --slate-700: #4a4c49;
    --slate-600: #5f6368;
    --slate-500: #7b8188;
    --slate-400: #9aa1a9;
    --slate-300: #c4cad1;
    --slate-200: #e2e6ea;
    --slate-100: #eef1f4;
    --slate-50:  #f6f8fb;

    --white: #ffffff;
    --danger: #d13438;
    --danger-bg: #fdecec;
    --success: #107c41;
    --success-bg: #e9f6ee;
    --warning: #b7791f;

    --bg-app: #f2f6fb;
    --sidebar-w: 260px;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;

    --shadow-xs: 0 1px 2px rgba(15, 40, 80, 0.06);
    --shadow-sm: 0 2px 8px rgba(15, 40, 80, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 40, 80, 0.08);
    --shadow-lg: 0 20px 48px rgba(15, 40, 80, 0.12);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        Helvetica, Arial, sans-serif;
}

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

html, body {
    height: 100%;
    font-family: var(--font);
    color: var(--slate-800);
    background: var(--bg-app);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-size: 14px;
    line-height: 1.5;
}

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

/* ---------- Login ---------- */

.auth-wrap {
    min-height: 100%;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}

.auth-brand {
    position: relative;
    background:
        radial-gradient(1200px 600px at 20% -10%, rgba(255,255,255,0.14), transparent 60%),
        linear-gradient(155deg, var(--blue-700) 0%, var(--blue-600) 45%, var(--blue-800) 100%);
    color: #fff;
    padding: 56px 64px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.auth-brand::after {
    content: '';
    position: absolute;
    right: -120px;
    bottom: -120px;
    width: 420px;
    height: 420px;
    border-radius: 40px;
    transform: rotate(35deg);
    background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0));
}

.auth-brand__logo {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.auth-brand__logo img {
    width: 52px;
    height: 52px;
    background: #fff;
    border-radius: 14px;
    padding: 7px;
    box-shadow: var(--shadow-md);
}

.auth-brand__logo span {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.auth-brand__body { position: relative; z-index: 1; max-width: 420px; }
.auth-brand__body h1 {
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}
.auth-brand__body p {
    font-size: 15px;
    color: rgba(255,255,255,0.82);
    line-height: 1.6;
}

.auth-brand__meta {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 28px;
    color: rgba(255,255,255,0.75);
    font-size: 13px;
}
.auth-brand__meta strong { display: block; color: #fff; font-size: 20px; font-weight: 700; }

.auth-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--white);
}

.auth-card { width: 100%; max-width: 380px; }
.auth-card__head { margin-bottom: 28px; }
.auth-card__head h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: -0.01em;
}
.auth-card__head p { color: var(--slate-500); margin-top: 6px; font-size: 14px; }

.field { margin-bottom: 18px; }
.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 7px;
}

.input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: var(--slate-50);
    font-size: 14px;
    color: var(--slate-900);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--slate-400); }
.input:focus {
    outline: none;
    background: #fff;
    border-color: var(--blue-400);
    box-shadow: 0 0 0 3px var(--blue-100);
}
.input--error { border-color: var(--danger); background: var(--danger-bg); }

.field__error { color: var(--danger); font-size: 12.5px; margin-top: 6px; }

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--slate-600); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--blue-600); }
.field-row a { font-size: 13.5px; color: var(--blue-600); font-weight: 600; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, box-shadow .15s, transform .05s;
}
.btn--primary {
    width: 100%;
    background: var(--blue-600);
    color: #fff;
    box-shadow: 0 6px 16px rgba(3, 85, 167, 0.28);
}
.btn--primary:hover { background: var(--blue-700); }
.btn--primary:active { transform: translateY(1px); }

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}
.alert--error { background: var(--danger-bg); color: var(--danger); border-color: #f3c9c9; }
.alert--success { background: var(--success-bg); color: var(--success); border-color: #bfe6cd; }

.auth-foot { margin-top: 26px; text-align: center; color: var(--slate-400); font-size: 12.5px; }

/* ---------- App shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--slate-900);
    color: var(--slate-300);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transition: transform .25s ease;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(15, 25, 45, 0.5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.sidebar-overlay[hidden] { display: none; }

/* Hamburger — desktop hidden, shown on mobile via media query */
.menu-toggle {
    display: none;
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--slate-200);
    background: #fff;
    color: var(--slate-700);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.menu-toggle:hover { background: var(--slate-50); }
.menu-toggle svg { width: 20px; height: 20px; }

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar__brand img {
    width: 40px; height: 40px;
    background: #fff;
    border-radius: 11px;
    padding: 5px;
}
.sidebar__brand b { color: #fff; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.sidebar__brand small { display: block; color: var(--slate-500); font-size: 11px; font-weight: 500; }

.nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav__label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--slate-500);
    padding: 12px 12px 6px;
    font-weight: 600;
}
.nav__label:first-child { padding-top: 4px; }
.nav__item { font-size: 13.5px; padding: 9px 12px; }
.nav__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--slate-300);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav__item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav__item.is-active {
    background: var(--blue-600);
    color: #fff;
    box-shadow: 0 6px 14px rgba(3,85,167,0.35);
}
.nav__item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav__item .nav__badge {
    margin-left: auto;
    min-width: 20px;
    text-align: center;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    padding: 1px 7px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(209,52,56,0.4);
}
.nav__item.is-active .nav__badge {
    background: #fff;
    color: var(--blue-700);
    box-shadow: none;
}

.sidebar__foot {
    padding: 14px;
    border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar__user {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px;
    border-radius: var(--radius-sm);
}
.avatar {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--blue-600);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.sidebar__user b { color: #fff; font-size: 13.5px; display: block; }
.sidebar__user small { color: var(--slate-500); font-size: 12px; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 66px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 { font-size: 18px; font-weight: 700; color: var(--slate-900); letter-spacing: -0.01em; }
.topbar__crumb { color: var(--slate-400); font-size: 13px; }

.search {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    height: 40px;
    width: 280px;
    padding: 0 14px;
    background: var(--slate-100);
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--slate-500);
}
.search input { border: none; background: transparent; outline: none; font-family: inherit; font-size: 13.5px; width: 100%; color: var(--slate-800); }
.search svg { width: 17px; height: 17px; flex-shrink: 0; }

.icon-btn {
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--slate-200);
    background: #fff;
    color: var(--slate-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--slate-50); border-color: var(--slate-300); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot {
    position: absolute; top: 8px; right: 9px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--danger); border: 2px solid #fff;
}

.content { padding: 28px; flex: 1; }
.page-head { margin-bottom: 22px; }
.page-head h2 { font-size: 22px; font-weight: 700; color: var(--slate-900); letter-spacing: -0.02em; }
.page-head p { color: var(--slate-500); margin-top: 4px; font-size: 14px; }

/* ---------- Stat cards ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}
.stat {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow .18s, transform .18s;
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat__label { color: var(--slate-500); font-size: 13px; font-weight: 500; }
.stat__ico {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: var(--blue-50);
    color: var(--blue-600);
    display: flex; align-items: center; justify-content: center;
}
.stat__ico svg { width: 20px; height: 20px; }
.stat__value { font-size: 28px; font-weight: 700; color: var(--slate-900); letter-spacing: -0.02em; }
.stat__foot { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12.5px; }
.chip {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: 12px;
}
.chip--up { background: var(--success-bg); color: var(--success); }
.chip--down { background: var(--danger-bg); color: var(--danger); }
.stat__foot .muted { color: var(--slate-400); }

/* ---------- Panels ---------- */

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }

.panel {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}
.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--slate-100);
}
.panel__head h3 { font-size: 15px; font-weight: 700; color: var(--slate-900); }
.panel__head a { font-size: 13px; color: var(--blue-600); font-weight: 600; }
.panel__body { padding: 20px; }

.chart {
    height: 240px;
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding-top: 10px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bar {
    width: 100%;
    max-width: 34px;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, var(--blue-400), var(--blue-600));
    transition: filter .15s;
}
.bar:hover { filter: brightness(1.08); }
.bar-col small { color: var(--slate-400); font-size: 11.5px; }

.list__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--slate-100);
}
.list__row:last-child { border-bottom: none; }
.list__ava {
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--slate-100); color: var(--slate-600);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.list__meta b { font-size: 13.5px; color: var(--slate-900); display: block; }
.list__meta small { color: var(--slate-500); font-size: 12px; }
.list__row .status { margin-left: auto; }

.status {
    font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
}
.status--ok { background: var(--success-bg); color: var(--success); }
.status--wait { background: #fff4e5; color: var(--warning); }
.status--off { background: var(--slate-100); color: var(--slate-500); }

.empty {
    text-align: center;
    color: var(--slate-400);
    padding: 30px 10px;
    font-size: 13.5px;
}

/* ---------- Table ---------- */

.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--slate-500);
    font-weight: 600;
    padding: 0 14px 12px;
    border-bottom: 1px solid var(--slate-200);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--slate-100); font-size: 13.5px; color: var(--slate-700); }
.table tr:last-child td { border-bottom: none; }
.table b { color: var(--slate-900); }

.logout-btn {
    background: transparent;
    border: none;
    color: var(--slate-400);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: inline-flex;
}
.logout-btn:hover { background: rgba(255,255,255,0.06); color: #fff; }

/* ---------- Pagination ---------- */

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 18px;
}
.pager__info {
    font-size: 12.5px;
    color: var(--slate-500);
}
.pager__list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.pager__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--slate-700);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
a.pager__btn:hover {
    background: var(--blue-50);
    border-color: var(--blue-200);
    color: var(--blue-700);
}
.pager__btn.is-active {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: var(--white);
    cursor: default;
}
.pager__btn--nav {
    font-size: 16px;
    font-weight: 700;
}
.pager__btn.is-disabled {
    color: var(--slate-300);
    background: var(--slate-50);
    cursor: not-allowed;
}
.pager__gap {
    border-color: transparent;
    background: transparent;
    color: var(--slate-400);
    min-width: 22px;
    padding: 0 2px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-brand { display: none; }

    /* Off-canvas sidebar, revealed by the hamburger */
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.is-open { transform: translateX(0); }
    .main { margin-left: 0; }

    .menu-toggle { display: inline-flex; }
    .topbar { padding: 0 16px; gap: 12px; }
    .topbar h1 { font-size: 16px; }
    .search { display: none; }
    .topbar .icon-btn { margin-left: auto; }

    .content { padding: 18px 16px; }
    .page-head h2 { font-size: 20px; }

    /* Keep wide tables inside their panel instead of blowing out the page */
    .panel__body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { min-width: 560px; }

    .pager { justify-content: center; }
    .pager__info { width: 100%; text-align: center; order: 2; }
}

body.menu-open { overflow: hidden; }

@media (max-width: 560px) {
    .stat-grid { grid-template-columns: 1fr; gap: 12px; }
    .mini-grid { grid-template-columns: 1fr; }
    .content { padding: 14px 12px; }
    .stat__value { font-size: 24px; }
}
