/* Operations shell: sidebar on desktop; top bar, tab bar and the Más sheet on
   phones. Data and permissions stay in dash.js / workspace.js. */
.dash {
  --shell-side: 248px;
  --shell-line: rgba(16, 32, 26, 0.07);
  --shell-bar: 56px;
  --shell-tabs: 62px;
  background: #fbfbf9;
  color: #10201a;
}

.workspace-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.workspace-brand > span { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.dash .workspace-brand roadless-header { display: block; padding: 0; }
.dash .workspace-brand .mark { width: 28px; height: 28px; margin: 0; border-radius: 8px; background: #143d2b; color: #e8f0ea; }
.dash .workspace-brand .mark svg { width: 18px; height: 18px; }

.workspace-icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.workspace-title,
.workspace-more,
.workspace-sheet-head,
.workspace-tabbar { display: none; }
.dash.is-signed-in [hidden],
.dash-chrome-bar [hidden] { display: none !important; }

/* Signed out: the brand alone above the sign-in card. */
.dash:not(.is-signed-in) .dash-chrome { position: static; border: 0; background: transparent; }
.dash:not(.is-signed-in) .dash-chrome-bar { display: flex; max-width: 460px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 20px 0; box-sizing: border-box; }

/* Sidebar and its navigation (also the content of the phone sheet). */
.dash.is-signed-in .dash-nav:not([hidden]) { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start; gap: 14px; }
.workspace-switch { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border: 1px solid rgba(16, 32, 26, 0.08); border-radius: 11px; background: #fff; box-shadow: 0 1px 2px rgba(16, 32, 26, 0.04); color: #10201a; font-size: 13.5px; font-weight: 500; text-decoration: none; }
.workspace-switch:hover { border-color: rgba(16, 32, 26, 0.16); }
.workspace-switch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-chevron { width: 15px; height: 15px; flex: none; fill: none; stroke: #7b867f; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.workspace-lot-nav { display: flex; flex-direction: column; gap: 14px; }
.workspace-lot-nav[hidden] { display: none; }
.workspace-group { display: flex; flex-direction: column; gap: 1px; }
.workspace-caption { margin: 0; padding: 0 10px 4px; color: #8b958f; font-size: 11.5px; font-weight: 500; }
.workspace-group.is-fold > summary { display: flex; align-items: center; cursor: pointer; list-style: none; }
.workspace-group.is-fold > summary::-webkit-details-marker { display: none; }
.workspace-group.is-fold > summary::after { content: ""; width: 6px; height: 6px; margin-left: auto; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s ease; }
.workspace-group.is-fold[open] > summary::after { transform: rotate(45deg); }
.dash.is-signed-in .dash-tabs { display: flex; flex: none; flex-direction: column; align-items: stretch; order: 0; gap: 1px; margin: 0; overflow: visible; }
.workspace-fold { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--shell-line); }
.workspace-fold > summary { display: flex; align-items: center; height: 32px; padding: 0 10px; border-radius: 9px; color: #8b958f; font-size: 11.5px; font-weight: 500; list-style: none; cursor: pointer; }
.workspace-fold > summary::-webkit-details-marker { display: none; }
.workspace-fold > summary::after { content: ""; width: 6px; height: 6px; margin-left: auto; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s ease; }
.workspace-fold[open] > summary::after { transform: rotate(45deg); }
.workspace-fold > .dash-tab { margin: 0; }
.dash.is-signed-in .dash-tab { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: #3d4a43; font-size: 13.5px; font-weight: 450; text-decoration: none; white-space: nowrap; }
.dash.is-signed-in .dash-tab[hidden] { display: none; }
.dash.is-signed-in .dash-tab .workspace-icon { color: #7b867f; }
.dash.is-signed-in .dash-tab:hover { background: rgba(16, 32, 26, 0.04); color: #10201a; }
.dash.is-signed-in .dash-tab.is-on { background: #fff; color: #10201a; font-weight: 550; box-shadow: 0 1px 2px rgba(16, 32, 26, 0.06), 0 0 0 1px rgba(16, 32, 26, 0.06); }
.dash.is-signed-in .dash-tab.is-on .workspace-icon { color: #143d2b; }
.dash-tab .health-badge { margin-left: auto; }
.dash-tab .health-badge:is([data-health="ok"], [data-health="none"], [data-health=""]),
.workspace-tab .health-badge:is([data-health="ok"], [data-health="none"], [data-health=""]) { display: none; }
.dash.is-signed-in .dash-nav-tools { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin: auto 0 0; padding-top: 10px; border-top: 1px solid var(--shell-line); }
.workspace-account { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.workspace-account strong,
.workspace-account span:not(.workspace-avatar) { display: block; }
.workspace-account strong { font-size: 13px; font-weight: 550; }
#workspace-role { margin-top: 1px; color: #8b958f; font-size: 12px; }
.workspace-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: #e3ebe5; color: #143d2b; font-size: 12px; font-weight: 600; }
.dash.is-signed-in .dash-logout { display: flex; align-items: center; justify-content: flex-start; gap: 10px; height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: #5f6b64; font-size: 13px; font-weight: 450; }
.dash.is-signed-in .dash-logout:hover { background: rgba(16, 32, 26, 0.04); color: #10201a; }

/* "Ver como": super admins only. A stacked segmented control, then the lot. */
.workspace-view-as { display: flex; flex-direction: column; gap: 6px; padding: 2px 0 4px; }
.workspace-view-as[hidden] { display: none; }
.workspace-view-as .workspace-caption { padding-bottom: 0; }
.workspace-view-as-roles { display: flex; flex-direction: column; gap: 2px; padding: 3px; border-radius: 11px; background: rgba(16, 32, 26, 0.045); }
.workspace-view-as-roles button { display: flex; align-items: center; justify-content: space-between; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: #3d4a43; font: inherit; font-size: 13px; font-weight: 450; text-align: left; cursor: pointer; }
.workspace-view-as-roles button:hover:not(:disabled) { color: #10201a; }
.workspace-view-as-roles button[aria-pressed="true"] { background: #fff; color: #10201a; font-weight: 550; box-shadow: 0 1px 2px rgba(16, 32, 26, 0.08), 0 0 0 1px rgba(16, 32, 26, 0.06); }
.workspace-view-as-roles button[aria-pressed="true"]::after { content: ""; width: 8px; height: 4px; margin-top: -3px; border-left: 1.6px solid #143d2b; border-bottom: 1.6px solid #143d2b; transform: rotate(-45deg); }
.workspace-view-as-roles button:disabled { color: #a5ada8; cursor: default; }
.workspace-view-as-lot { width: 100%; height: 34px; padding: 0 10px; border: 1px solid rgba(16, 32, 26, 0.1); border-radius: 9px; background: #fff; color: #10201a; font: inherit; font-size: 13px; }

/* While a super admin looks through a lower role. */
.view-as-banner:not([hidden]) { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 4px; padding: 10px var(--chrome-side, 20px); border-bottom: 1px solid #e8dcc0; background: #f8f1e1; color: #4d3f1c; }
.view-as-banner p { margin: 0; font-size: 13.5px; line-height: 1.4; }
.view-as-banner strong { font-weight: 600; color: #3a2f12; }
.view-as-back { flex: none; height: 32px; padding: 0 12px; border: 1px solid rgba(16, 32, 26, 0.12); border-radius: 9px; background: #fff; color: #143d2b; font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; box-shadow: 0 1px 2px rgba(16, 32, 26, 0.05); }
.view-as-back:hover { border-color: rgba(16, 32, 26, 0.24); }

@media (min-width: 741px) {
  .dash.is-signed-in .dash-chrome { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--shell-side); height: 100dvh; overflow-x: hidden; overflow-y: auto; border: 0; border-right: 1px solid var(--shell-line); background: #f7f7f4; }
  .dash.is-signed-in .dash-chrome-bar { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 14px; min-height: 100%; padding: 18px 14px 14px; box-sizing: border-box; }
  .dash.is-signed-in .workspace-brand { padding: 4px 8px; }
  .dash.is-signed-in .dash-nav:not([hidden]) { flex: 1; }
  .dash.is-signed-in .shell { width: calc(100% - var(--shell-side)); max-width: none; min-height: 100dvh; margin-left: var(--shell-side); }
}

/* Phone: sticky top bar, fixed tab bar, the whole menu in a sheet. */
@media (max-width: 740px) {
  .dash.is-signed-in .dash-chrome { position: sticky; top: 0; z-index: 30; width: auto; height: auto; border: 0; border-bottom: 1px solid var(--shell-line); background: #fbfbf9; }
  .dash.is-signed-in .dash-chrome-bar { display: flex; flex-direction: row; align-items: center; gap: 10px; min-height: var(--shell-bar); padding: env(safe-area-inset-top) 6px 0 16px; box-sizing: border-box; }
  .dash.is-signed-in .workspace-brand > span { display: none; }
  .dash.is-signed-in .workspace-title:not([hidden]) { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; min-height: 44px; color: #10201a; font-size: 16px; font-weight: 600; letter-spacing: -0.015em; text-decoration: none; }
  #workspace-title-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .workspace-title[href]::after { content: ""; flex: none; width: 6px; height: 6px; margin: -3px 0 0 2px; border-right: 1.6px solid #7b867f; border-bottom: 1.6px solid #7b867f; transform: rotate(45deg); }
  .dash.is-signed-in .workspace-more { display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; padding: 0; border: 0; border-radius: 12px; background: transparent; color: #3d4a43; }
  .dash.is-signed-in .workspace-more .workspace-icon { width: 22px; height: 22px; }

  .dash.is-signed-in .dash-nav:not([hidden]) { display: none; }
  .dash.is-signed-in.workspace-menu-open { overflow: hidden; }
  .dash.is-signed-in.workspace-menu-open .dash-chrome { z-index: 70; }
  .dash.is-signed-in.workspace-menu-open .dash-nav:not([hidden]) { position: fixed; inset: 0; z-index: 60; display: flex; gap: 16px; padding: env(safe-area-inset-top) 16px max(20px, env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; background: #f7f7f4; }
  .dash.is-signed-in .workspace-sheet-head { display: flex; align-items: center; justify-content: space-between; min-height: var(--shell-bar); margin-bottom: -4px; }
  .workspace-sheet-head strong { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; }
  .workspace-close { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: #3d4a43; }
  .workspace-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .workspace-switch { min-height: 48px; font-size: 15px; }
  .dash.is-signed-in .dash-tab,
  .dash.is-signed-in .dash-logout { height: 44px; font-size: 15px; }
  .workspace-fold > summary { height: 44px; font-size: 12.5px; }
  .workspace-view-as-roles button { height: 42px; font-size: 15px; }
  .workspace-view-as-lot { height: 44px; font-size: 15px; }
  .dash.is-signed-in .view-as-banner:not([hidden]) { top: calc(var(--shell-bar) + env(safe-area-inset-top)); }
  .view-as-banner:not([hidden]) { flex-wrap: wrap; gap: 8px; padding: 8px 16px 10px; }
  .view-as-banner p { font-size: 13px; }
  .view-as-back { height: 36px; }
  .workspace-caption { font-size: 12.5px; }
  .workspace-group.is-fold > summary { min-height: 44px; }

  .dash.is-signed-in .workspace-tabbar:not([hidden]) { position: fixed; inset: auto 0 0; z-index: 40; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 4px 4px max(4px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(16, 32, 26, 0.08); background: rgba(255, 255, 255, 0.94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  body.workspace-operator .dash.is-signed-in .workspace-tabbar:not([hidden]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workspace-tabbar-links { display: contents; }
  .workspace-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 54px; padding: 0 2px; border: 0; background: transparent; color: #7b867f; font: inherit; font-size: 11px; font-weight: 500; text-decoration: none; white-space: nowrap; }
  .workspace-tab .workspace-icon { width: 22px; height: 22px; }
  .workspace-tab.is-on { color: #143d2b; font-weight: 600; }
  .workspace-tab { position: relative; }
  .workspace-tab .health-badge { position: absolute; top: 4px; left: calc(50% + 6px); width: 15px; height: 15px; border-radius: 5px; background-size: 10px; box-shadow: 0 0 0 2px #fff; }
  .dash.is-signed-in .shell { padding-bottom: calc(var(--shell-tabs) + env(safe-area-inset-bottom)); }
}
