/*
 * Third-Party Mock Console — application shell
 *
 * Structure follows Vben Admin's frame, adapted to a two-screen tool:
 *
 *   [ sidebar        ] [ header: menu · breadcrumb · search · utilities ]
 *   [ logo           ] [ tab strip: 页面管理 | 日志管理                  ]
 *   [ group 控制台   ] [ main                                            ]
 *   [   nav item     ]
 *   [ collapsed: no  ] [                                                  ]
 *   [ footer toggle  ]
 *
 * What is deliberately NOT copied: the theme switch, the notification bell,
 * the lock and the user menu. This console has no dark theme, no accounts and
 * no notifications, so those buttons would be decoration pretending to be
 * controls. Every control in this shell does something.
 *
 * Load after tokens.css. Both console pages link this file and nothing else
 * of the shell lives in their own <style>.
 */

:root {
  --rail: 224px;
  --rail-collapsed: 68px;
  --header-h: 52px;
  --tabs-h: 38px;
}

/* ---- Sidebar ------------------------------------------------------------- */
/* White ground with a hairline seam, the way Vben separates the rail from the
   page. The dark spine is gone; nothing here assumes light text on dark. */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--rail);
  background: var(--spine);
  color: var(--ink);
  border-right: 1px solid var(--line);
  box-shadow: 1px 0 3px rgb(16 24 40 / 3%);
  transition: width var(--dur-state) var(--ease-standard),
    transform var(--dur-enter) var(--ease-standard);
}

.rail__mark {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  height: var(--header-h);
  padding: 0 16px;
  overflow: hidden;
}

.rail__mark img {
  /* The glyph has generous padding inside its own tile, so the element runs a
     little larger than the optical size of a plain mark. */
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  /* The PNG already carries its own white rounded tile and inset glyph, so the
     image needs no border, shadow or radius of its own. */
  border: 0;
  border-radius: 0;
}

.rail__name {
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.rail__name span {
  display: block;
  color: var(--ink-on-spine-2);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
}

/* ---- Sidebar navigation -------------------------------------------------- */
.rail__nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 6px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--spine-line) transparent;
}

/* A named group, the way Vben groups 分析页 / 工作台 under 概览. */
.nav-group + .nav-group {
  margin-top: 4px;
}

.nav-group__head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-on-spine-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  cursor: pointer;
  transition: color var(--dur-feedback) var(--ease-standard);
}

.nav-group__head:hover {
  color: var(--ink-on-spine);
}

.nav-group__chevron {
  flex: 0 0 12px;
  margin-left: auto;
  transition: transform var(--dur-state) var(--ease-standard);
}

.nav-group[data-open="false"] .nav-group__chevron {
  transform: rotate(-90deg);
}

.nav-group[data-open="false"] .nav-group__list {
  display: none;
}

.nav-group__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--ink-on-spine-2);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-feedback) var(--ease-standard),
    color var(--dur-feedback) var(--ease-standard);
}

.nav-item:hover {
  background: var(--spine-raised);
  color: var(--ink-on-spine);
}

.nav-item[aria-current="page"] {
  /* Vben's active state is a tinted row with coloured text, not a solid block;
     it keeps the sidebar calm while still reading as "you are here". */
  background: var(--brand-wash);
  color: var(--brand);
  font-weight: 600;
}

.nav-item svg {
  flex: 0 0 16px;
}

/* ---- Sidebar footer ------------------------------------------------------ */
.rail__foot {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 8px;
  border-top: 1px solid var(--spine-line);
}

.rail__toggle {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-on-spine-2);
  cursor: pointer;
  transition: background var(--dur-feedback) var(--ease-standard),
    color var(--dur-feedback) var(--ease-standard);
}

.rail__toggle:hover {
  background: var(--spine-raised);
  color: var(--ink-on-spine);
}

.rail__toggle svg {
  transition: transform var(--dur-state) var(--ease-standard);
}

/* ---- Collapsed sidebar --------------------------------------------------- */
[data-rail="collapsed"] .rail {
  width: var(--rail-collapsed);
}

[data-rail="collapsed"] .rail__mark {
  justify-content: center;
  padding: 0;
}

[data-rail="collapsed"] .rail__name,
[data-rail="collapsed"] .nav-group__head span,
[data-rail="collapsed"] .nav-group__chevron,
[data-rail="collapsed"] .nav-item span {
  display: none;
}

/* In a 68px rail there is no room for a group label; the icons stand on their
   own and the group heading collapses to a short divider so the section is
   still perceptible without eating a row. */
[data-rail="collapsed"] .nav-group__head {
  min-height: 0;
  height: 1px;
  margin: 6px 6px 8px;
  padding: 0;
  overflow: hidden;
  background: var(--spine-line);
  pointer-events: none;
}

[data-rail="collapsed"] .nav-group__head span,
[data-rail="collapsed"] .nav-group__chevron {
  display: none;
}

[data-rail="collapsed"] .rail__nav {
  padding: 6px 10px;
}

[data-rail="collapsed"] .nav-item {
  justify-content: center;
  padding: 0;
}

[data-rail="collapsed"] .rail__foot {
  justify-content: center;
  padding: 0 10px;
}

[data-rail="collapsed"] .rail__toggle svg {
  transform: rotate(180deg);
}

[data-rail="collapsed"] .shell {
  margin-left: var(--rail-collapsed);
}

/* ---- Shell --------------------------------------------------------------- */
.shell {
  margin-left: var(--rail);
  transition: margin-left var(--dur-state) var(--ease-standard);
}

/* ---- Header -------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: var(--header-h);
  padding: 0 var(--s-4) 0 var(--s-2);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
  /* The header floats above the scrolling page, so it earns a shadow and a
     frosted ground rather than sitting flush with the content. */
  backdrop-filter: saturate(160%) blur(10px);
  box-shadow: 0 1px 3px rgb(16 24 40 / 4%);
}

/* The scroll progress rule lives at the header bottom edge, where it reads as
   the page own measure rather than a second border. */
.topbar .scroll-progress {
  border-radius: 0 2px 2px 0;
}

.topbar__menu {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--dur-feedback) var(--ease-standard),
    color var(--dur-feedback) var(--ease-standard);
}

.topbar__menu:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}

.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink-3);
  font-size: var(--t-micro);
}

.crumb span {
  white-space: nowrap;
}

.crumb b {
  color: var(--ink);
  font-weight: 600;
}

.crumb svg {
  flex: 0 0 11px;
  color: var(--line-strong);
}

/* Header search: the same filter the page carries, reachable from anywhere. */
.topbar__search {
  position: relative;
  flex: 1 1 auto;
  max-width: 320px;
  margin-left: auto;
}

.topbar__search svg {
  position: absolute;
  top: 50%;
  left: 9px;
  translate: 0 -50%;
  color: var(--ink-3);
  pointer-events: none;
}

.topbar__search input {
  width: 100%;
  height: 32px;
  padding: 0 46px 0 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  color: var(--ink);
  font-size: var(--t-micro);
  transition: background var(--dur-feedback) var(--ease-standard),
    border-color var(--dur-feedback) var(--ease-standard);
}

.topbar__search input::placeholder {
  color: var(--ink-3);
}

.topbar__search input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.topbar__search kbd {
  position: absolute;
  top: 50%;
  right: 7px;
  translate: 0 -50%;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 10px;
  pointer-events: none;
}

.topbar__tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  position: relative;
}

.tool-divider {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--line);
}

/* A count on the bell is the only badge here: it says how many requests failed
   since the page was opened, which is the one number worth interrupting for. */
.tool-btn {
  position: relative;
}

.tool-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border: 1.5px solid var(--surface);
  border-radius: 8px;
  background: var(--bad);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  /* A counter is a label, not a control: it must never swallow the click
     meant for the button underneath it. */
  pointer-events: none;
}


/* ---- Segmented control (theme picker) ------------------------------------ */
.segmented {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-sunken);
}

.segmented__option {
  min-height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-2);
  font-size: 11px;
  cursor: pointer;
  transition: background var(--dur-feedback) var(--ease-standard),
    color var(--dur-feedback) var(--ease-standard);
}

.segmented__option:hover {
  color: var(--ink);
}

/* The chosen segment sits on the surface, the way Vben marks the active tab. */
.segmented__option.is-chosen {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(16 24 40 / 8%);
}

/* ---- Choice lists (theme, timezone, language) ---------------------------- */
.choice-group__title {
  margin: 0;
  padding: 9px 14px 5px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
}

.choice-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--t-micro);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-feedback) var(--ease-standard),
    color var(--dur-feedback) var(--ease-standard);
}

.choice-item:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}

.choice-item.is-chosen {
  color: var(--brand);
  font-weight: 650;
}

.choice-item__label {
  flex: 1 1 auto;
  min-width: 0;
}

.choice-item__meta {
  flex: 0 0 auto;
  color: var(--ink-3);
  font-family: var(--font-code);
  font-size: 10px;
}

/* The chosen row carries a check mark, so selection is never colour-only. */
.choice-item__check {
  flex: 0 0 14px;
  color: var(--brand);
  opacity: 0;
}

.choice-item.is-chosen .choice-item__check {
  opacity: 1;
}

/* ---- Icon pair for the theme button -------------------------------------- */
.tool-btn .icon-sun[hidden],
.tool-btn .icon-moon[hidden] {
  display: none;
}

/* ---- Header popover ------------------------------------------------------ */
.header-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: min(340px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 18px 48px rgb(16 38 43 / 16%);
}

.header-popover__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--t-micro);
  font-weight: 650;
}

.header-popover__head span {
  color: var(--ink-3);
  font-weight: 400;
}

.header-popover__body {
  max-height: min(420px, 62vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.header-popover__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 11px;
}

/* ---- Notification rows --------------------------------------------------- */
.notify-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-feedback) var(--ease-standard);
}

.notify-item:last-child {
  border-bottom: 0;
}

.notify-item:hover {
  background: var(--surface-sunken);
}

.notify-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: 3px;
}

.notify-item__endpoint {
  min-width: 0;
  color: var(--ink);
  font-family: var(--font-code);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.notify-item__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-3);
  font-size: 10px;
}

/* ---- Settings rows ------------------------------------------------------- */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row__label {
  min-width: 0;
}

.setting-row__label b {
  display: block;
  color: var(--ink);
  font-size: var(--t-micro);
  font-weight: 600;
}

.setting-row__label span {
  display: block;
  margin-top: 1px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.5;
}

/* A real switch: the checkbox keeps keyboard and screen-reader semantics. */
.switch {
  position: relative;
  flex: 0 0 auto;
  display: inline-block;
  width: 34px;
  height: 20px;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch__track {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--line-strong);
  pointer-events: none;
  transition: background var(--dur-state) var(--ease-standard);
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(16 38 43 / 24%);
  transition: transform var(--dur-state) var(--ease-standard);
}

.switch input:checked + .switch__track {
  background: var(--brand);
}

.switch input:checked + .switch__track::after {
  transform: translateX(14px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---- Density ------------------------------------------------------------- */
/* One step tighter on every gap that comes from the spacing tokens. */
[data-density="compact"] {
  --s-4: 12px;
  --s-5: 16px;
  --s-6: 22px;
  --s-7: 32px;
  --s-8: 48px;
}

/* ---- App dialog ---------------------------------------------------------- */
.app-dialog {
  width: min(420px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px rgb(16 38 43 / 26%);
}

.app-dialog::backdrop {
  background: rgb(16 38 43 / 50%);
}

.app-dialog__head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 18px 20px 0;
}

.app-dialog__icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: var(--brand-wash);
  color: var(--brand-deep);
}

.app-dialog__head h2 {
  font-size: var(--t-title);
}

.app-dialog__head p {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 11px;
}

.app-dialog__body {
  padding: 14px 20px 4px;
  color: var(--ink-2);
  font-size: var(--t-small);
  line-height: 1.7;
}

.app-dialog__body ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.app-dialog__body li + li {
  margin-top: 4px;
}

.app-dialog__body code {
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--surface-sunken);
  color: var(--brand-deep);
  font-size: 11px;
}

.app-dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  padding: 16px 20px 18px;
}

/* ---- Lock screen --------------------------------------------------------- */
/* A privacy curtain, not a lock: there is no account system to authenticate
   against, so the overlay says so rather than implying it protects anything. */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  /* The curtain covers the scrollbar gutter too, otherwise a white strip of
     the page stays readable along the right edge. */
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-5);
  /* A curtain is deliberately dark in either theme: light text on a light page
     would not read as "the screen is covered". */
  background: #1f2937;
  color: #f3f4f6;
  text-align: center;
}

/* While the curtain is up, the page behind must not scroll. */
[data-locked="true"] {
  overflow: hidden;
}

/* The mark already carries its own white tile, so on the dark curtain it
   reads without any extra frame. */
.lock-screen img {
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
}

.lock-screen h2 {
  color: #ffffff;
  font-size: 1.375rem;
}

.lock-screen p {
  max-width: 38ch;
  color: #9ca3af;
  font-size: var(--t-small);
  line-height: 1.7;
}

.lock-screen__time {
  color: #d1d5db;
  font-family: var(--font-code);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.lock-screen .btn {
  margin-top: var(--s-2);
  border-color: rgb(255 255 255 / 24%);
  background: rgb(255 255 255 / 8%);
  color: #fff;
}

.lock-screen .btn:hover {
  background: rgb(255 255 255 / 16%);
  border-color: rgb(255 255 255 / 40%);
}

.lock-screen small {
  color: #6f8b8a;
  font-size: 10px;
}

@media (max-width: 760px) {
  .tool-divider {
    display: none;
  }
}

.tool-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--dur-feedback) var(--ease-standard),
    color var(--dur-feedback) var(--ease-standard);
}

.tool-btn:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}

.tool-btn[aria-pressed="true"] {
  background: var(--brand-wash);
  color: var(--brand-deep);
}

.env-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  background: var(--warn-wash);
  color: var(--warn);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.env-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* ---- Tab strip ----------------------------------------------------------- */
.tabbar {
  position: sticky;
  top: var(--header-h);
  z-index: 19;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: var(--tabs-h);
  padding: 0 var(--s-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.tabbar__list {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabbar__list::-webkit-scrollbar {
  display: none;
}

.tab-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  min-height: 26px;
  padding: 0 6px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--t-micro);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-feedback) var(--ease-standard),
    color var(--dur-feedback) var(--ease-standard),
    border-color var(--dur-feedback) var(--ease-standard);
}

.tab-chip:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}

.tab-chip[aria-selected="true"] {
  border-color: var(--brand);
  background: var(--brand-wash);
  color: var(--brand-deep);
  font-weight: 600;
}

.tab-chip__close {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: currentColor;
  cursor: pointer;
  opacity: 0.55;
  transition: background var(--dur-feedback) var(--ease-standard),
    opacity var(--dur-feedback) var(--ease-standard);
}

.tab-chip__close:hover {
  background: rgb(0 0 0 / 8%);
  opacity: 1;
}

/* The last tab stays: an empty strip would leave the user nowhere to click. */
.tab-chip__close:disabled {
  cursor: not-allowed;
  opacity: 0.25;
}

.tabbar__tools {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex: 0 0 auto;
}

.tabbar__tools .tool-btn {
  width: 26px;
  height: 26px;
}

/* ---- Mobile drawer ------------------------------------------------------- */
.rail-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 29;
  border: 0;
  background: rgb(16 38 43 / 50%);
}

@media (max-width: 900px) {
  /* Off-canvas, opened by the header button. The desktop collapsed state is
     irrelevant here, so it is reset to a full drawer. */
  .rail {
    width: var(--rail);
    transform: translateX(-100%);
  }

  [data-rail="open"] .rail {
    transform: translateX(0);
    box-shadow: 0 18px 48px rgb(16 38 43 / 32%);
  }

  [data-rail="open"] .rail-scrim {
    display: block;
  }

  [data-rail="collapsed"] .rail {
    width: var(--rail);
  }

  /* The mobile drawer always shows the full frame, so the collapsed rules are
     neutralised regardless of what desktop state was stored. */
  [data-rail] .rail__mark {
    justify-content: flex-start;
    padding: 0 16px;
  }

  [data-rail] .rail__name,
  [data-rail] .nav-group__head span,
  [data-rail] .nav-group__chevron,
  [data-rail] .nav-item span {
    display: initial;
  }

  [data-rail] .nav-group__head {
    justify-content: flex-start;
    height: auto;
    min-height: 32px;
    margin: 0;
    padding: 0 8px;
    background: transparent;
    pointer-events: auto;
  }

  [data-rail] .rail__nav {
    padding: 6px 8px;
  }

  [data-rail] .nav-item {
    justify-content: flex-start;
    padding: 0 9px;
  }

  [data-rail] .rail__toggle svg {
    transform: none;
  }

  .shell,
  [data-rail="collapsed"] .shell {
    margin-left: 0;
  }

  /* The drawer footer toggle would collapse something nobody can see; it
     closes the drawer instead. */
  .rail__foot {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 var(--s-2);
    gap: 4px;
  }

  /* At 390px the header holds a menu button, six icons and a search box; the
     breadcrumb label is the only thing that can go without losing a function. */
  .crumb {
    display: none;
  }

  .topbar__search {
    max-width: none;
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar__search kbd {
    display: none;
  }

  .topbar__search input {
    padding-right: 10px;
  }

  /* A phone keeps the day-to-day controls: notifications, refresh, pause, lock
     and the account entry. Settings and fullscreen are the two that can wait,
     and both remain reachable once the viewport widens. */
  .tool-btn--secondary,
  .tool-divider {
    display: none;
  }

  .tabbar {
    padding: 0 var(--s-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rail,
  .shell,
  .nav-group__chevron,
  .rail__toggle svg {
    transition: none;
  }
}