:root {
  color-scheme: light;
  --ds-canvas: #fafafa;
  --ds-surface: #ebebeb;
  --ds-surface-raised: #ebebeb;
  --ds-text: #17202a;
  --ds-text-muted: #52606d;
  --ds-border: #c8c8c8;
  --ds-brand: #1455d9;
  --ds-on-brand: #ffffff;
  --ds-focus: #155eef;
  --ds-danger: #b42318;
  --ds-on-danger: #ffffff;
  --ds-warning: #8a4b08;
  --ds-on-warning: #ffffff;
  --ds-success: #067647;
  --ds-on-success: #ffffff;
  --ds-radius-sm: 6px;
  --ds-radius-md: 10px;
  --ds-radius-lg: 16px;
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 24px;
  --ds-font-family: system-ui;
  --ds-font-scale: 1;
}

* { box-sizing: border-box; }
html {
  min-width:320px;
  font-family: var(--ds-font-family), -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: calc(100% * var(--ds-font-scale));
  background: var(--ds-canvas);
  color: var(--ds-text);
  scroll-padding-top: calc(88px + env(safe-area-inset-top));
}
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--ds-canvas); color: var(--ds-text); }
button, input, select { font: inherit; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: var(--ds-space-4); top: -80px; z-index: 1000; padding: 12px 16px; border-radius: var(--ds-radius-sm); background: var(--ds-text); color: var(--ds-canvas); }
.skip-link:focus { top: max(var(--ds-space-4), env(safe-area-inset-top)); }
:focus-visible { outline: 3px solid var(--ds-focus); outline-offset: 3px; }

/* The client identity and credentials are deliberately kept on the light left panel. */
.login-layout { min-height: 100dvh; display: grid; grid-template-columns: minmax(320px, 44%) minmax(0, 56%); background: #fafafa; }
.login-panel { display: grid; align-items: center; min-width: 0; padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); background: #fafafa; color: #17202a; }
.login-card { width: min(500px, 100%); margin-inline: auto; padding: clamp(8px, 3vw, 36px); }
.tenant-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.tenant-logo-frame { flex: 0 0 auto; display: grid; place-items: center; width: 64px; height: 64px; border: 1px solid #c8c8c8; border-radius: 14px; background: #ffffff; }
.tenant-logo { width: 48px; height: 48px; object-fit: contain; border-radius: var(--ds-radius-sm); }
.login-panel .eyebrow { color: #1455d9; }
.login-panel .muted { color: #52606d; }
.login-card h1, .page-header h1 { margin: 0; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.08; }
.eyebrow, .card-label { margin: 0 0 6px; color: var(--ds-brand); font-size: .75rem; font-weight: 800; letter-spacing: .11em; }
.muted { color: var(--ds-text-muted); line-height: 1.55; }
.login-card label { display: block; margin: 18px 0 7px; font-weight: 700; }
.login-card input { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #c8c8c8; border-radius: var(--ds-radius-md); background: #ffffff; color: #17202a; }
.language-picker { margin: 0 0 22px; padding: 16px; border: 1px solid #c8c8c8; border-radius: var(--ds-radius-md); background: #ebebeb; }
.language-title { margin: 0 0 10px; font-weight: 750; }
.language-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.language-choice { min-height: 44px; padding: 8px; border: 1px solid #9ca6b0; border-radius: var(--ds-radius-sm); background: #ffffff; color: #17202a; font-weight: 700; cursor: pointer; }
.language-choice[aria-pressed="true"] { border-color: #1455d9; background: #1455d9; color: #ffffff; }
.button { min-height: 44px; padding: 9px 15px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-text); font-weight: 700; cursor: pointer; }
.button.primary { width: 100%; margin-top: 24px; border-color: var(--ds-brand); background: var(--ds-brand); color: var(--ds-on-brand); }
.button.subtle { background: transparent; }
.form-error { min-height: 24px; color: #b42318; font-weight: 650; }
.choice-list { display: grid; gap: 10px; }
.choice-list button { width: 100%; text-align: start; }

.login-brand-panel { position: relative; isolation: isolate; display: grid; place-items: center; min-width: 0; overflow: hidden; padding: max(36px, env(safe-area-inset-top)) max(36px, env(safe-area-inset-right)) max(36px, env(safe-area-inset-bottom)) 36px; background-color: #0a1929; background-image: radial-gradient(circle at 78% 18%, #4d8dff80 0, transparent 32%), radial-gradient(circle at 18% 82%, #16b8a64d 0, transparent 38%), linear-gradient(145deg, #0a1929 8%, #123d73 52%, #1455d9 100%); color: #ffffff; }
.login-brand-panel::before { position: absolute; z-index: -1; inset: 0; content: ""; opacity: .32; background-image: linear-gradient(115deg, transparent 0 46%, #ffffff14 46% 47%, transparent 47% 100%), linear-gradient(25deg, transparent 0 58%, #ffffff0f 58% 59%, transparent 59% 100%); background-size: 130px 130px, 180px 180px; }
.sisora-identity { display: flex; align-items: center; gap: clamp(18px, 3vw, 34px); }
.sisora-symbol { display: grid; place-items: center; width: clamp(88px, 12vw, 144px); height: clamp(88px, 12vw, 144px); border: 2px solid #ffffff80; border-radius: clamp(24px, 3vw, 40px); background: #ffffff1f; box-shadow: 0 24px 80px #00000040; color: #ffffff; font-size: clamp(2.8rem, 7vw, 5rem); font-weight: 850; }
.sisora-wordmark { display: grid; margin: 0; line-height: .95; }
.sisora-wordmark strong { font-size: clamp(2.4rem, 6vw, 5.5rem); letter-spacing: .08em; }
.sisora-wordmark span { margin-top: 12px; font-size: clamp(1rem, 2vw, 1.7rem); font-weight: 650; letter-spacing: .32em; text-transform: uppercase; }

.shell { --shell-header-height: calc(68px + env(safe-area-inset-top)); min-height: 100dvh; display: grid; grid-template-columns: 272px minmax(0, 1fr); grid-template-rows: var(--shell-header-height) minmax(0, 1fr); }
.topbar { grid-column: 1 / -1; position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--shell-header-height); padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--ds-border); background: var(--ds-surface); }
.brand { display: flex; align-items: center; min-width: 0; gap: 11px; color: var(--ds-text); text-decoration: none; }
.sisora-symbol.small { flex: 0 0 auto; width: 38px; height: 38px; border: 0; border-radius: 11px; background: var(--ds-brand); box-shadow: none; color: var(--ds-on-brand); font-size: 20px; }
.product-heading { display: grid; min-width: 0; }
.product-heading strong, .product-heading small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-heading small { color: var(--ds-text-muted); }
.shell-tenant-logo { flex: 0 0 auto; width: 38px; height: 38px; margin-inline-start: 4px; }
.top-actions { display: flex; gap: 8px; }
.menu-toggle { display: none; }
.icon-button { flex: 0 0 auto; width: 44px; height: 44px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: transparent; color: var(--ds-text); }
.sidebar { grid-column: 1; grid-row: 2; position: sticky; top: var(--shell-header-height); display: flex; flex-direction: column; height: calc(100dvh - var(--shell-header-height)); overflow: auto; padding: 20px 12px calc(20px + env(safe-area-inset-bottom)); border-inline-end: 1px solid var(--ds-border); background: var(--ds-surface); }
.module-navigation { flex: 1 0 auto; }
.sidebar ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.sidebar a, .nav-group-toggle { display: flex; align-items: center; width: 100%; min-height: 44px; gap: 10px; padding: 10px 12px; border: 0; border-radius: var(--ds-radius-md); background: transparent; color: var(--ds-text-muted); font: inherit; font-weight: 650; text-align: start; text-decoration: none; cursor: pointer; }
.sidebar a:hover, .sidebar a.active, .nav-group-toggle:hover, .nav-group-toggle[aria-expanded="true"] { background: color-mix(in srgb, var(--ds-brand), transparent 88%); color: var(--ds-text); }
.nav-icon { flex: 0 0 24px; display: grid; place-items: center; width: 24px; min-width: 24px; height: 24px; font-size: 1.05rem; }
.nav-label { flex: 1 1 auto; display: block; min-width: 0; overflow-wrap: anywhere; }
.nav-chevron { flex: 0 0 auto; transition: transform .18s ease; }
.nav-group-toggle[aria-expanded="true"] .nav-chevron { transform: rotate(90deg); }
.nav-children { margin: 4px 0 6px 24px !important; padding-inline-start: 12px !important; border-inline-start: 1px solid var(--ds-border); }
.nav-children a { min-height: 40px; padding-block: 8px; }
.nav-children .nav-icon { font-size: .8rem; }
.sidebar-preferences { flex: 0 0 auto; margin-top: 24px; padding: 16px 10px max(4px, env(safe-area-inset-bottom)); border-top: 1px solid var(--ds-border); }
.sidebar-preferences label { display: block; margin-bottom: 7px; font-weight: 750; }
.language-select { width: 100%; min-height: 44px; padding: 8px 34px 8px 10px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-canvas); color: var(--ds-text); }
.workspace { grid-column: 2; grid-row: 2; min-width: 0; padding: clamp(20px, 4vw, 48px); padding-bottom: max(48px, env(safe-area-inset-bottom)); background: var(--ds-canvas); }
.workspace.route-pending .breadcrumbs, .workspace.route-pending .page-header, .workspace.route-pending #dashboard-view, .workspace.route-pending #module-view, .workspace.route-pending #route-unavailable { visibility: hidden; }
.breadcrumbs { max-width: 980px; margin: 0 0 18px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { display: flex; align-items: center; min-width: 0; gap: 7px; color: var(--ds-text-muted); font-size: .9rem; }
.breadcrumbs li:not(:last-child)::after { content: "/"; color: var(--ds-border); font-weight: 800; }
.breadcrumbs a { color: var(--ds-text-muted); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.breadcrumbs [aria-current="page"] { overflow-wrap: anywhere; color: var(--ds-text); font-weight: 750; }
.page-header { max-width: 820px; margin-bottom: 32px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 980px; }
.route-message { max-width: 760px; }
.route-message .card { min-height: 180px; }
.route-message h2 { margin: 0; font-size: clamp(1.35rem, 3vw, 2rem); }
.route-error { border-color: color-mix(in srgb, var(--ds-danger), var(--ds-border) 50%); }
.module-view { display: grid; width: min(100%, 1120px); gap: var(--ds-space-4); }
.module-view-message { min-height: 140px; }
.module-component { min-width: 0; scroll-margin-top: calc(88px + env(safe-area-inset-top)); }
.module-heading { margin: 0; }
.module-text { max-width: 75ch; margin: 0; line-height: 1.6; }
.module-notice { padding: var(--ds-space-4); border: 1px solid var(--ds-border); border-inline-start-width: 5px; border-radius: var(--ds-radius-md); background: var(--ds-surface-raised); }
.module-notice.tone-danger { border-inline-start-color: var(--ds-danger); }
.module-notice.tone-warning { border-inline-start-color: var(--ds-warning); }
.module-notice.tone-success { border-inline-start-color: var(--ds-success); }
.module-notice.tone-info { border-inline-start-color: var(--ds-brand); }
.module-metric, .module-table-region, .module-calendar, .module-form { padding: var(--ds-space-5); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface-raised); }
.module-metric { display: grid; gap: var(--ds-space-2); }
.module-metric strong { overflow-wrap: anywhere; font-size: 1.75rem; }
.module-component-title { margin: 0 0 var(--ds-space-4); font-size: clamp(1.2rem, 2.5vw, 1.7rem); }
.module-table-scroll { max-width: 100%; overflow-x: auto; }
.module-table { width: 100%; border-collapse: collapse; }
.module-table th, .module-table td { padding: var(--ds-space-3); border-bottom: 1px solid var(--ds-border); text-align: start; vertical-align: top; overflow-wrap: anywhere; }
.module-table th { color: var(--ds-text-muted); font-weight: 800; }
.module-actions { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); }
.module-action { width: auto; margin: 0; }
.module-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--ds-space-2); margin: 0; padding: 0; list-style: none; }
.module-calendar-row { display: contents; }
.module-calendar-item { min-width: 0; min-height: 132px; padding: var(--ds-space-3); border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-canvas); }
.module-calendar-item h3 { margin: 0 0 var(--ds-space-2); font-size: 1rem; overflow-wrap: anywhere; }
.module-time, .module-status { margin: var(--ds-space-1) 0; color: var(--ds-text-muted); font-size: .9rem; overflow-wrap: anywhere; }
.module-status::before { content: "● "; color: var(--ds-brand); }
.module-form { display: grid; gap: var(--ds-space-3); max-width: 760px; }
.module-field { display: grid; gap: var(--ds-space-2); }
.module-field label { font-weight: 750; }
.module-field input, .module-field select, .module-field textarea { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-canvas); color: var(--ds-text); }
.module-field textarea { min-height: 120px; resize: vertical; }
.module-field input[type="checkbox"] { width: 24px; min-height: 24px; justify-self: start; }
.module-form-error { margin: 0; padding: var(--ds-space-3); border-inline-start: 4px solid var(--ds-danger); color: var(--ds-danger); font-weight: 700; }
.card { min-width: 0; padding: 24px; border: 1px solid var(--ds-border); border-radius: var(--ds-radius-lg); background: var(--ds-surface-raised); box-shadow: 0 8px 24px color-mix(in srgb, var(--ds-text), transparent 94%); }
.card strong { font-size: 1.75rem; }
.card h2 { margin: 0; }
.span-2 { grid-column: 1 / -1; }
.status-good { color: var(--ds-success); }
.scrim { display: none; }

@media (max-width: 760px) {
  .login-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .login-brand-panel { order: -1; min-height: clamp(190px, 30dvh, 280px); padding: max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 28px max(24px, env(safe-area-inset-left)); }
  .sisora-identity { gap: 16px; }
  .sisora-symbol { width: 70px; height: 70px; border-radius: 20px; font-size: 2.3rem; }
  .sisora-wordmark strong { font-size: clamp(2rem, 11vw, 3.4rem); }
  .sisora-wordmark span { margin-top: 8px; font-size: .85rem; }
  .login-panel { align-items: start; padding-top: 24px; }
  .login-card { padding: 4px 0 28px; }
  .language-options { grid-template-columns: 1fr; }
  .shell { --shell-header-height: calc(64px + env(safe-area-inset-top)); display: block; }
  .topbar { min-height: var(--shell-header-height); }
  .menu-toggle { display: block; }
  .shell-tenant-logo { display: none !important; }
  .top-actions .button { padding-inline: 10px; }
  .sidebar { position: fixed; z-index: 60; inset: var(--shell-header-height) auto 0 0; width: min(88vw, 320px); height: auto; padding-left: max(12px, env(safe-area-inset-left)); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 18px 0 40px #00000033; }
  .sidebar.open { transform: none; }
  .workspace { padding: 24px max(16px, env(safe-area-inset-right)) 64px max(16px, env(safe-area-inset-left)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .module-calendar-grid { grid-template-columns: 1fr; }
  .module-calendar-row { display: block; }
  .module-calendar-item { min-height: 0; }
  .module-metric, .module-table-region, .module-calendar, .module-form { padding: var(--ds-space-4); }
  .span-2 { grid-column: auto; }
  .scrim { position: fixed; z-index: 50; inset: var(--shell-header-height) 0 0; border: 0; background: #00000088; }
  .scrim:not(.hidden) { display: block; }
}

@media (max-width: 420px) {
  .tenant-heading { align-items: flex-start; }
  .tenant-logo-frame { width: 52px; height: 52px; }
  .tenant-logo-frame .tenant-logo { width: 40px; height: 40px; }
  .product-heading { max-width: 116px; }
  .top-actions { gap: 4px; }
  .top-actions .button { padding-inline: 8px; font-size: .85rem; }
  .card { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (forced-colors: active) {
  .button, .card, .sidebar, .topbar, .language-select, .language-choice, .tenant-logo-frame, .module-component, .module-calendar-item, .module-field input, .module-field select, .module-field textarea { border: 1px solid CanvasText; }
  .module-status::before { color: CanvasText; }
  .sisora-symbol { forced-color-adjust: none; }
  .login-brand-panel { forced-color-adjust: none; }
}
