/* Спільна "оболонка" редизайну ПК — сайдбар, шапка (topbar), токени.
   Використовується і на index.html (Шахматка), і на admin.html (Адмін-кабінет).
   Все скоуплено під body.mh-shell, щоб login.html (той самий style.css) лишився у старій темі. */

/* Ця таблиця стилів підключена лише на index.html/admin.html, тож html/body
   тут можна обмежити висотою екрана без ризику для login.html/mobile.html. */
html { height: 100%; overflow: hidden; }

body.mh-shell {
    --mh-accent: #415678;
    --mh-accent-hover: #2f3e57;
    --mh-confirmed: #2ecc71;
    --mh-canvas: #e9e7e2;
    --mh-app-bg: #faf9f7;
    --mh-sidebar-bg: #16181a;
    --mh-sidebar-active: #2a2d2a;
    --mh-sidebar-icon-inactive: #3a3d3a;
    --mh-sidebar-text-inactive: #9a9e9a;
    --mh-profile-bg: #212423;
    --mh-avatar-bg: #33465f;
    --mh-avatar-text: #cdd8e8;
    --mh-toolbar: #f7f5f1;
    --mh-fill: #f1efea;
    --mh-text: #16181a;
    --mh-text-secondary: #6d716f;
    --mh-text-weak: #8a8880;
    --mh-text-disabled: #c4c1b9;
    --mh-border: #e6e3dd;
    --mh-border-2: #e0ddd6;
    --mh-grid-line: #eeece7;
    --mh-grid-line-2: #eae7e1;
    --mh-warn: #b8791f;
    --mh-warn-text: #8a5a12;
    --mh-debt-solid: #8a2020;
    --mh-soft-bg: #e7ece8;
    --mh-soft-text: #3f5c4d;
    --mh-font: 'Manrope', system-ui, sans-serif;
    --mh-mono: 'IBM Plex Mono', monospace;

    background: var(--mh-canvas);
    font-family: var(--mh-font);
    color: var(--mh-text);
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

body.mh-shell .mh-app { display: flex; height: 100vh; }

/* Згорнута бічна панель — перемикається кнопкою ☰ в шапці (шахматка/адмінка на весь екран) */
body.mh-shell.mh-sidebar-collapsed .mh-sidebar { display: none; }

/* ===== Сайдбар ===== */
body.mh-shell .mh-sidebar {
    width: 212px; flex: none; background: var(--mh-sidebar-bg);
    display: flex; flex-direction: column; padding: 18px 0;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
body.mh-shell .mh-sidebar-brand { padding: 16px 18px 22px; display: flex; align-items: center; }
/* Повне лого (іконка+"MyHotel PMS") має темно-синій напис, тож на темному сайдбарі
   йому потрібна світла підкладка — інакше текст на #16181a практично не читається. */
body.mh-shell .mh-full-logo-wrap {
    background: #fff; border-radius: 10px; padding: 8px 14px; display: inline-flex; align-items: center;
    cursor: pointer; transition: opacity 0.15s;
}
body.mh-shell .mh-full-logo-wrap:hover { opacity: 0.85; }
body.mh-shell .mh-full-logo-wrap:active { opacity: 0.7; }
body.mh-shell .mh-full-logo { height: 26px; width: auto; display: block; }

body.mh-shell .mh-nav-back {
    margin: 0 10px 14px; padding: 9px 12px; border-radius: 9px;
    display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
    font-size: 13.5px; font-weight: 500; color: var(--mh-sidebar-text-inactive);
    background: rgba(255,255,255,0.04); border-bottom: 1px solid #2a2d2a;
}
body.mh-shell .mh-nav-back:hover { background: rgba(255,255,255,0.08); color: #faf9f7; }
body.mh-shell .mh-nav { padding: 0 10px; display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 0; }
body.mh-shell .mh-nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
    font-size: 13.5px; font-weight: 500; color: var(--mh-sidebar-text-inactive); cursor: pointer; user-select: none;
    border: none;
}
body.mh-shell .mh-nav-item:hover { background: rgba(255,255,255,0.05); }
body.mh-shell .mh-nav-item.active { background: var(--mh-sidebar-active); color: #faf9f7; font-weight: 700; }
body.mh-shell .mh-nav-icon { width: 16px; height: 16px; border-radius: 4px; flex: none; background: var(--mh-sidebar-icon-inactive); }
body.mh-shell .mh-nav-item.active .mh-nav-icon { background: var(--mh-accent); }
body.mh-shell .mh-nav-label { flex: 1; }

/* Обмежена роль (покоївка/тех.працівник) — лишаємо в сайдбарі тільки один
   дозволений пункт (Прибирання/Технічний стан) + профіль/вихід внизу. */
body.mh-role-restricted .mh-nav-item:not([data-view]) { display: none; }
body.mh-role-restricted[data-restricted-view="cleaning"] .mh-nav-item[data-view]:not([data-view="cleaning"]) { display: none; }
body.mh-role-restricted[data-restricted-view="condition"] .mh-nav-item[data-view]:not([data-view="condition"]) { display: none; }
/* Топбар обмеженої ролі — лишаємо тільки заголовок і кнопку згортання сайдбару */
body.mh-role-restricted .mh-date-nav,
body.mh-role-restricted .mh-segment,
body.mh-role-restricted #btn-toggle-filters,
body.mh-role-restricted #btn-global-book,
body.mh-role-restricted .mh-more-wrap { display: none; }
body.mh-shell .mh-nav-badge {
    font-family: var(--mh-mono); font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px;
    background: var(--mh-sidebar-active); color: var(--mh-sidebar-text-inactive);
}
body.mh-shell .mh-nav-item.active .mh-nav-badge { background: var(--mh-accent); color: #fff; }
body.mh-shell .mh-nav-disabled { opacity: 0.4; cursor: default; }
body.mh-shell .mh-nav-disabled:hover { background: none; }

body.mh-shell .mh-sidebar-bottom { margin-top: auto; padding: 16px 10px 0; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid #2a2d2a; }
body.mh-shell .mh-profile-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 6px; border-radius: 10px; background: var(--mh-profile-bg); }
body.mh-shell .mh-avatar {
    width: 28px; height: 28px; border-radius: 14px; background: var(--mh-avatar-bg); color: var(--mh-avatar-text);
    display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; flex: none;
}
body.mh-shell .mh-profile-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
body.mh-shell .mh-profile-name { font-size: 12.5px; font-weight: 600; color: #faf9f7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.mh-shell .mh-profile-role { font-size: 11px; color: #7d817d; }
body.mh-shell .mh-logout-btn { background: none; border: none; color: #7d817d; cursor: pointer; font-size: 15px; padding: 2px; min-height: auto; flex: none; }
body.mh-shell .mh-logout-btn:hover { color: #faf9f7; background: none; }

/* ===== Головна колонка ===== */
body.mh-shell .mh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--mh-app-bg); }

body.mh-shell header.mh-topbar {
    flex: none; padding: 16px 20px 14px; border-bottom: 1px solid var(--mh-border);
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
    background: var(--mh-app-bg); box-shadow: none; position: sticky; top: 0; z-index: 40;
}
body.mh-shell .mh-title-block { display: flex; flex-direction: column; gap: 3px; flex: none; }
body.mh-shell .mh-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; color: var(--mh-text); }
body.mh-shell .mh-subtitle { font-family: var(--mh-mono); font-size: 11.5px; color: var(--mh-text-weak); white-space: nowrap; }

body.mh-shell .mh-date-nav { display: flex; align-items: center; gap: 5px; flex: none; }
body.mh-shell .mh-icon-btn {
    width: 32px; height: 32px; border-radius: 8px; background: #fff; border: 1px solid var(--mh-border-2);
    display: flex; align-items: center; justify-content: center; font-size: 14px; color: #3a3d3a; flex: none;
    cursor: pointer; padding: 0; min-height: auto;
}
body.mh-shell .mh-icon-btn:hover { background: var(--mh-app-bg); }
body.mh-shell .mh-icon-btn.active { background: var(--mh-fill); }

body.mh-shell .mh-date-pill {
    height: 32px; padding: 0 10px; border-radius: 8px; background: #fff; border: 1px solid var(--mh-border-2);
    display: flex; align-items: center; gap: 4px; font-family: var(--mh-mono); font-size: 12px; white-space: nowrap; flex: none;
}
body.mh-shell .mh-date-pill input {
    border: none; padding: 0; width: 76px; font-family: var(--mh-mono); font-size: 12px; color: var(--mh-text);
    background: transparent; min-height: auto; text-align: center; cursor: pointer;
}
body.mh-shell .mh-date-pill .mh-date-sep { color: var(--mh-text-disabled); }

body.mh-shell .mh-pill-btn {
    height: 32px; padding: 0 12px; border-radius: 8px; background: var(--mh-fill); border: none;
    display: flex; align-items: center; font-size: 12px; font-weight: 600; color: #3a3d3a; white-space: nowrap; flex: none;
    cursor: pointer; min-height: auto;
}
body.mh-shell .mh-pill-btn:hover { background: var(--mh-border-2); }

body.mh-shell .mh-segment { display: flex; align-items: center; gap: 2px; margin-left: auto; background: var(--mh-fill); padding: 3px; border-radius: 9px; flex: none; }
body.mh-shell .mh-segment-item {
    height: 26px; padding: 0 10px; border-radius: 7px; display: flex; align-items: center;
    font-size: 12px; white-space: nowrap; font-weight: 500; color: var(--mh-text-secondary); cursor: pointer;
}
body.mh-shell .mh-segment-item.active { background: #fff; color: var(--mh-text); font-weight: 700; box-shadow: 0 1px 2px rgba(20,22,20,0.1); }

body.mh-shell .mh-btn-primary {
    height: 32px; padding: 0 13px; border-radius: 9px; background: var(--mh-accent); color: #fff;
    display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; flex: none;
    border: none; cursor: pointer; min-height: auto;
}
body.mh-shell .mh-btn-primary:hover { background: var(--mh-accent-hover); }

body.mh-shell .mh-btn-ghost {
    height: 32px; padding: 0 12px; border-radius: 9px; background: #fff; border: 1px solid var(--mh-border-2);
    display: flex; align-items: center; font-size: 13px; font-weight: 600; color: #3a3d3a; white-space: nowrap; flex: none;
    cursor: pointer; min-height: auto;
}
body.mh-shell .mh-btn-ghost:hover { background: var(--mh-app-bg); }

body.mh-shell .mh-btn-warn {
    height: 32px; padding: 0 12px; border-radius: 9px; background: var(--mh-warn); color: #fff; border: none;
    display: flex; align-items: center; font-size: 12.5px; font-weight: 700; white-space: nowrap; flex: none;
    cursor: pointer; min-height: auto;
}

body.mh-shell .mh-more-wrap { position: relative; flex: none; }
body.mh-shell .mh-more-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; background: #fff;
    border: 1px solid var(--mh-border); border-radius: 10px; box-shadow: 0 10px 30px rgba(20,22,20,0.15);
    padding: 6px; min-width: 210px; display: flex; flex-direction: column; gap: 2px;
}
body.mh-shell .mh-more-menu button {
    background: none; border: none; text-align: left; padding: 9px 10px; border-radius: 7px;
    font-size: 13px; color: var(--mh-text); cursor: pointer; min-height: auto; font-weight: 500; width: 100%;
}
body.mh-shell .mh-more-menu button:hover { background: var(--mh-app-bg); }
