/* SwaDharma operator shell. Public landing surfaces deliberately keep their theme. */
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 3000; padding: 12px 16px; border-radius: var(--radius-md); background: var(--brand-action); color: var(--white); font-size: 14px; text-decoration: none; }
.skip-link:focus { top: 12px; outline: 3px solid var(--brand-secondary); outline-offset: 3px; }
.app-shell { grid-template-columns: 244px minmax(0, 1fr); transition: grid-template-columns .22s cubic-bezier(.2,0,0,1); }
.app-shell.sidebar-collapsed { grid-template-columns: 80px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; height: 100vh; height: 100dvh; width: 244px; padding: 24px 12px 18px; overflow: hidden; transition: width .22s cubic-bezier(.2,0,0,1), transform .22s cubic-bezier(.2,0,0,1); }
.main { grid-column: 2; display: flex; flex-direction: column; min-height: 100vh; background: var(--page); }
.sidebar-toolbar { display: flex; align-items: center; justify-content: space-between; flex: 0 0 44px; min-height: 44px; margin-bottom: 8px; }
.sidebar-toolbar-label { margin-left: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.1px; color: var(--sidebar-muted); }
.sidebar-toggle, .sidebar-close { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--sidebar-control); flex: 0 0 44px; }
.sidebar-toggle:hover, .sidebar-close:hover { background: var(--sidebar-hover); color: var(--white); }
.sidebar-toggle svg, .sidebar-close svg { width: 20px; height: 20px; }
.sidebar-close { display: none; }
.sidebar :is(button, select, a):focus-visible { outline: 2px solid var(--brand-secondary); outline-offset: -3px; }
.sidebar .brand { flex: 0 0 auto; min-height: 44px; gap: 4px; padding: 0; margin-bottom: 12px; }
.sidebar .brand-mark { width: 36px; height: 31px; flex: 0 0 36px; object-fit: contain; }
.sidebar .brand strong { display: flex; align-items: baseline; gap: 4px; font-family: var(--font-serif); font-size: 27px; font-weight: 600; letter-spacing: -.6px; white-space: nowrap; overflow: visible; }
.sidebar .brand .brand-name { display: inline; margin: 0; color: var(--white); font-family: var(--font-serif); font-size: 27px; font-weight: 600; line-height: 1.12; letter-spacing: -.6px; }
.sidebar .brand .brand-suffix { display: inline; margin: 0; color: var(--brand-secondary); font-family: var(--font-sans); font-size: 21px; font-weight: 600; letter-spacing: -.6px; }
.sidebar .brand .brand-subtitle { color: var(--sidebar-muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.nav-list { margin-top: 4px; gap: 3px; scrollbar-width: thin; scrollbar-color: var(--sidebar-border) transparent; overscroll-behavior: contain; }
.nav-item { min-height: 52px; padding: 6px 12px; border-radius: var(--radius-lg); color: var(--sidebar-ink); font-size: 14px; font-weight: 500; gap: 12px; }
.nav-item svg { width: 19px; height: 19px; flex: 0 0 19px; }
.nav-item:hover { transform: none; background: var(--sidebar-hover); color: var(--white); }
.nav-item.active, .nav-item.nav-parent.active { background: var(--sidebar-active); }
.nav-item.active::before { content: none; }
.nav-item.active svg { color: var(--brand-secondary); }
.nav-children.open { max-height: 500px; }
.nav-child { min-height: 44px; padding-left: 23px; font-size: 13px; }
.nav-child svg { width: 17px; height: 17px; flex-basis: 17px; }
.sidebar-footer { flex: 0 0 auto; padding: 8px; margin-top: 12px; border-radius: var(--radius-xl); }
.sidebar-footer .footer-avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: var(--radius-lg); color: var(--white); font-size: 11px; font-weight: 700; background: var(--brand-action); }
.sidebar-footer .footer-id .footer-avatar { display: grid; place-items: center; color: var(--white); margin: 0; font-size: 11px; }
.footer-id { position: relative; min-height: 44px; gap: 8px; }
.footer-id > .status-dot { position: absolute; display: block; width: 8px; height: 8px; left: 28px; bottom: 2px; z-index: 1; }
.footer-user-copy { min-width: 0; }
.footer-user-copy strong, .footer-user-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.footer-id strong, .footer-id span { font-size: 12px; }
.footer-host-name { overflow-wrap: anywhere; }
.footer-actions { flex-wrap: wrap; }
.sidebar-footer .footer-actions button { min-height: 44px; font-size: 12px; }
.sidebar-footer .footer-host .select { font-size: 16px; min-height: 44px; }
/* The rail remains scrollable on short screens, with no painted scrollbar. */
.sidebar-collapsed .nav-list { scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-collapsed .nav-list::-webkit-scrollbar { display: none; width: 0; height: 0; }
.sidebar-collapsed:not(.sidebar-preview) .sidebar { width: 80px; }
.sidebar-collapsed:not(.sidebar-preview) .sidebar-toolbar { justify-content: center; }
.sidebar-collapsed:not(.sidebar-preview) :is(.sidebar-toolbar-label, .brand, .footer-user-copy, .footer-caret, .footer-collapsible) { display: none; }
.sidebar-collapsed:not(.sidebar-preview) .nav-item { width: 56px; min-height: 66px; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 6px 0; text-align: center; }
.sidebar-collapsed:not(.sidebar-preview) .nav-item > span:not(.nav-caret) { width: 64px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 10.5px; font-weight: 600; line-height: 1.2; }
.sidebar-collapsed:not(.sidebar-preview) .nav-caret, .sidebar-collapsed:not(.sidebar-preview) .nav-children { display: none; }
.sidebar-collapsed:not(.sidebar-preview) .sidebar-footer { padding: 4px; border: 0; background: transparent; }
.sidebar-collapsed:not(.sidebar-preview) .footer-id { justify-content: center; }
.sidebar-collapsed.sidebar-preview .sidebar { width: 244px; box-shadow: var(--shadow-sidebar-preview); }
.topbar { z-index: 24; min-height: 76px; height: 76px; padding: 0 34px; grid-template-columns: minmax(80px,1fr) minmax(80px,320px) auto; gap: 14px; flex: 0 0 auto; background: var(--topbar-translucent); }
.page-title { min-width: 0; display: flex; flex-direction: column; }
.page-title h1 { order: -1; margin: 0; color: var(--topbar-title-ink); font-family: var(--font-sans); font-size: 17px; line-height: 1.35; font-weight: 700; letter-spacing: -.2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-title #pageKicker { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.3; font-weight: 400; letter-spacing: 0; text-transform: none; }
.topbar-actions { gap: 8px; min-width: 0; }
.topbar-language { position: relative; display: flex; align-items: center; }
.language-glyph { display: none; }
.topbar-actions .lang-switcher { min-width: 96px; max-width: 126px; border-radius: var(--radius-xl); }
.topbar .icon-button, .notification-button { width: 44px; height: 44px; flex: 0 0 44px; border-radius: var(--radius-md); }
.topbar .notification-button { background: var(--white); border: 1px solid var(--line); color: var(--muted); }
.topbar .notification-button svg { width: 19px; height: 19px; }
.global-search { min-width: 0; }
.global-search input { min-width: 0; width: 100%; }
.profile-dropdown { position: relative; }
.profile-dropdown > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px; border: 1px solid transparent; border-radius: var(--radius-lg); cursor: pointer; list-style: none; }
.profile-dropdown > summary::-webkit-details-marker { display: none; }
.profile-dropdown > summary:hover, .profile-dropdown[open] > summary { background: var(--brand-soft); }
.profile-dropdown > summary:focus-visible { outline: 3px solid var(--focus-outline); outline-offset: 2px; }
.profile-avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; background: var(--brand-action); color: var(--white); border-radius: var(--radius-lg); font-size: 11px; font-weight: 700; }
.profile-copy { display: block; min-width: 0; max-width: clamp(60px, 9vw, 150px); }
.profile-copy strong, .profile-copy small { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy small { color: var(--muted); }
.profile-menu { position: absolute; top: calc(100% + 8px); right: 0; display: grid; gap: 8px; padding: 16px; width: min(300px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--topbar-bg); box-shadow: var(--shadow-menu); }
.profile-menu > strong { font-size: 14px; overflow-wrap: anywhere; }
.profile-menu > span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.profile-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; min-height: 44px; background: transparent; border: 0; border-radius: var(--radius-md); text-align: left; color: var(--ink); font-size: 16px; }
.profile-menu button:hover { background: var(--brand-soft); }
.content { width: 100%; max-width: none; margin: 0; padding: 31px 34px 28px; flex: 1 0 auto; }
.content:focus { outline: none; }
.search-status:not(:empty) { margin: 0; padding: 12px 34px 0; }
.app-footer { padding: 10px 34px 12px; color: var(--muted); text-align: center; font-size: 12px; }
.navigation-open { overflow: hidden; }
.bottom-nav { display: none; }
.boot-loader .boot-logo { object-fit: contain; }
.login-eyebrow, .auth-eyebrow { margin: 0 0 12px; font-family: var(--font-sans); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; }
.login-eyebrow { color: var(--sidebar-muted); }
.auth-eyebrow { color: var(--brand-action); }
.login-wordmark { letter-spacing: -.6px; }
.login-wordmark span { font-family: var(--font-sans); font-size: .78em; font-weight: 600; }
.auth-card h1 { font-family: var(--font-serif); font-size: 32px; font-weight: 600; }
.auth-card .auth-sub { font-size: 14px; }
.auth-lang .lang-switcher { width: 112px; min-width: 112px; max-width: 112px; border-radius: var(--radius-xl); }
.auth-error { border: 1px solid var(--alert-border); border-left: 5px solid var(--alert); border-radius: var(--radius-md); color: var(--alert-ink); background: var(--alert-bg); padding: 12px 14px; font-size: 14px; font-weight: 600; }
.console-visible .global-search { visibility: hidden; pointer-events: none; }
@media (min-width: 1600px) { .profile-copy { display: block; } }
@media (min-width: 901px) {
  .topbar .global-search { grid-column: auto; grid-row: auto; order: 0; }
  .topbar-actions { grid-column: auto; grid-row: auto; }
}
@media (min-width: 921px) {
  .login-brand { flex-direction: row; align-items: center; justify-content: center; gap: 24px; }
  .login-brand .login-logo { flex: 0 0 auto; }
}
@media (min-width: 921px) and (max-width: 1100px) { .login-brand { padding-right: 24px; padding-left: 24px; } }
@media (min-width: 901px) and (max-height: 820px) { .nav-item { min-height: 46px; } .sidebar-collapsed:not(.sidebar-preview) .nav-item { min-height: 60px; } }
@media (min-width: 901px) and (max-width: 920px) {
  .sidebar { transform: none; }
  .mobile-only { display: none; }
  .mobile-scrim { display: none; }
}
@media (min-width: 681px) and (max-width: 920px) {
  .login-shell { grid-template-columns: minmax(260px,.85fr) minmax(360px,1.15fr); min-height: 100%; background: var(--plum-950); }
  .login-brand { min-height: 0; padding: 32px 24px; flex-direction: column; text-align: center; }
  .login-logo { width: 112px; height: 94px; flex-basis: auto; }
  .login-wordmark { font-size: 40px; }
  .auth-card { width: calc(100% - 32px); margin: 28px 0; padding: 28px; }
}
@media (max-width: 900px) {
  .app-shell, .app-shell.sidebar-collapsed { grid-template-columns: minmax(0,1fr); }
  .main { grid-column: 1; }
  .app-shell .sidebar, .app-shell.sidebar-collapsed .sidebar { width: min(300px,calc(100vw - 40px)); transform: translateX(-102%); padding: 12px 12px 18px; }
  .app-shell .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-sidebar-drawer); }
  .sidebar-toolbar, .sidebar-collapsed:not(.sidebar-preview) .sidebar-toolbar { justify-content: space-between; }
  .app-shell .sidebar .sidebar-toolbar-label { display: block; }
  .app-shell .sidebar .sidebar-toggle { display: none; }
  .app-shell .sidebar .sidebar-close { display: grid; }
  .app-shell .sidebar .brand { display: flex; }
  .app-shell .sidebar .nav-item { display: flex; flex-direction: row; width: 100%; min-height: 46px; padding: 6px 12px; gap: 12px; text-align: left; }
  .app-shell .sidebar .nav-item > span:not(.nav-caret) { display: inline; width: auto; font-size: 14px; line-height: 1.35; }
  .app-shell .sidebar .nav-caret { display: block; }
  .app-shell .sidebar .nav-children { display: grid; }
  .app-shell .sidebar .nav-child { padding-left: 24px; }
  .app-shell .sidebar .sidebar-footer { padding: 8px; border: 1px solid var(--sidebar-border); background: var(--nav-soft); }
  .app-shell .sidebar .footer-user-copy, .app-shell .sidebar .footer-caret { display: block; }
  .app-shell .sidebar .footer-id { justify-content: start; }
  .app-shell .sidebar-footer.is-expanded .footer-collapsible { display: grid; }
  .mobile-only { display: inline-grid; }
  .mobile-scrim { display: block; position: fixed; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: var(--navigation-scrim); z-index: 29; visibility: hidden; opacity: 0; }
  .mobile-scrim.open { visibility: visible; opacity: 1; }
  .topbar { position: sticky; height: auto; min-height: 68px; padding: calc(10px + env(safe-area-inset-top)) 20px 10px; grid-template-columns: 44px minmax(0,1fr) auto; gap: 10px; background: var(--topbar-bg); }
  .profile-copy { display: none; }
  .search-status:not(:empty) { padding: 12px 20px 0; }
  .topbar-actions { grid-column: 3; grid-row: 1; }
  .global-search { grid-row: 2; grid-column: 1 / -1; order: 3; }
  .page-title h1 { font-size: 17px; }
  .content { padding: 25px 20px 28px; }
  .app-footer { padding: 10px 20px 12px; }
}
@media (max-width: 720px) {
  .topbar-signout { display: none; }
  .app-shell .sidebar .footer-collapsible { display: grid; }
  .sidebar-footer .footer-actions [data-logout] { width: 100%; flex: 1 0 100%; min-height: 48px; font-size: 16px; background: var(--toast-dismiss-hover); }
  .bottom-nav { display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 24; grid-template-columns: repeat(5,minmax(0,1fr)); min-height: 66px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--topbar-bg); border-top: 1px solid var(--line); box-shadow: var(--shadow-bottom-nav); }
  .bottom-nav-item { min-width: 0; height: 52px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: var(--radius-lg); padding: 4px 2px; background: transparent; color: var(--bottom-nav-ink); font-size: 11px; font-weight: 600; }
  .bottom-nav-item svg { width: 22px; height: 22px; }
  .bottom-nav-item > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav-item.active { color: var(--brand-action); background: var(--brand-soft); }
  .workspace-visible .main { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .console-visible .main { padding-bottom: 0; }
  body.keyboard-open .bottom-nav { display: none; }
  body.keyboard-open .main { padding-bottom: 0; }
}
@media (max-width: 680px) {
  .topbar { padding-right: 14px; padding-left: 14px; gap: 8px; }
  .page-title #pageKicker, #topbarProfile { display: none; }
  .topbar-actions .lang-switcher { width: 44px; min-width: 44px; max-width: 44px; height: 44px; padding: 0; text-indent: -9999px; color: transparent; background-image: none; }
  .topbar-actions .lang-switcher option { color: var(--ink); text-indent: 0; }
  .language-glyph { display: block; position: absolute; width: 19px; height: 19px; left: 12px; top: 12px; pointer-events: none; color: var(--muted); }
  .topbar-actions { gap: 6px; }
  .content { padding: 21px 14px 28px; }
  .search-status:not(:empty) { padding: 12px 14px 0; }
  .app-footer { padding: 10px 14px 12px; }
  .login-brand { min-height: 220px; padding: 34px 24px 62px; }
  .login-wordmark { font-size: 40px; }
  .login-eyebrow { margin-bottom: 8px; }
}
@media (max-width: 390px) {
  .topbar { gap: 6px; }
  .page-title h1 { overflow-wrap: anywhere; font-size: 17px; }
  .topbar-actions .lang-switcher { width: 44px; min-width: 44px; max-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-shell, .sidebar, .nav-item, .mobile-scrim { transition: none; animation: none; }
}
@media print { .app-shell { display: block; } .sidebar, .topbar, .app-footer, .bottom-nav, .skip-link { display: none !important; } .main, .content { padding: 0; } }


/* Brand identity stays within the existing rail/drawer and uses the product's
   short name. Long organisation and staff names retain their own truncation. */
.sidebar .brand { gap: 12px; }
.sidebar .brand strong { font-size: 30px; line-height: 1.1; letter-spacing: -.4px; }
.login-wordmark { font-size: clamp(44px, 4.4vw, 60px); }
.auth-card { max-width: 520px; }
@media (max-width: 680px) {
  .login-brand { min-height: 180px; padding-top: 26px; padding-bottom: 48px; }
  .login-brand .login-logo { width: 82px; height: 69px; flex-basis: auto; }
  .login-wordmark { font-size: 42px; }
  .auth-card { padding: 24px 20px; }
}

@media (min-width: 921px) and (max-height: 700px) {
  .auth-card { margin: 12px 0; padding: 24px 32px; }
  .auth-form { gap: 12px; }
  .auth-card .auth-sub { margin-bottom: 16px; }
  .auth-lang { margin-bottom: 4px; }
  .auth-eyebrow { margin-bottom: 8px; }
}


/* Focused document controls must clear sticky chrome. The extra breathing room
   keeps their labels/help readable; overlay bodies own separate scroll areas. */
html:has(body.workspace-visible) { scroll-padding-block: 92px 20px; }
#content :is(input, select, textarea, button, a[href], summary, [tabindex]) { scroll-margin-block: 16px; }
@media (max-width: 900px) {
  html:has(body.workspace-visible) { scroll-padding-block-start: calc(132px + env(safe-area-inset-top)); }
}
@media (max-width: 720px) {
  html:has(body.workspace-visible) { scroll-padding-block-end: calc(82px + env(safe-area-inset-bottom)); }
  html:has(body.workspace-visible.keyboard-open) { scroll-padding-block-end: 16px; }
}
