:root {
    --em-blue:       #0B3D9B;
    --em-blue-dark:  #082d73;
    --em-blue-light: #1a56db;
    --em-accent:     #E8911A;
    --em-sidebar-bg: #0f2552;
    --em-sidebar-w:  240px;
    --em-header-h:   56px;
    --em-bg:         #e8ecf5;
    --em-border:     #d9e1f2;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    background: var(--em-bg);
    color: #1a1a2e;
}

/* ── HEADER ── */
.em-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1040;
    height: var(--em-header-h);
    background: linear-gradient(135deg, #0f2552 0%, #0B3D9B 100%);
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center;
    padding: 0 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.3);
    gap: 8px;
}

.sidebar-toggle {
    background: none; border: none; color: #fff;
    font-size: 22px; cursor: pointer; padding: 4px 8px;
    border-radius: 6px; flex-shrink: 0;
    transition: background .15s;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.15); }

/* Hamburger → X animation */
.ham-icon {
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    gap: 5px; width: 20px; height: 20px;
}
.ham-icon span {
    display: block; height: 2px; background: #fff; border-radius: 2px;
    transition: transform .3s ease, opacity .2s ease, width .3s ease;
    transform-origin: center;
}
.ham-icon span:nth-child(1) { width: 20px; }
.ham-icon span:nth-child(2) { width: 14px; }
.ham-icon span:nth-child(3) { width: 20px; }

.sidebar-toggle.is-open .ham-icon span:nth-child(1) { transform: translateY(7px) rotate(45deg); width: 20px; }
.sidebar-toggle.is-open .ham-icon span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.sidebar-toggle.is-open .ham-icon span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); width: 20px; }

/* Desktop: collapsed үед зүүн сум харуулах */
.toggle-arrow {
    display: none;
    font-size: 18px;
    transition: transform .25s ease;
}

@media (min-width: 992px) {
    .sidebar-toggle .ham-icon { display: flex; }
    .sidebar-toggle .toggle-arrow { display: none; }

    .sidebar-toggle.desk-collapsed .ham-icon { display: none; }
    .sidebar-toggle.desk-collapsed .toggle-arrow { display: block; }
}

.em-logo {
    display: flex; align-items: center; gap: 9px;
    color: #fff; text-decoration: none; font-weight: 700;
    font-size: 15px; min-width: 0;
}
.em-logo .logo-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--em-accent); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; color: #fff;
}
.em-logo .logo-texts { min-width: 0; }
.em-logo .logo-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-logo .logo-sub { font-size: 10.5px; opacity: .7; font-weight: 400; white-space: nowrap; }

.em-header-right {
    margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.em-header-btn {
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
    color: #fff; border-radius: 6px; padding: 5px 12px;
    font-size: 12.5px; cursor: pointer; text-decoration: none;
    display: flex; align-items: center; gap: 5px;
    white-space: nowrap; transition: background .15s;
}
.em-header-btn:hover { background: rgba(255,255,255,.22); color: #fff; }
.em-header-btn.primary-btn { background: var(--em-accent); border-color: var(--em-accent); }
.em-header-btn.primary-btn:hover { background: #d07d15; }

/* ── SIDEBAR ── */
.em-sidebar {
    position: fixed; top: var(--em-header-h); left: 0; bottom: 0;
    width: var(--em-sidebar-w); z-index: 1030;
    background: var(--em-sidebar-bg);
    display: flex; flex-direction: column;
    transition: transform .25s ease;
    overflow-y: auto;
}
.em-sidebar.collapsed { transform: translateX(calc(-1 * var(--em-sidebar-w))); }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 1025;
}
.sidebar-backdrop.show { display: block; }

.sidebar-section-title {
    font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
    color: rgba(255,255,255,.35); text-transform: uppercase;
    padding: 18px 18px 6px;
}
.sidebar-nav { list-style: none; margin: 0; padding: 0 8px; }
.sidebar-nav li a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    color: rgba(255,255,255,.72); text-decoration: none;
    font-size: 13.5px; font-weight: 500;
    transition: background .15s, color .15s; margin-bottom: 2px;
}
.sidebar-nav li a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav li a.active {
    background: rgba(26,86,219,.35);
    color: #fff;
    border-left: 3px solid rgba(255,255,255,.85);
    padding-left: 9px;
}
.sidebar-nav li a i { font-size: 16px; flex-shrink: 0; }

.sidebar-footer {
    margin-top: auto; padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: 11px; color: rgba(255,255,255,.35); text-align: center;
}

/* ── MAIN ── */
.em-main {
    margin-left: var(--em-sidebar-w);
    margin-top: var(--em-header-h);
    padding: 24px 28px;
    min-height: calc(100vh - var(--em-header-h));
    transition: margin-left .25s ease;
}
.em-main.expanded { margin-left: 0; }

/* ── BREADCRUMB ── */
.em-breadcrumb-bar {
    background: #fff; border: 1px solid var(--em-border);
    border-radius: 8px; padding: 10px 14px;
    margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
}
.em-breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 12.5px; color: #666; flex-wrap: wrap;
}
.em-breadcrumb a { color: var(--em-blue); text-decoration: none; }
.em-breadcrumb a:hover { text-decoration: underline; }
.em-breadcrumb .sep { color: #bbb; }
.em-breadcrumb .current { color: #333; font-weight: 600; }
.em-page-title { font-size: 17px; font-weight: 700; color: var(--em-blue-dark); margin: 0; }

/* ── STAT CARDS ── */
.em-stat {
    background: #fff; border: 1px solid var(--em-border);
    border-radius: 10px; padding: 16px 18px;
    display: flex; align-items: center; gap: 14px;
    height: 100%;
    box-shadow: 0 1px 6px rgba(11,61,155,.07);
    transition: transform .18s, box-shadow .18s;
}
.em-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(11,61,155,.13);
}
.stat-col:nth-child(1) .em-stat { border-top: 3px solid var(--em-blue); }
.stat-col:nth-child(2) .em-stat { border-top: 3px solid #0a9b5f; }
.stat-col:nth-child(3) .em-stat { border-top: 3px solid #e74c3c; }

.em-stat-icon {
    width: 46px; height: 46px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 21px; flex-shrink: 0;
}
.em-stat-num { font-size: 26px; font-weight: 800; line-height: 1; color: #1a1a2e; }
.em-stat-label { font-size: 12px; color: #888; margin-top: 3px; }
.icon-blue   { background: #e8efff; color: var(--em-blue); }
.icon-green  { background: #e6f7ef; color: #0a9b5f; }
.icon-red    { background: #fdecea; color: #d63c3c; }
.icon-orange { background: #fff3e0; color: #e07c10; }

/* ── FILTER ── */
.em-filter-card {
    background: #fff; border: 1px solid var(--em-border);
    border-left: 3px solid var(--em-blue);
    border-radius: 10px; padding: 14px 16px; margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(11,61,155,.06);
}
.em-filter-card .filter-title {
    font-size: 12.5px; font-weight: 700; color: var(--em-blue);
    margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}

/* ── TABLE CARD ── */
.em-table-card {
    background: #fff; border: 1px solid var(--em-border);
    border-top: 3px solid var(--em-blue);
    border-radius: 10px; overflow: hidden;
    box-shadow: 0 2px 10px rgba(11,61,155,.08);
}
.em-table-card .card-top {
    padding: 13px 16px; border-bottom: 1px solid var(--em-border);
    background: #f8faff;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-top-title {
    font-size: 13.5px; font-weight: 700; color: var(--em-blue-dark);
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.em-table thead th {
    background: #f5f7fb; color: #555; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    border-bottom: 2px solid var(--em-border);
    padding: 9px 12px; white-space: nowrap;
}
.em-table tbody td {
    padding: 9px 12px; vertical-align: middle;
    border-bottom: 1px solid #edf0f7; font-size: 13px;
}
.em-table tbody tr:last-child td { border-bottom: none; }
.em-table tbody tr:hover td { background: #f8faff; }

/* ── MOBILE CARD LIST ── */
.mobile-card-list { display: none; }
.m-card {
    border-bottom: 1px solid var(--em-border);
    padding: 14px 16px;
}
.m-card:last-child { border-bottom: none; }
.m-card-header {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: 8px; margin-bottom: 8px;
}
.m-card-num {
    font-size: 16px; font-weight: 800; color: var(--em-blue);
    text-decoration: none;
}
.m-card-location { font-size: 12.5px; color: #555; margin-bottom: 8px; line-height: 1.4; }
.m-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.m-card-meta-item {
    font-size: 11.5px; color: #777;
    background: #f5f7fb; border-radius: 5px; padding: 3px 8px;
}
.m-card-photos { display: flex; gap: 6px; margin-bottom: 10px; }
.m-card-actions { display: flex; gap: 8px; }

/* ── BADGES ── */
.em-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
}
.em-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.em-badge.free          { background: #e6f7ef; color: #0a7e50; }
.em-badge.free::before  { background: #0a9b5f; }
.em-badge.busy          { background: #fdecea; color: #c0392b; }
.em-badge.busy::before  { background: #e74c3c; }

/* ── PHOTO ── */
.em-photo {
    width: 48px; height: 36px; object-fit: cover;
    border-radius: 5px; border: 1px solid var(--em-border);
    cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.em-photo:hover { transform: scale(1.08); box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.no-photo {
    width: 48px; height: 36px; border-radius: 5px;
    background: #f0f2f7; border: 1px dashed #ccc;
    display: flex; align-items: center; justify-content: center;
    color: #bbb; font-size: 14px;
}

/* ── ACTION BUTTONS ── */
.em-action-btn {
    width: 28px; height: 28px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; border: 1px solid; cursor: pointer;
    text-decoration: none; transition: all .15s;
}
.em-action-btn.view { color: var(--em-blue); border-color: #c0d0f5; background: #eef2ff; }
.em-action-btn.edit { color: #555; border-color: #ddd; background: #f5f5f5; }
.em-action-btn.del  { color: #e74c3c; border-color: #f5c6c6; background: #fef0f0; }
.em-action-btn:hover { opacity: .78; transform: translateY(-1px); }

.m-action-btn {
    height: 34px; padding: 0 14px; border-radius: 7px;
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12.5px; font-weight: 600; border: 1px solid;
    cursor: pointer; text-decoration: none; transition: opacity .15s;
}
.m-action-btn.view { color: var(--em-blue); border-color: #c0d0f5; background: #eef2ff; }
.m-action-btn.edit { color: #555; border-color: #ddd; background: #f5f5f5; }
.m-action-btn.del  { color: #e74c3c; border-color: #f5c6c6; background: #fef0f0; }

/* ── FORM ── */
.em-form-card {
    background: #fff; border: 1px solid var(--em-border);
    border-radius: 10px; overflow: hidden;
}
.em-form-section { border-bottom: 1px solid var(--em-border); padding: 16px 20px; }
.em-form-section:last-child { border-bottom: none; }
.em-form-section-title {
    font-size: 13px; font-weight: 700; color: var(--em-blue);
    margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.em-label { font-size: 12.5px; font-weight: 600; color: #444; margin-bottom: 5px; display: block; }
.em-input {
    width: 100%; padding: 9px 12px; font-size: 14px;
    border: 1px solid #d0d8ea; border-radius: 7px;
    background: #fff; color: #1a1a2e; outline: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
}
.em-input:focus {
    border-color: var(--em-blue-light);
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.em-input.is-invalid { border-color: #e74c3c; }
select.em-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%23666' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px;
}
.em-form-footer {
    padding: 14px 20px; background: #f8faff;
    border-top: 1px solid var(--em-border);
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.em-btn-primary {
    background: var(--em-blue); color: #fff; border: none;
    border-radius: 7px; padding: 9px 22px; font-size: 13.5px;
    font-weight: 600; cursor: pointer; display: inline-flex;
    align-items: center; gap: 7px; text-decoration: none;
    transition: background .15s; white-space: nowrap;
}
.em-btn-primary:hover { background: var(--em-blue-dark); color: #fff; }
.em-btn-secondary {
    background: #fff; color: #555; border: 1px solid #d0d8ea;
    border-radius: 7px; padding: 9px 18px; font-size: 13.5px;
    font-weight: 500; cursor: pointer; display: inline-flex;
    align-items: center; gap: 7px; text-decoration: none;
    transition: background .15s; white-space: nowrap;
}
.em-btn-secondary:hover { background: #f0f2f7; color: #333; }
.em-btn-danger {
    background: #fff; color: #e74c3c; border: 1px solid #f5c6c6;
    border-radius: 7px; padding: 9px 18px; font-size: 13.5px;
    font-weight: 500; cursor: pointer; display: inline-flex;
    align-items: center; gap: 7px; text-decoration: none;
    transition: background .15s; white-space: nowrap;
}
.em-btn-danger:hover { background: #fdecea; }

/* ── ALERT ── */
.em-alert {
    border-radius: 8px; padding: 12px 14px; margin-bottom: 16px;
    display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px;
}
.em-alert.success { background: #e6f7ef; border-left: 4px solid #0a9b5f; color: #075c38; }
.em-alert.danger  { background: #fdecea; border-left: 4px solid #e74c3c; color: #922b21; }

/* ── MODAL ── */
.em-modal-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.6); z-index: 2000;
    align-items: center; justify-content: center; padding: 16px;
}
.em-modal-backdrop.show { display: flex; }
.em-modal-box {
    background: #fff; border-radius: 12px;
    max-width: 700px; width: 100%; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.em-modal-header {
    background: var(--em-blue); color: #fff; padding: 13px 18px;
    display: flex; align-items: center; justify-content: space-between;
}
.em-modal-header h6 { margin: 0; font-size: 14px; font-weight: 700; }
.em-modal-close {
    background: none; border: none; color: #fff;
    font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.em-modal-body img { width: 100%; display: block; }

/* ── PAGINATION ── */
.em-pagination-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-top: 1px solid var(--em-border);
    flex-wrap: wrap; gap: 8px;
    background: #fafbfd;
    border-radius: 0 0 10px 10px;
}
.em-pagination-info {
    font-size: 12px; color: #888; white-space: nowrap;
}
.em-pagination-info b { color: #333; }

.pagination {
    display: flex; align-items: center; gap: 3px; margin: 0; flex-wrap: wrap;
}
.pagination .page-item .page-link {
    min-width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 8px; border-radius: 6px;
    border: 1px solid var(--em-border);
    color: var(--em-blue); font-size: 12.5px; font-weight: 500;
    background: #fff; line-height: 1;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
    text-decoration: none;
}
.pagination .page-item .page-link:hover {
    background: #eef2ff; border-color: #b0c4ec; color: var(--em-blue-dark);
    box-shadow: 0 1px 4px rgba(11,61,155,.1);
}
.pagination .page-item.active .page-link {
    background: var(--em-blue); border-color: var(--em-blue);
    color: #fff; font-weight: 700;
    box-shadow: 0 2px 7px rgba(11,61,155,.32);
    pointer-events: none;
}
.pagination .page-item.disabled .page-link {
    background: #f5f7fb; border-color: #e5e9f2;
    color: #ccc; cursor: not-allowed; pointer-events: none;
}
.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    font-size: 13px; padding: 0 11px; color: #555;
}
.pagination .page-item:first-child .page-link:hover,
.pagination .page-item:last-child .page-link:hover { color: var(--em-blue); }
.pagination .page-item.disabled:first-child .page-link,
.pagination .page-item.disabled:last-child .page-link { color: #ccc; }
@media (max-width: 480px) {
    .em-pagination-bar { justify-content: center; }
    .em-pagination-info { width: 100%; text-align: center; }
    .pagination { justify-content: center; }
}

/* ── PHOTO UPLOAD ── */
.em-current-photo {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 0 14px; margin-bottom: 14px;
    border-bottom: 1px solid var(--em-border);
}
.em-current-photo img {
    width: 88px; height: 66px; object-fit: cover;
    border-radius: 8px; border: 1px solid var(--em-border);
    flex-shrink: 0;
}
.em-current-photo-label {
    font-size: 12px; font-weight: 700; color: #0a7e50;
    display: flex; align-items: center; gap: 5px; margin-bottom: 3px;
}
.em-current-photo-sub { font-size: 11.5px; color: #999; }

.em-upload-zone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 7px; padding: 22px 16px;
    border: 2px dashed var(--em-border); border-radius: 10px;
    background: #f8faff; cursor: pointer; text-align: center;
    transition: background .15s, border-color .15s;
}
.em-upload-zone:hover {
    background: #eef2ff; border-color: var(--em-blue);
}
.em-upload-zone:hover .em-upload-icon { color: var(--em-blue); }
.em-upload-icon { font-size: 28px; color: #b8c4d8; transition: color .15s; }
.em-upload-label { font-size: 13.5px; font-weight: 600; color: #444; }
.em-upload-hint  { font-size: 11.5px; color: #aaa; }

.em-file-chosen {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px; margin-top: 8px;
    background: #f0f7ff; border: 1px solid #c0d4f5; border-radius: 8px;
    font-size: 13px; color: var(--em-blue);
}
.em-file-chosen span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.em-file-chosen-clear {
    background: none; border: none; cursor: pointer;
    color: #999; font-size: 16px; line-height: 1; padding: 2px 4px;
    border-radius: 4px; flex-shrink: 0;
    transition: color .12s, background .12s;
}
.em-file-chosen-clear:hover { color: #e74c3c; background: #fef0f0; }

/* ── EMPTY ── */
.em-empty { text-align: center; padding: 40px 20px; color: #aaa; }
.em-empty i { font-size: 44px; display: block; margin-bottom: 10px; }

/* ════════════════════════════════════════════
   MOBILE  ≤ 767px
════════════════════════════════════════════ */
@media (max-width: 767px) {
    .em-sidebar {
        transform: translateX(calc(-1 * var(--em-sidebar-w)));
        z-index: 1035;
    }
    .em-sidebar.mobile-open { transform: translateX(0); }
    .em-main { margin-left: 0 !important; padding: 12px 14px; }
    .em-logo .logo-sub { display: none; }
    .em-header-btn .btn-label { display: none; }
    .em-breadcrumb-bar { flex-direction: column; align-items: flex-start; gap: 6px; }
    .em-page-title { font-size: 15px; }
    .stat-col { flex: 0 0 33.333%; max-width: 33.333%; }
    .em-stat { padding: 10px 12px; gap: 8px; }
    .em-stat-icon { width: 36px; height: 36px; font-size: 16px; border-radius: 8px; }
    .em-stat-num { font-size: 20px; }
    .em-stat-label { font-size: 11px; }
    .em-filter-card { padding: 12px 14px; }
    .filter-col { flex: 0 0 100%; max-width: 100%; }
    .filter-btn-col { flex: 0 0 50%; max-width: 50%; }
    .desktop-table { display: none !important; }
    .mobile-card-list { display: block !important; }
    .em-form-section { padding: 14px 14px; }
    .em-form-footer { padding: 12px 14px; }
    .em-btn-primary, .em-btn-secondary, .em-btn-danger { width: 100%; justify-content: center; }
    .em-form-footer { flex-direction: column; }
    .em-form-footer > * { width: 100%; }
    .em-form-footer form { width: 100%; }
    .em-form-footer form button { width: 100%; justify-content: center; }
}

/* ════════════════════════════════════════════
   TABLET  768 – 991px
════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 991px) {
    .em-sidebar { transform: translateX(calc(-1 * var(--em-sidebar-w))); }
    .em-sidebar.tablet-open { transform: translateX(0); }
    .em-main { margin-left: 0; padding: 16px 20px; }
    .sidebar-backdrop.show { display: block; }
}

/* ════════════════════════════════════════════
   DESKTOP  ≥ 992px
════════════════════════════════════════════ */
@media (min-width: 992px) {
    .em-main { margin-left: var(--em-sidebar-w); }
    .em-main.expanded { margin-left: 0; }
}
