/* Shared responsive shell. View-specific cards live in mobile-*.css. */
.app-layout { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
.header, .header-left, .header-right, .main-content { min-width: 0; }
.header { height: auto; min-height: var(--header-height); flex-wrap: wrap; gap: .5rem 1rem; padding-block: .5rem; }
.header-left { order: 0; }
.header-right { order: 2; max-width: 100%; flex-wrap: wrap; }
.display-mode-control { display: inline-flex; align-items: center; gap: .5rem; order: 1; max-width: 100%; color: var(--text-medium); font-size: .8rem; font-weight: 600; }
.display-mode-control > label { flex-shrink: 0; }
.display-mode-control select { min-height: 40px; min-width: 0; max-width: 100%; padding: .4rem .65rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-primary); color: var(--text-main); cursor: pointer; }
.main-content { min-height: 0; }
.tenant-pill { white-space: normal; overflow-wrap: anywhere; }
.user-profile-menu { font: inherit; color: inherit; }
.sidebar-close, .mobile-brand, .mobile-bottom-nav, .mobile-account-links, .desktop-route-notice { display: none; }
.sidebar-backdrop[hidden] { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgb(15 23 42 / 45%); z-index: 99; }
.sidebar { height: 100dvh; }
.desktop-route-notice { grid-area: main; margin: 1rem; align-self: start; }
.desktop-route-notice p { margin: 1rem 0; }
.desktop-route-notice .btn { margin: .25rem .5rem .25rem 0; }
:is(button, a, input, select, textarea):focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

:where(html[data-navigation="drawer"]) .app-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "header" "main"; }
:where(html[data-navigation="drawer"]) .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(280px, calc(100vw - 32px)); transform: translateX(-100%); visibility: hidden; overflow-y: auto; overscroll-behavior: contain; box-shadow: 10px 0 30px rgb(0 0 0 / 10%); }
:where(html[data-navigation="drawer"]) .mobile-menu-toggle { display: block; flex-shrink: 0; }
:where(html[data-navigation="drawer"]) .sidebar > * { flex-shrink: 0; }
:where(html[data-navigation="drawer"]) .sidebar-nav { flex: 0 0 auto; }
:where(html[data-navigation="drawer"]) .sidebar.open { transform: translateX(0); visibility: visible; }
:where(html[data-navigation="drawer"]) .sidebar-close { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin-left: auto; font-size: 1.5rem; }
:where(html[data-navigation="drawer"]) .sidebar-logo { padding: .75rem; }
:where(html[data-navigation="drawer"]) .sidebar-logo .logo-text { font-size: 1rem; }
:where(html[data-navigation="drawer"]) .header { padding: .5rem 1rem; }
:where(html[data-navigation="drawer"]) .header-left,
:where(html[data-navigation="drawer"]) .header-right { gap: .5rem; }


:root[data-display-mode="mobile"] { --header-height: auto; --mobile-nav-height: 66px; }
:where(html[data-display-mode="mobile"]) body { height: 100dvh; }
:where(html[data-display-mode="mobile"]) .app-layout { grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "header" "main" "mobile-nav"; }
:where(html[data-display-mode="mobile"]) .header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 .5rem; padding: max(6px, env(safe-area-inset-top)) 12px 8px; height: auto; }
:where(html[data-display-mode="mobile"]) .header-left { display: contents; }
:where(html[data-display-mode="mobile"]) .mobile-menu-toggle { grid-column: 1; grid-row: 1; justify-self: start; width: 44px; height: 44px; }
:where(html[data-display-mode="mobile"]) .mobile-brand { display: block; grid-column: 1; grid-row: 1; margin-left: 50px; font-size: .95rem; font-weight: 700; align-self: center; }
:where(html[data-display-mode="mobile"]) .header-right { grid-column: 2; grid-row: 1; gap: 4px; }
:where(html[data-display-mode="mobile"]) .display-mode-control { grid-column: 1 / -1; grid-row: 3; width: 100%; margin-top: .3rem; justify-content: space-between; }
:where(html[data-display-mode="mobile"]) .display-mode-control select { flex: 1; max-width: 15rem; min-height: 44px; font-size: 16px; }
:where(html[data-display-mode="mobile"]) .header .tenant-pill { grid-row: 2; grid-column: 1 / -1; justify-self: start; font-size: .75rem; padding: 2px 0; border: 0; background: none; max-width: 100%; }
:where(html[data-display-mode="mobile"]) .header .user-info-brief,
:where(html[data-display-mode="mobile"]) #theme-toggle-btn,
:where(html[data-display-mode="mobile"]) #lang-toggle-btn { display: none; }
:where(html[data-display-mode="mobile"]) .header .control-btn,
:where(html[data-display-mode="mobile"]) .header .user-profile-menu { min-width: 44px; min-height: 44px; padding: 2px; }
:where(html[data-display-mode="mobile"]) .sidebar { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
:where(html[data-display-mode="mobile"]) .sidebar-logo { min-height: 60px; flex-shrink: 0; }
:where(html[data-display-mode="mobile"]) .sidebar .desktop-only-nav,
:where(html[data-display-mode="mobile"]) .sidebar-admin-label { display: none; }
:where(html[data-display-mode="mobile"]) .sidebar-nav { padding: .75rem; flex: 0 0 auto; }
:where(html[data-display-mode="mobile"]) .sidebar .nav-item { min-height: 44px; }
:where(html[data-display-mode="mobile"]) .sidebar-footer { margin-top: auto; }
:where(html[data-display-mode="mobile"]) .mobile-account-links { display: flex; flex-direction: column; padding: 0 .75rem .5rem; }
:where(html[data-display-mode="mobile"]) .mobile-account-links button { min-height: 44px; text-align: left; padding: 10px 16px; border-radius: 8px; }
:where(html[data-display-mode="mobile"]) .mobile-account-links button:hover { background: var(--bg-tertiary); }
:where(html[data-display-mode="mobile"]) .mobile-account-links p { font-size: .75rem; color: var(--text-medium); padding: .5rem 1rem; }
:where(html[data-display-mode="mobile"]) .mobile-bottom-nav { display: flex; grid-area: mobile-nav; background: var(--bg-secondary); border-top: 1px solid var(--border-color); padding: 4px max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); z-index: 80; }
:where(html[data-display-mode="mobile"]) .mobile-bottom-nav button { flex: 1; min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 10px; color: var(--text-medium); font-size: 11px; line-height: 1.2; }
:where(html[data-display-mode="mobile"]) .mobile-bottom-nav svg { width: 20px; height: 20px; }
:where(html[data-display-mode="mobile"]) .mobile-bottom-nav button[aria-current="page"] { color: var(--primary); background: var(--primary-glow); font-weight: 700; }
:where(html[data-display-mode="mobile"]) .main-content { padding: 16px 12px; gap: 1.25rem; overflow-wrap: anywhere; overscroll-behavior: contain; scroll-padding: 16px; }
:where(html[data-display-mode="mobile"]) .main-content > * { min-width: 0; max-width: 100%; }
:where(html[data-display-mode="mobile"]) .view-header { flex-wrap: wrap; gap: 12px; }
:where(html[data-display-mode="mobile"]) .view-actions { flex-wrap: wrap; }
:where(html[data-display-mode="mobile"]) .card { padding: 16px; border-radius: 14px; }
:where(html[data-display-mode="mobile"]) .main-content .btn,
:where(html[data-display-mode="mobile"]) .main-content .control-btn,
:where(html[data-display-mode="mobile"]) .modal-container .btn { min-height: 44px; white-space: normal; }
:where(html[data-display-mode="mobile"]) :is(input, select, textarea).form-control { font-size: 16px; min-width: 0; max-width: 100%; }
:where(html[data-display-mode="mobile"]) input.form-control,
:where(html[data-display-mode="mobile"]) select.form-control { min-height: 44px; }
:where(html[data-display-mode="mobile"]) .form-row { grid-template-columns: minmax(0, 1fr); }
:where(html[data-display-mode="mobile"]) .modal-backdrop { height: 100dvh; width: 100%; padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
:where(html[data-display-mode="mobile"]) .modal-container { width: 100%; display: flex; flex-direction: column; max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
:where(html[data-display-mode="mobile"]) .modal-container > form { display: flex; flex-direction: column; min-height: 0; }
:where(html[data-display-mode="mobile"]) .modal-header,
:where(html[data-display-mode="mobile"]) .modal-footer { flex-shrink: 0; }
:where(html[data-display-mode="mobile"]) .modal-body { min-height: 0; max-height: none; overflow-y: auto; padding: 16px; }
:where(html[data-display-mode="mobile"]) .modal-close { min-width: 44px; min-height: 44px; }
:where(html[data-display-mode="mobile"]) .modal-footer { flex-wrap: wrap; padding: 12px 16px; }
:where(html[data-display-mode="mobile"]) .modal-footer .btn { flex: 1; }
:where(html[data-display-mode="mobile"]) .toast-container { bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 12px); left: 12px; right: 12px; width: auto; pointer-events: none; }
:where(html[data-display-mode="mobile"]) .toast-container > * { max-width: 100%; pointer-events: auto; }
:where(html[data-display-mode="mobile"]) .login-view { grid-column: 1 / -1; grid-row: 1 / -1; width: 100%; padding: 16px; min-height: 100dvh; }
:where(html[data-display-mode="mobile"]) .login-card { width: 100%; padding: 24px 18px; }
:where(html[data-display-mode="mobile"]) .app-layout[data-mobile-route="desktop"] .main-content { display: none; }
:where(html[data-display-mode="mobile"]) .app-layout[data-mobile-route="desktop"] .desktop-route-notice { display: block; }
:where(html[data-display-mode="mobile"]) .main-content[data-route="#/profil"] .approvals-section { grid-template-columns: minmax(0, 1fr); }
:where(html[data-display-mode="mobile"]) .main-content[data-route="#/profil"] code { overflow-wrap: anywhere; }


@media (prefers-reduced-motion: reduce) {
    .sidebar, .mobile-bottom-nav button, .main-content .card { transition: none; animation: none; }
}
