/*
 * ZeroDrive web app stylesheet. One file, shared by every page: the account app, the checkout return
 * page, the legal pages, Support and the 404 page.
 *
 * The look follows the web app frames of the Claude Design project (templates/web-app, frames 4a to 4j,
 * and its tokens): a near-black window holding separate rounded panes (a toolbar pill, a side column
 * that is a labelled sidebar, a rail or a bottom tab bar, and a content pane) and a floating pill bar.
 * The class names are the ones the page script writes, so they stay as they are.
 *
 * Fixed rules:
 *   - four sizes (12, 16, 24, 44 px) and one weight (400), nothing else. Hierarchy comes from size and
 *     colour, never from bold;
 *   - three font-faces: Schibsted Grotesk in two files served from this site, and the fallback, Arial
 *     resized to the design face's line boxes. No remote address;
 *   - spacing in steps of 4 px (4, 8, 16, 24, 32, 48, 64), with two more values the frames draw: 12 px
 *     (nav icon to label, the nav pane's sides, under a table header) and 40 px (the content pane's
 *     padding from 900 px);
 *   - three animations and no others: zd-spin (the spinner), zd-in (a dialog opening) and zd-fade (its
 *     scrim). All motion goes when the viewer asks for less;
 *   - dark only: no light theme has been designed;
 *   - blue is the focus ring, a switch that is on, a ticked box and the storage bar. It is never a
 *     button, a link or a nav state. Green, amber and red only say a status, beside words;
 *   - the security policy allows no inline style, so every state is a class or an attribute here;
 *   - breakpoints at 600 px (below it: one column and a bottom tab bar; from it: panes, with the side
 *     column as a rail) and 900 px (the labelled sidebar; the head pill folds it to the rail).
 */

/* ---------- Tokens ---------- */

:root {
  color-scheme: dark;

  --zd-content: #0A0A0A;
  --zd-pane: #151515;
  --zd-raised: #1D1D1D;
  --zd-raised-2: #252525;
  --zd-raised-3: #2E2E2E;
  /* A control on the floating plane under the pointer: #2E2E2E with 7% of the text colour over it. */
  --zd-raised-4: #3C3C3D;
  --zd-tile: #F4F5FF;
  --zd-ink: #0A0A0A;

  --zd-text: #F4F5FF;
  --zd-soft: #C9CCE0;
  --zd-muted: #8A90B8;
  --zd-disabled: #52566E;
  --zd-blue: #3D63FF;
  --zd-on-blue: #FFFFFF;
  /* A light button while its request is in flight: a quieter fill, so the dark label stays readable. */
  --zd-busy: #B4B6C4;
  --zd-good: #39FF14;
  --zd-warn: #FFB800;
  --zd-bad: #FF2E63;
  --zd-on-bad: #05060F;
  --zd-bad-rim: rgba(255, 46, 99, 0.5);

  --zd-hairline: rgba(244, 245, 255, 0.08);
  --zd-hairline-strong: rgba(244, 245, 255, 0.14);
  --zd-hover-row: rgba(244, 245, 255, 0.03);
  --zd-hover: rgba(244, 245, 255, 0.07);
  --zd-track: rgba(244, 245, 255, 0.1);
  --zd-fill: rgba(244, 245, 255, 0.05);
  /* The edge of an empty checkbox, a switch that is off: 3:1 or more on every pane. */
  --zd-outline: rgba(244, 245, 255, 0.4);
  --zd-underline: rgba(244, 245, 255, 0.5);
  --zd-rim: inset 0 0 0 1px rgba(244, 245, 255, 0.12), 0 14px 30px -12px rgba(0, 0, 0, 0.8);

  --text-label: 12px;
  --text-body: 16px;
  --text-heading: 24px;
  --text-display: 44px;
  --weight-regular: 400;
  --font-app: "dieGroteskA", "Schibsted Grotesk", "dieGroteskA Fallback", system-ui, sans-serif;
  --font-mono: "abcDiatypeMono", ui-monospace, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.2, 0.715, 0.205, 0.99);

  --radius-control: 999px;
  --radius-pane: 32px;
  --radius-group: 16px;
  --toolbar: 56px;
  --sidebar: 238px;
  --rail: 66px;
  --column: 520px;
  --reading: 680px;
  --gap: 8px;
  --pad-x: 16px;
  --pad-y: 24px;
}

@media (min-width: 600px) {
  :root {
    --radius-pane: 36px;
    --gap: 16px;
    --pad-x: 24px;
    --pad-y: 32px;
  }
}

@media (min-width: 900px) {
  :root {
    --pad-x: 40px;
    --pad-y: 40px;
  }
}

@media (prefers-contrast: more) {
  :root {
    --zd-hairline: rgba(244, 245, 255, 0.24);
    --zd-hairline-strong: rgba(244, 245, 255, 0.4);
    --zd-muted: #C9CCE0;
  }
}

/*
 * The app face: Schibsted Grotesk (SIL Open Font License 1.1, assets/fonts/OFL.txt), the closest free
 * face to the design's dieGroteskA, which is not licensed (owner decision, 2026-11-17). Both files are
 * served from this site, so the security policy stays self-only. One weight (400) is used.
 */
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/assets/fonts/schibsted-grotesk-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/assets/fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/*
 * The fallback face while the app face loads: Arial with its line boxes resized to the design face's.
 * Its source is a font on the computer, and where Arial is missing the text falls to system-ui.
 */
@font-face {
  font-family: "dieGroteskA Fallback";
  src: local("Arial");
  ascent-override: 91.3%;
  descent-override: 19.83%;
  line-gap-override: 0%;
  size-adjust: 101.86%;
}

/* ---------- Spacing tokens of the web app (the Windows app does not use them) ---------- */

:root {
  /*
   * Widths of things, not spacing steps (a name starting --w-): the checkbox (18 px, a 44 px target on a touch
   * screen) and the Sign out pill (136 px). A sum that starts from one of them is measured by the steps that
   * come after it, which is what tests/test-site-static.js checks.
   */
  --w-check: 18px;
  --w-check-touch: 44px;
  --w-signout: 136px;

  /* Where a name starts: the kind icon (20 px) and the gap to the name, 8 px, or 16 px from 600 px. A second line, a mark or a notice under a name lines up here. */
  --entry-indent: calc(20px + 8px);

  /* The tab bar's height: 64 px at rest; a script writes the measured height when the labels wrap. */
  --tabbar-h: 64px;

  /* The visible part of the window while the on-screen keyboard shortens it: drive.js writes them (and sets data-viewport on the root); at rest the dialog ignores them. */
  --zd-viewport-top: 0px;
  --zd-viewport-h: 100dvh;

  /* Where the name starts when the row has a checkbox before the icon: the checkbox, a gap, the icon, a gap. Upload rows and the list's second lines clear it. */
  --row-indent: calc(var(--w-check) + 8px + 20px + 8px);
}

@media (min-width: 600px) {
  :root {
    --entry-indent: calc(20px + 16px);
    --row-indent: calc(var(--w-check) + 16px + 20px + 16px);
  }
}

/* On a touch screen the checkbox is a 44 px target, so a row clears 44 px, not 18. */
@media (pointer: coarse) {
  :root {
    --row-indent: calc(var(--w-check-touch) + 8px + 20px + 8px);
  }
}

@media (pointer: coarse) and (min-width: 600px) {
  :root {
    --row-indent: calc(var(--w-check-touch) + 16px + 20px + 16px);
  }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* A class that sets display must never bring back something the page has hidden. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 16px;
  scroll-padding-bottom: calc(var(--tabbar-h) + 16px); /* the end clearance: the bar's own height (64 px at rest, taller at 200% text) and 16 px of air */
}

/* Shown only when JavaScript is off; as a block it takes the same spacing as any other region. */
noscript {
  display: block;
}

/*
 * The shell: a near-black window holding panes. Below 600 px it is one column: the toolbar pill, the
 * content pane, the footer, and (for a signed-in account) the tab bar fixed at the bottom. From 600 px
 * the section nav is a column of its own on the left. When the nav is hidden it takes no room, which
 * gives the plain page of the legal pages and of a visitor who is not signed in.
 */
body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header"
    "main"
    "footer";
  gap: var(--gap);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: var(--gap);
  background: var(--zd-content);
  color: var(--zd-text);
  font-family: var(--font-app);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  font-synthesis: none;
  line-height: 1.5;
  letter-spacing: 0.02em;
  overflow-wrap: break-word;
}

/*
 * Room for the tab bar, so the footer and the end of a list are never under it. A script writes the bar's
 * measured height to --tabbar-h (it is taller when its labels wrap); 64 px is the bar at rest.
 */
body:has(#app-nav:not([hidden])) {
  padding-bottom: calc(var(--tabbar-h) + 8px + 16px); /* the tab bar, its 8 px offset and 16 px of air */
}

/* While the round Upload button shows (Your files, below 600 px) the clearance holds the button too: its 56 px and the 16 px above the bar and above it. */
@media (max-width: 599px) {
  body:has(#app-nav:not([hidden])):has(.account-app[data-view="drive"] .upload-round:not([hidden])) {
    padding-bottom: calc(var(--tabbar-h) + 8px + 16px + 56px + 16px);
  }
}

/*
 * Below 600 px the search pill stays on screen while the page scrolls: sticky, 8 px from the top, above the
 * content. It sticks inside its container, so with the pill showing the page is a column and not the grid
 * (a grid area is only as tall as its row, and a sticky pill would leave with it). Its 56 px and the 8 px gap
 * are added to the scroll padding, so a focused row is never under it.
 */
@media (max-width: 599px) {
  body:has(#search-bar:not([hidden])) {
    display: flex;
    flex-direction: column;
  }

  body:has(#search-bar:not([hidden])) > main {
    flex: 1 0 auto;
  }

  html:has(#search-bar:not([hidden])) {
    scroll-padding-top: calc(16px + 56px + 8px);
  }

}

h1,
h2,
h3 {
  margin: 0;
  font-weight: var(--weight-regular);
  letter-spacing: 0;
}

/* The page title: Heading below 600 px, Display from 600 px. */
h1 {
  font-size: var(--text-heading);
  line-height: 1.25;
}

h2 {
  font-size: var(--text-heading);
  line-height: 1.25;
}

h3 {
  font-size: var(--text-body);
  line-height: 1.5;
  letter-spacing: 0.02em;
}

p,
ul,
ol {
  margin: 0 0 12px;
}

ul,
ol {
  padding-left: 24px;
}

li + li {
  margin-top: 8px;
}

strong,
b,
th {
  color: var(--zd-text);
  font-weight: var(--weight-regular);
}

/* A link is the text colour, underlined. The underline comes to full strength under the pointer. */
a {
  color: var(--zd-text);
  text-decoration: underline;
  text-decoration-color: var(--zd-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color 160ms;
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 3px solid var(--zd-blue);
  outline-offset: 3px;
}

/* A heading or a notice that the script moves focus to, so a screen reader reads it: a ring set off from the words. */
[tabindex="-1"]:focus-visible {
  outline-offset: 4px;
}

/* The page's title takes focus only so that it is read out. A ring around it would read as a stray box. */
h1[tabindex="-1"]:focus-visible {
  outline-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.label {
  color: var(--zd-muted);
  font-size: var(--text-label);
  line-height: 1.33;
}

/* Words that can wrap are set at the body size, not Label: Label is for one line at 320 px (U-4). */
.body-note {
  color: var(--zd-muted);
  font-size: var(--text-body);
  line-height: 1.5;
}

.icon {
  flex: none;
  width: 16px;
  height: 16px;
}

/* ---------- Toolbar ---------- */

.skip-link {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-control);
  background: var(--zd-blue);
  color: var(--zd-on-blue);
  text-decoration: none;
  transform: translateY(-300%);
}

.skip-link:focus {
  outline-color: var(--zd-on-blue);
  transform: none;
}

/* The toolbar pill: a pane of its own, 56 px high. */
.site-header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--toolbar);
  padding: 0 8px 0 12px;
  border-radius: 28px;
  background: var(--zd-pane);
}

/* The logo sits on its light tile, as in the apps. The image is the real wordmark, never redrawn. */
.brand-mark {
  display: block;
  width: auto;
  height: 32px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--zd-tile);
}

/* In the toolbar the tile is the image's own box, so the link around it can be a taller target on a touch screen. */
.wordmark {
  display: inline-flex;
  flex: none;
  align-items: center;
  border-radius: 8px;
}

.toolbar-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--zd-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-title:empty {
  display: none;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* A link of the toolbar is one line at every width, 320 px included. */
.site-header nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  background: var(--zd-raised);
  color: var(--zd-text);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms;
}

.site-header nav a:hover {
  background: var(--zd-raised-3);
}

/* ---------- Section nav: tab bar, rail or labelled sidebar ---------- */

/*
 * Below 600 px the three entries are a tab bar fixed at the bottom of the window: an icon over a short
 * label, in equal columns. The bar never scrolls. The head pill and the account line are for the wider
 * shells, so they are not drawn here.
 */
.app-nav {
  position: fixed;
  right: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 8px;
  z-index: 6;
  display: flex;
  align-items: stretch;
  min-height: 64px; /* a minimum, so the labels can wrap at 200% text and the bar grows with them */
  padding: 0 8px;
  border-radius: 32px;
  background: var(--zd-pane);
  box-shadow: var(--zd-rim);
}

/*
 * The entries are in a list of their own so that, from 600 px, the list can scroll between the head pill and
 * the account at the foot. In the tab bar the list takes no box: its entries are the bar's columns.
 */
.nav-list {
  display: contents;
}

/* Below 600 px four entries have no tab: Search is the pill above, and the other three are in More. */
.nav-item.nav-no-tab {
  display: none;
}

/* More is a button, drawn as the other tabs are. */
button.nav-item {
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.nav-logo,
.nav-spacer,
.nav-user,
.nav-label {
  display: none;
}

.nav-item {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  border-radius: 24px;
  color: var(--zd-muted);
  font-size: var(--text-label);
  line-height: 1.33;
  text-decoration: none;
  transition:
    background-color 160ms,
    color 160ms;
}

.nav-item .icon {
  width: 20px;
  height: 20px;
}

/* In the tab bar the current entry is told by its ink icon and label; the others are muted. */
.nav-item[aria-current="page"],
.nav-more[aria-current="true"] {
  color: var(--zd-text);
}

.nav-item:hover {
  background: var(--zd-hover);
}

.nav-item:focus-visible {
  outline-offset: -3px;
}

.tab-label,
.nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A tab label may wrap at word boundaries (text at 200%); the bar is as tall as its tallest tab. */
.tab-label {
  overflow: visible;
  text-align: center;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 599px) {
  .nav-item:has(.tab-label) {
    padding: 4px 0;
  }
}

/*
 * 600 px and up: the section nav is a column of two panes: the head pill, and under it the pane of
 * entries with the account at its foot. It is a rail of icons; from 900 px it is the labelled sidebar
 * unless the head pill has folded it (html.nav-rail).
 */
@media (min-width: 600px) {
  body {
    padding-bottom: 8px;
  }

  /* A signed-in account: the nav takes the left column and the window stops scrolling; the content pane scrolls. */
  body:has(#app-nav:not([hidden])) {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "nav header"
      "nav main"
      "nav footer";
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding-bottom: 8px;
  }

  h1 {
    font-size: var(--text-display);
    line-height: 1;
  }

  .site-header {
    gap: 12px;
    padding: 0 8px 0 24px;
  }

  .site-header nav a {
    padding: 0 16px;
  }

  .app-nav {
    position: relative;
    inset: auto;
    grid-area: nav;
    isolation: isolate;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: var(--rail);
    height: auto;
    min-height: 0;
    padding: 0 0 12px;
    border-radius: 0;
    background: none;
    box-shadow: none;
    transition: width 280ms var(--ease-out);
  }

  /* The pane behind the entries: it starts under the head pill and the gap between the two. */
  .app-nav::before {
    position: absolute;
    inset: calc(var(--toolbar) + 16px) 0 0; /* the head pill's height and the 16 px gap between panes */
    z-index: -1;
    border-radius: 33px;
    background: var(--zd-pane);
    content: "";
  }

  /* The head pill: a button that folds the sidebar and opens it again. On the rail it shows the mark on its light tile. */
  .nav-logo {
    display: flex;
    flex: none;
    align-items: center;
    align-self: stretch;
    justify-content: center;
    height: 56px;
    margin: 0 0 16px;
    padding: 0;
    border: 0;
    border-radius: 28px;
    background: var(--zd-pane);
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background-color 160ms;
  }

  .nav-logo:hover {
    background: var(--zd-raised);
  }

  /* Where the window is too narrow for the labelled sidebar there is nothing to fold: the pill is only the logo. */
  .nav-logo:disabled {
    background: var(--zd-pane);
    cursor: default;
  }

  .logo-wordmark {
    display: none;
  }

  .logo-mark {
    display: block;
    width: 32px;
    height: 32px;
    padding: 8px;
    border-radius: 22.4%;
    background: var(--zd-tile);
    object-fit: contain;
  }

  /* A rail item: a 44 px circle with the icon. Its name is its label, kept for assistive technology, and its title. */
  .nav-item {
    flex: none;
    flex-direction: row;
    gap: 12px;
    width: 44px;
    height: 44px;
    border-radius: 22px;
    color: var(--zd-text);
    font-size: var(--text-body);
    line-height: 1.5;
  }

  .nav-item:focus-visible {
    outline-offset: 3px;
  }

  /* The current section is the light pill with dark words, as in the design. */
  .nav-item[aria-current="page"] {
    background: var(--zd-tile);
    color: var(--zd-ink);
  }

  .tab-label,
  .nav-more {
    display: none;
  }

  .nav-item.nav-no-tab {
    display: flex;
  }

  /*
   * The list of entries is its own scroll region between the head pill and the account at the foot: in a
   * window shorter than the list the foot stays and the list scrolls. A focused entry scrolls into view; its
   * ring is drawn inside the entry so the list does not cut it.
   */
  .nav-list {
    position: relative; /* the rail's visually hidden labels are absolute: they belong to the list's scroll box, not the nav's */
    display: flex;
    flex: 0 1 auto;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .nav-list .nav-item:focus-visible {
    outline-offset: -3px;
  }

  .nav-label,
  .nav-user-text {
    position: absolute;
    display: block;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .nav-spacer {
    display: block;
    flex: 1;
  }

  /* The account at the foot of the pane: the email's first letter, and in the labelled sidebar the email over the plan line. */
  .nav-user {
    display: flex;
    flex: none;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: var(--zd-text);
  }

  .nav-avatar {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--zd-raised-2);
    font-size: var(--text-body);
    line-height: 1;
  }

  /* With an email on file the avatar is its first letter; with none it is the person icon. */
  #nav-avatar:empty {
    display: none;
  }

  #nav-avatar:not(:empty) + .icon {
    display: none;
  }

  /* While the section nav shows, it carries the logo, so the toolbar does not repeat it. */
  body:has(#app-nav:not([hidden])) .site-header .wordmark {
    display: none;
  }
}

@media (min-width: 900px) {
  html:not(.nav-rail) .app-nav {
    align-items: stretch;
    gap: 4px;
    width: var(--sidebar);
    padding: 0 12px 16px;
  }

  html:not(.nav-rail) .nav-logo {
    margin: 0 -12px 24px;
  }

  html:not(.nav-rail) .nav-list {
    align-items: stretch;
  }

  /* In the labelled sidebar the logo is the white wordmark, straight on the dark pill. */
  html:not(.nav-rail) .logo-wordmark {
    display: block;
    width: auto;
    height: 24px;
  }

  html:not(.nav-rail) .logo-mark {
    display: none;
  }

  html:not(.nav-rail) .nav-item {
    justify-content: flex-start;
    width: auto;
    padding: 0 16px;
  }

  html:not(.nav-rail) .nav-label,
  html:not(.nav-rail) .nav-user-text {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    clip-path: none;
  }

  html:not(.nav-rail) .nav-user {
    padding: 0 4px;
  }

  html:not(.nav-rail) .nav-user-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    line-height: 1.33;
  }

  /* A long email is cut with an ellipsis; its title holds the whole of it. */
  .nav-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* The plan line wraps: a long plan name must not push the storage figure out of sight. */
  .nav-plan {
    color: var(--zd-muted);
    font-size: var(--text-label);
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

/* ---------- Content pane and footer ---------- */

main {
  grid-area: main;
  width: 100%;
  min-width: 0;
  padding: var(--pad-y) var(--pad-x) 32px;
  border-radius: var(--radius-pane);
  background: var(--zd-pane);
}

main:focus-visible {
  outline-offset: -3px;
}

.site-footer {
  grid-area: footer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding: 4px 16px;
  color: var(--zd-muted);
  font-size: var(--text-label);
  line-height: 1.33;
}

.site-footer a,
.site-footer span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

.site-footer a {
  color: var(--zd-muted);
}

@media (min-width: 600px) {
  /* The pane scrolls, and keeps 64 px of clear room at its foot, so the last row is never under the floating bar. */
  body:has(#app-nav:not([hidden])) main {
    min-height: 0;
    padding-bottom: 64px;
    overflow-y: auto;
    scroll-padding-bottom: calc(64px + 16px);
  }

  .site-footer {
    padding: 0 24px;
  }
}

/* ---------- Buttons and links ---------- */

/* A dark pill, 36 px high. On the floating plane (the bar, a sheet, a notice inside one) it is one step lighter. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--zd-raised);
  color: var(--zd-text);
  font: inherit;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 160ms,
    color 160ms,
    transform 160ms;
}

.btn:active {
  transform: scale(0.98);
}

/* The one main action of a view: the ink pill with dark words. */
.btn-primary {
  background: var(--zd-tile);
  color: var(--zd-ink);
}

/* Hover and press darken the light fill a little; the dark label stays far above 4.5:1. */
.btn-primary:hover {
  filter: brightness(0.94);
}

.btn-primary:active {
  filter: brightness(0.88);
}

/* On a light fill the blue ring would sit too close to the fill, so the ring is the text colour. */
.btn-primary:focus-visible {
  outline-color: var(--zd-text);
}

.btn-secondary:hover {
  background: var(--zd-raised-3);
}

.checkout .btn-secondary,
.capsule .btn-secondary,
.confirm-panel .btn-secondary,
.preview-part .btn-secondary {
  background: var(--zd-raised-3);
}

.checkout .btn-secondary:hover,
.capsule .btn-secondary:hover,
.confirm-panel .btn-secondary:hover,
.preview-part .btn-secondary:hover {
  background: var(--zd-raised-4);
}

/* A destructive action: the red fill with dark words. */
.btn-danger {
  background: var(--zd-bad);
  color: var(--zd-on-bad);
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-danger:focus-visible {
  outline-color: var(--zd-text);
}

/*
 * A busy button. Its label is the progress message ("Opening billing…"), so the words keep their full
 * colour; the fill goes quieter and the pointer says it cannot be pressed again yet.
 */
.btn[aria-disabled="true"],
.btn[aria-disabled="true"]:hover,
.btn[aria-disabled="true"]:active {
  background: var(--zd-fill);
  color: var(--zd-text);
  filter: none;
  opacity: 1;
  transform: none;
  cursor: not-allowed;
}

.btn-primary[aria-disabled="true"],
.btn-primary[aria-disabled="true"]:hover,
.btn-primary[aria-disabled="true"]:active {
  background: var(--zd-busy);
  color: var(--zd-ink);
}

/* The sign-in pill: one dark pill, 48 px high, the full width of its pane. It names no provider and carries no mark. */
.btn-google {
  width: 100%;
  min-height: 48px;
}

/* An action that reads as words: underlined, in the text colour. The destructive one is red. */
.text-action {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 36px;
  white-space: nowrap;
  padding: 0;
  border: 0;
  background: none;
  color: var(--zd-text);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--zd-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: text-decoration-color 160ms;
}

.text-action:hover {
  text-decoration-color: currentColor;
}

.text-action[aria-disabled="true"] {
  color: var(--zd-soft);
  text-decoration: none;
  cursor: not-allowed;
}

/* A name that reads as part of a list: folder and file names, breadcrumb steps. */
.link-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--zd-muted);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color 160ms;
}

.link-button:hover {
  color: var(--zd-text);
}

/* ---------- Status ---------- */

/*
 * A line that says a state: a 6 px dot in the state's colour, then the words. The dot is decoration;
 * the words carry the state. A line with no state (the line under Settings' title) has no dot.
 */
.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.status-line[data-state]::before {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--zd-muted);
  content: "";
}

.status-line[data-state="ok"]::before {
  background: var(--zd-good);
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.6);
}

.status-line[data-state="warn"]::before {
  background: var(--zd-warn);
  box-shadow: 0 0 8px rgba(255, 184, 0, 0.6);
}

.status-line[data-state="error"]::before {
  background: var(--zd-bad);
  box-shadow: 0 0 8px rgba(255, 46, 99, 0.6);
}

/* The plan's state as a chip: an icon in the state's colour, then the words. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--zd-muted);
  font-size: var(--text-label);
  line-height: 1.33;
}

/* The chip holds one icon per variant; only the one for its variant shows. The icon carries the status colour. */
.status-icon {
  display: none;
}

.status-ok .status-icon-ok,
.status-neutral .status-icon-neutral,
.status-warn .status-icon-warn,
.status-error .status-icon-error {
  display: block;
}

.status-icon-ok {
  color: var(--zd-good);
}

.status-icon-neutral {
  color: var(--zd-muted);
}

.status-icon-warn {
  color: var(--zd-warn);
}

.status-icon-error {
  color: var(--zd-bad);
}

/* ---------- Notice and banner ---------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-group);
  background: var(--zd-raised);
  color: var(--zd-soft);
}

.notice p {
  min-width: 0;
  margin: 0;
}

.notice > .icon {
  margin-top: 4px;
  color: var(--zd-muted);
}

.notice-warn > .icon {
  color: var(--zd-warn);
}

.notice-error > .icon {
  color: var(--zd-bad);
}

/* A notice with no icon gets a dot in its status colour. */
.notice:not(:has(> svg))::before {
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--zd-muted);
  content: "";
}

.notice-warn:not(:has(> svg))::before {
  background: var(--zd-warn);
}

.notice-error:not(:has(> svg))::before {
  background: var(--zd-bad);
}

.notice-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.notice .btn-secondary {
  background: var(--zd-raised-3);
}

.notice .btn-secondary:hover {
  background: var(--zd-raised-4);
}

/* ---------- Groups ---------- */

/*
 * A group of rows, as in the frames: a small label over a stronger hairline, then rows with a hairline
 * under each. Nothing is boxed: the content pane is the only surface.
 */
.card > * {
  margin: 0;
}

.card > * + * {
  margin-top: 12px;
}

/* An empty slot takes no room. */
.card > :empty {
  margin-top: 0;
}

.card > h2,
.group-label {
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--zd-hairline-strong);
  color: var(--zd-muted);
  font-size: var(--text-label);
  line-height: 1.33;
  letter-spacing: 0.06em;
}

.plan-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  color: var(--zd-muted);
}

.plan-price strong {
  font-size: var(--text-heading);
  line-height: 1.25;
  letter-spacing: 0;
}

/* ---------- Account app ---------- */

/* One column of regions with an even gap. A hidden or empty region leaves no gap behind. */
.account-app {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.account-app > :where(:not(.sr-only)) {
  width: 100%;
  margin: 0;
}

/* With no view open (the order review, a notice on its own) the content is one narrow column, centred. */
.account-app:not([data-view]) > :where(:not(.sr-only)) {
  max-width: var(--column);
  margin: 0 auto;
}

#flash:empty,
#billing-banner:empty {
  display: none;
}

/*
 * The views of a signed-in account. The script names the view on main; each view hides the other
 * views' regions. Nothing gains or loses the hidden attribute for this, so every state stays as the
 * script set it. The storage block shows in Your files and in Plan and storage only.
 */
.account-app[data-view]:not([data-view="drive"]) > .view-drive,
.account-app[data-view]:not([data-view="search"]) > .view-search,
.account-app[data-view]:not([data-view="links"]) > .view-links,
.account-app[data-view]:not([data-view="shared"]) > .view-shared,
.account-app[data-view]:not([data-view="trash"]) > .view-trash,
.account-app[data-view]:not([data-view="duplicates"]) > .view-duplicates,
.account-app[data-view]:not([data-view="brain"]) > .view-brain,
.account-app[data-view]:not([data-view="connect"]) > .view-connect,
.account-app[data-view]:not([data-view="account"]) > .view-account,
.account-app[data-view]:not([data-view="settings"]) > .view-settings,
.account-app[data-view]:not([data-view="drive"]):not([data-view="account"]) > #storage-card {
  display: none;
}

/*
 * The order on screen follows the frames: the title, the status line and any notice, then the storage
 * block, then the view's own rows. The storage block sits later in the page, so it is ordered here. It
 * holds nothing that takes keyboard focus, so the Tab order still follows the screen.
 */
.account-app > #storage-card {
  order: 1;
}

.account-app > .view-drive,
.account-app > .view-search,
.account-app > .view-links,
.account-app > .view-shared,
.account-app > .view-trash,
.account-app > .view-duplicates,
.account-app > .view-brain,
.account-app > .view-connect,
.account-app > .view-settings,
.account-app > #plan-summary,
.account-app > #choose-plan,
.account-app > #add-storage {
  order: 2;
}

/* The status line, and the one line under the title of Shared with me, sit 8 px under the title. */
.account-app > .title-line,
.account-app > .status-line,
.search > .status-line,
.links > .status-line,
.settings > .status-line {
  margin-top: -16px;
}

#loading p {
  margin: 0;
  color: var(--zd-muted);
}

/*
 * Before an account is on screen (signing in, loading, an account that could not be loaded) the content
 * is one small pane, centred on the ground: the wordmark, the heading, a notice if there is one, a line,
 * and the sign-in pill.
 */
main:has(> #signin-panel:not([hidden]), > #loading:not([hidden]), > #account-error:not([hidden])) {
  align-self: center;
  justify-self: center;
  max-width: 440px;
  padding: 24px;
}

main:has(> #signin-panel:not([hidden]), > #loading:not([hidden]), > #account-error:not([hidden])) > h1 {
  font-size: var(--text-heading);
  line-height: 1.25;
}

/*
 * The white wordmark at the top of the pane, 24 px high: the real logo file from this site, drawn as the
 * pane's first line. It is decoration here: the toolbar already carries the wordmark with its name.
 */
main:has(> #signin-panel:not([hidden]), > #loading:not([hidden]))::before {
  display: block;
  flex: none;
  height: 24px;
  margin-bottom: 16px;
  background: url("/assets/brand/zerodrive-wordmark-white.png") left center / contain no-repeat;
  content: "";
}

/* In the pane the parts sit closer: 32 px under the wordmark, 16 px between the heading, a notice and the line, 24 px over the pill. */
main:has(> #signin-panel:not([hidden]), > #loading:not([hidden]), > #account-error:not([hidden])) {
  gap: 16px;
}

.signin-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.signin-panel > * {
  margin: 0;
}

.signin-panel > p {
  color: var(--zd-muted);
}

.signin-panel > .btn-google {
  margin-top: 8px;
}

/* "Signed in as" and Sign out. Below 600 px Sign out is in Settings, so the bar is not drawn there. */
.signed-in-bar {
  display: none;
}

@media (min-width: 600px) {
  main:has(> #signin-panel:not([hidden]), > #loading:not([hidden]), > #account-error:not([hidden])) {
    padding: 32px;
  }

  /*
   * Sign out sits at the end of the toolbar row in every view, as in the frames. The bar stays where it
   * is in the page for a screen reader; here it is lifted out to the window's corner, and the toolbar
   * pill leaves room for it. From 900 px "Signed in as" shows before it.
   */
  body:has(#signed-in-bar:not([hidden])) .site-header,
  body:has(#signed-in-bar:not([hidden])) .search-bar {
    margin-right: calc(var(--w-signout) + 16px); /* the Sign out pill and a 16 px gap */
  }

  .account-app > #signed-in-bar {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 6;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    width: var(--w-signout);
    max-width: var(--w-signout);
    height: 56px;
    margin: 0;
  }

  #signed-in-bar p {
    display: none;
  }

  #signed-in-bar .btn {
    flex: none;
  }
}

@media (min-width: 900px) {
  /* A third of the window, 460 px at most: room for the caption on a wide window, and for the toolbar pill on a narrow one. */
  body:has(#signed-in-bar:not([hidden])) .site-header,
  body:has(#signed-in-bar:not([hidden])) .search-bar {
    margin-right: calc(min(460px, 34vw) + 16px);
  }

  .account-app > #signed-in-bar {
    width: min(460px, 34vw);
    max-width: none;
  }

  #signed-in-bar p {
    display: block;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---------- Storage: the figure and its bar ---------- */

#storage-card {
  display: flex;
  flex-direction: column;
}

#storage-card > * {
  margin: 0;
}

/* The block's own name is kept for assistive technology; the page's title is the heading a visitor sees. */
#storage-heading,
#files-heading,
#plan-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* "412 GB" in Display, with "of 1 TB used (41%)" beside it on the same baseline. */
#storage-card > .storage-line {
  display: flex;
  order: 1;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  color: var(--zd-muted);
}

.storage-figure {
  color: var(--zd-text);
  font-size: var(--text-display);
  line-height: 1;
  letter-spacing: 0;
}

#storage-card > .meter-row {
  order: 2;
  margin-top: 16px;
}

/* The bar's name is kept for assistive technology; the line above it already says what it shows. */
.meter-row .label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.meter {
  display: block;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 2px;
  background: var(--zd-track);
  color: var(--zd-blue);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}

.meter::-webkit-progress-bar {
  background: transparent;
}

.meter::-webkit-progress-value {
  border-radius: 2px;
  background: var(--zd-blue);
}

.meter::-moz-progress-bar {
  border-radius: 2px;
  background: var(--zd-blue);
}


/* The note under the bar says "Nearly full." or that storage is full. Its dot and the bar take the status colour. */
#storage-card > .storage-note {
  display: flex;
  order: 3;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  color: var(--zd-soft);
}

/* The dot sits beside the first line, also when the note wraps to two. */
.storage-note::before {
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 8px; /* the dot sits beside the first line of a 24 px body line: 9 px snapped down to the step */
  border-radius: 50%;
  background: var(--zd-warn);
  content: "";
}

#storage-card:where(:has(.storage-note:not([hidden]))) .meter {
  color: var(--zd-warn);
}

#storage-card:where(:has(.storage-note:not([hidden]))) .meter::-webkit-progress-value {
  background: var(--zd-warn);
}

#storage-card:where(:has(.storage-note:not([hidden]))) .meter::-moz-progress-bar {
  background: var(--zd-warn);
}

#storage-card.storage-full .storage-note::before {
  background: var(--zd-bad);
}

#storage-card.storage-full .meter {
  color: var(--zd-bad);
}

#storage-card.storage-full .meter::-webkit-progress-value {
  background: var(--zd-bad);
}

#storage-card.storage-full .meter::-moz-progress-bar {
  background: var(--zd-bad);
}

/* ---------- Plan and storage: the plan's rows ---------- */

/*
 * Rows as in frame 4h: a muted label, the value, and an action at the row's end where there is one,
 * under a stronger hairline, with a hairline between rows. Below 600 px a row stacks: label, value,
 * then its action. The actions stay where they are in the page (Manage billing, then the deletion
 * request); the grid places each at the end of its row.
 */
/* The grid is set with no weight from the id, so the rule that hides a view that is not open still wins. */
.view-account:where(#plan-summary) {
  display: grid;
}

#plan-summary {
  grid-template-columns: minmax(0, 1fr);
  border-bottom: 1px solid var(--zd-hairline);
}

#plan-summary > * {
  margin: 0;
}

/* The actions' holder takes no box of its own: its buttons, its notices and the confirmation are placed by the grid. */
#plan-actions {
  display: contents;
}

.plan-row,
#plan-inactive-note {
  grid-column: 1 / -1;
  padding: 12px 4px;
  border-top: 1px solid var(--zd-hairline);
  color: var(--zd-text);
  font-size: var(--text-body);
  line-height: 1.5;
}

.plan-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#plan-summary > :first-child + .plan-row {
  border-top-color: var(--zd-hairline-strong);
}

.row-label {
  color: var(--zd-muted);
}

.row-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

#plan-inactive-note {
  color: var(--zd-soft);
}

/* The plan's state is the line under the page's title. The chip keeps the same words for assistive technology. */
#plan-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The order of the rows, top to bottom. An empty row takes no room. */
.plan-line {
  grid-row: 1;
}

#plan-inactive-note {
  grid-row: 2;
}

/* A running trial takes the renewal row's place: the two never show together. */
#plan-renews,
#plan-trial {
  grid-row: 3;
}

#plan-extra-drives {
  grid-row: 4;
}

#manage-billing-error {
  grid-row: 5;
  grid-column: 1 / -1;
  margin: 16px 0;
}

#plan-billing {
  grid-row: 6;
}

#manage-billing {
  grid-row: 7;
}

#plan-account {
  grid-row: 8;
}

#request-deletion {
  grid-row: 9;
}

#deletion-confirm,
#deletion-notice {
  grid-row: 10;
  grid-column: 1 / -1;
  margin: 16px 0;
}

#manage-billing,
#request-deletion {
  justify-self: start;
  margin: 0 4px 12px;
}

/* Manage billing is the view's one main action: the light pill. */
#manage-billing {
  background: var(--zd-tile);
  color: var(--zd-ink);
}

#manage-billing:hover {
  filter: brightness(0.94);
}

#manage-billing:focus-visible {
  outline-color: var(--zd-text);
}

#manage-billing[aria-disabled="true"] {
  background: var(--zd-busy);
  filter: none;
}

/* The deletion request reads as words, in red: it opens a confirmation and deletes nothing by itself. */
#request-deletion {
  padding: 0;
  background: none;
  color: var(--zd-bad);
  text-decoration: underline;
  text-decoration-color: rgba(255, 46, 99, 0.5);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

#request-deletion:hover {
  opacity: 1;
  text-decoration-color: currentColor;
}

#request-deletion:focus-visible {
  outline-color: var(--zd-blue);
}

/* The hairline between rows does the divider's work. */
.plan-divider {
  display: none;
}

@media (min-width: 600px) {
  /* The label column is 176 px: the first track also holds the row's 4 px of side padding. */
  #plan-summary {
    grid-template-columns: 180px minmax(0, 1fr);
    column-gap: 16px;
  }

  /* A row spans the columns and takes their widths, so every label and value lines up. */
  .plan-row {
    display: grid;
    grid-template-columns: subgrid;
    align-items: center;
    gap: 0 16px;
    min-height: 48px;
    padding: 8px 4px;
  }

  .plan-row > .row-label {
    grid-column: 1;
  }

  .plan-row > .row-value {
    grid-column: 2 / -1;
  }

  /* Up to 899 px a row's action sits under its value, in the value's column. */
  #manage-billing,
  #request-deletion {
    grid-column: 2;
    margin: 0 0 12px;
  }
}

@media (min-width: 900px) {
  /* From 900 px a third column holds the actions, each at the end of its row: Manage billing in Billing, the deletion request in Account. */
  #plan-summary {
    grid-template-columns: 180px minmax(0, 1fr) auto;
  }

  #plan-billing > .row-value,
  #plan-account > .row-value {
    grid-column: 2;
  }

  #manage-billing {
    grid-row: 6;
  }

  #request-deletion {
    grid-row: 8;
  }

  #manage-billing,
  #request-deletion {
    z-index: 1;
    grid-column: 3;
    align-self: center;
    justify-self: end;
    margin: 0 4px 0 0;
  }
}

.plan-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ---------- Settings ---------- */

.settings {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings > * {
  margin: 0;
}

/* The one switch folds the sidebar, so it is offered only where the sidebar can be either: from 900 px. */
.settings-general {
  display: none;
}

/* A row of a group: 48 px high, a hairline under it, the control at its end. */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 0 4px;
  border-bottom: 1px solid var(--zd-hairline);
}

label.setting-row {
  cursor: pointer;
}

.setting-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.settings-group > .field-error {
  margin: 8px 4px 0;
}

/*
 * A switch: a native checkbox drawn 38 by 22 px. Off is a quiet track with an outline; on is blue. The
 * knob is the text colour and moves to the end when the switch is on.
 */
.switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  margin: 0;
  border: 0;
  border-radius: 11px;
  background: rgba(244, 245, 255, 0.16);
  box-shadow: inset 0 0 0 1px var(--zd-outline);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 160ms;
}

.switch::before {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--zd-text);
  content: "";
  transition: transform 160ms;
}

.switch:checked {
  background: var(--zd-blue);
  box-shadow: none;
}

.switch:checked::before {
  transform: translateX(16px);
}

@media (min-width: 900px) {
  .settings-general {
    display: block;
  }
}

/*
 * The Deleting group: two settings, each a fieldset with a question and two chips (the chips are the Share dialog's, 32 px
 * high and 44 on touch, 8 px apart, wrapping), then a muted line for the chosen choice. Under a group's label a muted
 * line says where its settings are saved.
 */
.settings-saved {
  margin: 8px 4px 0;
}

.deleting-settings {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 16px;
}

.delete-setting {
  min-width: 0;
  margin: 0;
  padding: 0 4px;
  border: 0;
}

/* The legend floats so the fieldset lays out as a plain block; each part under it sits 8 px below the one before. */
.delete-setting > legend {
  float: left;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  color: var(--zd-text);
}

.delete-setting > :not(legend) {
  clear: both;
  margin: 8px 0 0;
}

.delete-setting > legend + :not([hidden]) {
  margin-top: 0;
}

/* A line with nothing to say (before the settings are known) takes no room. */
.delete-setting > p:empty {
  display: none;
}

#settings-deleting > #deleting-no-plan,
#settings-deleting > #deleting-read-only {
  margin: 16px 4px 0;
}

#delete-ai-trash-link a {
  color: var(--zd-text);
}

/* ---------- File list ---------- */

/* Picked by its view class, not its id: an id would outweigh the rule that hides a view that is not open. */
.account-app > .view-drive {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

/* The parts of the list sit 16 px apart by the gap; none keeps a margin of its own. The bar's margins are its own, below. */
.view-drive > :where(:not(.capsule)) {
  margin: 0;
}

#files-loading,
#files-inactive,
#files-empty-read-only,
#files-empty-folder {
  color: var(--zd-muted);
}

/* While the list loads: the spinner, then the words that carry the state. */
.files-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The folder path: small and muted, the open folder in the text colour. Steps wrap when they do not fit. */
.breadcrumb {
  color: var(--zd-muted);
  font-size: var(--text-label);
  line-height: 1.33;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 24px;
  margin: 0;
}

.breadcrumb li + li::before {
  content: "/";
}

/* One step: on one line, cut with an ellipsis after 24 characters. Its title holds the whole name. */
.crumb {
  display: inline-block;
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb .link-button {
  min-height: 0;
  line-height: 24px;
  text-decoration: none;
}

.breadcrumb .link-button:focus-visible {
  outline-offset: -3px;
}

.crumb-current {
  color: var(--zd-text);
  line-height: 24px;
}

/* A folder that is not in the drive any more: one line, with its link. */
#files-gone {
  color: var(--zd-muted);
}

/* An empty drive: a heading and a line, centred, with room above and below. No box. */
.empty-state {
  padding: 48px 16px;
  text-align: center;
}

/* The heading of an empty state is the Heading size. */
.empty-state h3 {
  font-size: var(--text-heading);
  line-height: 1.25;
  letter-spacing: 0;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--zd-muted);
}

/*
 * Below 600 px the table is stacked rows: the name on the first line, then size and date under it in
 * the label size. The table roles are set on the elements, so the table keeps its meaning when display changes.
 */
.file-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.file-table,
.file-table tbody,
.file-table tr,
.file-table td {
  display: block;
}

.file-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-table tbody {
  border-top: 1px solid var(--zd-hairline-strong);
}

/*
 * A row is 56 px high or more with its hairline under it (U-5), folders and files alike: a file's name over
 * its size and date is 8 + 24 + 16 + 8 = 56 px before the hairline, and a folder's name alone is held to the
 * same height, centred, so no list shows two row heights. A two-line name grows the row with its text.
 */
.file-table tr {
  padding: 8px 4px;
  border-bottom: 1px solid var(--zd-hairline);
}

@media (max-width: 599px) {
  .file-table tbody tr {
    min-height: calc(56px + 1px);
  }
}

.file-table td {
  padding: 0;
}

.file-table .cell-size,
.file-table .cell-modified {
  display: inline;
  color: var(--zd-muted);
  font-size: var(--text-label);
  line-height: 1.33;
}

/* The second line starts under the name, past the icon and its gap. */
.file-table .row-file .cell-size {
  padding-left: var(--entry-indent);
}

.file-table .cell-modified::before {
  content: " \00B7  ";
}

.file-table .row-folder .cell-size,
.file-table .row-folder .cell-modified {
  display: none;
}

.entry {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 24px;
  color: var(--zd-text);
}

.link-button.entry {
  width: 100%;
  color: var(--zd-text);
}

.entry .icon {
  width: 20px;
  height: 20px;
  color: var(--zd-muted);
}

/* On a narrow screen a long name wraps and is never cut short. */
.entry-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

/*
 * A row that can be ticked and acted on (frames 4a and 4b). In the page a row holds the checkbox, the
 * kind icon, the name, its cells and its actions, in that order. Below 600 px it is a small grid: the
 * name's line with the actions at its end, and the size and the date on a second line under the name.
 */
.file-table tr {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.file-table .cell-name {
  grid-row: 1;
  grid-column: 1 / 3;
}

.file-table .cell-size {
  grid-row: 2;
  grid-column: 1;
}

.file-table .cell-modified {
  grid-row: 2;
  grid-column: 2;
}

/* The dot between the size and the date keeps the space on each side of it. */
.file-table .cell-modified::before {
  white-space: pre;
}

.file-table .cell-actions {
  display: flex;
  grid-row: 1 / 3;
  grid-column: 3;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
}

/* A cell with no action in it takes no room. */
.file-table .cell-actions:empty {
  display: none;
}

/* The name's line: the checkbox, then the name. */
.row-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.row-name .link-button.entry {
  flex: 1;
  width: auto;
}

/* With a checkbox before the name, the second line starts past the checkbox too. */
.file-table .row-file:has(.row-select) .cell-size {
  padding-left: var(--row-indent);
}

/*
 * The checkbox: 18 px, hidden until its row is under the pointer, holds keyboard focus or is ticked, or
 * any row is ticked. Its label is the target. A ticked box is blue, one of the few places blue is used.
 */
.row-select {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  cursor: pointer;
  transition: opacity 160ms;
}

.row-check,
.head-check {
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--zd-outline);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 160ms;
}

.row-check:checked,
.head-check:checked {
  border-color: var(--zd-blue);
  background: var(--zd-blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4l3 3 6-6.6' fill='none' stroke='%2305060F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}

/* Inside a row the ring is the text colour. */
.row-check:focus-visible,
.head-check:focus-visible {
  outline: 3px solid var(--zd-text);
  outline-offset: 2px;
}

/*
 * The header checkbox (Select all, plan 07-16): it sits before the word Name where a row's checkbox sits before its name, shows on
 * the same terms (header hover, focus in the header, any row ticked; a coarse pointer always, in the rules below), and when some
 * rows are ticked it is mixed: the blue box with a dash. In forced colours the dash is CanvasText, not a colour.
 */
.head-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.head-select[hidden] {
  display: none;
}

.head-check:indeterminate {
  border-color: var(--zd-blue);
  background: var(--zd-blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' fill='none' stroke='%2305060F' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}

/* Below 600 px the header row is hidden; the Select all box shows in it while it has focus, while any row is ticked, and always on a screen with no pointer to rest on it. */
@media (max-width: 599px) {
  .file-table thead:focus-within,
  .file-table.has-selection thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }

  .file-table thead:focus-within th:not(:first-child),
  .file-table.has-selection thead th:not(:first-child) {
    display: none;
  }

  .file-table thead:focus-within th,
  .file-table.has-selection thead th {
    display: block;
    padding: 4px 4px 0;
    text-align: start;
  }
}

@media (max-width: 599px) and (hover: none), (max-width: 599px) and (pointer: coarse) {
  .file-table thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }

  .file-table thead th:not(:first-child) {
    display: none;
  }

  .file-table thead th {
    display: block;
    padding: 4px 4px 0;
    text-align: start;
  }

  .file-table thead tr {
    display: block;
    padding: 0;
    border-bottom: 0;
  }
}

/*
 * A row's own buttons, and the More button beside the page's title: 32 px, an icon alone, muted until
 * the pointer is on them. A row's buttons show with its checkbox.
 */
.row-action,
.title-more {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--zd-muted);
  cursor: pointer;
  transition:
    background-color 160ms,
    color 160ms,
    opacity 160ms;
}

.row-action {
  opacity: 0;
}

.row-action .icon,
.title-more .icon {
  width: 20px;
  height: 20px;
}

.row-action:hover,
.title-more:hover {
  background: var(--zd-hover);
  color: var(--zd-text);
}

.row-action:focus-visible,
.title-more:focus-visible {
  outline: 3px solid var(--zd-text);
  outline-offset: -3px;
}

/* More stays in view while its menu is open, also when the pointer has left the row. */
.file-table .row-action[aria-expanded="true"] {
  opacity: 1;
}

/*
 * Below 600 px there is no floating bar, so Refresh files and New folder are in a More button at the end
 * of the title's line. It follows the title in the page and is pulled up onto its line: the 24 px gap
 * between regions and its own 32 px.
 */
.account-app > .title-actions {
  position: relative;
  display: none;
  order: 0;
  flex-direction: row;
  gap: 0;
  align-self: flex-end;
  width: auto;
  margin-top: calc(var(--toolbar) * -1); /* lifted up by the toolbar's height */
}

@media (max-width: 599px) {
  .account-app > .title-actions {
    display: flex;
  }
}

/* ---------- The More menu ---------- */

/*
 * A menu opens beside its button, under the button's end, on the floating plane: the raised fill, the
 * rim, 12 px corners. It flips up when there is no room below. Items are 40 px high with a 16 px icon.
 */
.row-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}

.menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 9;
  min-width: 200px;
  margin: 0;
  padding: 4px;
  border-radius: 12px;
  background: var(--zd-raised);
  box-shadow: var(--zd-rim);
  text-align: left;
  white-space: nowrap;
}

.menu-up {
  top: auto;
  bottom: calc(100% + 4px);
}

/*
 * The right-click menu (plan 07-17): the same menu, in the window instead of beside a button. The page measures it from this first
 * place at the window's corner and sets its left and top from the pointer. It holds focus itself after a pointer opened it, so its
 * items carry the ring and the menu itself none.
 */
.context-menu {
  position: fixed;
  top: 0;
  right: auto;
  bottom: auto;
  left: 0;
}

.context-menu:focus-visible {
  outline-color: transparent;
}

@media (pointer: coarse) {
  .context-menu .menu-item {
    min-height: 48px;
  }
}

/* The More tab's menu opens upward from the bar at the foot of the window, 48 px items. */
.more-menu {
  top: auto;
  right: 8px;
  bottom: calc(100% + 8px);
}

.more-menu .menu-item {
  min-height: 48px;
  text-decoration: none;
}

/* While the menu is open the bar is above the round Upload button (z-index 6), so the menu is never under it. */
.app-nav:has(.more-menu) {
  z-index: 7;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 0 16px 0 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--zd-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--zd-hover);
}

/* On the floating plane the ring is the text colour, drawn inside the item. */
.menu-item:focus-visible {
  outline: 3px solid var(--zd-text);
  outline-offset: -3px;
}

.menu-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
  color: var(--zd-muted);
}

.menu-rule {
  height: 1px;
  margin: 4px 0;
  background: var(--zd-hairline-strong);
}

/* Delete is red. Red words keep their contrast only on the plain fill, so the pointer underlines them and adds no fill. */
.menu-danger,
.menu-danger .menu-icon {
  color: var(--zd-bad);
}

.menu-danger:hover,
.menu-danger:focus-visible {
  background: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.file-table tr:hover .row-select,
.file-table tr:focus-within .row-select,
.file-table .row-selected .row-select,
.file-table.has-selection .row-select,
.file-table tr:hover .row-action,
.file-table tr:focus-within .row-action,
.file-table .row-selected .row-action {
  opacity: 1;
}

/* A ticked row: a fill one step stronger than the pointer's, and its blue box. */
.file-table .row-selected {
  background: var(--zd-hover);
}

/*
 * Drag to move (plan 07-17): the one folder row or earlier crumb a dragged row would land in is a blue tint with a 3 px ring drawn
 * inside it. The drag image is a 32 px pill on the raised plane, kept off the screen; the browser draws it under the pointer.
 */
.file-table tr.drop-target,
.crumb.drop-target {
  background: rgba(61, 99, 255, 0.16);
  outline: 3px solid var(--zd-blue);
  outline-offset: -3px;
}

/* A crumb is a line of text: while it is the target it gets 8 px of room inside the ring, taken back with the same margin so nothing moves. */
.crumb.drop-target {
  margin: 0 -8px;
  padding: 0 8px;
  border-radius: 8px;
}

.drag-pill {
  position: fixed;
  top: 0;
  left: 0;
  transform: translateY(-100%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 16px;
  border-radius: 16px;
  background: var(--zd-raised-3);
  color: var(--zd-text);
  white-space: nowrap;
}

/* In forced colours the target is a 3 px Highlight outline with no tint. */
@media (forced-colors: active) {
  .file-table tr.drop-target,
  .crumb.drop-target {
    background: none;
    outline: 3px solid Highlight;
    outline-offset: -3px;
  }
}

/* ---------- The floating bar ---------- */

/*
 * One pill at the foot of the list: the plan line with its dot, Refresh files, and while there is more
 * to load the count and Load more. From 600 px it floats at the bottom centre of the content pane, 16 px
 * up. Below 600 px it rests at the end of the list, clear of the tab bar.
 */
.capsule {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
  margin: 8px 0 0;
  padding: 4px;
  border-radius: 24px;
  background: var(--zd-raised);
  box-shadow: var(--zd-rim);
}

.capsule > * {
  margin: 0;
}

/*
 * The bar has two contents and never shows both: its usual parts, or the selection's. Each set is a
 * holder that takes no box of its own, so its parts sit in the bar as before.
 */
.bar-set {
  display: contents;
}

.bar-set > * {
  margin: 0;
}

/* With nothing in it (no plan line, no count, no button) the bar is not drawn. */
.capsule:not(:has(> .bar-set:not([hidden]) > :not([hidden]))) {
  display: none;
}

/* The plan line, with its dot: green while the drive is switched on, amber when it is not. Shown from 900 px. */
.bar-plan {
  display: none;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 4px 0 16px;
  overflow-wrap: anywhere;
}

.bar-plan::before {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--zd-warn);
  box-shadow: 0 0 8px rgba(255, 184, 0, 0.6);
  content: "";
}

.bar-plan[data-state="on"]::before {
  background: var(--zd-good);
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.6);
}

/* Refresh files reads as words in the bar, as in the frame. */
.capsule #files-refresh {
  background: none;
}

.capsule #files-refresh:hover {
  background: var(--zd-hover);
}

/* Load more is the bar's main action: the light pill, 40 px high inside the 48 px bar. */
.capsule #files-more {
  min-height: 40px;
  background: var(--zd-tile);
  color: var(--zd-ink);
}

.capsule #files-more[aria-disabled="true"] {
  background: var(--zd-busy);
}

.capsule .files-count {
  padding: 0 12px 0 16px;
  color: var(--zd-text);
  font-size: var(--text-body);
  line-height: 1.5;
}

/* The selection bar: "{n} selected", a hairline, the actions for what is ticked, then the button that clears it. */
.selection-count {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 0 16px;
  white-space: nowrap;
}

.selection-count::after {
  flex: none;
  width: 1px;
  height: 16px;
  margin-left: 8px;
  background: var(--zd-hairline-strong);
  content: "";
}

/* An action of the selection bar reads as words, like Refresh files. Below 600 px it is its icon. */
.capsule .bar-action {
  background: none;
}

.capsule .bar-action:hover {
  background: var(--zd-hover);
}

.bar-action .icon,
.bar-action-icon {
  display: none;
}

/* New folder reads as words in the bar, like Refresh files. */
.capsule #new-folder {
  background: none;
}

.capsule #new-folder:hover {
  background: var(--zd-hover);
}

/* The hairline that sets Delete apart from the other actions. */
.bar-divider {
  flex: none;
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: var(--zd-hairline-strong);
}

/* Delete is red. Red words keep their contrast only on the bar's own fill, so the pointer underlines them and adds no fill. */
.capsule .bar-action-danger {
  color: var(--zd-bad);
}

.capsule .bar-action-danger:hover {
  background: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* From 600 to 899 px the plan line is not drawn, so a bar that holds nothing else is not drawn either. */
@media (max-width: 899px) {
  .capsule:not(:has(> .bar-set:not([hidden]) > :not([hidden]):not(.bar-plan))) {
    display: none;
  }
}

.bar-clear {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--zd-muted);
  cursor: pointer;
  transition:
    background-color 160ms,
    color 160ms;
}

.bar-clear:hover {
  background: var(--zd-hover);
  color: var(--zd-text);
}

/*
 * Below 600 px the selection bar takes the tab bar's place until the selection is cleared: the same
 * pill, fixed at the foot of the window, with its actions as icons that keep their names.
 */
@media (max-width: 599px) {
  .account-app[data-view="drive"] .capsule:has(> #bar-selection:not([hidden])),
  .account-app[data-view="trash"] .capsule:has(> #trash-bar-selection:not([hidden])) {
    position: fixed;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    z-index: 7;
    flex-wrap: nowrap;
    justify-content: flex-start;
    min-height: 64px;
    margin: 0;
    padding: 0 8px;
    border-radius: 32px;
  }

  body:has(.account-app[data-view="drive"] #bar-selection:not([hidden])) .app-nav,
  body:has(.account-app[data-view="trash"] #trash-bar-selection:not([hidden])) .app-nav {
    visibility: hidden;
  }

  /*
   * The count gives way before a button does: a bar that holds Share, Download as zip, Move, Delete and Clear is wider than a
   * 320 px window, and a button pushed out of the pill cannot be pressed. The buttons touch (their 44 px boxes keep the icons
   * apart) and the hairline loses its margins; the count has 8 px on its left and is cut with an ellipsis if there is still not
   * room (its whole text is read by a screen reader).
   */
  .account-app[data-view="drive"] .capsule:has(> #bar-selection:not([hidden])) {
    gap: 0;
  }

  .capsule .bar-divider {
    margin: 0;
  }

  .selection-count {
    display: block;
    flex: 1 1 0;
    min-width: 0;
    padding: 0 0 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .selection-count::after {
    display: none;
  }

  .capsule .bar-action {
    flex: none;
    width: 44px;
    min-height: 44px;
    padding: 0;
  }

  .bar-action .icon {
    display: block;
    width: 20px;
    height: 20px;
  }

  .bar-action-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  /* Move is two icons side by side, so its button is wider. */
  .capsule #selection-move {
    width: 56px;
  }

  /* Refresh files and New folder are in the More button beside the title here, so the bar holds only the count and Load more. */
  .capsule #files-refresh,
  .capsule #new-folder {
    display: none;
  }

  .capsule:not(:has(> :is(#bar-selection, #trash-bar-selection):not([hidden]))):not(:has(#files-count:not([hidden]), #files-more:not([hidden]), #links-bar-count:not([hidden]), #links-more:not([hidden]), #trash-bar-count:not([hidden]), #trash-more:not([hidden]), #duplicates-shown:not([hidden]), #duplicates-more:not([hidden]), #duplicates-bar-count:not([hidden]), #duplicates-remove:not([hidden]), #shared-bar-count:not([hidden]), #shared-more:not([hidden]), #shared-folder-bar-count:not([hidden]), #shared-folder-more:not([hidden]))) {
    display: none;
  }

  .bar-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .bar-clear {
    width: 44px;
    height: 44px;
  }
}

/* ---------- The toast ---------- */

/*
 * One toast at a time, for routine success: the light fill with dark words, at the bottom centre of the
 * content pane, 16 px above the floating bar or the tab bar. Two lines at most, 480 px wide at most.
 * The holder lets a press through; only the toast itself is under the pointer.
 */
.toast-region {
  position: fixed;
  right: 16px;
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + 80px);
  left: 16px;
  z-index: 8;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

/* The room around the words is a border in the fill's colour: padding would show half of a third line. */
.toast {
  display: -webkit-box;
  max-width: 480px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: solid var(--zd-tile);
  border-width: 12px 16px;
  border-radius: 12px;
  background: var(--zd-tile);
  color: var(--zd-ink);
  overflow-wrap: anywhere;
  pointer-events: auto;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  animation: zd-fade 200ms cubic-bezier(0.2, 0.715, 0.205, 0.99);
}

@media (min-width: 600px) {
  .toast-region {
    bottom: calc(80px + 80px); /* above the floating bar and its end clearance; snapped up from 128 px to the nearest declared value, 160 px */
    left: calc(var(--rail) + 32px);
  }
}

@media (min-width: 900px) {
  html:not(.nav-rail) .toast-region {
    left: calc(var(--sidebar) + 32px);
  }
}

/*
 * The Undo toast (plan 07-12): the same toast with its words and one text action at the end (Body, underlined, 4 px offset).
 * The words are not cut (see .toast-words); the toast itself lets the action's focus ring show. On a touch screen the action is a
 * 44 by 44 px target and the toast's own edge gives back the room it takes.
 */
.toast.toast-has-action {
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: visible;
}

/* The words are never cut: a name is already cut in the middle at 40 characters, so the longest toast (a shared item) is three lines on a phone, and its sentence about the link is always read in full. */
.toast-words {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-action {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--zd-ink);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.toast-action[aria-disabled="true"] {
  cursor: progress;
  text-decoration: none;
}

@media (pointer: coarse) {
  .toast.toast-has-action {
    border-width: 4px 16px;
  }

  .toast-action {
    min-width: 44px;
    min-height: 44px;
  }
}

/* A row that is on its way to Trash stays on screen, muted, until the API says it is moved. */
.file-table .row-moving .entry-name,
.file-table .row-moving .cell-size,
.file-table .row-moving .cell-modified {
  color: var(--zd-muted);
}

/* The files notice is the Trash notice's twin: one message above the table, then its text action. */
#files-notice .notice-body {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 4px 16px;
}

#files-notice .notice-body p {
  margin: 0;
}

/* The second line of a zip refusal (plan 07-15) is a line of its own; Try again and Hide message follow it. */
#files-notice #files-notice-detail {
  flex-basis: 100%;
}

/* A folder's zip control and the bar's, while its zip is being checked: in view, muted, and saying so by the cursor. */
.file-table .row-zip.is-working {
  opacity: 1;
}

.file-table .row-zip[aria-disabled="true"],
#selection-zip[aria-disabled="true"] {
  cursor: progress;
}

/* ---------- Buying: plan chooser, extra drives, order review ---------- */

/* Rows of "Choose a plan" and "Add storage": name and price, one fact line, then the button. */
.offer-list {
  padding: 0;
  list-style: none;
}

.card > .offer-list {
  margin-top: 0;
}

.offer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 56px;
  margin: 0;
  padding: 8px 4px;
  border-bottom: 1px solid var(--zd-hairline);
}

.offer-text {
  flex: 1 1 176px;
  min-width: 0;
}

.offer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
}

.offer-row h3,
.offer-row p {
  margin: 0;
  overflow-wrap: anywhere;
}

.offer-row .btn {
  flex: none;
}

/* Monthly / Yearly above the plan rows: one capsule with two options, the chosen one the light pill. */
.billing-switch {
  display: inline-flex;
  gap: 4px;
  width: fit-content;
  padding: 4px;
  border-radius: var(--radius-control);
  background: var(--zd-raised);
}

.billing-option {
  min-height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--zd-soft);
  font: inherit;
  cursor: pointer;
  transition:
    background-color 160ms,
    color 160ms;
}

.billing-option:hover {
  color: var(--zd-text);
}

.billing-option[aria-pressed="true"] {
  background: var(--zd-tile);
  color: var(--zd-ink);
}

.billing-option[aria-pressed="true"]:focus-visible {
  outline-color: var(--zd-text);
}

/* A plan's price per month reads in the text colour; the amount billed sits beneath. */
.billing-switch ~ .offer-list .offer-price {
  color: var(--zd-text);
  font-size: var(--text-body);
  line-height: 1.5;
}

/* The order review: a sheet in the page, one column, top to bottom. It is part of the page, not laid over it. */
.checkout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: 22px;
  background: var(--zd-raised);
  box-shadow: var(--zd-rim);
  color: var(--zd-soft);
}

.checkout > * {
  margin: 0;
}

.order-summary {
  padding: 0 0 16px;
  border-bottom: 1px solid var(--zd-hairline-strong);
  font-variant-numeric: tabular-nums;
}

.order-summary > * + * {
  margin-top: 4px;
}

.order-summary > h2 {
  padding-bottom: 0;
  border-bottom: 0;
  color: var(--zd-text);
  font-size: var(--text-heading);
  line-height: 1.25;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.order-account {
  overflow-wrap: anywhere;
}

/* A label that wraps a checkbox and its text. The whole row is the target. */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 32px;
  padding: 4px 0;
  color: var(--zd-text);
  cursor: pointer;
}

.checkbox-row input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: calc((1lh - 18px) / 2) 0 0; /* optical exception A (3 px): the 18 px box centred on a 24 px line */
  line-height: 24px; /* one line of the row's text, so 1lh above is that line */
  border: 1px solid var(--zd-outline);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 160ms;
}

.checkbox-row input:checked {
  border-color: var(--zd-blue);
  background: var(--zd-blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4l3 3 6-6.6' fill='none' stroke='%2305060F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}

.checkbox-row input[aria-invalid="true"] {
  border-color: var(--zd-bad);
}

/* The error's icon is red; its words stay in the text colour so they can be read. */
.field-error {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--zd-text);
}

.field-error .icon {
  color: var(--zd-bad);
}

/* A row of buttons: the end of a billing banner, the plan card's actions, the confirm panel, the return page. */
.checkout-actions,
.banner-actions,
.plan-actions,
.confirm-actions,
.return-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* The order review's buttons are stacked and full width, the main one first. */
.checkout-actions {
  flex-direction: column;
  margin-top: 8px;
}

/* A notice body lines its children up at the start; the banner's button row takes the full width. */
.banner-actions {
  align-self: stretch;
}

/* A confirmation that opens in place, inside a group: part of the page, with nothing laid over it.
   The danger variant is the account deletion request. */
.confirm-panel {
  flex: 1 0 100%;
  min-width: 0;
  padding: 16px;
  border-radius: var(--radius-group);
  background: var(--zd-raised);
  color: var(--zd-soft);
}

.confirm-panel-danger {
  box-shadow: inset 0 0 0 1px var(--zd-bad-rim);
}

.confirm-panel > * {
  margin: 0;
}

.confirm-panel > * + * {
  margin-top: 12px;
}

/* The checkout return page: one state at a time, each in a note box, with its buttons at the end. */
.return-state {
  padding: 16px;
  border-radius: var(--radius-group);
  background: var(--zd-raised);
  color: var(--zd-soft);
}

.return-state > * {
  margin: 0;
}

.return-state > * + * {
  margin-top: 12px;
}

.return-state > :empty {
  display: none;
}

.return-state > .notice {
  padding: 0;
  background: none;
}

.return-state > .return-actions {
  margin-top: 16px;
}

/* The desktop app prompt after a new plan: a short block inside the confirmation, its buttons stacked on a phone. */
.return-app > * {
  margin: 0;
}

.return-app > * + * {
  margin-top: 12px;
}

.return-app h2 {
  font-size: 16px;
  color: var(--zd-text);
}

.return-app .return-actions {
  margin-top: 16px;
}

.return-app .btn {
  min-height: 44px;
}

.return-state .btn-secondary {
  background: var(--zd-raised-3);
}

.return-state .btn-secondary:hover {
  background: var(--zd-raised-4);
}

/* ---------- Long-form pages (Terms, Privacy, Refund Policy, Support, 404) ---------- */

/* Put long-form on the main element: one reading column inside the pane. */
.long-form {
  color: var(--zd-soft);
  line-height: 1.5;
}

.long-form > * {
  max-width: var(--reading);
  margin-right: auto;
  margin-left: auto;
}

.long-form h1,
.long-form h2,
.long-form h3 {
  color: var(--zd-text);
}

.long-form h1 {
  margin-bottom: 16px;
}

.long-form h2 {
  margin-top: 32px;
  margin-bottom: 8px;
}

.long-form h3 {
  margin-top: 16px;
  margin-bottom: 8px;
}

/* The "On this page" list of in-page links: a grouped list with a hairline between rows. */
.on-this-page {
  margin-bottom: 32px;
  padding: 12px 16px 4px;
  border-radius: var(--radius-group);
  background: var(--zd-raised);
}

.on-this-page p {
  margin: 0 0 4px;
}

.on-this-page ul,
.on-this-page ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.on-this-page li {
  margin: 0;
  border-top: 1px solid var(--zd-hairline);
}

.on-this-page a {
  display: flex;
  align-items: center;
  min-height: 36px;
  text-decoration: none;
}

.on-this-page a:hover {
  text-decoration: underline;
}

/* Tables inside a long-form page (the Termly privacy policy has three): scroll sideways on a small screen. */
.long-form .table-wrap {
  overflow-x: auto;
  margin: 16px auto;
}

.long-form table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-label);
}

.long-form th,
.long-form td {
  padding: 8px 12px 8px 0;
  border-top: 1px solid var(--zd-hairline);
  text-align: left;
  vertical-align: top;
}

.long-form th {
  color: var(--zd-text);
  font-weight: 400;
}

.long-form ul,
.long-form ol {
  padding-left: 24px;
}

/* A heading reached from a link gets a little air above it. */
[id] {
  scroll-margin-top: 8px;
}

/* ---------- 600 px and up: the file list is a table, and the bar floats ---------- */

@media (min-width: 600px) {
  .file-table {
    display: table;
    table-layout: fixed;
  }

  .file-table thead {
    position: static;
    display: table-header-group;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }

  .file-table tbody {
    display: table-row-group;
    border-top: 0;
  }

  .file-table tr,
  .file-table .row-folder {
    display: table-row;
    padding: 0;
    border-bottom: 0;
  }

  /* A row is 48 px high with a hairline under it, 16 px between cells and 4 px at its sides. */
  .file-table th,
  .file-table td,
  .file-table .cell-size,
  .file-table .cell-modified,
  .file-table .row-file .cell-size,
  .file-table .row-folder .cell-size,
  .file-table .row-folder .cell-modified {
    display: table-cell;
    height: 48px;
    padding: 0 16px 0 0;
    border-bottom: 1px solid var(--zd-hairline);
    font-size: var(--text-body);
    line-height: 1.5;
    vertical-align: middle;
  }

  /* The header: small, muted, widely spaced, over the stronger hairline. */
  .file-table th {
    height: auto;
    padding: 16px 16px 12px 0;
    border-bottom: 1px solid var(--zd-hairline-strong);
    color: var(--zd-muted);
    font-size: var(--text-label);
    line-height: 1.33;
    letter-spacing: 0.06em;
  }

  .file-table th:first-child,
  .file-table .cell-name {
    padding-left: 4px;
  }

  .file-table th:last-child,
  .file-table td:last-child {
    padding-right: 4px;
  }

  .file-table th:nth-child(2),
  .file-table th:nth-child(3),
  .file-table th:nth-child(4),
  .file-table .cell-size,
  .file-table .cell-modified {
    color: var(--zd-muted);
    white-space: nowrap;
  }

  .file-table th:nth-child(3) {
    width: 88px;
  }

  .file-table th:nth-child(4) {
    width: 108px;
  }

  .file-table .cell-modified::before {
    content: none;
  }

  .entry {
    gap: 16px;
    min-height: 32px;
  }

  /* Hover fills the whole row as one block, as in a file window. */
  .file-table tbody tr:hover > td {
    background: var(--zd-hover-row);
  }

  /* Keyboard focus on a name rings the whole row, inside it, in the text colour. A browser without :has() keeps the ring on the name. */
  @supports selector(:has(*)) {
    .file-table tbody tr:has(.link-button:focus-visible) {
      outline: 3px solid var(--zd-text);
      outline-offset: -3px;
    }

    .file-table .link-button.entry:focus-visible {
      outline-color: transparent;
    }
  }

  /* In the table a name stays on one line and is cut with an ellipsis, as in a file window; its title holds the whole name. */
  .entry-name {
    overflow: hidden;
    overflow-wrap: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /*
   * The bar floats 16 px above the pane's foot. The pane keeps 64 px clear under its content, which is
   * the bar's height and its 16 px: the bar hangs 48 px into that room, so at the end of a long list it
   * rests under the last row and not over it, and a file's name can always be pressed.
   */
  .capsule {
    position: sticky;
    bottom: -48px;
    z-index: 2;
    width: fit-content;
    max-width: 100%;
    margin-right: auto;
    margin-bottom: -48px;
    margin-left: auto;
  }

  body:has(#app-nav:not([hidden])) .account-app[data-view="drive"] > #files-card {
    flex: 1 0 auto;
  }

  body:has(#app-nav:not([hidden])) .account-app[data-view="drive"] > #files-card > .capsule {
    margin-top: auto;
  }

  .checkout {
    padding: 32px;
  }
}

/*
 * From 600 px the row's actions are the table's last column, 96 px wide, with no heading text. The date
 * column makes room for the 16 px between cells now that it is not the last one.
 */
@media (min-width: 600px) {
  .file-table .cell-actions,
  .file-table .cell-actions:empty {
    display: table-cell;
    text-align: right;
  }

  .file-table .col-actions {
    width: 100px;
  }

  .file-table th:nth-child(4) {
    width: 120px;
  }

  .file-table .row-file:has(.row-select) .cell-size {
    padding: 0 16px 0 0;
  }

  .row-name {
    gap: 16px;
  }

}

/*
 * From 600 to 899 px, beside the rail, the pane can be too narrow for every column and a name that can
 * be read (at 600 px a name would get about 60 px), so the date column is left out there. A file's date
 * is still in its preview. The page keeps its two breakpoints: this is the range between them.
 */
@media (min-width: 600px) and (max-width: 899px) {
  .file-table th:nth-child(4),
  .file-table .row-file .cell-modified,
  .file-table .row-folder .cell-modified {
    display: none;
  }
}

/* From 900 px the bar starts with the plan line, then a hairline, then its actions. */
@media (min-width: 900px) {
  .bar-plan {
    display: flex;
  }

  .bar-plan::after {
    flex: none;
    width: 1px;
    height: 16px;
    margin-left: 8px;
    background: var(--zd-hairline-strong);
    content: "";
  }
}

/* In a very short window the bar would cover most of the list, so it rests at the list's end instead of floating. */
@media (max-height: 520px) {
  .capsule {
    position: static;
  }
}

/* ---------- File preview ---------- */

/*
 * One modal dialog, opened by a press on a file's name. Below 600 px it is the whole window; from 600 px
 * it fills the window less a 16 px margin, 1280 px wide at most. A closed dialog is not displayed: the
 * layout below applies only while it is open.
 */
.preview-dialog {
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--zd-pane);
  box-shadow: var(--zd-rim);
  color: var(--zd-text);
}

.preview-dialog[open] {
  display: flex;
  animation: zd-in 200ms cubic-bezier(0.2, 0.715, 0.205, 0.99);
}

.preview-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  animation: zd-fade 200ms cubic-bezier(0.2, 0.715, 0.205, 0.99);
}

.preview-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 16px;
}

.preview-kind {
  display: inline-flex;
  flex: none;
  color: var(--zd-muted);
}

.preview-kind .icon {
  width: 20px;
  height: 20px;
}

.preview-title {
  flex: 1;
  min-width: 0;
}

/* One line, cut with an ellipsis; the whole name is in the title attribute, as text. */
.preview-name {
  margin: 0;
  overflow: hidden;
  font-size: var(--text-body);
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-meta {
  margin: 0;
  color: var(--zd-muted);
}

.preview-close {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--zd-raised-3);
  color: var(--zd-text);
  cursor: pointer;
  transition: background-color 160ms;
}

.preview-close:hover {
  background: var(--zd-raised-4);
}

.preview-close:focus-visible {
  outline-color: var(--zd-text);
}

.preview-stage {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 24px;
  overflow: auto;
  background: var(--zd-content);
}

/* Scaled down to fit, never scaled up. */
.preview-image,
.preview-media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* A PDF fills the stage edge to edge, in the browser's own viewer. */
.preview-stage-flush {
  padding: 0;
}

.preview-frame {
  flex: 1;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  border: 0;
}

/* The waveform, then the browser's own control, 480 px wide at most. */
.preview-audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 480px;
}

.preview-audio-control {
  width: 100%;
}

.preview-audio-icon,
.preview-state-icon {
  display: inline-flex;
  color: var(--zd-disabled);
}

.preview-audio-icon .icon,
.preview-state-icon .icon {
  width: 64px;
  height: 64px;
}

/*
 * Text and code: the part of the stage that scrolls. The text is mono, wraps, and is 80 characters wide
 * at most. For a file over 1 MB the notice stays at the top while the text scrolls under it.
 */
.preview-doc {
  flex: 1;
  align-self: stretch;
  min-width: 0;
  overflow: auto;
}

.preview-text {
  max-width: 80ch;
  margin: 0;
  color: var(--zd-text);
  font-family: var(--font-mono);
  font-size: var(--text-body);
  line-height: 1.5;
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-part {
  display: flex;
  position: sticky;
  top: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 16px;
  padding: 8px 8px 8px 16px;
  border-radius: 24px;
  background: var(--zd-raised);
}

.preview-part-line {
  margin: 0;
  color: var(--zd-soft);
}

/* No preview, cannot play, cannot show, file gone and failed: an icon, a heading, a line and the actions. */
.preview-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  text-align: center;
}

.preview-state-title {
  margin: 8px 0 0;
  font-size: var(--text-heading);
  line-height: 1.25;
  letter-spacing: 0;
}

.preview-state-body {
  margin: 0;
  color: var(--zd-muted);
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

/* An empty row of actions takes no room. */
.preview-actions:empty {
  display: none;
}

.preview-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--zd-muted);
}

/* From 600 px Download is a pill with its word; below it, an icon button that keeps its name for assistive technology. */
.preview-download .icon {
  display: none;
}

@media (max-width: 599px) {
  .preview-download {
    flex: none;
    width: 36px;
    padding: 0;
  }

  .preview-download .icon {
    display: block;
  }

  .preview-download-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.spinner {
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--zd-hairline-strong);
  border-top-color: var(--zd-text);
  border-radius: 50%;
  animation: zd-spin 800ms linear infinite;
}

@media (min-width: 600px) {
  .preview-dialog {
    width: calc(100% - 32px);
    max-width: 1280px;
    height: calc(100% - 32px);
    margin: auto;
    border-radius: 36px;
  }
}

/* ---------- Dialogs: New folder, Rename, Move, Delete ---------- */

/*
 * A modal dialog on the floating plane: 480 px wide, never wider than the window less 32 px, 22 px
 * corners, the rim. The dialog element is only the frame; its box is the element inside it, which holds
 * the padding, so a press on the dialog element itself is a press on the scrim. A closed dialog is not
 * displayed.
 */
.sheet {
  width: 480px;
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 22px;
  background: var(--zd-raised);
  box-shadow: var(--zd-rim);
  color: var(--zd-text);
}

.sheet[open] {
  animation: zd-in 200ms cubic-bezier(0.2, 0.715, 0.205, 0.99);
}

.sheet::backdrop {
  background: rgba(0, 0, 0, 0.6);
  animation: zd-fade 200ms cubic-bezier(0.2, 0.715, 0.205, 0.99);
}

.sheet-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.sheet-box > * {
  margin: 0;
}

/* The title names what the dialog acts on. A long name wraps and is never cut. */
.sheet-title {
  overflow-wrap: anywhere;
}

.sheet-body {
  color: var(--zd-muted);
}

/* A label sits 8 px above its field, and the reason 8 px under it. */
.sheet-box > .field-label {
  margin-bottom: -8px;
}

.sheet-box > .field-error {
  margin-top: -8px;
}

/* A text field: a 48 px pill on the ground colour with a line around it. A long value scrolls sideways. */
.text-field {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--zd-outline);
  border-radius: 24px;
  background: var(--zd-content);
  color: var(--zd-text);
  font: inherit;
  letter-spacing: inherit;
}

/* A wrong value: the line turns red and 2 px. The padding gives the extra pixel back, so the words do not move. */
.text-field[aria-invalid="true"] {
  padding: 0 calc(16px - 1px); /* optical exception B (15 px) */
  border: 2px solid var(--zd-bad);
}

/* The buttons: stacked and full width with the acting one on top; from 600 px at the bottom right, the safe one first. */
.sheet-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  margin-top: 8px;
}

.sheet-actions .btn {
  width: 100%;
}

.sheet .btn-secondary {
  background: var(--zd-raised-3);
}

.sheet .btn-secondary:hover {
  background: var(--zd-raised-4);
}

/*
 * An acting button that cannot act yet: half strength, with its reason in words beside it. It is
 * aria-disabled, not disabled, so it keeps focus; a busy button keeps its full strength instead.
 */
.btn.btn-off[aria-disabled="true"],
.btn.btn-off[aria-disabled="true"]:hover,
.btn.btn-off[aria-disabled="true"]:active {
  opacity: 0.5;
}

.btn-primary.btn-off[aria-disabled="true"],
.btn-primary.btn-off[aria-disabled="true"]:hover,
.btn-primary.btn-off[aria-disabled="true"]:active {
  background: var(--zd-tile);
}

/*
 * The permanent-delete confirm (07-UI-SPEC.md 1C). The status line reserves its height, so nothing jumps while the
 * word is typed. The confirm button has two looks and the look carries the state, never opacity: off is an outline
 * pill (a 2 px red edge, red words, aria-disabled), on is the red fill with the dark words. Its edge is 2 px in every
 * state so the button never changes size; only off has a red edge, the red fill hides it when on.
 */
#delete-confirm-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 16px;
  color: var(--zd-muted);
}

.sheet #delete-act {
  min-height: 44px;
  border: 2px solid transparent;
}

.sheet #delete-act.confirm-off,
.sheet #delete-act.confirm-off:hover,
.sheet #delete-act.confirm-off:active {
  border-color: var(--zd-bad);
  background: transparent;
  color: var(--zd-bad);
  opacity: 1;
  cursor: not-allowed;
}

/* The word's field keeps the same 48 px as every text field; its buttons sit pinned under a scrolling body. */
#delete-dialog .sheet-actions {
  position: sticky;
  bottom: 0;
  margin: 0 0 -24px;
  padding: 8px 0 24px;
  background: var(--zd-raised);
}

#delete-dialog {
  max-height: calc(var(--zd-viewport-h, 100dvh) - 32px);
}

/* While the on-screen keyboard (or a zoom) makes the visible part of the window shorter, the dialog sits at the top of what is visible. */
html[data-viewport="short"] #delete-dialog {
  top: var(--zd-viewport-top, 0px);
  bottom: auto;
  margin: 16px auto 0;
}

@media (min-width: 600px) {
  #delete-dialog .sheet-actions {
    margin-bottom: -32px;
    padding-bottom: 32px;
  }
}

/* Move: the folder browser. Its list is 320 px tall at most and scrolls inside the dialog. */
.picker {
  max-height: 320px;
  overflow-y: auto;
  border-top: 1px solid var(--zd-hairline-strong);
}

.picker-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.picker-list li {
  margin: 0;
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 48px;
  padding: 0 4px;
  border: 0;
  border-bottom: 1px solid var(--zd-hairline);
  background: none;
  color: var(--zd-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms;
}

.picker-row:hover {
  background: var(--zd-hover-row);
}

.picker-row:focus-visible {
  outline: 3px solid var(--zd-text);
  outline-offset: -3px;
}

.picker-row .icon {
  width: 20px;
  height: 20px;
  color: var(--zd-muted);
}

.picker-row-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-note {
  min-height: 48px;
  margin: 0;
  padding: 12px 4px;
  color: var(--zd-muted);
}

.picker-note p {
  margin: 0 0 8px;
}

@media (min-width: 600px) {
  .sheet-box {
    padding: 32px;
  }

  .sheet-actions {
    flex-direction: row;
    justify-content: flex-end;
  }

  .sheet-actions .btn {
    width: auto;
  }
}

@keyframes zd-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes zd-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes zd-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ---------- Upload ---------- */

/*
 * Upload files is the one ink pill of Your files, at the end of the floating bar. Below 600 px there is
 * no bar: a 56 px round ink button sits at the bottom right, 16 px above the tab bar, and the list keeps
 * room under its last row so the button never covers a row's own buttons.
 */
.upload-round {
  position: fixed;
  right: 16px;
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + var(--tabbar-h) + 16px); /* 16 px above the tab bar, whatever its height */
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--zd-tile);
  color: var(--zd-ink);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  transition: filter 160ms;
}

.upload-round .icon {
  width: 24px;
  height: 24px;
}

.upload-round:hover {
  filter: brightness(0.94);
}

.upload-round:active {
  filter: brightness(0.88);
}

/* On the light fill the ring is the text colour, with a dark gap so it shows on the fill and on the pane. */
.upload-round:focus-visible {
  outline-color: var(--zd-text);
}

@media (max-width: 599px) {
  .account-app[data-view="drive"] .upload-round {
    display: inline-flex;
  }

  .capsule #upload-files {
    display: none;
  }

  /* The toast sits 16 px above the round button, not over it. */
  body:has(.account-app[data-view="drive"] .upload-round:not([hidden])) .toast-region {
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + var(--tabbar-h) + 16px + 56px + 16px); /* 16 px above the round button */
  }
}

/*
 * The line under the title while files upload, and after: a dot, then the words, on one line, 8 px
 * under the title and before the storage block. It is shown in Your files only.
 */
.account-app > #upload-status {
  order: 0;
  flex-direction: row;
  gap: 8px;
  margin-top: -16px;
}

/* The hint of an empty folder sits close under its line. */
#files-empty-folder-hint {
  margin-top: -12px;
  color: var(--zd-muted);
}

/* Add storage, beside the full-storage note. */
#storage-card > .storage-add {
  order: 4;
  margin: 4px 0 0 16px;
}

/*
 * An upload's row sits in the list's own table, above its rows: the kind icon and the name, the percent
 * in the Size cell, "Uploading…" in the Modified cell, and Cancel upload at the row's end. A 4 px blue
 * bar along the row's bottom edge shows how far it is; the percent says the same in words.
 */
#upload-body:empty {
  display: none;
}

#upload-body:not(:empty) + #files-body {
  border-top: 0;
}

.file-table .upload-row {
  position: relative;
}

.upload-entry {
  cursor: default;
}

/* The list's rows start with a checkbox. An upload's row keeps that room, so its icon and its name line up with theirs. */
.upload-row .row-name::before {
  flex: none;
  width: var(--w-check);
  content: "";
}

/* A file that did not upload carries the warning icon in red. */
.upload-row[data-state="failed"] .upload-kind .icon {
  color: var(--zd-bad);
}

.upload-kind {
  display: inline-flex;
  flex: none;
}

/* Below 600 px the percent keeps its width as it counts, so the words after it stand still. */
.file-table .upload-row .cell-size {
  box-sizing: border-box;
  min-width: 90px;
  padding-left: var(--row-indent);
}

.file-table .upload-row .cell-modified:empty::before {
  content: none;
}

.upload-acts {
  display: flex;
  justify-content: flex-end;
  white-space: nowrap;
}

.upload-bar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  border-radius: 0;
}

.upload-bar::-webkit-progress-value {
  border-radius: 0;
  transition: width 160ms linear;
}

.upload-bar::-moz-progress-bar {
  border-radius: 0;
}

/* The reason a file did not upload, or the question about a name that is taken, under the name, with its actions. */
.upload-detail {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 0 16px;
  padding: 0 0 4px var(--row-indent);
}

.upload-reason {
  flex: 1 1 200px;
  min-width: 0;
  margin: 0;
  color: var(--zd-muted);
  overflow-wrap: anywhere;
}

.upload-choices {
  display: flex;
  flex-flow: row wrap;
  gap: 0 16px;
}

@media (min-width: 600px) {
  .file-table .upload-row .cell-size {
    min-width: 0;
    padding: 0 16px 0 0;
  }

  .upload-detail {
    padding: 0 0 8px var(--row-indent);
  }
}

/* On a touch screen the list's checkbox is a 44 px target, so the room an upload's row keeps is 44 px too (--row-indent follows it). */
@media (pointer: coarse) {
  .upload-row .row-name::before {
    width: var(--w-check-touch);
  }
}

@media (pointer: coarse) and (min-width: 600px) {
  .file-table .upload-row .cell-size {
    padding: 0 16px 0 0;
  }
}

/*
 * Files dragged over the content pane: a blue tint and a 2 px blue ring inside its edge, and one line in
 * the Heading size, centred in the pane, that names the folder the files would go to.
 */
.account-app.drop-on {
  box-shadow:
    inset 0 0 0 2px var(--zd-blue),
    inset 0 0 0 100vmax rgba(61, 99, 255, 0.08);
}

.drop-hint {
  position: fixed;
  top: 50%;
  right: 16px;
  left: 16px;
  z-index: 7;
  display: flex;
  justify-content: center;
  margin: 0;
  transform: translateY(-50%);
  font-size: var(--text-heading);
  line-height: 1.25;
  text-align: center;
  pointer-events: none;
}

.drop-hint > span {
  max-width: 480px;
  padding: 16px 24px;
  border-radius: 16px;
  background: var(--zd-raised);
  box-shadow: var(--zd-rim);
  overflow-wrap: anywhere;
}

@media (min-width: 600px) {
  .drop-hint {
    left: calc(var(--rail) + 32px);
  }
}

@media (min-width: 900px) {
  html:not(.nav-rail) .drop-hint {
    left: calc(var(--sidebar) + 32px);
  }
}

/* ---------- Search: the toolbar's field and the results ---------- */

/*
 * A signed-in account's toolbar is the search field: a pill of its own, 56 px high, in the header's
 * place. The header every page shares is not drawn while it shows: the section nav carries the logo, and
 * Support is in Settings and in the footer. The field is a real search input and is the pill itself, so
 * its focus ring follows the pill; the magnifier and the hint lie over its ends and take no press.
 */
.search-bar {
  position: relative;
  grid-area: header;
  min-width: 0;
  color: var(--zd-muted);
}

body:has(#search-bar:not([hidden])) .site-header {
  display: none;
}

/* Below 600 px the pill is sticky (see the shell's note on the page being a column): 8 px from the top, above the content. */
@media (max-width: 599px) {
  .search-bar {
    position: sticky;
    top: 8px;
    z-index: 5;
  }

  /* Content that scrolls behind the pill is covered by the page's ground, 8 px around the pill. */
  .search-bar::before {
    position: absolute;
    inset: -8px;
    z-index: -1;
    background: var(--zd-content);
    content: "";
  }
}

.search-bar .icon {
  position: absolute;
  top: calc((56px - 16px) / 2); /* the 56 px pill, the 16 px icon centred in it */
  left: 24px;
  pointer-events: none;
}

.search-input {
  display: block;
  width: 100%;
  height: var(--toolbar);
  margin: 0;
  padding: 0 24px 0 calc(24px + 16px + 12px); /* the pill's side padding, the icon and a 12 px gap */
  border: 0;
  border-radius: 28px;
  background: var(--zd-pane);
  color: var(--zd-text);
  font: inherit;
  letter-spacing: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.search-input::placeholder {
  color: var(--zd-muted);
  opacity: 1;
}

/* The keys that focus the field. Only where there is a keyboard to press them on: from 600 px. */
.search-hint {
  position: absolute;
  top: 0;
  right: 24px;
  display: none;
  font-family: var(--font-mono);
  line-height: var(--toolbar);
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
}

@media (min-width: 600px) {
  .search-bar .icon {
    left: 24px;
  }

  .search-input {
    padding-right: calc(64px + 16px); /* room for the key hint: its 64 px and 16 px of air */
  }

  .search-hint {
    display: block;
  }
}

/* The Search view: the result line, the line that says what is searched, then the rows. */
.account-app > .view-search {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.search > * {
  margin: 0;
}

/* The scope line sits close under the result line: one says what was found, the other what was looked at. */
.search > #search-scope {
  margin-top: -16px;
}

#search-inactive {
  color: var(--zd-muted);
}

.search .empty-state .btn {
  margin-top: 24px;
}

.search .empty-state p {
  overflow-wrap: anywhere;
}

/*
 * A result row is a row of Your files with the Location added. Below 600 px the Location is the second
 * line, under the name, and the size and date are the third. The location is a link to its folder.
 */
.result-location {
  display: block;
  min-width: 0;
  min-height: 0;
  color: var(--zd-muted);
  font-size: var(--text-label);
  line-height: 1.33;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: var(--zd-hairline-strong);
  text-underline-offset: 4px;
}

.result-location:hover {
  text-decoration-color: currentColor;
}

/* Inside a row the ring is the text colour, and it is the link's own: the row's ring is for the name. */
.result-location:focus-visible {
  outline-color: var(--zd-text);
  outline-offset: 2px;
}

.search-table .cell-location {
  grid-row: 2;
  grid-column: 1 / 3;
  padding: 4px 0 4px var(--entry-indent);
}

.search-table .cell-size {
  grid-row: 3;
}

.search-table .cell-modified {
  grid-row: 3;
}

.search-table .cell-actions {
  grid-row: 1 / 4;
}

/*
 * From 600 px the results are columns. Each row is a grid with the same columns, so the cells line up as
 * in a table, and the element roles keep the table's meaning. A name and a location are each cut with an
 * ellipsis and have their whole text in their title.
 *
 * How many columns show follows the room the pane has, not the window: beside the labelled sidebar a
 * 900 px window leaves the pane less room than a 899 px one does beside the rail. So the view is a size
 * container, measured at the page's own two widths. In a pane under 600 px: Name, Location and the
 * actions, the name taking three parts of the room to the location's two. From 600 px the Location is its
 * 192 px and Size joins. From 900 px Modified joins: the five columns of frame 4c. A file's size and date
 * are in its preview at every width. A browser without container queries keeps the three columns.
 */
@media (min-width: 600px) {
  .search {
    container-type: inline-size;
  }

  #search-table,
  #search-table thead,
  #search-table tbody {
    display: block;
  }

  #search-table tr {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) 100px;
    align-items: stretch;
  }

  #search-table th,
  #search-table td {
    display: flex;
    grid-row: auto;
    grid-column: auto;
    align-items: center;
    min-width: 0;
    height: auto;
    min-height: 48px;
  }

  #search-table th {
    width: auto;
    min-height: 0;
    color: var(--zd-muted);
    white-space: nowrap;
  }

  #search-table th:nth-child(3),
  #search-table th:nth-child(4),
  #search-table .cell-size,
  #search-table .cell-modified {
    display: none;
  }

  #search-table tbody tr:has(.result-location:focus-visible) {
    outline-color: transparent;
  }

  #search-table .cell-location {
    padding: 0 16px 0 0;
  }

  #search-table .cell-actions {
    justify-content: flex-end;
  }

  #search-table .row-name {
    flex: 1;
  }

  .result-location {
    overflow: hidden;
    overflow-wrap: normal;
    font-size: var(--text-body);
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@container (min-width: 600px) {
  #search-table tr {
    grid-template-columns: minmax(0, 1fr) minmax(0, 192px) 88px 100px;
  }

  #search-table th:nth-child(3),
  #search-table .cell-size {
    display: flex;
  }
}

@container (min-width: 900px) {
  #search-table tr {
    grid-template-columns: minmax(0, 1fr) minmax(0, 192px) 88px 120px 100px;
  }

  #search-table th:nth-child(4),
  #search-table .cell-modified {
    display: flex;
  }
}

/* ---------- Connect your AI ---------- */

/*
 * One reading column, 680 px at most: the intro, then groups divided as Settings is (a group label over a
 * hairline, then its lines). The steps are an ordered list that wraps at 64 characters. A field is a
 * 48 px pill in the mono face, read only, that scrolls sideways when its address or command is longer;
 * its button sits beside it from 600 px and under it below.
 */
.account-app > .view-connect {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: var(--reading);
}

.connect > *,
.connect-steps-groups {
  margin: 0;
}

.connect-intro {
  color: var(--zd-muted);
}

.connect-steps-groups {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.connect-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.connect-group > * {
  margin: 0;
}

.connect-group > .group-label {
  margin-bottom: 4px;
}

.connect-group p,
.connect-steps {
  max-width: 64ch;
}

.connect-steps {
  margin: 0;
  padding-left: 24px;
}

.connect-steps li {
  padding-left: 4px;
}

.connect-steps li + li {
  margin-top: 4px;
}

.connect-help,
.connect-tested {
  color: var(--zd-muted);
}

.connect-field-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.connect-field {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
}

.connect-field-row .btn {
  flex: none;
}

.connect-actions {
  display: flex;
}

.connect-actions[hidden],
.connect-actions:has(> [hidden]:only-child) {
  display: none;
}

@media (min-width: 600px) {
  .connect-field-row {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .connect-field-row .btn {
    min-width: 108px;
  }

  .connect-field {
    flex: 1;
  }
}

/* Connected apps: a row of the list is a settings row with the app's name over its dates. */
.connection-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.connection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--zd-hairline);
}

.connection-text {
  min-width: 0;
}

.connection-text > p {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Each date is one piece: below 600 px they sit on two lines, from 600 px on one line with a dot between. */
.connection-made,
.connection-used {
  display: block;
  white-space: nowrap;
}

@media (min-width: 600px) {
  .connection-made,
  .connection-used {
    display: inline;
  }

  .connection-used::before {
    content: " \00B7  ";
    white-space: pre;
  }
}

/* Connected means only that a grant exists: no dot, no colour, nothing that says it is working. */
.connection-disconnect {
  min-height: 44px;
}

/* ---------- Universal Connect Platform (Phase 14) ---------- */

.connect-platform {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
}

.platform-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding-top: 24px;
  border-top: 1px solid var(--zd-hairline);
}

.platform-group > * {
  margin: 0;
}

.platform-group-label {
  font-size: var(--text-heading);
  font-weight: var(--weight-regular);
  color: var(--zd-text);
  margin: 0 0 4px 0;
}

.platform-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.platform-form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.platform-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.platform-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.platform-secret-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: 16px;
  background: var(--zd-raised);
}

.platform-secret-box > * {
  margin: 0;
}

.platform-kv-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.platform-kv-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.platform-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--zd-hairline);
}

.platform-row-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.platform-row-meta > p {
  margin: 0;
  overflow-wrap: anywhere;
}

.platform-row-title {
  color: var(--zd-text);
  font-size: var(--text-body);
}

.platform-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (min-width: 600px) {
  .platform-form-row {
    grid-template-columns: 1fr 1fr;
  }

  .platform-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ---------- Forced colours (Windows High Contrast) ---------- */

/*
 * The system paints over fills and shadows, so every shape that was told by a fill gets a line in a
 * system colour: buttons, the order sheet, the floating bar, the tab bar, the switch, the storage bar
 * and the current section. The logo keeps its light tile, or the black mark would sit on black.
 */
@media (forced-colors: active) {
  .btn,
  .checkout,
  .capsule,
  .app-nav,
  .notice,
  .confirm-panel,
  .preview-part,
  .preview-close {
    border: 1px solid ButtonText;
  }

  .preview-dialog {
    border: 1px solid CanvasText;
  }

  .btn[aria-disabled="true"] {
    border-style: dashed;
  }

  .nav-item[aria-current="page"] {
    border: 2px solid Highlight;
  }

  .switch {
    border: 1px solid ButtonText;
  }

  .switch:checked {
    border-color: Highlight;
    background: Highlight;
  }

  .switch::before {
    background: ButtonText;
  }

  .nav-logo,
  .logo-mark,
  .brand-mark {
    forced-color-adjust: none;
  }

  .meter {
    height: 8px;
    border: 1px solid CanvasText;
    border-radius: 0;
  }

  /* The amber and red bar rules are picked by id, so these two need the upper hand to keep a system colour. */
  .meter::-webkit-progress-value {
    border-radius: 0;
    background: Highlight !important;
  }

  .meter::-moz-progress-bar {
    border-radius: 0;
    background: Highlight !important;
  }

  .storage-note::before,
  .status-line[data-state]::before,
  .bar-plan::before,
  .notice:not(:has(> svg))::before {
    background: CanvasText !important;
  }

  .file-table tbody tr:hover > td {
    background: none;
  }

  /* A row's checkbox and a ticked row, the selection bar's round button, and the toast. */
  .row-check,
  .head-check,
  .bar-clear {
    border: 1px solid ButtonText;
  }

  .row-check:checked,
  .head-check:checked {
    border-color: Highlight;
    background-color: Highlight;
  }

  /* The mixed Select all box: a Canvas box with a dash drawn in CanvasText, so it never rests on a colour. */
  .head-check:indeterminate {
    border-color: Highlight;
    background: Canvas linear-gradient(CanvasText, CanvasText) center / 8px 2px no-repeat;
    forced-color-adjust: none;
  }

  .file-table .row-selected {
    outline: 1px solid Highlight;
    outline-offset: -1px;
  }

  .toast {
    border-color: Canvas;
    outline: 1px solid CanvasText;
  }

  .toast-action {
    color: LinkText;
    text-decoration: underline;
  }

  /* A dialog, a menu and a text field each keep an edge, and the current item of a menu its mark. */
  .sheet,
  .menu {
    border: 1px solid CanvasText;
  }

  .text-field,
  .search-input,
  .connect-field,
  .title-more {
    border: 1px solid ButtonText;
  }

  /* The choices and the suggestions each keep an edge, and the chosen one is Highlight with HighlightText. */
  .sheet .share-chips .share-chip,
  .sheet .share-suggestion,
  .sheet .share-pending-chip,
  .sheet .share-general,
  .sheet .btn-outline {
    border: 1px solid ButtonText;
  }

  .sheet .share-icon-btn,
  .sheet .share-role,
  .sheet .share-avatar,
  .sheet .share-general-icon {
    border: 1px solid ButtonText;
  }

  .share-chips .share-chip[aria-pressed="true"],
  .share-chips .share-chip[aria-pressed="true"]:hover {
    border-color: Highlight;
    background: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }

  .text-field[aria-invalid="true"] {
    border: 2px solid Mark;
  }

  .menu-item:hover,
  .menu-item:focus-visible,
  .picker-row:hover {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}

@media (forced-colors: active) and (min-width: 600px) {
  .app-nav {
    border: 0;
  }
}

/* The phone's tab bar and the More menu: the current tab is Highlight with HighlightText, the others ButtonText on Canvas, the menu Canvas with a 1 px edge. */
@media (forced-colors: active) and (max-width: 599px) {
  .nav-item {
    color: ButtonText;
  }

  .nav-item[aria-current="page"],
  .nav-more[aria-current="true"] {
    border: 0;
    background: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }
}

@media (forced-colors: active) {
  .more-menu {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
  }

  .more-menu .menu-item:hover,
  .more-menu .menu-item:focus-visible {
    background: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }
}

/* The right-click menu in forced colours: Canvas with a 1 px CanvasText edge, the hovered or focused item Highlight, the hairline CanvasText (plan 07-17). */
@media (forced-colors: active) {
  .context-menu {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
  }

  .context-menu .menu-item:hover,
  .context-menu .menu-item:focus-visible {
    background: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }

  .context-menu .menu-rule {
    background: CanvasText;
  }
}

/* ---------- Sharing: the Share dialog and Shared links ---------- */

/*
 * The Share dialog is a sheet laid out as Google Drive's is: a title row with a help and a gear button, one
 * Add people field with suggestion chips, People with access (the owner first), General access with a
 * two-value dropdown, and a foot with Copy link at the left and Done at the right. The choices of the gear's
 * panel and the suggestions are native buttons drawn as chips: 32 px high, 16 px of side padding, a 16 px
 * radius, 8 px apart, wrapping onto the next row when they do not fit. The one that is chosen is the ink chip;
 * the others are the raised grey. A choice that cannot be pressed (aria-disabled) keeps its look at the same
 * strength, so nothing reads as chosen by being brighter.
 */
.share-choices {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.share-choices > legend {
  float: left;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  color: var(--zd-muted);
}

.share-chips,
.share-suggestions,
.share-pending {
  clear: both;
  display: flex;
  flex-flow: row wrap;
  gap: 8px;
}

.share-suggestions[hidden],
.share-pending[hidden] {
  display: none;
}

.share-chip,
.share-suggestion,
.share-pending-chip {
  min-height: 32px;
  max-width: 100%;
  padding: 0 16px;
  border: 0;
  border-radius: 16px;
  background: var(--zd-raised-3);
  color: var(--zd-text);
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    background-color 160ms,
    color 160ms;
}

.share-chip:hover,
.share-suggestion:hover,
.share-pending-chip:hover {
  background: var(--zd-raised-4);
}

/* A person waiting to be added: the address, then an x that takes them off the list. */
.share-pending-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.share-pending-address {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-pending-chip .icon {
  flex: none;
}

.share-chip[aria-pressed="true"],
.share-chip[aria-pressed="true"]:hover {
  background: var(--zd-tile);
  color: var(--zd-ink);
}

.share-chip[aria-pressed="true"]:focus-visible {
  outline-color: var(--zd-text);
}

.share-chip[aria-disabled="true"],
.share-suggestion[aria-disabled="true"],
.share-pending-chip[aria-disabled="true"] {
  cursor: not-allowed;
}

.share-chip[aria-disabled="true"]:hover,
.share-suggestion[aria-disabled="true"]:hover,
.share-pending-chip[aria-disabled="true"]:hover {
  background: var(--zd-raised-3);
}

.share-chip[aria-pressed="true"][aria-disabled="true"]:hover {
  background: var(--zd-tile);
}

/* The title row: the name takes the width, the two icon buttons sit at its right. */
.share-top {
  display: flex;
  align-items: center;
  gap: 4px;
}

.share-top .sheet-title {
  flex: 1;
  min-width: 0;
}

/* A 32 px round icon button (44 px under a coarse pointer), muted until the pointer is on it. */
.share-icon-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: none;
  color: var(--zd-muted);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 160ms,
    color 160ms;
}

.share-icon-btn .icon {
  width: 20px;
  height: 20px;
}

.share-icon-btn:hover,
.share-icon-btn[aria-expanded="true"] {
  background: var(--zd-hover);
  color: var(--zd-text);
}

.share-icon-btn:focus-visible,
.share-role:focus-visible,
.share-general:focus-visible {
  outline: 3px solid var(--zd-text);
  outline-offset: -3px;
}

.share-icon-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.share-icon-btn[aria-disabled="true"]:hover {
  background: none;
  color: var(--zd-muted);
}

/* The help text and the gear's panel open under the title row. */
.share-help-text,
.share-default-panel {
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--zd-raised-3);
}

.share-help-text[hidden],
.share-default-panel[hidden] {
  display: none;
}

/* The panels sit on the raised grey, where the muted colour is below 4.5:1: their words are the text colour. */
.share-help-text,
.share-default-panel .label,
.share-default-panel .body-note,
.share-default-panel .share-choices > legend {
  color: var(--zd-text);
}

.share-default-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* On the panel's raised grey a chip takes the dialog's own fill, so it still reads as a chip; the chosen one stays the ink chip. */
.share-default-panel .share-chip:not([aria-pressed="true"]) {
  background: var(--zd-raised);
}

.share-default-panel .share-chip:not([aria-pressed="true"]):hover {
  background: var(--zd-content);
}

.share-default-panel > * {
  margin: 0;
}

.share-add,
.share-link-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-add[hidden],
.share-link-block[hidden] {
  display: none;
}

.share-add > *,
.share-link-block > * {
  flex: none;
  margin: 0;
}

.share-add-hint {
  color: var(--zd-muted);
}

/* The notice email's box (07-UI-SPEC.md Screen 7): the page's own checkbox row, drawn only while the settings say it is there. */
.share-notice-row[hidden],
.share-add > .notice[hidden] {
  display: none;
}

.share-full:focus-visible {
  outline: 3px solid var(--zd-blue);
  outline-offset: 3px;
}

/* A section of the dialog: its heading, and its content 8 px under it. */
.share-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-section > * {
  margin: 0;
}

.share-section-head {
  display: flex;
  align-items: center;
  gap: 4px;
}

.share-section-head .share-section-title {
  flex: 1;
  min-width: 0;
}

/* The people: one row each, 40 px, a hairline between rows. From 600 px the list scrolls by itself above 240 px. */
.share-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.share-person {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  border-bottom: 1px solid var(--zd-hairline);
}

.share-person:last-child {
  border-bottom: 0;
}

/* The initial of the address in a 32 px circle on the raised grey. No colour is chosen for a person. */
.share-avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--zd-raised-3);
  color: var(--zd-text);
  text-transform: uppercase;
}

.share-address {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-owner-label,
.share-general-role {
  flex: none;
  color: var(--zd-muted);
}

/* The role of a person: Viewer and a caret, a button that opens a menu holding Remove access. */
.share-role,
.share-general {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 8px 0 12px;
  border: 0;
  border-radius: 16px;
  background: none;
  color: var(--zd-text);
  font: inherit;
  cursor: pointer;
  transition: background-color 160ms;
}

.share-role {
  flex: none;
}

.share-role:hover,
.share-role[aria-expanded="true"] {
  background: var(--zd-hover);
}

.share-role[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.share-role .icon,
.share-general .icon {
  flex: none;
  color: var(--zd-muted);
}

/* The menus of the dialog open under their button, at its left edge for the dropdown and at its end for a role. */
.share-person .menu {
  z-index: 10;
}

.share-general-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.share-general-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--zd-raised-3);
  color: var(--zd-text);
}

.share-general-main {
  position: relative;
  flex: 1;
  min-width: 0;
}

/* The dropdown: a 48 px pill with a line around it, as a text field has, and its caret at its end. */
.share-general {
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--zd-outline);
  border-radius: 24px;
  background: var(--zd-content);
}

.share-general:hover,
.share-general[aria-expanded="true"] {
  background: var(--zd-raised-3);
}

/* General access is the last block above the pinned foot, so its menu opens upward, over the people and not over the buttons. */
.share-general-main .menu {
  top: auto;
  right: auto;
  bottom: calc(100% + 4px);
  left: 0;
  min-width: 100%;
}

.share-general-row .share-general-role {
  align-self: center;
}

/* Under a coarse pointer every control of the dialog is a 44 px target. */
@media (pointer: coarse) {
  .share-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 22px;
  }

  .share-role,
  .share-chip,
  .share-suggestion,
  .share-pending-chip {
    min-height: 44px;
  }

  .share-top {
    gap: 0;
  }
}

/* Below 600 px the row keeps Share, Download and More, so the name keeps its second line; Copy link is in More. */
@media (max-width: 599px) {
  .file-table .row-copy-link {
    display: none;
  }
}

/* The line under the dropdown stands still while empty: nothing is drawn for it then. */
.share-line {
  margin: 8px 0 0;
}

.share-line:empty {
  display: none;
}

.share-link-block .field-label {
  margin-bottom: 0;
}

/* Copy link: an outlined pill with a 1 px line, transparent, as high as a button. */
.btn-outline {
  border: 1px solid var(--zd-outline);
  background: none;
}

.btn-outline:hover {
  background: var(--zd-raised-3);
}

.btn-outline[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline[aria-disabled="true"]:hover {
  background: none;
}

.sheet-box > .share-line,
.sheet-box > #share-finder {
  margin-top: 0;
}

/* The foot: Copy link at the left, Done at the right, on one row at every width. */
.share-dialog .share-actions {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.share-dialog .share-actions .btn {
  flex: none;
  width: auto;
}

/*
 * The Share dialog can be taller than a small window (three people and a link on a 640 px screen). The dialog scrolls,
 * and its buttons are pinned to its foot on the dialog's own fill: the row reaches over the box's bottom padding, so the
 * words scroll under it and it rests where it always did at the end.
 */
.share-dialog {
  scroll-padding-bottom: calc(80px + 80px); /* the pinned buttons, stacked, and air; snapped up from 128 px to the nearest declared value */
}

.share-dialog .sheet-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin: 0 0 -24px;
  padding: 8px 0 24px;
  background: var(--zd-raised);
}

@media (min-width: 600px) {
  .share-dialog {
    scroll-padding-bottom: calc(64px + 24px);
  }

  .share-dialog .sheet-actions {
    margin-bottom: -32px;
    padding-bottom: 32px;
  }

  .share-list {
    max-height: 240px;
    overflow-y: auto;
  }
}

/* The Shared links view: the count line, a notice, then the rows. */
.account-app > .view-links {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.links > * {
  margin: 0;
}

.links {
  container-type: inline-size;
}

#links-noplan {
  color: var(--zd-muted);
}

.links .empty-state .btn {
  margin-top: 24px;
}

.links .empty-state p {
  overflow-wrap: anywhere;
}

/*
 * A row of Shared links: the item's name over a second line (who can open it, then where it is), and at its
 * end Copy link, the row's one text action, and a More button whose menu holds Make private (D-32). Where the
 * pane is wide enough for every column (measured on the pane, as Search is) the second line goes, and the row is
 * Name, Location, Who can open and the actions. The header rule is drawn on the header row and the hairlines on the
 * rows, so they run across the gaps between the columns without a break. The row's roles keep the table's meaning
 * either way.
 */
#links-table,
#links-table tbody {
  display: block;
}

#links-table thead {
  position: absolute;
  display: block;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#links-table tbody {
  border-top: 1px solid var(--zd-hairline-strong);
}

#links-table tr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid var(--zd-hairline);
}

#links-table td {
  display: block;
  height: auto;
  padding: 0;
  border: 0;
}

#links-table .cell-name {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

#links-table .cell-location,
#links-table .cell-who {
  display: none;
}

#links-table .cell-actions {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

#links-table .row-action {
  opacity: 1;
}

#links-table .link-entry {
  cursor: default;
}

#links-table a.link-entry {
  cursor: pointer;
}

/* Below 600 px the second line is two lines: Who can open in Label and In {location} in Body, muted, because a location path can wrap (U-4). */
.link-second {
  padding: 0 0 0 var(--entry-indent);
}

.link-second > p {
  margin: 0;
  overflow-wrap: anywhere;
}

/* The line a row shows while it is being made private, under the name like the second line. */
.link-busy {
  margin: 0;
  padding: 0 0 0 var(--entry-indent);
}

.link-gone {
  color: var(--zd-muted);
}

.link-field-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 8px var(--entry-indent);
}

.link-field-box[hidden] {
  display: none;
}

.link-field-box > * {
  margin: 0;
}

#links-table .link-private-failed {
  margin: 4px 0 0;
  padding-left: var(--entry-indent);
}

#links-table .link-private-failed[hidden] {
  display: none;
}

/*
 * The pane's width picks how many columns show, at the page's own two widths (the pane is a size
 * container, as Search's is). From 600 px: Name over where it is, Who can open, and the two actions as
 * words. From 900 px the Location is a column of its own and the second line goes.
 */
@container (min-width: 600px) {
  #links-table thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  #links-table tbody {
    border-top: 0;
  }

  #links-table tr {
    grid-template-columns: minmax(0, 1fr) 176px 144px;
    align-items: stretch;
    padding: 0;
  }

  /* One unbroken header rule on the header row, and a hairline under each row: neither stops at a gap between columns. */
  #links-table thead tr {
    border-bottom: 1px solid var(--zd-hairline-strong);
  }

  #links-table th,
  #links-table td {
    display: flex;
    grid-row: auto;
    grid-column: auto;
    align-items: center;
    min-width: 0;
    min-height: 48px;
    padding: 0 16px 0 0;
    border: 0;
  }

  #links-table th {
    min-height: 0;
    padding: 16px 16px 12px 0;
    color: var(--zd-muted);
    font-size: var(--text-label);
    line-height: 1.33;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  #links-table th:nth-child(2) {
    display: none;
  }

  #links-table .cell-name,
  #links-table .cell-actions {
    grid-row: auto;
    grid-column: auto;
  }

  #links-table th:first-child,
  #links-table .cell-name {
    padding-left: 4px;
  }

  #links-table th:last-child,
  #links-table td:last-child {
    padding-right: 4px;
  }

  #links-table .cell-name {
    display: block;
    align-self: stretch;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  #links-table .cell-name > .row-name {
    min-height: 32px;
  }

  #links-table .cell-location {
    display: none;
  }

  #links-table .cell-who {
    display: flex;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #links-table .cell-actions {
    justify-content: flex-end;
  }

  #links-table .link-actions {
    display: inline-flex;
    align-items: center;
    gap: 16px;
  }

  /* The second line is the location alone here: Who can open is a column, and the line is one line with an ellipsis. */
  #links-table .link-who-line,
  #links-table .link-in {
    display: none;
  }

  #links-table .link-where-line {
    overflow: hidden;
    color: var(--zd-muted);
    font-size: var(--text-label);
    line-height: 1.33;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #links-table .entry-name {
    overflow: hidden;
    overflow-wrap: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #links-table .link-private-failed,
  #links-table .link-field-box {
    padding-left: var(--entry-indent);
  }

  #links-table tbody tr:hover > td {
    background: var(--zd-hover-row);
  }
}

@container (min-width: 900px) {
  #links-table tr {
    grid-template-columns: minmax(0, 1fr) 192px 176px 144px;
  }

  #links-table th:nth-child(2) {
    display: flex;
  }

  #links-table .cell-location {
    display: flex;
    overflow: hidden;
    color: var(--zd-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #links-table .link-second {
    display: none;
  }
}

/* The bar under the list holds "Showing {x} of {y}", Load more, and the line for a Load more that failed. */
.links-capsule .files-count,
.duplicates-capsule .files-count,
.trash-capsule .files-count,
.shared-capsule .files-count,
.shared-folder-capsule .files-count {
  padding: 0 12px 0 16px;
  color: var(--zd-text);
  font-size: var(--text-body);
  line-height: 1.5;
}

.links-capsule #links-more,
.duplicates-capsule #duplicates-more,
.trash-capsule #trash-more,
.shared-capsule #shared-more,
.shared-folder-capsule #shared-folder-more {
  min-height: 40px;
  background: var(--zd-tile);
  color: var(--zd-ink);
}

.links-capsule #links-more[aria-disabled="true"],
.duplicates-capsule #duplicates-more[aria-disabled="true"],
.trash-capsule #trash-more[aria-disabled="true"],
.shared-capsule #shared-more[aria-disabled="true"],
.shared-folder-capsule #shared-folder-more[aria-disabled="true"] {
  background: var(--zd-busy);
}

.links-capsule .links-more-error,
.duplicates-capsule .links-more-error,
.trash-capsule .links-more-error,
.shared-capsule .links-more-error,
.shared-folder-capsule .links-more-error {
  padding: 0 8px 0 16px;
  color: var(--zd-text);
  font-size: var(--text-body);
  line-height: 1.5;
}

.links-capsule,
.duplicates-capsule,
.trash-capsule,
.shared-capsule,
.shared-folder-capsule {
  align-self: center;
}

/*
 * Trash and Shared with me: the title and its lines, then the list. Each is a read-only list of rows in the
 * pattern of Shared links: a name over its second line, and where the pane is wide enough the cells are
 * columns. A name is plain text (not a link, not a button, not a tab stop): nothing opens an item here. The
 * pane's width, not the window's, picks the columns (the section is a size container, as Shared links is),
 * at the page's two widths: three lines and no columns below 900 px of pane, columns from 900 px.
 */
.account-app > section.view-trash,
.account-app > section.view-duplicates,
.account-app > section.view-shared {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.trash > *,
.duplicates > *,
.shared > * {
  margin: 0;
}

.trash,
.shared {
  container-type: inline-size;
}

.duplicates {
  container-type: inline-size;
}

/* The explainer is a reading column of 680 px at most. */
.trash-explainer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 680px;
}

.trash-explainer > p {
  margin: 0;
}

:is(#trash-noplan, #duplicates-noplan) {
  color: var(--zd-muted);
}

.trash .empty-state,
.duplicates .empty-state,
.shared .empty-state {
  padding: 24px 16px;
}

.empty-state .icon-empty {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--zd-disabled);
}

.empty-state h2 {
  font-size: var(--text-heading);
  line-height: 1.25;
}

.shared .empty-state p {
  overflow-wrap: anywhere;
}

:is(#trash-table, #shared-table),
:is(#trash-table, #shared-table) tbody {
  display: block;
}

:is(#trash-table, #shared-table) thead {
  position: absolute;
  display: block;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:is(#trash-table, #shared-table) tbody {
  border-top: 1px solid var(--zd-hairline-strong);
}

/*
 * Trash's header row (with its Select all box, plan 07-16) is out of sight until the pane is 900 px wide. Narrower, it comes into
 * view while it has keyboard focus or any row is ticked, and always on a screen with no pointer to rest on it, with its Name cell alone.
 */
#trash-table thead:focus-within,
#trash-table.has-selection thead {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
}

@container (max-width: 899px) {
  #trash-table thead:focus-within th:not(:first-child),
  #trash-table.has-selection thead th:not(:first-child) {
    display: none;
  }

  #trash-table thead:focus-within th:first-child,
  #trash-table.has-selection thead th:first-child {
    display: block;
    padding: 4px 4px 0;
    text-align: start;
  }
}

@container (max-width: 899px) {
  @media (hover: none), (pointer: coarse) {
    #trash-table thead {
      position: static;
      width: auto;
      height: auto;
      overflow: visible;
      clip-path: none;
      white-space: normal;
    }

    #trash-table thead tr {
      display: block;
      min-height: 0;
      padding: 0;
      border-bottom: 0;
    }

    #trash-table thead th:first-child {
      display: block;
      padding: 4px 4px 0;
      text-align: start;
    }

    #trash-table thead th:not(:first-child) {
      display: none;
    }
  }
}

/* A row is at least 56 px below 600 px and 48 px from 600 px. */
:is(#trash-table, #shared-table) tr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 56px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--zd-hairline);
}

:is(#trash-table, #shared-table) td {
  display: block;
  height: auto;
  padding: 0;
  border: 0;
}

:is(#trash-table, #shared-table) .cell-name {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

:is(#trash-table, #shared-table) .cell-where,
:is(#trash-table, #shared-table) .cell-size,
:is(#trash-table, #shared-table) .cell-left,
:is(#trash-table, #shared-table) .cell-on {
  display: none;
}

:is(#trash-table, #shared-table) .cell-actions {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  justify-content: flex-end;
}

:is(#trash-table, #shared-table) .entry {
  flex: 0 1 auto;
  cursor: default;
}

/* The lines under a name start under the name, past the icon and its gap. */
.trash-second,
.trash-where-line,
.trash-partial,
.trash-via,
.shared-second {
  margin: 0;
  padding: 0 0 0 var(--entry-indent);
  color: var(--zd-muted);
  overflow-wrap: anywhere;
}

.trash-where-line,
.trash-partial {
  font-size: var(--text-body);
  line-height: 1.5;
}

/* Trash has no Shared column, so the mark that says an item was shared is drawn at every width (the page's rule hides it from 900 px, where Your files has the column). */
#trash-table .shared-mark {
  display: inline-flex;
}

@media (min-width: 600px) {
  :is(#trash-table, #shared-table) tr {
    min-height: 48px;
  }
}

/* From 600 px of pane: the header shows and the cells are columns. Trash: Name, Where it was, Size, Time left. Shared with me: Name, Shared on. */
@container (min-width: 900px) {
  :is(#trash-table, #shared-table) thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  :is(#trash-table, #shared-table) tbody {
    border-top: 0;
  }

  :is(#trash-table, #shared-table) tr {
    align-items: stretch;
    padding: 0;
    border-bottom: 0;
  }

  #trash-table tr {
    grid-template-columns: minmax(0, 1fr) 192px 88px 120px 100px;
  }

  #shared-table tr {
    grid-template-columns: minmax(0, 1fr) 120px 100px;
  }

  :is(#trash-table, #shared-table) th,
  :is(#trash-table, #shared-table) td {
    display: flex;
    grid-row: auto;
    grid-column: auto;
    align-items: center;
    min-width: 0;
    min-height: 48px;
    padding: 0 16px 0 0;
    border-bottom: 1px solid var(--zd-hairline);
  }

  :is(#trash-table, #shared-table) th {
    min-height: 0;
    padding: 16px 16px 12px 0;
    border-bottom: 1px solid var(--zd-hairline-strong);
    color: var(--zd-muted);
    font-size: var(--text-label);
    line-height: 1.33;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  :is(#trash-table, #shared-table) th:first-child,
  :is(#trash-table, #shared-table) .cell-name {
    padding-left: 4px;
  }

  :is(#trash-table, #shared-table) th:last-child,
  :is(#trash-table, #shared-table) td:last-child {
    padding-right: 4px;
  }

  :is(#trash-table, #shared-table) .cell-name,
  :is(#trash-table, #shared-table) .cell-actions {
    grid-row: auto;
    grid-column: auto;
  }

  :is(#trash-table, #shared-table) .cell-name {
    display: block;
    align-self: stretch;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  :is(#trash-table, #shared-table) .cell-name > .row-name {
    min-height: 32px;
  }

  /* A cell of text: one line cut with an ellipsis (its title holds the whole text); Time left may wrap, as "Less than a day left" is longer than its 120 px column. */
  :is(#trash-table, #shared-table) .cell-where,
  :is(#trash-table, #shared-table) .cell-size,
  :is(#trash-table, #shared-table) .cell-left,
  :is(#trash-table, #shared-table) .cell-on {
    display: block;
    padding: 12px 16px 12px 0;
    overflow: hidden;
    color: var(--zd-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #trash-table .cell-left {
    white-space: normal;
  }

  :is(#trash-table, #shared-table) .trash-second,
  :is(#trash-table, #shared-table) .trash-where-line,
  :is(#trash-table, #shared-table) .shared-second {
    display: none;
  }

  :is(#trash-table, #shared-table) .entry-name {
    overflow: hidden;
    overflow-wrap: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :is(#trash-table, #shared-table) tbody tr:hover > td {
    background: var(--zd-hover-row);
  }
}

/*
 * Trash: what a writer can do (plan 07-11). Empty trash is the one ink pill of the screen, at the end of the title's
 * row. It is out of the flow (so the title's row and the gap under it are what they were), at the pane's top and end
 * edges, and moved down by half of what the title is taller than the pill so the two share a centre line: the title is
 * 30 px high below 600 px and 44 px from 600 px; the pill is 36 px high, 44 px on touch.
 */
.account-app {
  position: relative;
}

.account-app > .trash-title-actions {
  --title-h: 30px;
  --pill-h: 36px;
  position: absolute;
  top: var(--pad-y);
  right: var(--pad-x);
  display: flex;
  width: auto;
  transform: translateY(calc((var(--title-h) - var(--pill-h)) / 2));
}

@media (min-width: 600px) {
  .account-app > .trash-title-actions {
    --title-h: 44px;
  }
}

@media (pointer: coarse) {
  .account-app > .trash-title-actions {
    --pill-h: 44px;
  }

  #empty-trash {
    min-height: 44px;
  }
}

.account-app > .trash-title-actions[hidden] {
  display: none;
}

/* The Trash and Shared with me notice slots: one message above the table, with its text action. */
:is(#trash-notice, #shared-notice, #duplicates-notice) .notice-body {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 4px 16px;
}

:is(#trash-notice, #shared-notice, #duplicates-notice) .notice-body p {
  margin: 0;
}

/* A writer's row: Delete forever is a red icon (4.25 to 5.88:1 as a mark), Restore is muted until the pointer is on it. */
#trash-table .row-forever {
  color: var(--zd-bad);
}

#trash-table .row-forever:hover {
  background: var(--zd-hover);
  color: var(--zd-bad);
}

/* A fine pointer has Restore and Delete forever and no More; a coarse one has More alone, always shown, with the menu holding both. */
#trash-table .row-more {
  display: none;
}

@media (pointer: coarse) {
  #trash-table .row-restore,
  #trash-table .row-forever {
    display: none;
  }

  #trash-table .row-more {
    display: inline-flex;
  }
}

/* A control that has been pressed and is waiting for the API stays in view and says so (its name reads Restoring…). */
#trash-table .row-action.is-working {
  opacity: 1;
  cursor: progress;
}

#trash-table .row-action[aria-disabled="true"] {
  cursor: progress;
}

/*
 * Shared with me (plan 07-14). A name opens the item, so it is a button or a link and shows the pointer (the shared lists' plain
 * names did not). A fine pointer has Download (files) and Remove from my list on a row and no More; a coarse one has More alone,
 * always shown, with a menu that holds both. Remove is a plain muted x: nothing here is destructive of the owner's item.
 */
#shared-table .link-button.entry {
  cursor: pointer;
}

#shared-table .row-more {
  display: none;
}

@media (pointer: coarse) {
  #shared-table .row-download,
  #shared-table .row-remove {
    display: none;
  }

  #shared-table .row-more {
    display: inline-flex;
  }
}

#shared-table .row-action.is-working {
  opacity: 1;
  cursor: progress;
}

#shared-table .row-action[aria-disabled="true"] {
  cursor: progress;
}

/*
 * A shared folder opens in place under the same title: its path, then the table of the public share page (the same rules),
 * read only. A file row's Download is a 48 px target and always shown; a folder row has none.
 */
.shared-folder {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.shared-folder[hidden] {
  display: none;
}

.shared-folder > * {
  margin: 0;
}

#shared-folder-empty,
#shared-folder-gone {
  color: var(--zd-muted);
}

#shared-folder-table .row-download {
  width: 48px;
  height: 48px;
}

#shared-folder-table .link-button.entry {
  cursor: pointer;
}

#shared-folder-table .row-action[aria-disabled="true"] {
  cursor: progress;
}

/* A toast whose whole sentence must be read (Remove from my list) is not cut to two lines. */
.toast.toast-whole {
  display: block;
  overflow: visible;
}

/* With a checkbox before the name, the lines under it start past the checkbox too. */
#trash-table .row-trash:has(.row-select) :is(.trash-second, .trash-where-line, .trash-partial, .trash-via) {
  padding-left: var(--row-indent);
}

/* Share in the selection bar and in the preview's header, and the Shared cell. */
.preview-share .icon {
  display: none;
}

@media (max-width: 599px) {
  .preview-share {
    flex: none;
    width: 36px;
    padding: 0;
  }

  .preview-share .icon {
    display: block;
  }

  .preview-share-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.preview-share[hidden] {
  display: none;
}

.preview-header .preview-share {
  background: var(--zd-raised-3);
}

.preview-header .preview-share:hover {
  background: var(--zd-raised-4);
}

/* Below 600 px a row shows no Shared cell: the second line has no room for it, and the dialog says who can open an item. */
.file-table .cell-shared {
  display: none;
}

@media (min-width: 600px) {
  .file-table .cell-shared,
  .file-table .col-shared {
    display: table-cell;
    color: var(--zd-muted);
    white-space: nowrap;
  }

  .file-table .col-shared {
    width: 112px;
  }
}

@media (min-width: 600px) and (max-width: 899px) {
  .file-table .cell-shared,
  .file-table .col-shared {
    display: none;
  }
}

/*
 * The Shared mark: below 900 px, where the Shared column is not shown, a shared item has a 16 px muted icon
 * after its name. It does not shrink; a long name does. Below 600 px a name wraps, so the mark sits beside
 * its first line (a 24 px line, a 16 px icon, 4 px above and below). From 600 px a name is one line and the
 * mark is centred with it.
 */
.shared-mark {
  display: inline-flex;
  flex: none;
  align-self: flex-start;
  margin-top: 4px;
  color: var(--zd-muted);
}

.shared-mark .icon {
  width: 16px;
  height: 16px;
}

/* The name takes only the room it needs, so the mark sits right after it and not at the far end of the row. */
@supports selector(:has(*)) {
  .row-name .link-button.entry:has(+ .shared-mark) {
    flex: 0 1 auto;
  }
}

@media (min-width: 600px) {
  .shared-mark {
    align-self: center;
    margin-top: 0;
  }
}

/* From 900 px the Shared column says it, so the mark is not drawn twice. */
@media (min-width: 900px) {
  .shared-mark {
    display: none;
  }
}

/* ---------- Touch ---------- */

/* A finger gets a 44 px target on everything that can be pressed. */
@media (pointer: coarse) {
  .btn,
  .text-action,
  .skip-link,
  .wordmark,
  .nav-logo,
  .nav-item,
  .link-button,
  .preview-close,
  .billing-option,
  .share-chip,
  .site-header nav a,
  .site-footer a,
  .on-this-page a,
  .setting-row a,
  .checkbox-row {
    min-height: 44px;
  }

  .nav-logo,
  .nav-item,
  .preview-close,
  .preview-download,
  .site-header nav a {
    min-width: 44px;
  }

  .setting-row a {
    display: inline-flex;
    align-items: center;
  }

  .breadcrumb li,
  .breadcrumb .link-button {
    min-height: 44px;
  }

  /* No pointer rests on a row here, so its checkbox and its actions always show, each a 44 px target. */
  .row-select,
  .row-action,
  .title-more {
    min-width: 44px;
    min-height: 44px;
    opacity: 1;
  }

  /* More is the only action on a row here, and its menu holds every action. A menu item is 48 px. */
  .file-table .row-copy-link,
  .file-table .row-share,
  .file-table .row-download,
  .file-table .row-zip {
    display: none;
  }

  .menu-item,
  .picker-row {
    min-height: 48px;
  }

  .account-app > .title-actions {
    margin-top: calc(var(--toolbar) * -1 - 12px); /* the toolbar's height and 12 px (the 44 px touch targets) */
  }

  .bar-action,
  .bar-clear {
    min-width: 44px;
    min-height: 44px;
  }

  .share-person {
    min-height: 48px;
  }

  .share-remove,
  #links-table .text-action {
    min-height: 44px;
  }

  /* A result's location is a link of its own: a 44 px target with its words in the middle. */
  .result-location {
    display: flex;
    align-items: center;
    min-height: 44px;
  }

  .search-table .cell-location {
    padding-top: 0;
    padding-bottom: 0;
  }
}

/* The same on a screen with no pointer to rest on a row at all. */
@media (hover: none) {
  .row-select,
  .row-action {
    opacity: 1;
  }
}

@media (pointer: coarse) and (min-width: 600px) {
  .file-table .row-file:has(.row-select) .cell-size {
    padding: 0 16px 0 0;
  }

  /* One line, cut with an ellipsis: the line is 44 px high, so the link is a 44 px target and its words stay centred. */
  .result-location {
    display: block;
    min-height: 44px;
    line-height: 44px;
  }
}

/* ---------- Shared link page (/s/) ---------- */

/*
 * One pane, 1040 px wide at most and centred, with "Stored with ZeroDrive" under it and the footer at the
 * foot of the window. The pane is as tall as its content.
 */
body[data-page="share"] {
  grid-template-rows: auto auto auto 1fr;
  grid-template-areas:
    "header"
    "main"
    "stored"
    "footer";
}

body[data-page="share"] .site-footer {
  align-self: end;
}

/* The logo is the white wordmark straight on the dark toolbar, 24 px high, as in the app's sidebar. It has no light tile. */
body[data-page="share"] .brand-mark {
  height: 24px;
  padding: 0;
  border-radius: 0;
  background: none;
}

/* On a phone the wordmark is 16 px high, so it fits beside Support and Sign in at 320 px. */
@media (max-width: 599px) {
  body[data-page="share"] .brand-mark {
    height: 16px;
  }
}

.share-app {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1040px;
  justify-self: center;
}

.share-app > * {
  margin: 0;
}

.share-stored {
  grid-area: stored;
  margin: 0;
  color: var(--zd-muted);
  text-align: center;
}

/*
 * The item's head: the kind icon, the name as the h1 (it wraps and is never cut), the line under it, and
 * Download. Below 600 px the head stacks and Download is as wide as the pane.
 */
.share-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "kind title"
    ". meta"
    "action action"
    "failed failed";
  column-gap: 12px;
  row-gap: 4px;
  align-items: start;
}

.share-head > * {
  margin: 0;
}

.share-title {
  grid-area: title;
  font-size: var(--text-heading);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.share-title:focus-visible {
  outline-offset: 4px;
}

.share-kind {
  grid-area: kind;
  display: inline-flex;
  align-self: center;
  color: var(--zd-muted);
}

.share-kind .icon {
  width: 20px;
  height: 20px;
}

.share-meta {
  grid-area: meta;
  color: var(--zd-muted);
}

.share-download,
.share-zip {
  grid-area: action;
  margin-top: 16px;
}

/* Download all is the one action of a folder, and a thumb's width tall on a phone. */
.share-zip {
  min-height: 44px;
}

.share-download-failed {
  grid-area: failed;
  margin-top: 8px;
}

/* A link that does not work, and a sign-in that is needed: the icon over the line, in the pane. */
.share-head-state {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "kind"
    "title";
  row-gap: 16px;
}

.share-kind-state {
  color: var(--zd-disabled);
}

.share-kind-state .icon {
  width: 64px;
  height: 64px;
}

.share-line {
  max-width: var(--reading);
  color: var(--zd-muted);
}

.share-signin {
  align-self: flex-start;
}

.share-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--zd-muted);
}

.share-network {
  max-width: var(--reading);
}

/* The stage is 60% of the window's height, 70% (720 px at most) from 600 px. A long file scrolls inside it. */
.share-stage {
  flex: none;
  height: 60vh;
  height: 60dvh;
  border-radius: 22px;
}

@media (min-width: 600px) {
  .share-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "kind title action"
      ". meta action"
      ". failed failed";
  }

  .share-download,
  .share-zip {
    margin-top: 0;
  }

  .share-download-failed {
    justify-self: end;
  }

  .share-head-state {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "kind"
      "title";
  }

  .share-stage {
    height: min(70vh, 720px);
    height: min(70dvh, 720px);
  }
}

/* A folder link: the breadcrumb, the table, "Showing x of y" and Load more. */
.share-folder {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.share-folder > * {
  margin: 0;
}

.share-empty,
.share-folder-gone {
  color: var(--zd-muted);
}

.share-paging {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.share-paging > * {
  margin: 0;
}

.share-count {
  color: var(--zd-muted);
}

/*
 * Below 600 px the table is stacked rows: the name on the first line with Download at the row's end, then
 * the size and the date under it in the label size. The table roles are set on the elements, so the table
 * keeps its meaning when display changes.
 */
.share-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.share-table,
.share-table tbody,
.share-table td {
  display: block;
}

.share-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.share-table tbody {
  border-top: 1px solid var(--zd-hairline-strong);
}

.share-table tr {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "name name action"
    "size modified action";
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid var(--zd-hairline);
}

.share-table .row-folder {
  padding: 16px 4px;
}

.share-table td {
  padding: 0;
}

.share-table .cell-name {
  grid-area: name;
  min-width: 0;
}

.share-table .cell-size,
.share-table .cell-modified {
  color: var(--zd-muted);
  font-size: var(--text-label);
  line-height: 1.33;
}

.share-table .cell-size {
  grid-area: size;
  padding-left: var(--entry-indent);
}

.share-table .cell-modified {
  grid-area: modified;
}

.share-table .cell-modified::before {
  content: " \00B7  ";
  white-space: pre;
}

.share-table .row-folder .cell-size,
.share-table .row-folder .cell-modified {
  display: none;
}

.share-table .cell-actions {
  display: flex;
  grid-area: action;
  grid-row: 1 / 3;
  align-items: center;
  justify-content: flex-end;
}

/* A file's Download is always shown, on a pointer and on a touch screen. */
.share-table .row-action {
  opacity: 1;
}

.share-row-failed {
  margin: 4px 0 0;
}

.share-preview-failed {
  flex: none;
  margin: 0;
  padding: 0 16px 8px;
}

@media (min-width: 600px) {
  .share-table {
    display: table;
    table-layout: fixed;
  }

  .share-table thead {
    position: static;
    display: table-header-group;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }

  .share-table tbody {
    display: table-row-group;
    border-top: 0;
  }

  .share-table tr,
  .share-table .row-folder {
    display: table-row;
    padding: 0;
    border-bottom: 0;
  }

  /* A row is 48 px high with a hairline under it, 16 px between cells and 4 px at its sides. */
  .share-table th,
  .share-table td,
  .share-table .cell-size,
  .share-table .cell-modified,
  .share-table .row-folder .cell-size,
  .share-table .row-folder .cell-modified {
    display: table-cell;
    height: 48px;
    padding: 0 16px 0 0;
    border-bottom: 1px solid var(--zd-hairline);
    font-size: var(--text-body);
    line-height: 1.5;
    vertical-align: middle;
  }

  .share-table th {
    height: auto;
    padding: 16px 16px 12px 0;
    border-bottom: 1px solid var(--zd-hairline-strong);
    color: var(--zd-muted);
    font-size: var(--text-label);
    line-height: 1.33;
    letter-spacing: 0.06em;
  }

  .share-table th:first-child,
  .share-table .cell-name {
    padding-left: 4px;
  }

  .share-table th:last-child,
  .share-table td:last-child {
    padding-right: 4px;
  }

  .share-table .col-size {
    width: 88px;
  }

  .share-table .col-modified {
    width: 120px;
  }

  .share-table .col-actions {
    width: 56px;
  }

  .share-table .cell-size,
  .share-table .cell-modified {
    padding-left: 0;
    white-space: nowrap;
  }

  .share-table .cell-modified::before {
    content: none;
  }

  .share-table .cell-actions {
    display: table-cell;
    text-align: right;
  }

  .share-table tbody tr:hover > td {
    background: var(--zd-hover-row);
  }

  @supports selector(:has(*)) {
    .share-table tbody tr:has(.link-button:focus-visible) {
      outline: 3px solid var(--zd-text);
      outline-offset: -3px;
    }

    .share-table .link-button.entry:focus-visible {
      outline-color: transparent;
    }
  }
}

/*
 * Forced colours for the typed confirm and the Deleting group. The confirm button is a ButtonText outline with
 * ButtonText words and no fill while it is off, and a ButtonText fill with ButtonFace words when it is on: the two
 * differ by fill, not by colour, so the state survives. The check beside Matches. is drawn in the text colour. A
 * settings chip keeps an edge; the chosen one is Highlight, as in the Share dialog.
 */
@media (forced-colors: active) {
  .sheet #delete-act {
    forced-color-adjust: none;
    border: 2px solid ButtonText;
    background: ButtonText;
    color: ButtonFace;
  }

  .sheet #delete-act.confirm-off,
  .sheet #delete-act.confirm-off:hover,
  .sheet #delete-act.confirm-off:active {
    border-color: ButtonText;
    background: transparent;
    color: ButtonText;
  }

  #delete-confirm-status .icon {
    color: CanvasText;
  }

  .delete-chips .share-chip {
    border: 1px solid ButtonText;
  }

  .delete-chips .share-chip[aria-pressed="true"],
  .delete-chips .share-chip[aria-pressed="true"]:hover {
    border-color: Highlight;
    background: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }
}

/* ---------- Duplicates (plan 09-05) ---------- */

/*
 * The Duplicates screen is in the pattern of Trash: the title, a reading column of explainer, the result, then the groups and the bar. Each
 * group is a heading and its files with one Keep choice. The pane's width, not the window's, picks the layout (the section is a size
 * container): three lines a row below 900 px of pane, four columns from 900 px. Colours, sizes and spacing are the page's own tokens.
 */
/* Find duplicates is the one ink pill of the screen, at the end of the title's row, placed as Empty trash is (the title is 30 px high below 600 px, 44 from 600 px; the pill 36 px, 44 on touch). */
.account-app > .duplicates-title-actions {
  --title-h: 30px;
  --pill-h: 36px;
  position: absolute;
  top: var(--pad-y);
  right: var(--pad-x);
  display: flex;
  width: auto;
  transform: translateY(calc((var(--title-h) - var(--pill-h)) / 2));
}

@media (min-width: 600px) {
  .account-app > .duplicates-title-actions {
    --title-h: 44px;
  }
}

@media (pointer: coarse) {
  .account-app > .duplicates-title-actions {
    --pill-h: 44px;
  }

  #duplicates-find {
    min-height: 44px;
  }
}

.account-app > .duplicates-title-actions[hidden] {
  display: none;
}

/* The explainer is a reading column of 680 px at most, as Trash's is. */
.duplicates-explainer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 680px;
}

.duplicates-explainer > p {
  margin: 0;
}

.duplicates-status {
  margin: 0;
  color: var(--zd-muted);
}

.duplicates-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 680px;
}

.duplicates-result > * {
  margin: 0;
}

.duplicates-result h2 {
  font-size: var(--text-heading);
  line-height: 1.25;
}

#duplicates-message,
#duplicates-counts {
  color: var(--zd-muted);
  font-size: var(--text-body);
  line-height: 1.5;
}

#duplicates-summary {
  color: var(--zd-muted);
}

.dup-table {
  display: block;
  border-top: 1px solid var(--zd-hairline-strong);
}

.dup-head {
  display: none;
}

.dup-group {
  display: block;
}

.dup-group-head {
  margin: 0;
  padding: 16px 4px 8px;
  color: var(--zd-muted);
  font-size: var(--text-body);
  line-height: 1.5;
}

.dup-files {
  display: block;
}

/* A row below 900 px of pane: the Keep choice, then the name over its Label line; at least 56 px high. */
.dup-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-height: 56px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--zd-hairline);
}

.dup-table.is-reader .dup-row {
  grid-template-columns: minmax(0, 1fr);
}

.dup-keep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.dup-radio {
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--zd-outline);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 160ms;
}

.dup-radio:checked {
  border-color: var(--zd-blue);
  background: var(--zd-blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='3' fill='%2305060F'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}

.dup-radio:focus-visible {
  outline: 3px solid var(--zd-text);
  outline-offset: 2px;
}

/* A checked choice is a blue fill, and the ring round a blue fill is white (the page's rule for a ring on blue). */
.dup-radio:checked:focus-visible {
  outline-color: var(--zd-on-blue);
}

.dup-radio[disabled] {
  cursor: progress;
}

.dup-name {
  min-width: 0;
  align-self: center;
}

.dup-entry {
  cursor: default;
}

.dup-where {
  display: none;
}

.dup-second {
  margin: 0;
  padding: 0 0 0 var(--entry-indent);
  color: var(--zd-muted);
  overflow-wrap: anywhere;
}

.dup-modified,
.dup-size {
  display: none;
  margin: 0;
  color: var(--zd-muted);
}

/* Duplicates has no Shared column, so the mark that says a file has a link is drawn at every width. */
.dup-row .shared-mark {
  display: inline-flex;
}

@media (min-width: 600px) {
  .dup-row {
    min-height: 48px;
  }
}

@container (min-width: 900px) {
  .dup-head {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 120px 88px;
    align-items: end;
    padding: 16px 4px 12px 0;
    border-bottom: 1px solid var(--zd-hairline-strong);
    color: var(--zd-muted);
    font-size: var(--text-label);
    line-height: 1.33;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  .dup-head > * {
    min-width: 0;
  }

  .dup-table.is-reader .dup-head {
    grid-template-columns: minmax(0, 1fr) 120px 88px;
  }

  .dup-table.is-reader .dup-head-keep {
    display: none;
  }

  .dup-table {
    border-top: 0;
  }

  .dup-row {
    grid-template-columns: 56px minmax(0, 1fr) 120px 88px;
    gap: 0;
    align-items: center;
    min-height: 48px;
    padding: 0 4px 0 0;
  }

  .dup-table.is-reader .dup-row {
    grid-template-columns: minmax(0, 1fr) 120px 88px;
  }

  .dup-name {
    padding: 8px 16px 8px 0;
  }

  .dup-where {
    display: block;
    margin: 0;
    padding: 0 0 0 var(--entry-indent);
    color: var(--zd-muted);
    overflow-wrap: anywhere;
  }

  .dup-second {
    display: none;
  }

  .dup-modified,
  .dup-size {
    display: block;
    padding: 0 16px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dup-group-head {
    padding: 24px 4px 8px 0;
  }
}

/* The dialogs: the Trash one is a native dialog of the page's own anatomy; its error line sits above the buttons. */
#duplicates-dialog .notice p {
  margin: 0;
}

@media (forced-colors: active) {
  .dup-radio {
    border: 1px solid ButtonText;
  }

  .dup-radio:checked {
    border-color: Highlight;
    background: Canvas radial-gradient(circle, Highlight 0 4px, transparent 5px);
    forced-color-adjust: none;
  }
}

/* ---------- Knowledge Brain ---------- */

.account-app > .view-brain {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: var(--reading);
}

.brain > * {
  margin: 0;
}

.brain-intro {
  color: var(--zd-muted);
}

.brain-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--zd-hairline-strong);
  padding-bottom: 12px;
}

.brain-tab {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--zd-muted);
  font: inherit;
  cursor: pointer;
  transition: background-color 160ms, color 160ms;
}

.brain-tab:hover {
  background: var(--zd-hover);
  color: var(--zd-text);
}

.brain-tab[aria-selected="true"],
.brain-tab[aria-selected="true"]:hover {
  background: var(--zd-tile);
  color: var(--zd-ink);
}

.brain-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brain-panel > * {
  margin: 0;
}

.brain-panel-sub {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-group);
  background: var(--zd-raised);
}

.brain-panel-sub > * {
  margin: 0;
}

.brain-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.brain-group > * {
  margin: 0;
}

.brain-summary-row,
.brain-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brain-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.brain-list,
.brain-results {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--zd-hairline-strong);
}

.brain-list > li + li,
.brain-results > li + li {
  margin-top: 0;
}

.brain-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--zd-hairline);
}

@media (min-width: 600px) {
  .brain-row-split {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
}

.brain-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.brain-row-title {
  color: var(--zd-text);
  overflow-wrap: anywhere;
}

.brain-row-meta {
  color: var(--zd-muted);
  font-size: var(--text-label);
  line-height: 1.33;
  overflow-wrap: anywhere;
}

.brain-row-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.brain-select {
  min-width: 144px;
  background: var(--zd-raised-2);
  color: var(--zd-text);
}

.brain-client-input {
  max-width: 160px;
}

.brain-query-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brain-query-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 600px) {
  .brain-query-row {
    flex-direction: row;
    align-items: stretch;
  }

  .brain-query-row .text-field {
    flex: 1;
    min-width: 0;
  }
}

.brain-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.brain-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .brain-filter-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.brain-preset-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.brain-preset-fieldset > legend {
  margin: 0 0 8px;
  padding: 0;
  color: var(--zd-muted);
}

.brain-result-excerpt {
  color: var(--zd-soft);
  font-size: var(--text-body);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.brain-client-sublist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 0;
  padding: 8px 0 0 16px;
  list-style: none;
  border-top: 1px solid var(--zd-hairline);
}

.brain-client-sublist > li + li {
  margin-top: 0;
}

.brain-textarea {
  height: auto;
  min-height: 96px;
  padding: 12px 16px;
  border-radius: var(--radius-group);
  line-height: 1.5;
  resize: vertical;
}

.brain-kit {
  font-family: var(--font-mono);
  font-size: var(--text-label);
}

.brain-form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (forced-colors: active) {
  .brain-tab[aria-selected="true"],
  .brain-tab[aria-selected="true"]:hover {
    background: Highlight;
    color: HighlightText;
  }

  .brain-panel-sub {
    border: 1px solid CanvasText;
  }
}

/* ---------- Ask your AI dock (app.zerodrive.dev & /support/) ---------- */

.ask-ai-wrap {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 16px;
  z-index: 4;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

@media (max-width: 599px) {
  body:has(#app-nav:not([hidden])) .ask-ai-wrap {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 600px) {
  body:has(main[data-view="drive"] .capsule > .bar-set:not([hidden]) > :not([hidden])) .ask-ai-wrap {
    bottom: calc(64px + 16px);
  }
}

.ask-ai-dock {
  pointer-events: auto;
  max-width: 780px;
}

.ask-ai-dock[open] {
  position: relative;
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  width: min(100%, 780px);
  padding: 12px 12px 16px 16px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: 20px;
  background: rgba(21, 21, 21, 0.92);
  box-shadow: var(--zd-rim);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.ask-ai-dock[open]::after {
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 32px;
  height: 4px;
  border-radius: var(--radius-control);
  background: rgba(244, 245, 255, 0.22);
  transform: translateX(-50%);
  content: "";
}

.ask-ai-dock:not([open]) {
  margin-left: auto;
}

.ask-ai-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  cursor: pointer;
  color: var(--zd-muted);
  font-size: var(--text-label);
  font-weight: var(--weight-regular);
  transition: background-color 160ms, color 160ms;
}

.ask-ai-toggle::-webkit-details-marker {
  display: none;
}

.ask-ai-dock[open] > .ask-ai-toggle {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-control);
}

.ask-ai-dock[open] > .ask-ai-toggle:hover {
  background: var(--zd-hover);
  color: var(--zd-text);
}

.ask-ai-dock:not([open]) > .ask-ai-toggle {
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-control);
  background: rgba(21, 21, 21, 0.92);
  color: var(--zd-text);
  box-shadow: var(--zd-rim);
}

.ask-ai-dock:not([open]) > .ask-ai-toggle:hover {
  background: var(--zd-raised);
}

.ask-ai-dock[open] .ask-ai-toggle-open {
  display: none;
}

.ask-ai-dock:not([open]) .ask-ai-toggle-close {
  display: none;
}

.ask-ai-panel {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-width: 0;
}

.ask-ai-copy {
  flex: 1 1 200px;
  margin: 0;
  color: var(--zd-soft);
  font-size: var(--text-label);
  line-height: 1.35;
}

.ask-ai-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ask-ai-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-control);
  background: var(--zd-raised);
  color: var(--zd-text);
  font-size: var(--text-label);
  font-weight: var(--weight-regular);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms, border-color 160ms, transform 160ms;
}

.ask-ai-link:hover {
  border-color: var(--zd-outline);
  background: var(--zd-raised-2);
}

.ask-ai-link:active {
  transform: scale(0.98);
}

.ask-ai-link:focus-visible,
.ask-ai-toggle:focus-visible {
  outline: 2px solid var(--zd-blue);
  outline-offset: 2px;
}

.ask-ai-icon-claude {
  color: #e27a53;
}

.ask-ai-icon-chatgpt {
  color: var(--zd-text);
}

.ask-ai-icon-gemini {
  color: #7ca7ff;
}

.ask-ai-icon-perplexity {
  color: #46c6d2;
}

.ask-ai-icon-grok {
  color: var(--zd-text);
}

@media (forced-colors: active) {
  .ask-ai-dock[open],
  .ask-ai-dock:not([open]) > .ask-ai-toggle,
  .ask-ai-link {
    border: 1px solid CanvasText;
  }
}

/* ---------- Motion ---------- */

/*
 * The motion is the 160 ms colour change on controls, the sidebar folding, a dialog and its scrim
 * opening, and the spinner. All of it goes when the viewer asks for less motion: the spinner stands
 * still and its words carry the state.
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after,
  *::backdrop {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Web Upgrade (.zd-up-*) ---------- */

.zd-up-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 8px;
}

.zd-up-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-group);
  background: var(--zd-fill);
}

.zd-up-card > * {
  margin: 0;
}

.zd-up-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.zd-up-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.zd-up-steps,
.zd-up-list,
.zd-up-recipes-list,
.zd-up-scope-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zd-up-step,
.zd-up-item-row,
.zd-up-recipe-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 12px 16px;
  border: 1px solid var(--zd-hairline);
  border-radius: var(--radius-group);
  background: var(--zd-pane);
}

.zd-up-recipe-row {
  flex-direction: column;
  align-items: stretch;
}

.zd-up-recipe-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
}

.zd-up-recipe-meta,
.zd-up-item-meta {
  display: flex;
  flex: 1 1 240px;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.zd-up-recipe-title,
.zd-up-quick-title,
.zd-up-step-title {
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  color: var(--zd-text);
}

.zd-up-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-right: 8px;
  padding: 2px 8px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-control);
  background: var(--zd-raised);
  color: var(--zd-soft);
  font-size: var(--text-label);
}

.zd-up-recipe-actions,
.zd-up-item-actions,
.zd-up-inline-actions,
.zd-up-quick-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.zd-up-recipe-folder-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.zd-up-folder-input {
  flex: 1 1 220px;
}

.zd-up-recipes-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zd-up-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.zd-up-chip[aria-pressed="true"] {
  border-color: var(--zd-outline);
  background: var(--zd-raised-2);
  color: var(--zd-text);
}

.zd-up-quick-grid,
.zd-up-breakdown-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .zd-up-quick-grid,
  .zd-up-breakdown-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .zd-up-breakdown-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.zd-up-quick-card,
.zd-up-stat-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--zd-hairline);
  border-radius: var(--radius-group);
  background: var(--zd-pane);
}

.zd-up-stat-value {
  font-size: var(--text-heading);
  font-weight: var(--weight-regular);
  color: var(--zd-text);
}

.zd-up-prompt-preview {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--zd-hairline);
  border-radius: 12px;
  background: var(--zd-content);
  color: var(--zd-soft);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.zd-up-input {
  width: 100%;
  min-width: 0;
}

.zd-up-btn,
.zd-up-preview-btn {
  min-height: 32px;
  padding: 4px 12px;
  font-size: var(--text-label);
}

.zd-up-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-control);
  background: var(--zd-fill);
  color: var(--zd-soft);
  font-family: inherit;
  font-size: var(--text-label);
  cursor: pointer;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}

.zd-up-row-btn:hover {
  border-color: var(--zd-outline);
  background: var(--zd-hover);
  color: var(--zd-text);
}

.zd-up-row-btn:focus-visible {
  outline: 3px solid var(--zd-blue);
  outline-offset: 2px;
}

.zd-up-editor-dialog,
.zd-up-history-dialog,
.zd-up-grant-dialog,
.zd-up-perms-dialog,
.zd-up-meta-dialog {
  width: 680px;
  max-width: calc(100% - 32px);
}

.zd-up-editor-area {
  width: 100%;
  min-height: 240px;
  padding: 12px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: 12px;
  background: var(--zd-content);
  color: var(--zd-text);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  line-height: 1.5;
  resize: vertical;
}

.zd-up-secret-area {
  min-height: 64px;
}

.zd-up-editor-area:focus-visible {
  outline: 3px solid var(--zd-blue);
  outline-offset: 2px;
}

.zd-up-diff-box {
  margin: 0;
  padding: 12px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: 12px;
  background: var(--zd-content);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  line-height: 1.5;
}

.zd-up-diff-line {
  display: block;
  padding: 0 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.zd-up-diff-add {
  background: rgba(57, 255, 20, 0.12);
  color: var(--zd-good);
}

.zd-up-diff-del {
  background: rgba(255, 46, 99, 0.14);
  color: var(--zd-bad);
}

.zd-up-diff-hdr {
  color: var(--zd-muted);
}

.zd-up-recovery-bar {
  margin-bottom: 16px;
}

.zd-up-refs-box {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 2px solid var(--zd-hairline-strong);
}

.zd-up-ref-list {
  margin: 4px 0 0;
  padding-left: 16px;
}

.zd-up-scope-group {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--zd-hairline);
  border-radius: 12px;
}

.zd-up-notice {
  margin: 0;
}

.zd-up-head-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.zd-up-head-copy > * {
  margin: 0;
}

.zd-up-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .zd-up-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.zd-up-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.zd-up-inline-form .zd-up-input {
  flex: 1 1 220px;
}

.zd-up-days-input {
  width: 96px;
  flex: 0 0 auto;
}

.zd-up-select {
  width: auto;
  min-width: 140px;
  max-width: 100%;
  min-height: 32px;
  padding: 4px 12px;
  font-size: var(--text-label);
}

.zd-up-subpanel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: 12px;
  background: var(--zd-pane);
}

.zd-up-files-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-group);
  background: var(--zd-pane);
}

.zd-up-files-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.zd-up-files-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.zd-up-files-search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.zd-up-files-search-form .zd-up-input {
  flex: 1 1 220px;
}

.zd-up-segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-control);
  background: var(--zd-content);
}

.zd-up-seg-btn {
  padding: 4px 12px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--zd-muted);
  font-family: inherit;
  font-size: var(--text-label);
  font-weight: var(--weight-regular);
  cursor: pointer;
  transition: background-color 160ms, color 160ms;
}

.zd-up-seg-btn:hover {
  color: var(--zd-text);
}

.zd-up-seg-btn[aria-pressed="true"] {
  background: var(--zd-raised-2);
  color: var(--zd-text);
}

.zd-up-seg-btn:focus-visible {
  outline: 3px solid var(--zd-blue);
  outline-offset: 2px;
}

.zd-up-grid-mode #files-table {
  display: none;
}

.zd-up-files-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  .zd-up-files-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .zd-up-files-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.zd-up-files-bar[hidden],
.zd-up-files-grid[hidden],
.zd-up-search-results[hidden],
.zd-up-alt-banner[hidden],
.zd-up-alt-empty[hidden],
.zd-up-subpanel[hidden] {
  display: none;
}

.zd-up-file-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--zd-hairline);
  border-radius: var(--radius-group);
  background: var(--zd-pane);
  transition: border-color 160ms, background-color 160ms;
}

.zd-up-file-tile:hover {
  border-color: var(--zd-hairline-strong);
  background: var(--zd-raised);
}

.zd-up-tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.zd-up-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: 12px;
  background: var(--zd-raised-2);
  color: var(--zd-soft);
}

.zd-up-tile-icon-folder {
  color: var(--zd-text);
}

.zd-up-tile-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.zd-up-tile-name {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--zd-text);
  font-family: inherit;
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.zd-up-tile-name:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.zd-up-tile-name:focus-visible {
  outline: 3px solid var(--zd-blue);
  outline-offset: 2px;
}

.zd-up-tile-meta {
  margin: 0;
  color: var(--zd-muted);
}

.zd-up-tile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.zd-up-search-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-group);
  background: var(--zd-pane);
}

.zd-up-snippets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.zd-up-snippet-line {
  margin: 0;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--zd-content);
  color: var(--zd-soft);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  overflow-wrap: anywhere;
}

.zd-up-alt-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 12px;
  padding: 12px 16px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: 12px;
  background: var(--zd-raised);
}

.zd-up-alt-empty {
  margin: 0;
  padding: 16px 0;
}

.zd-up-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-control);
  background: var(--zd-raised);
  color: var(--zd-soft);
  font-size: var(--text-label);
  white-space: nowrap;
}

.zd-up-pill-good {
  border-color: rgba(57, 255, 20, 0.35);
  color: var(--zd-good);
}

.zd-up-pill-warn {
  border-color: rgba(255, 184, 0, 0.35);
  color: var(--zd-warn);
}

.zd-up-pill-bad {
  border-color: var(--zd-bad-rim);
  color: var(--zd-bad);
}

.zd-up-pill-accent {
  border-color: var(--zd-blue);
  color: var(--zd-text);
}

.zd-up-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--zd-hairline);
  border-radius: 12px;
  background: var(--zd-pane);
}

.zd-up-meta-grid dt {
  color: var(--zd-muted);
}

.zd-up-meta-val {
  margin: 0;
  color: var(--zd-text);
  overflow-wrap: anywhere;
}

.zd-up-perms-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zd-up-vote-btn[aria-pressed="true"] {
  border-color: var(--zd-blue);
  background: var(--zd-raised-2);
  color: var(--zd-text);
}

.zd-up-account-switcher {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
}

.zd-up-account-switcher[hidden],
.zd-up-switcher-menu[hidden],
.zd-up-switcher-plan[hidden],
#zd-up-connected-accounts[hidden] {
  display: none;
}

.zd-up-switcher-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--zd-hairline-strong);
  border-radius: var(--radius-control);
  background: var(--zd-raised);
  color: var(--zd-text);
  font-family: inherit;
  font-size: var(--text-label);
  font-weight: var(--weight-regular);
  cursor: pointer;
  transition: background-color 160ms, border-color 160ms;
}

.zd-up-switcher-pill:hover {
  border-color: var(--zd-outline);
  background: var(--zd-raised-2);
}

.zd-up-switcher-pill:focus-visible {
  outline: 3px solid var(--zd-blue);
  outline-offset: 2px;
}

.zd-up-switcher-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zd-up-switcher-plan {
  margin-right: 0;
}

.zd-up-switcher-menu {
  top: calc(100% + 4px);
  right: 0;
  min-width: 240px;
}

.zd-up-switcher-item {
  justify-content: space-between;
}

.zd-up-switcher-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 599px) {
  .zd-up-switcher-plan {
    display: none;
  }
}

.zd-up-link-dialog {
  width: 520px;
  max-width: calc(100% - 32px);
}

.zd-up-btn-danger {
  color: var(--zd-bad);
}

.zd-up-btn-danger:hover {
  border-color: var(--zd-bad-rim);
}

.zd-up-dialog:modal,
.zd-up-dialog::backdrop {
  overscroll-behavior: contain;
}

.zd-up-dialog:modal {
  overflow: auto;
}

.zd-up-cloud-crumbs {
  flex: 1 1 240px;
  min-width: 0;
}

.zd-up-scan-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--zd-hairline);
  border-radius: var(--radius-control);
  background: var(--zd-content);
}

.zd-up-scan-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zd-up-scan-group h4 {
  margin: 0;
  color: var(--zd-muted);
}

.zd-up-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: var(--text-label);
  font-weight: var(--weight-regular);
  color: var(--zd-text);
  cursor: pointer;
}

.zd-up-cloud-img-preview {
  display: block;
  max-width: 100%;
  max-height: 360px;
  margin-top: 12px;
  border: 1px solid var(--zd-hairline);
  border-radius: var(--radius-control);
  object-fit: contain;
}

@media (pointer: coarse) {
  .zd-up-seg-btn,
  .zd-up-cloud-crumbs .crumb {
    min-height: 44px;
  }
}

@media (forced-colors: active) {
  .zd-up-scan-panel,
  .zd-up-grid-card,
  .zd-up-dialog {
    border: 1px solid CanvasText;
  }

  .zd-up-seg-btn[aria-pressed="true"] {
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Spatial Workspace (Concept I) ---------- */

@property --zd-rim-angle {
  syntax: "<angle>";
  initial-value: 135deg;
  inherits: false;
}

@keyframes zd-rim-spin {
  to {
    --zd-rim-angle: 495deg;
  }
}

:root {
  --sp-card-pad: calc(16px + 4px);
  --sp-cell-pad-x: calc(8px + 2px);
  --sp-section-gap: calc(16px + 2px);
  --sp-switch-on: #0a84ff;
  --sp-bg: #151619;
  --sp-sidebar: #242529;
  --sp-card: #1d1e23;
  --sp-card-hover: #23252c;
  --sp-input: #191a1f;
  --sp-button: #28292f;
  --sp-button-hover: #32343c;
  --sp-text: #f5f5f7;
  --sp-muted: #a7a9b4;
  --sp-border: rgba(255, 255, 255, 0.08);
  --sp-border-strong: rgba(255, 255, 255, 0.16);
  --sp-active: rgba(255, 255, 255, 0.08);
  --sp-green: #51d58b;
  --sp-blue: #6089ff;
  --sp-amber: #f5b942;
  --sp-coral: #d97757;
  --sp-teal: #10a37f;
  --sp-slate: #8296b9;
  --sp-danger: #f06277;
  --sp-danger-rim: rgba(240, 98, 119, 0.45);
  --sp-on-danger: #ffffff;
  --sp-primary: #f1f2f5;
  --sp-primary-text: #151619;
  --sp-shadow-sidebar: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 36px rgba(0, 0, 0, 0.24);
  --sp-shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

:root:has(> head > meta[name="color-scheme"][content="light"]),
:root[data-theme="light"] {
  color-scheme: light;
  --sp-bg: #f6f7f9;
  --sp-sidebar: #ebedf2;
  --sp-card: #ffffff;
  --sp-card-hover: #f9fafc;
  --sp-input: #f4f5f8;
  --sp-button: #e7e9ef;
  --sp-button-hover: #dcdfe8;
  --sp-text: #17181c;
  --sp-muted: #5f6472;
  --sp-border: rgba(23, 24, 28, 0.09);
  --sp-border-strong: rgba(23, 24, 28, 0.16);
  --sp-active: rgba(23, 24, 28, 0.06);
  --sp-green: #148f4e;
  --sp-blue: #365ef2;
  --sp-amber: #b86f08;
  --sp-coral: #c95b3b;
  --sp-danger: #c9334b;
  --sp-danger-rim: rgba(201, 51, 75, 0.4);
  --sp-on-danger: #ffffff;
  --sp-primary: #17181c;
  --sp-primary-text: #ffffff;
  --sp-shadow-sidebar: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 12px 32px rgba(15, 23, 42, 0.08);
  --sp-shadow-card: 0 1px 3px rgba(15, 23, 42, 0.05);
}

/* Unified Design System Token Bridge for both Dark and Light Modes */
body.zd-spatial {
  --radius-control: 10px;
  --radius-group: 14px;
  --zd-content: var(--sp-bg);
  --zd-pane: var(--sp-card);
  --zd-raised: var(--sp-button);
  --zd-raised-2: var(--sp-button-hover);
  --zd-raised-3: var(--sp-button-hover);
  --zd-raised-4: var(--sp-border-strong);
  --zd-tile: var(--sp-primary);
  --zd-ink: var(--sp-primary-text);
  --zd-text: var(--sp-text);
  --zd-soft: var(--sp-text);
  --zd-muted: var(--sp-muted);
  --zd-blue: var(--sp-blue);
  --zd-on-blue: #ffffff;
  --zd-good: var(--sp-green);
  --zd-warn: var(--sp-amber);
  --zd-bad: var(--sp-danger);
  --zd-on-bad: var(--sp-on-danger);
  --zd-bad-rim: var(--sp-danger-rim);
  --zd-hairline: var(--sp-border);
  --zd-hairline-strong: var(--sp-border-strong);
  --zd-hover: var(--sp-active);
  --zd-hover-row: var(--sp-active);
  --zd-fill: var(--sp-input);
  --zd-track: var(--sp-active);
  --zd-outline: var(--sp-border-strong);
  --zd-underline: var(--sp-muted);
  --zd-rim: var(--sp-shadow-card);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Schibsted Grotesk", "Segoe UI", sans-serif;
  font-size: 14px;
  font-synthesis: style;
  letter-spacing: 0;
  background: var(--sp-bg);
  color: var(--sp-text);
  -webkit-font-smoothing: antialiased;
}

/* Lock scroll behind native top-layer dialogs cleanly */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

body.zd-spatial strong,
body.zd-spatial th,
body.zd-spatial h1,
body.zd-spatial h2,
body.zd-spatial h3 {
  font-weight: 600;
}

/* Remove marketing dock and legacy top search/account pills when signed in */
body.zd-spatial .ask-ai-wrap {
  display: none;
}

body.zd-spatial:has(#app-nav:not([hidden])) #search-bar {
  display: none;
}

body.zd-spatial:has(#app-nav:not([hidden])) .site-header .wordmark,
body.zd-spatial .site-header nav,
body.zd-spatial .zd-up-account-switcher,
body.zd-spatial #signed-in-bar {
  display: none;
}

body.zd-spatial:has(#app-nav:not([hidden])) .site-header,
body.zd-spatial:has(#search-bar:not([hidden])) .site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 0 12px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

body.zd-spatial .toolbar-title {
  display: block;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--sp-muted);
}

body.zd-spatial main.account-app {
  background: transparent;
  border-radius: 0;
}

.zd-sp-btn-short {
  display: none;
}

/* Desktop & Tablet Floating Tahoe Layout */
@media (min-width: 600px) {
  body.zd-spatial:has(#app-nav:not([hidden])) {
    padding: 16px;
    column-gap: 24px;
    row-gap: 0;
    height: auto;
    min-height: 100dvh;
    background: var(--sp-bg);
  }

  body.zd-spatial .zd-sp-mobile-tabs,
  body.zd-spatial .zd-sp-mobile-brand {
    display: none;
  }

  body.zd-spatial .app-nav > #nav-logo,
  body.zd-spatial .app-nav > #nav-list,
  body.zd-spatial .app-nav > .nav-spacer,
  body.zd-spatial .app-nav > #nav-user {
    display: none;
  }

  body.zd-spatial .app-nav {
    width: var(--rail);
    height: calc(100dvh - 32px);
    position: sticky;
    top: 16px;
    align-self: start;
    padding: 12px 8px;
    border-radius: 22px;
    background: var(--sp-sidebar);
    background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.03), transparent);
    box-shadow: var(--sp-shadow-sidebar);
    overflow-y: auto;
    overflow-x: hidden;
    align-items: stretch;
    gap: 0;
  }

  body.zd-spatial .app-nav::before {
    display: none;
  }

  body.zd-spatial:has(#signed-in-bar:not([hidden])) .site-header,
  body.zd-spatial:has(#app-nav:not([hidden])) .site-header,
  body.zd-spatial:has(#search-bar:not([hidden])) .site-header {
    grid-area: header;
    min-height: 48px;
    padding: 0 12px 12px 0;
    margin-right: 0;
    width: 100%;
    max-width: 1280px;
  }

  body.zd-spatial:has(#app-nav:not([hidden])) main,
  body.zd-spatial main.account-app {
    background: transparent;
    border-radius: 0;
    padding: 4px 12px 32px 0;
    max-width: 1280px;
    min-height: auto;
    overflow-y: visible;
  }

  body.zd-spatial #page-title {
    font-size: clamp(24px, 2.6vw, 36px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.18;
    margin: 0 0 8px;
    color: var(--sp-text);
  }

  body.zd-spatial .site-footer {
    max-width: 1280px;
    padding: 16px 12px 16px 0;
    margin-top: 24px;
    border-top: 1px solid var(--sp-border);
    color: var(--sp-muted);
    font-size: 12px;
  }
}

@media (min-width: 900px) {
  html:not(.nav-rail) body.zd-spatial .app-nav {
    width: 248px;
    padding: 16px;
  }

  body.zd-spatial:has(#signed-in-bar:not([hidden])) .site-header,
  body.zd-spatial:has(#app-nav:not([hidden])) .site-header,
  body.zd-spatial:has(#search-bar:not([hidden])) .site-header {
    margin-right: 0;
  }
}

@media (max-width: 599px) {
  body.zd-spatial:has(#app-nav:not([hidden])) {
    padding-bottom: calc(var(--tabbar-h) + 24px);
  }

  body.zd-spatial .zd-sp-sidebar-root,
  body.zd-spatial .app-nav > #nav-logo,
  body.zd-spatial .app-nav > #nav-list,
  body.zd-spatial .app-nav > .nav-spacer,
  body.zd-spatial .app-nav > #nav-user,
  body.zd-spatial .zd-sp-kbd-hint,
  body.zd-spatial .zd-sp-theme-label,
  body.zd-spatial .zd-sp-btn-full {
    display: none;
  }

  body.zd-spatial .zd-sp-btn-short {
    display: inline;
  }

  body.zd-spatial main.account-app {
    padding: 4px 12px 24px;
  }

  body.zd-spatial #page-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 8px;
    color: var(--sp-text);
  }

  body.zd-spatial:has(#app-nav:not([hidden])) .site-header {
    padding: 8px 12px;
    gap: 8px;
  }

  body.zd-spatial .zd-sp-header-actions {
    gap: 4px;
  }

  body.zd-spatial .zd-sp-header-btn {
    min-height: 32px;
    padding: 0 8px;
    font-size: 12px;
    gap: 4px;
  }

  body.zd-spatial .zd-sp-btn-primary {
    min-height: 32px;
    padding: 0 12px;
    font-size: 12px;
  }

  body.zd-spatial .app-nav {
    background: var(--sp-sidebar);
    border: 1px solid var(--sp-border-strong);
    box-shadow: var(--sp-shadow-sidebar);
    padding: 4px 8px;
  }

  .zd-sp-mobile-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    gap: 4px;
  }

  .zd-sp-mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    padding: 4px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--sp-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
  }

  .zd-sp-mobile-tab .zd-sp-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .zd-sp-mobile-tab.is-active,
  .zd-sp-mobile-tab[aria-current="page"] {
    color: var(--sp-text);
    background: var(--sp-active);
    font-weight: 600;
  }

  body.zd-spatial .site-footer {
    padding: 12px 12px 0;
    margin-top: 16px;
    border-top: 1px solid var(--sp-border);
    color: var(--sp-muted);
    font-size: 12px;
  }
}

/* Compact icon-only mode when rail is active (600-899px or collapsed) */
html.nav-rail body.zd-spatial .zd-sp-brand-name,
html.nav-rail body.zd-spatial .zd-sp-brand-wordmark,
html.nav-rail body.zd-spatial .zd-sp-workspace-text,
html.nav-rail body.zd-spatial .zd-sp-workspace-chevron,
html.nav-rail body.zd-spatial .zd-sp-section-label,
html.nav-rail body.zd-spatial .zd-sp-nav-text,
html.nav-rail body.zd-spatial .zd-sp-storage-card {
  display: none;
}

html.nav-rail body.zd-spatial .zd-sp-brand-row {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 0 12px;
}

html.nav-rail body.zd-spatial .zd-sp-workspace-btn {
  justify-content: center;
  padding: 8px;
}

html.nav-rail body.zd-spatial .zd-sp-nav-link {
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0 auto;
  border-radius: 12px;
}

@media (max-width: 899px) {
  body.zd-spatial .zd-sp-brand-name,
  body.zd-spatial .zd-sp-brand-wordmark,
  body.zd-spatial .zd-sp-workspace-text,
  body.zd-spatial .zd-sp-workspace-chevron,
  body.zd-spatial .zd-sp-section-label,
  body.zd-spatial .zd-sp-nav-text,
  body.zd-spatial .zd-sp-storage-card,
  body.zd-spatial .zd-sp-collapse-btn {
    display: none;
  }

  body.zd-spatial .zd-sp-brand-row {
    justify-content: center;
    padding: 0 0 12px;
  }

  body.zd-spatial .zd-sp-workspace-btn {
    justify-content: center;
    padding: 8px;
  }

  body.zd-spatial .zd-sp-nav-link {
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0 auto;
    border-radius: 12px;
  }
}

/* Floating Tahoe Sidebar Internals */
.zd-sp-sidebar-root {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.zd-sp-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 16px;
}

.zd-sp-brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sp-text);
  text-decoration: none;
  min-width: 0;
}

.zd-sp-mobile-brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  text-decoration: none;
  border-radius: 8px;
}

.zd-sp-logo-badge {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  background: #0f0f0f;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.zd-sp-logo-badge-sm {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.zd-sp-logo-mark {
  display: block;
  height: 20px;
  width: auto;
  filter: invert(1) brightness(1.04);
}

.zd-sp-logo-badge-sm .zd-sp-logo-mark {
  height: 16px;
}

.zd-sp-brand-wordmark {
  display: block;
  height: 20px;
  width: auto;
  flex: none;
}

.zd-sp-brand-wordmark-light {
  display: none;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) .zd-sp-brand-wordmark-dark,
:root[data-theme="light"] .zd-sp-brand-wordmark-dark {
  display: none;
}

@media (min-width: 900px) {
  :root:not(.nav-rail):has(> head > meta[name="color-scheme"][content="light"]) .zd-sp-brand-wordmark-light,
  :root:not(.nav-rail)[data-theme="light"] .zd-sp-brand-wordmark-light {
    display: block;
  }
}

:root:has(> head > meta[name="color-scheme"][content="light"]) .zd-sp-logo-badge,
:root[data-theme="light"] .zd-sp-logo-badge {
  border-color: rgba(15, 15, 15, 0.14);
}

.zd-sp-brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--sp-text);
  white-space: nowrap;
}

.zd-sp-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sp-muted);
  cursor: pointer;
  flex: none;
  padding: 0;
}

.zd-sp-collapse-btn:hover {
  background: var(--sp-active);
  color: var(--sp-text);
}

.zd-sp-workspace-wrap {
  position: relative;
  margin-bottom: 16px;
}

.zd-sp-workspace-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  color: var(--sp-text);
  background: var(--sp-active);
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 160ms, border-color 160ms;
}

.zd-sp-workspace-btn:hover {
  border-color: var(--sp-border-strong);
  background: var(--sp-button-hover);
}

.zd-sp-workspace-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.zd-sp-workspace-chevron {
  flex: none;
  color: var(--sp-muted);
}

.zd-sp-workspace-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 8px;
  border: 1px solid var(--sp-border-strong);
  border-radius: 14px;
  background: var(--sp-card);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.52);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zd-sp-workspace-menu[hidden] {
  display: none;
}

.zd-sp-menu-label {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sp-muted);
}

.zd-sp-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sp-text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.zd-sp-menu-item:hover,
.zd-sp-menu-item:focus-visible {
  background: var(--sp-active);
}

.zd-sp-menu-divider {
  border: 0;
  border-top: 1px solid var(--sp-border);
  margin: 4px 0;
}

.zd-sp-nav-group {
  display: grid;
  gap: 4px;
}

.zd-sp-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--sp-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms, color 160ms;
}

.zd-sp-nav-link:hover {
  background: var(--sp-active);
  color: var(--sp-text);
}

.zd-sp-nav-link.is-active,
.zd-sp-nav-link[aria-current="page"] {
  background: var(--sp-active);
  color: var(--sp-text);
  font-weight: 600;
}

.zd-sp-nav-link .zd-sp-icon {
  flex: none;
  width: 28px;
  height: 28px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.zd-sp-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zd-sp-nav-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.zd-sp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 8px 8px 12px;
}

.zd-sp-section-label {
  color: var(--sp-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.zd-sp-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--sp-muted);
  font-size: 18px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.zd-sp-icon-btn:hover {
  background: var(--sp-active);
  color: var(--sp-text);
}

.zd-sp-drives-nav {
  display: grid;
  gap: 2px;
}

.zd-sp-drive-link {
  color: var(--sp-text);
  font-weight: 400;
}

.zd-sp-secondary-nav {
  margin-top: 24px;
  display: grid;
  gap: 4px;
}

.zd-sp-storage-card {
  margin-top: auto;
  padding: 24px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.zd-sp-storage-meter {
  display: block;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--sp-active);
  accent-color: var(--sp-blue);
  appearance: none;
}

.zd-sp-storage-meter::-webkit-progress-bar {
  background: var(--sp-active);
  border-radius: 999px;
}

.zd-sp-storage-meter::-webkit-progress-value {
  background: var(--sp-blue);
  border-radius: 999px;
}

.zd-sp-storage-meter::-moz-progress-bar {
  background: var(--sp-blue);
  border-radius: 999px;
}

.zd-sp-storage-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--sp-muted);
  white-space: nowrap;
}

.zd-sp-storage-info > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.zd-sp-storage-info > span:last-child {
  flex: none;
}

/* Spatial Header Actions */
.zd-sp-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.zd-sp-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  background: var(--sp-button);
  color: var(--sp-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms, border-color 160ms, opacity 160ms;
}

.zd-sp-header-btn:hover {
  background: var(--sp-button-hover);
  border-color: var(--sp-border-strong);
}

.zd-sp-btn-primary {
  border: 0;
  border-radius: 10px;
  min-height: 36px;
  padding: 0 16px;
  background: var(--sp-primary);
  color: var(--sp-primary-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 160ms;
}

.zd-sp-btn-primary:hover {
  opacity: 0.9;
}

/* Dedicated Horizontal Sub-Tabs Host */
.zd-sp-subtabs-host {
  margin: 0 0 24px;
}

.zd-sp-subtabs-host[hidden] {
  display: none;
}

.zd-sp-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.zd-sp-subtab {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid var(--sp-border);
  background: transparent;
  color: var(--sp-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 160ms, color 160ms, border-color 160ms;
}

.zd-sp-subtab:hover {
  background: var(--sp-active);
  color: var(--sp-text);
}

.zd-sp-subtab[aria-current="page"] {
  background: var(--sp-card);
  border-color: var(--sp-border-strong);
  color: var(--sp-text);
  font-weight: 600;
}

/* Spatial Overview (#home) */
.zd-sp-status-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
  margin: 0 0 16px;
  color: var(--sp-muted);
  font-size: 14px;
}

.zd-sp-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--sp-green);
}

.zd-sp-status-line > .zd-sp-dot {
  margin-top: 4px;
}

.zd-sp-dot-coral { background: var(--sp-coral); }
.zd-sp-dot-blue { background: var(--sp-blue); }
.zd-sp-dot-amber { background: var(--sp-amber); }
.zd-sp-dot-green { background: var(--sp-green); }

/* Signature Obsidian Metallic Silver Rim-Light AI Command Hub Composer */
.zd-sp-composer {
  color-scheme: only dark;
  accent-color: #6089ff;
  position: relative;
  border: 2px solid transparent;
  border-radius: 24px;
  padding: 16px 24px;
  margin-bottom: 16px;
  background:
    linear-gradient(#0d0e10, #0d0e10) padding-box,
    conic-gradient(
      from var(--zd-rim-angle),
      #8c95a6 0deg,
      #cdd5e2 34deg,
      #ffffff 66deg,
      #e2e8f2 92deg,
      #9aa3b4 132deg,
      #858e9e 176deg,
      #c2cad8 220deg,
      #f8faff 254deg,
      #cdd5e2 288deg,
      #939cad 328deg,
      #8c95a6 360deg
    ) border-box;
  color: #f5f5f7;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.36);
  animation: zd-rim-spin 14s linear infinite;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) .zd-sp-composer,
:root[data-theme="light"] .zd-sp-composer {
  background:
    linear-gradient(#0d0e10, #0d0e10) padding-box,
    conic-gradient(
      from var(--zd-rim-angle),
      #6a7385 0deg,
      #adb6c6 34deg,
      #dde3ed 66deg,
      #bec7d6 92deg,
      #7c8596 132deg,
      #616a7a 176deg,
      #a5aebf 220deg,
      #d8dfe9 254deg,
      #acb5c5 288deg,
      #747d8f 328deg,
      #6a7385 360deg
    ) border-box;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.zd-sp-hub-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.zd-sp-composer-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f5f5f7;
}

.zd-sp-hub-modes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #17181d;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.zd-sp-hub-tab {
  padding: 4px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #a7a9b4;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 160ms, color 160ms;
}

.zd-sp-hub-tab:hover {
  color: #f5f5f7;
}

.zd-sp-hub-tab[aria-pressed="true"] {
  background: #282a32;
  color: #ffffff;
  font-weight: 600;
}

.zd-sp-prompt-box {
  background: #191a20;
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  display: flex;
  align-items: flex-end;
  padding: 8px 8px 8px 16px;
  min-height: 56px;
  gap: 12px;
}

.zd-sp-prompt-wave {
  flex: none;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  font-size: 18px;
  line-height: 1;
  user-select: none;
}

.zd-sp-prompt-box input,
.zd-sp-prompt-box textarea {
  background: transparent;
  color: #f5f5f7;
  border: 0;
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  max-height: 180px;
  padding: 8px 0;
  margin: 0;
  resize: none;
  field-sizing: content;
  overflow-y: auto;
}

.zd-sp-prompt-box input::placeholder,
.zd-sp-prompt-box textarea::placeholder {
  color: #979aa8;
}

.zd-sp-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #151619;
  border: 0;
  border-radius: 50%;
  height: 40px;
  width: 40px;
  flex: none;
  padding: 0;
  cursor: pointer;
  transition: background-color 160ms, opacity 160ms, transform 140ms;
}

.zd-sp-send-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zd-sp-send-btn:disabled {
  background: rgba(255, 255, 255, 0.14);
  color: #8c90a0;
  opacity: 0.55;
  cursor: default;
}

.zd-sp-send-btn:not(:disabled):hover {
  opacity: 0.92;
}

.zd-sp-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.zd-sp-quick-actions button,
.zd-sp-quick-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: #24252b;
  color: #e3e4ea;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms;
}

.zd-sp-quick-actions button:hover,
.zd-sp-quick-actions a:hover {
  background: #2e3038;
}

.zd-sp-hub-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zd-sp-hub-panel[hidden] {
  display: none;
}

.zd-sp-tool-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.zd-sp-tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #191a20;
  color: #c5c7d0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.zd-sp-tool-pill[aria-pressed="true"] {
  background: #272933;
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-weight: 600;
}

.zd-sp-code-box {
  background: #14151a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #e3e4ea;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
}

.zd-sp-hub-dark-input,
.zd-sp-hub-dark-select {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  color: #f5f5f7;
  min-height: 36px;
  font-family: inherit;
  font-size: 13px;
}

.zd-sp-hub-dark-input {
  background: #191a20;
  padding: 8px 12px;
}

.zd-sp-hub-dark-btn {
  background: #24252b;
  color: #f5f5f7;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  min-height: 36px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.zd-sp-hub-dark-btn-primary {
  background: #f1f2f5;
  color: #151619;
  border: 0;
  border-radius: 10px;
  min-height: 36px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.zd-sp-composer-results {
  margin-top: 12px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #14151a;
  color: #f5f5f7;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zd-sp-composer-results[hidden] {
  display: none;
}

.zd-sp-composer-result-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: #1d1e24;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.zd-sp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.zd-sp-section-head h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--sp-text);
  margin: 0;
}

.zd-sp-text-link {
  color: var(--sp-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.zd-sp-text-link:hover {
  color: var(--sp-text);
}

/* 3-Column Drives Grid */
.zd-sp-drive-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 600px) {
  .zd-sp-drive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .zd-sp-drive-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.zd-sp-drive-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  min-height: 92px;
  padding: 16px;
  border-radius: 14px;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-card);
  color: var(--sp-text);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms, background-color 160ms, transform 160ms;
}

.zd-sp-drive-card:hover {
  border-color: rgba(96, 137, 255, 0.45);
  background: var(--sp-card-hover);
  transform: translateY(-2px);
}

.zd-sp-drive-card-add {
  background: transparent;
  border: 1px dashed var(--sp-border-strong);
  box-shadow: none;
  color: var(--sp-muted);
}

.zd-sp-drive-card-add:hover {
  color: var(--sp-text);
  background: var(--sp-active);
}

.zd-sp-drive-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: inherit;
}

.zd-sp-drive-card-top .zd-sp-icon {
  width: 18px;
  height: 18px;
  color: var(--sp-slate);
  flex: none;
}

.zd-sp-drive-card-top .zd-sp-dot {
  margin-left: auto;
}

.zd-sp-drive-card-meta {
  font-size: 13px;
  color: var(--sp-muted);
}

/* 2-Column AI Connections + Recent Activity Bento */
.zd-sp-bento-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

@media (min-width: 900px) {
  .zd-sp-bento-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.zd-sp-panel-card {
  display: flex;
  flex-direction: column;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 14px;
  padding: 16px 24px;
  box-shadow: var(--sp-shadow-card);
}

.zd-sp-panel-card h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--sp-text);
  margin: 0 0 8px;
}

.zd-sp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
}

.zd-sp-app-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  flex: none;
  background: var(--sp-active);
  border: 1px solid var(--sp-border);
  color: var(--sp-text);
}

.zd-sp-app-tile svg {
  width: 15px;
  height: 15px;
  display: block;
  flex: none;
}

.zd-sp-app-claude,
.zd-sp-app-claudecode {
  background: rgba(217, 119, 87, 0.14);
  border-color: rgba(217, 119, 87, 0.28);
  color: #d97757;
}

.zd-sp-app-cursor {
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.28);
  color: var(--sp-text);
}

.zd-sp-app-chatgpt {
  background: #10a37f;
  border-color: rgba(16, 163, 127, 0.4);
  color: #ffffff;
}

.zd-sp-app-codex {
  background: linear-gradient(180deg, #7a9dff, #3941ff);
  border-color: rgba(122, 157, 255, 0.4);
  color: #ffffff;
}

.zd-sp-app-perplexity {
  background: rgba(34, 184, 205, 0.14);
  border-color: rgba(34, 184, 205, 0.28);
  color: #22b8cd;
}

.zd-sp-app-gemini {
  background: rgba(49, 134, 255, 0.12);
  border-color: rgba(49, 134, 255, 0.26);
  color: #3186ff;
}

.zd-sp-app-mcp {
  background: var(--sp-active);
  border-color: var(--sp-border-strong);
  color: var(--sp-text);
}

.zd-sp-tool-pill .zd-sp-app-tile,
.zd-up-chip .zd-sp-app-tile {
  width: 18px;
  height: 18px;
  border-radius: 5px;
}

.zd-sp-tool-pill .zd-sp-app-tile svg,
.zd-up-chip .zd-sp-app-tile svg {
  width: 12px;
  height: 12px;
}

.zd-sp-composer .zd-sp-app-cursor,
.zd-sp-composer .zd-sp-app-mcp {
  color: #f5f5f7;
}

.zd-sp-connect-tool-row .zd-sp-app-tile {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.zd-sp-connect-tool-row .zd-sp-app-tile svg {
  width: 18px;
  height: 18px;
}

.zd-sp-connect-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zd-sp-connect-group-head .zd-sp-app-tile {
  width: 20px;
  height: 20px;
  border-radius: 6px;
}

.zd-sp-connect-group-head .zd-sp-app-tile svg {
  width: 13px;
  height: 13px;
}

body.zd-spatial .zd-up-chip:has(.zd-sp-app-tile) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.zd-sp-row-status {
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--sp-green);
}

.zd-sp-row-connect {
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--sp-blue);
  background: transparent;
  border: 0;
  padding: 0;
  text-decoration: none;
  cursor: pointer;
}

.zd-sp-row-connect:hover {
  text-decoration: underline;
}

.zd-sp-panel-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--sp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Unified Components & Cards across ALL Sub-Views */
body.zd-spatial .btn,
body.zd-spatial .zd-up-btn,
body.zd-spatial .connection-disconnect {
  border-radius: 10px;
  min-height: 36px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
}

body.zd-spatial .btn-small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

body.zd-spatial .btn-primary {
  background: var(--sp-primary);
  color: var(--sp-primary-text);
  font-weight: 600;
}

body.zd-spatial .btn-secondary {
  background: var(--sp-button);
  color: var(--sp-text);
  border: 1px solid var(--sp-border);
}

body.zd-spatial .btn-secondary:hover {
  background: var(--sp-button-hover);
  border-color: var(--sp-border-strong);
}

body.zd-spatial .btn-outline {
  border: 1px solid var(--sp-border-strong);
  background: transparent;
  color: var(--sp-text);
}

body.zd-spatial .btn-danger {
  background: rgba(240, 98, 119, 0.14);
  color: var(--sp-danger);
  border: 1px solid var(--sp-danger-rim);
}

body.zd-spatial .btn-danger:hover {
  background: rgba(240, 98, 119, 0.22);
}

body.zd-spatial .text-field:not(select),
body.zd-spatial textarea.text-field,
body.zd-spatial .connect-field,
body.zd-spatial .zd-up-input:not(select) {
  border-radius: 10px;
  min-height: 36px;
  padding: 8px 12px;
  background: var(--sp-input);
  border: 1px solid var(--sp-border-strong);
  color: var(--sp-text);
  font-size: 13px;
}

body.zd-spatial select,
body.zd-spatial select.text-field,
body.zd-spatial select.zd-up-select,
body.zd-spatial select.zd-up-select-compact,
body.zd-spatial select.brain-select,
body.zd-spatial select.zd-up-input,
body.zd-spatial select.zd-sp-hub-dark-select {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 10px;
  height: 36px;
  min-height: 36px;
  padding: 0 32px 0 12px;
  background-color: var(--sp-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23a7a9b4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  border: 1px solid var(--sp-border-strong);
  color: var(--sp-text);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
}

body.zd-spatial select::-ms-expand {
  display: none;
}

body.zd-spatial select option {
  background-color: var(--sp-card);
  color: var(--sp-text);
}

:where(:root:has(> head > meta[name="color-scheme"][content="light"]), :root[data-theme="light"]) body.zd-spatial select,
:where(:root:has(> head > meta[name="color-scheme"][content="light"]), :root[data-theme="light"]) body.zd-spatial select.text-field,
:where(:root:has(> head > meta[name="color-scheme"][content="light"]), :root[data-theme="light"]) body.zd-spatial select.zd-up-select,
:where(:root:has(> head > meta[name="color-scheme"][content="light"]), :root[data-theme="light"]) body.zd-spatial select.zd-up-select-compact,
:where(:root:has(> head > meta[name="color-scheme"][content="light"]), :root[data-theme="light"]) body.zd-spatial select.brain-select,
:where(:root:has(> head > meta[name="color-scheme"][content="light"]), :root[data-theme="light"]) body.zd-spatial select.zd-up-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%235f6472' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.zd-spatial .zd-sp-composer select,
body.zd-spatial select.zd-sp-hub-dark-select {
  color-scheme: dark;
  background-color: #191a20;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23a7a9b4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  border-color: rgba(255, 255, 255, 0.16);
  color: #f5f5f7;
}

body.zd-spatial .zd-sp-composer select option,
body.zd-spatial select.zd-sp-hub-dark-select option {
  background-color: #191a20;
  color: #f5f5f7;
}

body.zd-spatial .share-chip,
body.zd-spatial .zd-up-chip,
body.zd-spatial .brain-tab {
  border-radius: 9px;
  min-height: 32px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
}

body.zd-spatial .account-app > .view-connect,
body.zd-spatial .account-app > .view-brain,
body.zd-spatial .account-app > .view-trash,
body.zd-spatial .account-app > .view-duplicates,
body.zd-spatial .trash-explainer,
body.zd-spatial .duplicates-explainer,
body.zd-spatial .duplicates-result,
body.zd-spatial .connect-group p,
body.zd-spatial .connect-steps {
  max-width: none;
}

body.zd-spatial .card,
body.zd-spatial .zd-up-card,
body.zd-spatial .settings-group,
body.zd-spatial .brain-panel,
body.zd-spatial #brain-buckets-group,
body.zd-spatial #brain-clients-group,
body.zd-spatial .connect-platform > .platform-group,
body.zd-spatial #connect > .connect-group {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 14px;
  padding: 16px 24px;
  box-shadow: var(--sp-shadow-card);
}

body.zd-spatial .zd-up-subpanel,
body.zd-spatial #brain-setup-box,
body.zd-spatial #brain-advisor-box,
body.zd-spatial #brain-rules-box {
  background: var(--sp-input);
  border: 1px solid var(--sp-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: none;
}

body.zd-spatial .zd-up-subpanel > .btn {
  align-self: flex-start;
}

@media (min-width: 600px) {
  body.zd-spatial .zd-up-subpanel .zd-up-row-head form.zd-up-inline-actions {
    flex-wrap: nowrap;
    flex: none;
  }

  body.zd-spatial .zd-up-subpanel .zd-up-row-head form.zd-up-inline-actions .zd-up-input {
    width: 220px;
  }
}

body.zd-spatial .zd-up-subpanel .zd-up-row-head form.zd-up-inline-actions .btn {
  flex: none;
  white-space: nowrap;
}

body.zd-spatial .connect-field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

body.zd-spatial .connect-field-row .connect-field {
  flex: 1 1 280px;
  min-width: 0;
}

body.zd-spatial .connect-platform {
  gap: 16px;
  margin-top: 16px;
}

body.zd-spatial .connect-platform > .platform-group {
  border-top: 1px solid var(--sp-border);
}

body.zd-spatial .connect-group,
body.zd-spatial .platform-group-label,
body.zd-spatial .settings-group h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--sp-text);
}

body.zd-spatial #zd-up-connect-prompt-bar {
  margin-bottom: 16px;
}

.zd-sp-connect-tools-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 600px) {
  .zd-sp-connect-tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.zd-sp-connect-tool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--sp-input);
  border: 1px solid var(--sp-border);
}

.zd-sp-connect-tool-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.zd-sp-connect-tool-meta .zd-up-item-meta {
  min-width: 0;
}

.zd-sp-connect-tool-row .btn {
  flex: none;
  white-space: nowrap;
}

.zd-sp-connect-steps-details {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 14px;
  padding: 16px 24px;
  margin: 16px 0;
}

.zd-sp-connect-steps-details summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--sp-text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.zd-sp-connect-steps-details summary::-webkit-details-marker {
  display: none;
}

.zd-sp-connect-steps-details summary::after {
  content: "+";
  color: var(--sp-muted);
  font-size: 18px;
}

.zd-sp-connect-steps-details[open] summary::after {
  content: "\2212";
}

.zd-sp-connect-steps-body {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Spatial Plan Summary Fix */
body.zd-spatial #plan-summary {
  padding: 16px 24px;
  border: 1px solid var(--sp-border);
  border-radius: 14px;
  background: var(--sp-card);
}

body.zd-spatial #storage-card {
  padding: 16px 24px;
  border: 1px solid var(--sp-border);
  border-radius: 14px;
  background: var(--sp-card);
  margin-bottom: 16px;
}

/* Clean Files Experience (#files) */
body.zd-spatial #files-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

body.zd-spatial .account-app[data-view="drive"] > #storage-card {
  display: none;
}

body.zd-spatial .account-app[data-view="drive"] > #files-card > .capsule:not(:has(> #bar-selection:not([hidden]))) {
  display: none;
}

body.zd-spatial #zd-up-files-bar {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--sp-shadow-card);
}

body.zd-spatial .zd-up-files-bar-row {
  justify-content: flex-start;
}

body.zd-spatial .zd-up-files-bar-row > .zd-up-segmented {
  margin-left: auto;
}

body.zd-spatial .file-table,
body.zd-spatial #files-table,
body.zd-spatial #trash-table,
body.zd-spatial #links-table,
body.zd-spatial #shared-table,
body.zd-spatial #shared-folder-table,
body.zd-spatial #search-table {
  background: var(--sp-card);
  border: 0;
  border-radius: 14px;
  overflow: visible;
  border-collapse: separate;
  border-spacing: 0 2px;
}

body.zd-spatial :is(.file-table, #files-table, #trash-table, #links-table, #shared-table, #shared-folder-table, #search-table) :is(thead, tbody, tr, th, td, .row-file td, .row-folder td, .cell-name, .cell-shared, .cell-size, .cell-modified, .cell-where, .cell-left, .cell-on, .cell-actions) {
  border: 0;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
}

@media (min-width: 600px) {
  body.zd-spatial :is(.file-table, #files-table, #trash-table, #links-table, #shared-table, #shared-folder-table, #search-table) thead th {
    height: 32px;
    min-height: 32px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sp-muted);
    padding: 0 var(--sp-cell-pad-x);
  }

  body.zd-spatial :is(.file-table, #files-table, #trash-table, #links-table, #shared-table, #shared-folder-table, #search-table) tbody :is(td, .cell-name, .cell-shared, .cell-size, .cell-modified, .cell-where, .cell-left, .cell-on, .cell-actions) {
    height: 36px;
    min-height: 36px;
    font-size: 13px;
    padding: 0 var(--sp-cell-pad-x);
    vertical-align: middle;
  }
}

body.zd-spatial :is(.file-table, #files-table, #trash-table, #links-table, #shared-table, #shared-folder-table, #search-table) tbody tr {
  border-radius: 10px;
  transition: background-color 140ms;
}

body.zd-spatial :is(.file-table, #files-table, #trash-table, #links-table, #shared-table, #shared-folder-table, #search-table) tbody tr:hover,
body.zd-spatial :is(.file-table, #files-table, #trash-table, #links-table, #shared-table, #shared-folder-table, #search-table) tbody tr:focus-within {
  background: var(--sp-active);
}

body.zd-spatial .file-table tbody tr.row-selected {
  background: rgba(10, 132, 255, 0.14);
}

/* Settings & Switches */
body.zd-spatial .switch {
  background: rgba(120, 120, 128, 0.36);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

:root:has(> head > meta[name="color-scheme"][content="light"]) body.zd-spatial .switch,
:root[data-theme="light"] body.zd-spatial .switch {
  background: rgba(120, 120, 128, 0.24);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

body.zd-spatial .switch::before {
  background: #ffffff;
}

body.zd-spatial .switch:checked,
:root:has(> head > meta[name="color-scheme"][content="light"]) body.zd-spatial .switch:checked,
:root[data-theme="light"] body.zd-spatial .switch:checked {
  background: var(--sp-switch-on);
  border-color: var(--sp-switch-on);
  box-shadow: none;
}

body.zd-spatial .switch:checked::before {
  background: #ffffff;
}

/* Progressive Disclosure & Dialogs */
.zd-sp-details {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 14px;
  padding: 16px 24px;
}

.zd-sp-details summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--sp-text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.zd-sp-details summary::-webkit-details-marker {
  display: none;
}

.zd-sp-details summary::after {
  content: "+";
  color: var(--sp-muted);
  font-size: 18px;
}

.zd-sp-details[open] summary::after {
  content: "\2212";
}

.zd-sp-details-body {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.zd-sp-teams-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 900px) {
  .zd-sp-teams-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

.zd-sp-mobile-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.zd-sp-mobile-sheet-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zd-sp-search-dialog,
.zd-sp-dialog {
  width: 520px;
  max-width: calc(100% - 32px);
  padding: 24px;
  border-radius: 20px;
  background: var(--sp-card);
  color: var(--sp-text);
  border: 1px solid var(--sp-border-strong);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.zd-sp-search-results {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  max-height: 360px;
  overflow-y: auto;
}

.zd-sp-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--sp-text);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.zd-sp-search-item:hover,
.zd-sp-search-item.is-selected {
  background: var(--sp-active);
}

.zd-sp-search-kind {
  font-size: 12px;
  color: var(--sp-muted);
}

.zd-sp-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.zd-sp-appearance-group {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--sp-input);
  border: 1px solid var(--sp-border);
}

.zd-sp-appearance-btn {
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sp-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.zd-sp-appearance-btn[aria-pressed="true"] {
  background: var(--sp-button);
  color: var(--sp-text);
  font-weight: 600;
}

/* Connect & Secondary Views Calm Spatial Overrides */
body.zd-spatial #connect > .connect-group:has(#connections-list) {
  display: none;
}

body.zd-spatial .zd-sp-details .platform-group {
  background: var(--sp-input);
  border: 1px solid var(--sp-border);
  border-radius: 12px;
  padding: 16px;
}

body.zd-spatial .brain-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--sp-muted);
}

body.zd-spatial .brain-tab:hover {
  background: var(--sp-active);
  color: var(--sp-text);
}

body.zd-spatial .brain-tab[aria-selected="true"],
body.zd-spatial .brain-tab[aria-selected="true"]:hover {
  background: var(--sp-button);
  border-color: var(--sp-border-strong);
  color: var(--sp-text);
  font-weight: 600;
}

body.zd-spatial .share-chip,
body.zd-spatial .zd-up-chip {
  background: var(--sp-input);
  border: 1px solid var(--sp-border);
  color: var(--sp-muted);
}

body.zd-spatial .share-chip:hover,
body.zd-spatial .zd-up-chip:hover {
  background: var(--sp-active);
  border-color: var(--sp-border-strong);
  color: var(--sp-text);
}

body.zd-spatial .share-chip[aria-pressed="true"],
body.zd-spatial .zd-up-chip[aria-pressed="true"] {
  background: rgba(96, 137, 255, 0.16);
  border-color: rgba(96, 137, 255, 0.42);
  color: var(--sp-text);
  font-weight: 600;
}

body.zd-spatial .delete-setting {
  border: 1px solid var(--sp-border);
  border-radius: 12px;
  padding: 16px;
  background: var(--sp-input);
}

body.zd-spatial .dup-group {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

body.zd-spatial .zd-sp-title-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

body.zd-spatial .zd-up-badge {
  border: 1px solid var(--sp-border-strong);
  background: var(--sp-active);
  color: var(--sp-muted);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

body.zd-spatial .zd-up-row-btn {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--sp-border);
  background: var(--sp-button);
  color: var(--sp-text);
  font-size: 12px;
  font-weight: 500;
}

body.zd-spatial .zd-up-row-btn:hover {
  background: var(--sp-button-hover);
  border-color: var(--sp-border-strong);
}

body.zd-spatial .zd-up-segmented {
  background: var(--sp-input);
  border: 1px solid var(--sp-border);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}

body.zd-spatial .zd-up-seg-btn {
  padding: 4px 12px;
  border-radius: 8px;
  color: var(--sp-muted);
  font-size: 13px;
  font-weight: 500;
}

body.zd-spatial .zd-up-seg-btn[aria-pressed="true"] {
  background: var(--sp-button);
  color: var(--sp-text);
  font-weight: 600;
}

/* Overview Recent Files, Ready-Made Prompts & Prompt Studio */
.zd-sp-ps-widget {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zd-sp-ps-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 600px) {
  .zd-sp-ps-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.zd-sp-ps-goal {
  width: 100%;
}

.zd-sp-studio-subtitle {
  font-size: 12px;
  color: #a7a9b4;
}

.zd-sp-recipes-studio {
  margin-bottom: 16px;
}

.zd-sp-overview-section {
  margin-top: 24px;
}

.zd-sp-recent-files-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 900px) {
  .zd-sp-recent-files-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.zd-sp-recent-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-card);
  min-width: 0;
}

.zd-sp-recent-file-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zd-sp-recent-file-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.zd-sp-prompts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 900px) {
  .zd-sp-prompts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .zd-sp-prompts-grid > .zd-sp-prompt-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

.zd-sp-prompt-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zd-sp-prompt-card > .zd-up-badge {
  align-self: flex-start;
}

.zd-sp-prompt-card > .zd-up-prompt-preview {
  margin: 0;
  flex: 1 1 auto;
}

/* Color-Coded File Type Badges */
.zd-sp-ft-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid var(--sp-border);
}

.zd-sp-ft-folder {
  background: rgba(96, 137, 255, 0.16);
  color: var(--sp-blue);
  border-color: rgba(96, 137, 255, 0.34);
}

.zd-sp-ft-pdf {
  background: rgba(217, 119, 87, 0.16);
  color: var(--sp-coral);
  border-color: rgba(217, 119, 87, 0.34);
}

.zd-sp-ft-media {
  background: rgba(245, 185, 66, 0.16);
  color: var(--sp-amber);
  border-color: rgba(245, 185, 66, 0.34);
}

.zd-sp-ft-doc {
  background: rgba(16, 163, 127, 0.16);
  color: var(--sp-teal);
  border-color: rgba(16, 163, 127, 0.34);
}

.zd-sp-ft-data {
  background: rgba(81, 213, 139, 0.16);
  color: var(--sp-green);
  border-color: rgba(81, 213, 139, 0.34);
}

.zd-sp-ft-generic {
  background: rgba(130, 150, 185, 0.16);
  color: var(--sp-slate);
  border-color: rgba(130, 150, 185, 0.34);
}

/* Files Drive Strip, Inline Meta, Workspace Split, Inspector, Grid & Cards */
.zd-sp-drive-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-card);
}

.zd-sp-drive-meta-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.zd-sp-drive-meta-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--sp-text);
}

.zd-sp-inline-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  flex-wrap: wrap;
}

.zd-sp-meta-chip {
  font-size: 11px;
  font-weight: 600;
}

.zd-sp-files-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.zd-sp-files-main {
  min-width: 0;
}

.zd-sp-inspector-backdrop {
  position: fixed;
  inset: 0;
  z-index: 34;
  background: rgba(0, 0, 0, 0.34);
  opacity: 1;
  transition-property: display, opacity;
  transition-duration: 220ms;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

@starting-style {
  .zd-sp-inspector-backdrop {
    opacity: 0;
  }
}

.zd-sp-inspector-backdrop:where([hidden], [data-closing]) {
  opacity: 0;
}

.zd-sp-inspector-backdrop[hidden] {
  display: none;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) .zd-sp-inspector-backdrop,
:root[data-theme="light"] .zd-sp-inspector-backdrop {
  background: rgba(15, 23, 42, 0.18);
}

.zd-sp-inspector {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 35;
  width: min(380px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  height: calc(100dvh - 32px);
  background: var(--sp-sidebar);
  background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.03), transparent);
  border: 1px solid var(--sp-border-strong);
  border-radius: 22px;
  padding: var(--sp-card-pad);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  overscroll-behavior: contain;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 24px 64px rgba(0, 0, 0, 0.45);
  opacity: 1;
  translate: 0 0;
  transition-property: display, opacity, translate;
  transition-duration: 240ms;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  transition-behavior: allow-discrete;
}

@starting-style {
  .zd-sp-inspector {
    opacity: 0;
    translate: calc(100% + 24px) 0;
  }
}

.zd-sp-inspector:where([hidden], [data-closing]) {
  opacity: 0;
  translate: calc(100% + 24px) 0;
}

.zd-sp-inspector[hidden] {
  display: none;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) .zd-sp-inspector,
:root[data-theme="light"] .zd-sp-inspector {
  background: var(--sp-card);
  background-image: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 24px 64px rgba(15, 23, 42, 0.16);
}

@media (max-width: 599px) {
  .zd-sp-inspector {
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    height: calc(100dvh - 24px);
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zd-sp-inspector {
    translate: none;
    transition-duration: 0.1s;
  }

  @starting-style {
    .zd-sp-inspector {
      translate: none;
    }
  }

  .zd-sp-inspector:where([hidden], [data-closing]) {
    translate: none;
  }

  .zd-sp-inspector-backdrop {
    transition-duration: 0.1s;
  }
}

.zd-sp-insp-head {
  flex: none;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sp-border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.zd-sp-insp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
}

.zd-sp-insp-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.zd-sp-insp-title-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zd-sp-insp-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--sp-text);
  word-break: break-word;
}

.zd-sp-insp-dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--sp-border);
  padding: 0 0 12px;
}

.zd-sp-insp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 12px;
}

.zd-sp-insp-dt {
  margin: 0;
  color: var(--sp-muted);
  flex-shrink: 0;
}

.zd-sp-insp-dd {
  margin: 0;
  color: var(--sp-text);
  font-weight: 500;
  text-align: right;
  word-break: break-all;
}

.zd-sp-insp-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zd-sp-insp-sub {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--sp-muted);
}

.zd-sp-insp-actions {
  flex: none;
  padding-top: 12px;
  border-top: 1px solid var(--sp-border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Grid vs Cards Distinction in Spatial #files */
body.zd-spatial #zd-up-files-grid.is-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  body.zd-spatial #zd-up-files-grid.is-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  body.zd-spatial #zd-up-files-grid.is-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

body.zd-spatial .zd-sp-grid-tile {
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--sp-shadow-card);
}

body.zd-spatial .zd-sp-grid-tile .zd-up-tile-icon {
  width: 44px;
  height: 44px;
}

body.zd-spatial #zd-up-files-grid.is-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 600px) {
  body.zd-spatial #zd-up-files-grid.is-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  body.zd-spatial #zd-up-files-grid.is-cards {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  }
}

.zd-sp-file-card .zd-up-tile-actions {
  gap: 4px;
}

.zd-sp-file-card .zd-up-tile-name {
  overflow-wrap: anywhere;
}

.zd-sp-file-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-card);
  transition: border-color 160ms, background-color 160ms;
}

.zd-sp-file-card:hover {
  border-color: var(--sp-border-strong);
  background: var(--sp-card-hover);
}

.zd-sp-file-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.zd-sp-file-card-titlebox {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zd-sp-file-card-path {
  margin: 0;
  color: var(--sp-muted);
  word-break: break-all;
}

.zd-sp-card-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  background: var(--sp-input);
  border: 1px solid var(--sp-border);
}

.zd-sp-card-meta-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.zd-sp-card-meta-k {
  font-size: 11px;
  color: var(--sp-muted);
}

.zd-sp-card-meta-v {
  font-size: 12px;
  font-weight: 500;
  color: var(--sp-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Spatial View Visibility Hooks */
.account-app[data-view="home"] > #files-card,
.account-app[data-view="home"] > #storage-card,
.account-app[data-view="teams"] > #files-card,
.account-app[data-view="teams"] > #storage-card {
  display: none;
}

/* ---------- Desktop Icon Tiles, Hero Headers, Settings Split & Drive Redesign ---------- */

.zd-sp-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: #ffffff;
  border-radius: 8px;
  background-color: #2b95ff;
  background-image: linear-gradient(180deg, #2b95ff 0%, #0066d6 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 2px 6px rgba(0, 0, 0, 0.2);
}

.zd-sp-tile svg {
  display: block;
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zd-sp-tile-prism {
  background-color: #32ade6;
  background-image: linear-gradient(145deg, #32ade6 0%, #bf5af2 100%);
}

.zd-sp-tile-blue {
  background-color: #2b95ff;
  background-image: linear-gradient(180deg, #2b95ff 0%, #0066d6 100%);
}

.zd-sp-tile-indigo {
  background-color: #7a78ff;
  background-image: linear-gradient(180deg, #7a78ff 0%, #4b49c8 100%);
}

.zd-sp-tile-purple {
  background-color: #cb6df7;
  background-image: linear-gradient(180deg, #cb6df7 0%, #9434cc 100%);
}

.zd-sp-tile-orange {
  background-color: #ffb340;
  background-image: linear-gradient(180deg, #ffb340 0%, #e07800 100%);
}

.zd-sp-tile-green {
  background-color: #47e06e;
  background-image: linear-gradient(180deg, #47e06e 0%, #1fa643 100%);
}

.zd-sp-tile-teal {
  background-color: #45e0dc;
  background-image: linear-gradient(180deg, #45e0dc 0%, #189da6 100%);
}

.zd-sp-tile-rose {
  background-color: #ff5478;
  background-image: linear-gradient(180deg, #ff5478 0%, #d61f49 100%);
}

.zd-sp-tile-cyan {
  background-color: #5ad4f5;
  background-image: linear-gradient(180deg, #5ad4f5 0%, #1e8ac4 100%);
}

.zd-sp-tile-graphite {
  background-color: #9a9aa0;
  background-image: linear-gradient(180deg, #9a9aa0 0%, #636368 100%);
}

.zd-sp-tile-red {
  background-color: #ff5c52;
  background-image: linear-gradient(180deg, #ff5c52 0%, #d72a20 100%);
}

.zd-sp-tile-dark {
  background-color: #383942;
  background-image: linear-gradient(180deg, #383942 0%, #1d1e24 100%);
}

/* Desktop Storage Advisor Centered Hero Page Header */
body.zd-spatial .zd-sp-page-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: var(--sp-card-pad) 0;
  margin: 0 0 8px;
}

body.zd-spatial .zd-sp-page-hero[hidden] {
  display: none;
}

body.zd-spatial .zd-sp-hero-tile {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}

body.zd-spatial .zd-sp-hero-tile svg {
  width: 22px;
  height: 22px;
}

body.zd-spatial .zd-sp-hero-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 10px 28px rgba(0, 0, 0, 0.36);
}

body.zd-spatial .zd-sp-hero-logo .zd-sp-logo-mark {
  height: 44px;
  width: auto;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) body.zd-spatial .zd-sp-hero-logo,
:root[data-theme="light"] body.zd-spatial .zd-sp-hero-logo {
  border-color: rgba(15, 15, 15, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 10px 24px rgba(15, 23, 42, 0.14);
}

body.zd-spatial .zd-sp-page-hero > #page-title {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--sp-text);
  text-align: center;
}

body.zd-spatial .account-app[data-view="drive"] .zd-sp-page-hero > #page-title {
  font-size: 20px;
}

/* Keep page action triggers outside centered hero without overlap */
body.zd-spatial .account-app > .trash-title-actions,
body.zd-spatial .account-app > .duplicates-title-actions {
  position: static;
  top: auto;
  right: auto;
  transform: none;
  display: flex;
  justify-content: flex-end;
  margin: 0 0 12px;
}

body.zd-spatial .account-app > .trash-title-actions[hidden],
body.zd-spatial .account-app > .duplicates-title-actions[hidden] {
  display: none;
}

body.zd-spatial .account-app > .title-actions {
  margin-top: 0;
  justify-content: flex-end;
  margin-bottom: 8px;
}

/* Hide signed-in shared footer cleanly while keeping public policy pages intact */
body.zd-spatial.zd-signed-in .site-footer,
body.zd-spatial:has(#app-nav:not([hidden])) .site-footer {
  display: none;
}

/* Hide verbose Trash paragraphs cleanly in Spatial mode */
body.zd-spatial #trash-explainer > p:not(#trash-shared-note) {
  display: none;
}

body.zd-spatial .zd-sp-subtabs-host {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

body.zd-spatial .zd-sp-subtab-quiet {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--sp-muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 140ms, background-color 140ms;
}

body.zd-spatial .zd-sp-subtab-quiet:hover {
  color: var(--sp-text);
  background: var(--sp-active);
}

/* Settings & Billing: 200 px left navigation + 32 px gap + wide right details */
.zd-sp-settings-wrap {
  container-type: inline-size;
  container-name: settings-shell;
  width: 100%;
  margin: 0 0 16px;
}

.zd-sp-settings-wrap[hidden] {
  display: none;
}

.zd-sp-settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.zd-sp-settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 16px;
}

.zd-sp-settings-nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--sp-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 140ms, color 140ms;
}

.zd-sp-settings-nav-item:hover {
  background: var(--sp-active);
  color: var(--sp-text);
}

.zd-sp-settings-nav-item[aria-current="page"] {
  background: var(--sp-card);
  color: var(--sp-text);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--sp-border-strong);
}

.zd-sp-settings-detail {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.zd-sp-settings-detail-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--sp-text);
}

.zd-sp-settings-detail-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

@container settings-shell (width < 760px) {
  .zd-sp-settings-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .zd-sp-settings-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .zd-sp-settings-nav-item {
    width: auto;
  }
}

/* Cards inside Settings & Billing right pane: 20 px padding, height follows content */
body.zd-spatial #zd-sp-settings-detail-body .card,
body.zd-spatial #zd-sp-settings-detail-body .zd-up-card,
body.zd-spatial #zd-sp-settings-detail-body .settings-group,
body.zd-spatial #zd-sp-settings-detail-body #plan-summary,
body.zd-spatial #zd-sp-settings-detail-body #storage-card,
body.zd-spatial #zd-sp-settings-detail-body #choose-plan,
body.zd-spatial #zd-sp-settings-detail-body #add-storage {
  padding: var(--sp-card-pad);
  height: auto;
  min-height: 0;
  margin: 0;
  border-radius: 14px;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-card);
}

.zd-sp-plan-account-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.zd-sp-plan-account-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

body.zd-spatial .zd-sp-plan-account-row .plan-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px 16px;
  flex: 1 1 auto;
  width: auto;
  min-width: 220px;
  margin: 0;
  padding: 0;
  border-top: 0;
  min-height: 0;
}

body.zd-spatial .zd-sp-plan-account-row .plan-row > .row-label {
  flex: none;
  grid-column: auto;
  color: var(--sp-muted);
}

body.zd-spatial .zd-sp-plan-account-row .plan-row > .row-value {
  flex: 0 1 auto;
  min-width: 0;
  grid-column: auto;
  overflow-wrap: anywhere;
}

body.zd-spatial .zd-sp-plan-account-row #request-deletion {
  grid-column: auto;
  justify-self: auto;
  flex: none;
  margin-left: auto;
}

body.zd-spatial #request-deletion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--sp-danger-rim);
  background: rgba(240, 98, 119, 0.12);
  color: var(--zd-bad);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

body.zd-spatial #request-deletion:hover {
  background: rgba(240, 98, 119, 0.2);
  text-decoration: none;
}

/* Drive Toolbar 36 px uniform controls */
body.zd-spatial #zd-up-files-bar button:not(.zd-up-seg-btn),
body.zd-spatial #zd-up-files-bar select,
body.zd-spatial #files-card .toolbar button,
body.zd-spatial #files-card .toolbar select {
  height: 36px;
  min-height: 36px;
}

body.zd-spatial #zd-up-files-bar .zd-up-segmented {
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

body.zd-spatial #zd-up-files-bar .zd-up-seg-btn {
  height: 28px;
  min-height: 28px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
}

/* Drive Folders Grid & Separate Borderless Files Table */
.zd-sp-folders-section[hidden],
.zd-sp-drive-section-heading[hidden] {
  display: none;
}

.zd-sp-drive-section-heading {
  font-size: 12px;
  font-weight: 600;
  color: var(--sp-muted);
  letter-spacing: 0.02em;
  margin: 0 0 8px;
}

#zd-sp-files-section-heading.has-folders-above {
  margin-top: var(--sp-section-gap);
}

.zd-sp-folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(248px, 100%), 1fr));
  gap: 8px;
}

.zd-sp-folder-tile {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px var(--sp-cell-pad-x);
  border-radius: 10px;
  background: var(--sp-card);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-card);
  min-width: 0;
  transition: background-color 140ms, border-color 140ms;
}

.zd-sp-folder-tile:hover,
.zd-sp-folder-tile:focus-within {
  background: var(--sp-card-hover);
  border-color: var(--sp-border-strong);
}

.zd-sp-folder-tile.is-selected {
  background: rgba(10, 132, 255, 0.14);
  border-color: rgba(10, 132, 255, 0.4);
}

.zd-sp-folder-check {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
  accent-color: var(--sp-switch-on);
  cursor: pointer;
}

.zd-sp-folder-open {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: var(--sp-text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.zd-sp-folder-open svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--sp-blue);
}

.zd-sp-folder-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.zd-spatial .zd-sp-folder-tile .zd-up-badge,
body.zd-spatial .row-name .zd-up-badge {
  flex: none;
  align-self: center;
  margin-right: 0;
}

body.zd-spatial #files-card[data-view-mode="list"] #files-table tr[data-kind="folder"] {
  display: none;
}

body.zd-spatial #files-table[data-zd-sp-only-folders="1"] {
  display: none;
}

@media (min-width: 600px) {
  body.zd-spatial #files-table {
    table-layout: fixed;
    width: 100%;
    padding: 4px;
  }

  body.zd-spatial #files-table th:nth-child(3) {
    width: 96px;
  }

  body.zd-spatial #files-table .col-actions {
    width: 84px;
    min-width: 84px;
  }

  body.zd-spatial .file-table .entry {
    gap: 8px;
    min-height: 24px;
  }

  body.zd-spatial .file-table .entry .icon {
    width: 16px;
    height: 16px;
    flex: none;
  }

  body.zd-spatial .file-table .row-name {
    gap: 8px;
    min-width: 0;
  }

  body.zd-spatial .file-table .link-button.entry {
    min-width: 0;
    overflow: hidden;
  }

  body.zd-spatial .file-table .entry-name {
    font-size: 14px;
    font-weight: 500;
  }

  body.zd-spatial .file-table .row-file:has(.row-select) .cell-size {
    padding: 0 var(--sp-cell-pad-x);
  }
}

body.zd-spatial .zd-sp-inline-meta {
  flex: none;
  margin-left: 4px;
}

body.zd-spatial .file-table td.cell-actions {
  white-space: nowrap;
  text-align: right;
}

body.zd-spatial #files-table .row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

body.zd-spatial #files-table .row-actions > :not(.zd-sp-row-icon-btn) {
  display: none;
}

body.zd-spatial .zd-sp-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: none;
}

body.zd-spatial .zd-sp-row-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sp-muted);
  opacity: 1;
  cursor: pointer;
  flex: none;
  transition: background-color 140ms, color 140ms;
}

body.zd-spatial .zd-sp-row-icon-btn:hover,
body.zd-spatial .zd-sp-row-icon-btn:focus-visible,
body.zd-spatial .zd-sp-row-icon-btn[aria-expanded="true"] {
  background: var(--sp-active);
  color: var(--sp-text);
  opacity: 1;
}

body.zd-spatial .zd-sp-row-icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.zd-sp-action-menu {
  position: fixed;
  z-index: 40;
  min-width: 192px;
  max-width: 260px;
  padding: 4px;
  border-radius: 12px;
  background: var(--sp-card);
  border: 1px solid var(--sp-border-strong);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zd-sp-action-menu[hidden] {
  display: none;
}

.zd-sp-action-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 4px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sp-text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.zd-sp-action-menu-item:hover,
.zd-sp-action-menu-item:focus-visible {
  background: var(--sp-active);
}

.zd-sp-action-menu-item.is-danger {
  color: var(--zd-bad);
}

.zd-sp-action-menu-divider {
  border: 0;
  border-top: 1px solid var(--sp-border);
  margin: 2px 4px;
}

/* Activity two-line visual hierarchy */
.zd-sp-activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
}

.zd-sp-activity-row > .zd-sp-dot {
  margin-top: 8px;
}

.zd-sp-activity-body {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zd-sp-activity-title {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  color: var(--sp-text);
  overflow-wrap: anywhere;
}

.zd-sp-activity-meta {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  color: var(--sp-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

/* Inspector & Dialog Copyable IDs */
.zd-sp-id-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.zd-sp-id-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sp-text);
  word-break: break-all;
}

.zd-sp-copy-mini {
  flex: none;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--sp-border-strong);
  background: var(--sp-button);
  color: var(--sp-text);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.zd-sp-copy-mini:hover {
  background: var(--sp-button-hover);
}
