:root {
    --gm-blue: #0b2f7a;
    --gm-blue-mid: #1a4db0;
    --gm-teal: #0f9a9a;
    --gm-teal-soft: #e6f7f7;
    --gm-teal-dark: #0b7a7a;
    --gm-copper: #b87333;
    --gm-copper-light: #d4a017;
    --gm-ink: #1f2937;
    --gm-muted: #6b7280;
    --gm-sidebar-bg: #f3f4f6;
    --gm-panel: #ffffff;
    --gm-border: #e5e7eb;
    --gm-accent: #0f9a9a;
    --gm-accent-hover: #0b7a7a;
    --gm-sidebar-width: 280px;
}

* { box-sizing: border-box; }

body {
    background: #eef1f4;
    color: var(--gm-ink);
    height: 100%;
    min-height: 100vh;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    margin: 0;
    font-size: 0.875rem;
    overflow: hidden;
}

html {
    height: 100%;
    overflow: hidden;
}

.page-title.h3,
h1.page-title { font-size: 1.25rem !important; }
h1, .h3 { font-size: 1.2rem; }
.small, small { font-size: 0.78rem; }

/* ========== TOP NAVBAR ========== */
.gm-navbar {
    background: #fff;
    border-bottom: 1px solid var(--gm-border);
    height: 56px;
    padding: 0;
    z-index: 1030;
    flex-shrink: 0;
}

.gm-navbar .container-fluid {
    height: 56px;
}

.gm-nav-link-text {
    color: var(--gm-ink);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.35rem 0.5rem;
}

.gm-nav-link-text:hover { color: var(--gm-teal); }

.gm-icon-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: #4b5563;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
}

.gm-icon-btn:hover {
    background: #f3f4f6;
    color: var(--gm-teal);
}

.gm-icon-btn .gm-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    padding: 0 4px;
}

.gm-badge-danger { background: #ef4444; }
.gm-badge-warning { background: #f59e0b; }

.gm-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    background: var(--gm-teal-soft);
    color: var(--gm-teal-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    text-decoration: none;
}

.gm-hamburger {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #374151;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gm-hamburger:hover { background: #f3f4f6; color: var(--gm-teal); }

/* ========== SIDEBAR ========== */
.gm-shell {
    display: flex;
    height: calc(100vh - 56px);
    max-height: calc(100vh - 56px);
    min-height: 0;
    overflow: hidden;
}

.gm-sidebar {
    background: var(--gm-sidebar-bg);
    width: var(--gm-sidebar-width);
    height: 100%;
    max-height: 100%;
    min-height: 0;
    border-right: 1px solid var(--gm-border);
    overflow-x: hidden;
    overflow-y: auto;
    flex-shrink: 0;
    overscroll-behavior: contain;
}

.gm-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1rem 0.75rem;
    text-decoration: none;
    color: var(--gm-ink);
}

.gm-sidebar-brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--gm-border);
}

.gm-sidebar-brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    color: #111827;
}

.gm-sidebar-brand-sub {
    font-size: 0.72rem;
    color: var(--gm-muted);
    font-weight: 500;
}

.gm-user-card {
    margin: 0.25rem 0.85rem 1rem;
    padding: 0.7rem 0.85rem;
    background: #fff;
    border: 1px solid var(--gm-border);
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.gm-user-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 154, 154, 0.08);
}

.gm-user-card .gm-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.gm-user-meta { min-width: 0; flex: 1; }
.gm-user-name {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #111827;
}
.gm-user-role {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gm-teal);
}

.gm-menu-section {
    padding: 0.35rem 1rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
}

.gm-sidebar .nav {
    padding: 0 0.75rem 1.25rem;
    gap: 0.25rem;
}

.gm-sidebar .nav-link {
    color: #4b5563;
    border-radius: 0.65rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border: none;
    border-left: 0 !important;
    background: transparent;
    box-shadow: none;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.gm-sidebar .nav-link .gm-nav-icon {
    width: 1.25rem;
    text-align: center;
    color: #9ca3af;
    font-size: 1rem;
    transition: color .16s ease;
}

.gm-sidebar .nav-link .gm-nav-label { flex: 1; }
.gm-sidebar .nav-link .gm-nav-chevron {
    color: #d1d5db;
    font-size: 0.75rem;
    opacity: 0.55;
    transition: color .16s ease, opacity .16s ease, transform .16s ease;
}

/* Hover: soft gray wash, icon turns brand color — no left accent bar */
.gm-sidebar .nav-link:hover {
    background: rgba(15, 23, 42, 0.05);
    color: #111827;
    border-left: 0 !important;
    box-shadow: none;
}

.gm-sidebar .nav-link:hover .gm-nav-icon {
    color: var(--gm-teal);
}

.gm-sidebar .nav-link:hover .gm-nav-chevron {
    color: var(--gm-teal);
    opacity: 1;
    transform: translateX(2px);
}

/* Active: solid brand pill */
.gm-sidebar .nav-link.active,
.gm-sidebar .nav-link.active:hover {
    background: var(--gm-teal);
    color: #fff;
    font-weight: 600;
    border-left: 0 !important;
    box-shadow: 0 8px 18px rgba(13, 148, 136, 0.28);
}

.gm-sidebar .nav-link.active .gm-nav-icon,
.gm-sidebar .nav-link.active .gm-nav-chevron,
.gm-sidebar .nav-link.active:hover .gm-nav-icon,
.gm-sidebar .nav-link.active:hover .gm-nav-chevron {
    color: #fff;
    opacity: 1;
}

.gm-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    background: #eef1f4;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ========== SHARED UI ========== */
.btn {
    font-size: 0.8125rem;
    padding: 0.35rem 0.75rem;
    border-radius: 0.4rem;
    line-height: 1.4;
}

.btn-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
}

.btn-lg,
.btn.py-2 {
    font-size: 0.875rem;
    padding: 0.45rem 0.9rem !important;
}

.btn-accent,
.btn-primary {
    background: var(--gm-teal);
    border-color: var(--gm-teal);
    color: #fff;
    box-shadow: 0 1px 2px rgba(15, 154, 154, 0.2);
}

.btn-accent:hover,
.btn-primary:hover,
.btn-accent:focus,
.btn-primary:focus {
    background: var(--gm-teal-dark);
    border-color: var(--gm-teal-dark);
    color: #fff;
}

.btn-copper {
    background: linear-gradient(180deg, var(--gm-copper-light), var(--gm-copper));
    border-color: #8a5520;
    color: #111;
    font-weight: 600;
}

.btn-copper:hover {
    background: linear-gradient(180deg, #e0b84a, var(--gm-copper));
    color: #111;
}

.btn-outline-secondary {
    border-color: #cbd5e1;
    color: #374151;
}

.btn-outline-secondary:hover {
    background: #f3f4f6;
    border-color: #94a3b8;
    color: #111;
}

.table thead th {
    background: #f8fafc;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    border-bottom: 1px solid var(--gm-border) !important;
}

.card {
    border: 1px solid var(--gm-border);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    background: #fff;
}

.card-stat {
    border: 1px solid var(--gm-border);
    border-left: 4px solid var(--gm-teal);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Dashboard KPI + feature cards */
.gm-kpi-card {
    background: #fff;
    border: 1px solid var(--gm-border);
    border-radius: 0.85rem;
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow .15s ease, transform .15s ease;
}
.gm-kpi-card:hover {
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}
.gm-kpi-icon {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.gm-kpi-card.tone-blue .gm-kpi-icon { background: #e8f0fe; color: #1d4ed8; }
.gm-kpi-card.tone-green .gm-kpi-icon { background: #e7f8ef; color: #15803d; }
.gm-kpi-card.tone-rose .gm-kpi-icon { background: #fde8e8; color: #b91c1c; }
.gm-kpi-value {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.1;
    color: #111827;
}
.gm-kpi-label {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 0.15rem;
}

.gm-feature-card {
    background: #fff;
    border: 1px solid var(--gm-border);
    border-radius: 0.9rem;
    padding: 1.15rem 1.25rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow .15s ease, transform .15s ease;
}
.gm-feature-card:hover {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}
.gm-feature-left {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
}
.gm-feature-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    background: #e6f7f7;
    color: var(--gm-teal-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.gm-feature-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f3f4c;
    margin: 0 0 0.15rem;
}
.gm-feature-desc {
    font-size: 0.8rem;
    color: #6b7280;
}
.gm-feature-right {
    text-align: right;
    flex-shrink: 0;
}
.gm-feature-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
}
.gm-feature-cta {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
    border: 1px solid var(--gm-border);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
}

.page-title {
    font-weight: 700;
    color: #111827;
}

.badge.text-bg-success { background: var(--gm-teal) !important; }
.badge.text-bg-warning { background: var(--gm-copper) !important; color: #fff !important; }

/* Notched outline floating labels (Material-style) */
.gm-outline-field {
    position: relative;
    width: 100%;
}

.gm-outline-input {
    display: block;
    width: 100%;
    height: 2.35rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #111827;
    background: #fff;
    border: 1px solid #9aa6b2;
    border-radius: 0.4rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gm-outline-textarea {
    height: auto;
    min-height: 4.5rem;
    padding-top: 0.55rem;
    resize: vertical;
}

.gm-outline-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 12px 10px;
    padding-right: 1.75rem;
}

.gm-outline-label {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 0.3rem;
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1;
    color: #6b7280;
    background: #fff;
    pointer-events: none;
    transition: top 0.15s ease, font-size 0.15s ease, color 0.15s ease, transform 0.15s ease;
    max-width: calc(100% - 1.5rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gm-outline-textarea-field .gm-outline-label {
    top: 0.85rem;
    transform: none;
}

.gm-outline-input:focus {
    border-color: var(--gm-teal);
    box-shadow: 0 0 0 0.15rem rgba(15, 154, 154, 0.15);
}

.gm-outline-input:focus + .gm-outline-label,
.gm-outline-input:not(:placeholder-shown) + .gm-outline-label,
.gm-outline-field.has-value .gm-outline-label,
.gm-outline-select:valid + .gm-outline-label,
.gm-outline-select:focus + .gm-outline-label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: #6b7280;
}

.gm-outline-input:focus + .gm-outline-label {
    color: var(--gm-teal-dark);
}

.gm-outline-input.is-invalid {
    border-color: #dc3545;
}

.gm-outline-input.is-invalid:focus {
    box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.15);
}

.gm-outline-field .invalid-feedback {
    font-size: 0.72rem;
    margin-top: 0.2rem;
}

/* Selects: float label when a non-empty option is chosen */
.gm-outline-select:has(option:checked:not([value=""])) + .gm-outline-label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.7rem;
}

.card-body { font-size: 0.875rem; }
.table { font-size: 0.8125rem; }

/* DataTables — match admin theme */
div.dataTables_wrapper {
    font-size: 0.8125rem;
}
div.dataTables_wrapper .dataTables_length,
div.dataTables_wrapper .dataTables_filter,
div.dataTables_wrapper .dataTables_info,
div.dataTables_wrapper .dataTables_paginate {
    margin-bottom: 0.75rem;
}
div.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #9aa6b2;
    border-radius: 0.4rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.8125rem;
    margin-left: 0.35rem;
}
div.dataTables_wrapper .dataTables_length select {
    border: 1px solid #9aa6b2;
    border-radius: 0.4rem;
    padding: 0.25rem 0.4rem;
    font-size: 0.8125rem;
}
div.dataTables_wrapper .page-link {
    font-size: 0.78rem;
    color: var(--gm-teal-dark);
}
div.dataTables_wrapper .page-item.active .page-link {
    background-color: var(--gm-teal);
    border-color: var(--gm-teal);
}
table.dataTable thead th {
    white-space: nowrap;
}
.form-check-label { font-size: 0.8125rem; }
.form-control,
.form-select {
    font-size: 0.8125rem;
    min-height: 2.35rem;
    padding: 0.4rem 0.7rem;
    border-radius: 0.4rem;
}

.gm-toast-wrap {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
}

.gm-toast {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    animation: gmSlideIn 0.25s ease;
}

.gm-toast.success { background: var(--gm-teal); }
.gm-toast.error { background: #b91c1c; }
.gm-toast.info { background: var(--gm-copper); }

.gm-loading {
    position: fixed;
    inset: 0;
    background: rgba(15, 154, 154, 0.12);
    z-index: 1090;
    display: none;
    align-items: center;
    justify-content: center;
}

.gm-loading.show { display: flex; }

.gm-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.5);
    border-top-color: var(--gm-teal);
    border-radius: 50%;
    animation: gmSpin 0.7s linear infinite;
}

@keyframes gmSpin { to { transform: rotate(360deg); } }
@keyframes gmSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 767.98px) {
    html,
    body {
        height: auto;
        overflow: auto;
    }

    .gm-shell {
        flex-direction: column;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .gm-sidebar {
        width: 100%;
        height: auto;
        max-height: 70vh;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--gm-border);
    }

    .gm-content {
        height: auto;
        overflow: visible;
    }
}
