* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --navy: #172554;
    --purple: #7c3aed;
    --cyan: #0891b2;
    --green: #059669;
    --red: #e11d48;
    --orange: #ea580c;
    --bg: #f4f7fc;
    --white: #ffffff;
    --text: #172033;
    --muted: #64748b;
    --border: #e2e8f0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, "Noto Sans Khmer", sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* =====================================================
   APP LAYOUT
===================================================== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   SIDEBAR
===================================================== */

.sidebar {
    width: 255px;
    min-height: 100vh;

    background:
        linear-gradient(
            180deg,
            #111c44 0%,
            #172554 55%,
            #1e1b4b 100%
        );

    color: white;

    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;

    display: flex;
    flex-direction: column;

    padding: 25px 15px;

    z-index: 1000;

    box-shadow:
        10px 0 35px rgba(15,23,42,.10);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 0 10px 28px;

    border-bottom:
        1px solid rgba(255,255,255,.12);
}

.brand-logo {
    width: 46px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            135deg,
            #3b82f6,
            #7c3aed
        );

    border-radius: 14px;

    font-size: 24px;

    box-shadow:
        0 8px 20px rgba(59,130,246,.30);
}

.brand h2 {
    font-size: 18px;
}

.brand span {
    font-size: 12px;
    color: #a5b4fc;
}

.menu-title {
    font-size: 10px;
    font-weight: 800;

    color: #94a3b8;

    letter-spacing: 1.3px;

    padding: 25px 12px 10px;
}

.settings-title {
    margin-top: 5px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.menu-item {
    text-decoration: none;
    color: #cbd5e1;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 12px 13px;

    border-radius: 11px;

    font-size: 14px;
    font-weight: 600;

    transition: .2s;
}

.menu-item:hover {
    color: white;

    background:
        rgba(255,255,255,.09);
}

.menu-item.active {
    color: white;

    background:
        linear-gradient(
            135deg,
            #2563eb,
            #4f46e5
        );

    box-shadow:
        0 7px 18px rgba(37,99,235,.28);
}

.menu-icon {
    width: 25px;
    text-align: center;
    font-size: 17px;
}

.online-dot {
    width: 7px;
    height: 7px;

    background: #22c55e;

    border-radius: 50%;

    margin-left: auto;
}

.sidebar-bottom {
    margin-top: auto;
}

.admin-box {
    display: flex;
    align-items: center;

    gap: 10px;

    padding: 12px;

    border-radius: 13px;

    background:
        rgba(255,255,255,.07);
}

.admin-avatar {
    width: 38px;
    height: 38px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            135deg,
            #3b82f6,
            #8b5cf6
        );

    font-weight: 800;
}

.admin-info {
    display: flex;
    flex-direction: column;

    flex: 1;
}

.admin-info strong {
    font-size: 12px;
}

.admin-info small {
    font-size: 10px;
    color: #94a3b8;
}

.admin-more {
    border: none;
    background: transparent;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

/* =====================================================
   MAIN
===================================================== */

.main-content {
    margin-left: 255px;

    width: calc(100% - 255px);

    padding: 25px 30px;
}

/* =====================================================
   TOPBAR
===================================================== */

.topbar {
    height: 65px;

    background: white;

    border: 1px solid var(--border);

    border-radius: 17px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 20px;

    margin-bottom: 25px;

    box-shadow:
        0 8px 25px rgba(15,23,42,.05);
}

.page-title {
    display: flex;
    flex-direction: column;
}

.page-title span {
    font-size: 19px;
    font-weight: 800;
    color: var(--navy);
}

.page-title small {
    color: var(--muted);
    font-size: 11px;
}

.topbar > div:first-child {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.system-online {
    color: var(--green);

    background: #ecfdf5;

    border: 1px solid #bbf7d0;

    padding: 8px 12px;

    border-radius: 20px;

    font-size: 12px;
    font-weight: 700;
}

.pulse {
    display: inline-block;

    width: 7px;
    height: 7px;

    background: #22c55e;

    border-radius: 50%;

    margin-right: 5px;

    box-shadow:
        0 0 0 4px rgba(34,197,94,.12);
}

.notification {
    position: relative;

    font-size: 19px;

    cursor: pointer;
}

.notification span {
    position: absolute;

    top: -6px;
    right: -7px;

    width: 16px;
    height: 16px;

    background: var(--red);

    color: white;

    font-size: 9px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-top {
    border: none;

    background:
        #fff1f2;

    color: var(--red);

    padding: 9px 13px;

    border-radius: 9px;

    font-weight: 700;

    cursor: pointer;
}

.mobile-menu-btn {
    display: none;

    border: none;

    background: #eff6ff;

    color: var(--blue);

    padding: 8px;

    border-radius: 8px;

    cursor: pointer;
}

/* =====================================================
   PAGE SECTION
===================================================== */

.page-section {
    display: none;
}

.page-section.active-section {
    display: block;

    animation:
        fadeIn .25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================
   WELCOME
===================================================== */

.welcome-banner {
    background:
        linear-gradient(
            135deg,
            #1d4ed8,
            #4f46e5 60%,
            #7c3aed
        );

    color: white;

    padding: 30px;

    border-radius: 22px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 22px;

    box-shadow:
        0 15px 35px rgba(37,99,235,.20);

    overflow: hidden;

    position: relative;
}

.welcome-banner::after {
    content: "";

    width: 220px;
    height: 220px;

    position: absolute;

    right: -70px;
    top: -100px;

    border-radius: 50%;

    background:
        rgba(255,255,255,.10);
}

.welcome-small {
    font-size: 13px;
    opacity: .85;
}

.welcome-banner h1 {
    font-size: 25px;
    margin: 7px 0;
}

.welcome-banner p {
    font-size: 13px;
    opacity: .85;
}

.welcome-icon {
    font-size: 70px;

    position: relative;
    z-index: 2;
}

/* =====================================================
   DASHBOARD
===================================================== */

.dashboard {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 18px;

    margin-bottom: 20px;
}

.card {
    background: white;

    padding: 22px;

    border-radius: 18px;

    border: 1px solid var(--border);

    display: flex;
    align-items: center;

    gap: 15px;

    box-shadow:
        0 8px 25px rgba(15,23,42,.05);

    transition: .25s;
}

.card:hover {
    transform: translateY(-5px);

    box-shadow:
        0 15px 35px rgba(15,23,42,.09);
}

.card-icon {
    width: 55px;
    height: 55px;

    border-radius: 15px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 25px;

    flex-shrink: 0;
}

.card-blue .card-icon {
    background: #dbeafe;
}

.card-green .card-icon {
    background: #d1fae5;
}

.card-red .card-icon {
    background: #ffe4e6;
}

.card-purple .card-icon {
    background: #ede9fe;
}

.card-content p {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.card-content h2 {
    font-size: 26px;
    margin: 3px 0;
}

.card-content small {
    color: #94a3b8;
    font-size: 10px;
}

/* =====================================================
   QUICK CARDS
===================================================== */

.quick-grid {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 18px;

    margin-bottom: 25px;
}

.quick-card {
    background: white;

    border: 1px solid var(--border);

    border-radius: 17px;

    padding: 17px;

    display: flex;
    align-items: center;

    gap: 12px;

    cursor: pointer;

    transition: .25s;
}

.quick-card:hover {
    transform: translateY(-3px);

    box-shadow:
        0 12px 25px rgba(15,23,42,.07);
}

.quick-card > div:nth-child(2) {
    flex: 1;

    display: flex;
    flex-direction: column;
}

.quick-card strong {
    font-size: 13px;
}

.quick-card small {
    color: var(--muted);
    font-size: 10px;
    margin-top: 3px;
}

.quick-card > span {
    color: #94a3b8;
}

.quick-icon {
    width: 42px;
    height: 42px;

    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-icon.blue {
    background: #dbeafe;
}

.quick-icon.purple {
    background: #ede9fe;
}

.quick-icon.cyan {
    background: #cffafe;
}

/* =====================================================
   CONTENT HEADER
===================================================== */

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}

.content-header h2 {
    color: var(--navy);

    font-size: 22px;

    margin-bottom: 4px;
}

.content-header p {
    color: var(--muted);

    font-size: 12px;
}

.content-header.compact {
    margin-bottom: 18px;
}

/* =====================================================
   SECTION
===================================================== */

.section {
    background: white;

    padding: 25px;

    border-radius: 20px;

    border: 1px solid var(--border);

    box-shadow:
        0 8px 25px rgba(15,23,42,.05);

    margin-bottom: 20px;
}

/* =====================================================
   FORM
===================================================== */

.form-title {
    display: flex;
    align-items: center;

    gap: 12px;

    margin-bottom: 25px;
}

.form-title-icon {
    width: 45px;
    height: 45px;

    background:
        linear-gradient(
            135deg,
            #dbeafe,
            #ede9fe
        );

    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 22px;
}

.form-title h2 {
    font-size: 18px;
    color: var(--navy);
}

.form-title p {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
}

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 18px;
}

.form-group label {
    display: block;

    font-size: 13px;

    font-weight: 700;

    color: #334155;

    margin-bottom: 7px;
}

.form-group input,
.form-group select {
    width: 100%;

    padding: 13px 14px;

    background: #f8fafc;

    border: 1px solid #dbe3ee;

    border-radius: 10px;

    outline: none;

    font-size: 14px;

    color: var(--text);

    transition: .2s;
}

.form-group input:focus,
.form-group select:focus {
    background: white;

    border-color: var(--blue);

    box-shadow:
        0 0 0 4px rgba(37,99,235,.10);
}

.primary-btn {
    margin-top: 23px;

    padding: 13px 22px;

    border: none;

    border-radius: 10px;

    color: white;

    background:
        linear-gradient(
            135deg,
            #2563eb,
            #4f46e5
        );

    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 7px 18px rgba(37,99,235,.20);

    transition: .2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
}

#message {
    margin-top: 12px;
}

/* =====================================================
   SEARCH
===================================================== */

.search-box {
    margin-bottom: 18px;
}

.search-box input {
    width: 100%;

    padding: 13px 15px;

    border: 1px solid #dbe3ee;

    background: #f8fafc;

    border-radius: 10px;

    outline: none;

    font-size: 14px;
}

.search-box input:focus {
    background: white;

    border-color: var(--blue);

    box-shadow:
        0 0 0 4px rgba(37,99,235,.10);
}

/* =====================================================
   TABLE
===================================================== */

.table-container {
    overflow-x: auto;

    border: 1px solid var(--border);

    border-radius: 13px;
}

table {
    width: 100%;

    min-width: 1000px;

    border-collapse: collapse;
}

th,
td {
    padding: 14px;

    border-bottom:
        1px solid #edf2f7;

    text-align: left;

    font-size: 13px;
}

th {
    background:
        linear-gradient(
            135deg,
            #eff6ff,
            #f5f3ff
        );

    color: #475569;

    font-size: 11px;

    font-weight: 800;
}

td {
    background: white;
}

tbody tr:hover td {
    background: #f8fbff;
}

.status {
    display: inline-flex;

    padding: 6px 10px;

    border-radius: 20px;

    font-size: 11px;

    font-weight: 800;
}

.status-paid {
    color: #047857;

    background: #d1fae5;

    border: 1px solid #a7f3d0;
}

.status-unpaid {
    color: #be123c;

    background: #ffe4e6;

    border: 1px solid #fecdd3;
}

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.table-btn {
    border: none;

    padding: 7px 9px;

    border-radius: 7px;

    cursor: pointer;

    font-size: 11px;

    font-weight: 700;

    transition: .2s;
}

.table-btn:hover {
    transform: translateY(-1px);
}

.paid-btn {
    background: #d1fae5;
    color: #047857;
}

.unpaid-btn {
    background: #fff7ed;
    color: #c2410c;
}

.next-btn {
    background: #e0f2fe;
    color: #0369a1;
}

.edit-btn {
    background: #ede9fe;
    color: #6d28d9;
}

.delete-btn {
    background: #ffe4e6;
    color: #be123c;
}

.refresh-btn {
    border: 1px solid #bfdbfe;

    padding: 9px 14px;

    border-radius: 9px;

    background: #eff6ff;

    color: var(--blue);

    font-weight: 700;

    cursor: pointer;
}

.empty {
    text-align: center;

    padding: 45px;

    color: #94a3b8;
}

/* =====================================================
   REPORT
===================================================== */

.report-grid {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 18px;

    margin-bottom: 20px;
}

.report-card {
    padding: 23px;

    border-radius: 18px;

    display: flex;
    align-items: center;

    gap: 15px;

    border: 1px solid var(--border);
}

.report-card > span {
    width: 50px;
    height: 50px;

    border-radius: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 24px;
}

.report-card div {
    display: flex;
    flex-direction: column;
}

.report-card small {
    color: var(--muted);
}

.report-card strong {
    font-size: 24px;
    margin-top: 4px;
}

.blue-report {
    background: #eff6ff;
}

.blue-report > span {
    background: #dbeafe;
}

.green-report {
    background: #ecfdf5;
}

.green-report > span {
    background: #d1fae5;
}

.red-report {
    background: #fff1f2;
}

.red-report > span {
    background: #ffe4e6;
}

.report-message {
    text-align: center;

    padding: 50px;
}

.big-report-icon {
    font-size: 50px;

    margin-bottom: 10px;
}

.report-message h2 {
    color: var(--navy);
}

.report-message p {
    color: var(--muted);

    margin-top: 7px;
}

/* =====================================================
   TELEGRAM
===================================================== */

.telegram-panel {
    background:
        linear-gradient(
            135deg,
            #0284c7,
            #2563eb,
            #4f46e5
        );

    color: white;

    padding: 30px;

    border-radius: 20px;

    display: flex;

    align-items: center;

    gap: 20px;

    margin-bottom: 20px;

    box-shadow:
        0 15px 35px rgba(37,99,235,.18);
}

.telegram-big-icon {
    width: 70px;
    height: 70px;

    background:
        rgba(255,255,255,.15);

    border-radius: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 38px;
}

.telegram-info h2 {
    margin-bottom: 6px;
}

.telegram-info p {
    font-size: 13px;
    opacity: .85;
}

.telegram-connected {
    margin-top: 12px;

    display: inline-block;

    background:
        rgba(255,255,255,.13);

    padding: 7px 12px;

    border-radius: 20px;

    font-size: 11px;
}

/* =====================================================
   REMINDER
===================================================== */

.reminder-list {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 15px;
}

.reminder-item {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 15px;

    border: 1px solid var(--border);

    border-radius: 13px;
}

.reminder-item > div {
    display: flex;
    flex-direction: column;
}

.reminder-item small {
    color: var(--muted);

    font-size: 10px;

    margin-top: 3px;
}

.reminder-icon {
    width: 42px;
    height: 42px;

    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: 800;
}

.reminder-icon.blue {
    background: #dbeafe;
    color: #2563eb;
}

.reminder-icon.purple {
    background: #ede9fe;
    color: #7c3aed;
}

.reminder-icon.red {
    background: #ffe4e6;
    color: #e11d48;
}

/* =====================================================
   SETTINGS
===================================================== */

.settings-card {
    padding: 10px 25px;
}

.settings-row {
    padding: 20px 0;

    border-bottom:
        1px solid var(--border);

    display: flex;

    justify-content: space-between;

    align-items: center;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row div {
    display: flex;
    flex-direction: column;
}

.settings-row strong {
    font-size: 14px;
}

.settings-row small {
    color: var(--muted);

    margin-top: 4px;

    font-size: 11px;
}

.setting-status {
    color: var(--green);

    background: #ecfdf5;

    padding: 7px 12px;

    border-radius: 20px;

    font-size: 11px;

    font-weight: 700;
}

/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 1100px) {

    .dashboard {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .quick-grid {
        grid-template-columns: 1fr;
    }

}

/* =====================================================
   TABLET
===================================================== */

@media (max-width: 800px) {

    .sidebar {
        transform: translateX(-100%);

        transition: .3s;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;

        width: 100%;

        padding: 18px;
    }

    .mobile-menu-btn {
        display: block;
    }

    .topbar {
        height: auto;

        min-height: 60px;

        padding: 10px 13px;
    }

    .system-online {
        display: none;
    }

    .logout-top {
        font-size: 11px;
    }

    .welcome-banner {
        padding: 23px;
    }

    .welcome-banner h1 {
        font-size: 20px;
    }

    .welcome-icon {
        font-size: 50px;
    }

    .report-grid {
        grid-template-columns: 1fr;
    }

    .reminder-list {
        grid-template-columns: 1fr;
    }

}

/* =====================================================
   PHONE
===================================================== */

@media (max-width: 600px) {

    .main-content {
        padding: 12px;
    }

    .topbar {
        margin-bottom: 15px;
    }

    .page-title span {
        font-size: 16px;
    }

    .page-title small {
        display: none;
    }

    .notification {
        display: none;
    }

    .dashboard {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 18px;
    }

    .welcome-banner {
        padding: 20px;

        border-radius: 17px;
    }

    .welcome-banner h1 {
        font-size: 18px;
    }

    .welcome-banner p {
        font-size: 11px;
    }

    .welcome-icon {
        display: none;
    }

    .content-header {
        align-items: flex-start;

        gap: 10px;
    }

    .content-header h2 {
        font-size: 18px;
    }

    .section {
        padding: 18px;

        border-radius: 17px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .primary-btn {
        width: 100%;
    }

    .telegram-panel {
        padding: 22px;

        align-items: flex-start;
    }

    .telegram-big-icon {
        width: 55px;
        height: 55px;

        font-size: 28px;
    }

    .telegram-info h2 {
        font-size: 17px;
    }

    .settings-row {
        gap: 10px;
    }

}