body {
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
  color: var(--md-sys-color-on-background);
  /* Iteration 17: base surface + two faint radial glows (--bg-glow), fixed so
     the glow stays put while content scrolls. Global on purpose (Q6). */
  background-color: var(--md-sys-color-background);
  background-image: var(--bg-glow);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--md-sys-color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 {
  font-family: var(--md-sys-typescale-headline-medium-font);
  font-size: var(--md-sys-typescale-headline-medium-size);
  line-height: var(--md-sys-typescale-headline-medium-line-height);
  font-weight: var(--md-sys-typescale-headline-medium-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 1rem;
}
h2 {
  font-family: var(--md-sys-typescale-title-large-font);
  font-size: var(--md-sys-typescale-title-large-size);
  line-height: var(--md-sys-typescale-title-large-line-height);
  font-weight: var(--md-sys-typescale-title-large-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 0.75rem;
}
h3 {
  font-family: var(--md-sys-typescale-title-medium-font);
  font-size: var(--md-sys-typescale-title-medium-size);
  line-height: var(--md-sys-typescale-title-medium-line-height);
  font-weight: var(--md-sys-typescale-title-medium-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 0.5rem;
}

main {
  padding: 1.5rem;
  max-width: var(--container-max);
  margin: 0 auto;
}
main.main--wide {
  max-width: none;
  padding: 1rem 1.5rem;
}
/* Full-bleed: fill the viewport below the 64px top nav, no cap, no padding.
   For creative tools (the email visual editor, canvases) that own the whole region.
   Its sticky-pin lives in layouts/sidebar.css (`.app-shell main.main--bleed`),
   which owns main's positioning + the z-index trap. */
main.main--bleed {
  max-width: none;
  padding: 0;
  margin: 0;
  height: calc(100vh - var(--app-bar-h));
  overflow: hidden;
}
/* The app shell's billing banner (it-320 D13 / it-330) sits inside main, above the page. In a full-bleed frame the
   editor is height: 100% of main, so the banner pushed its bottom edge out of the frame (and overflow: hidden cut it
   off). With the banner present, the frame is two rows: the banner's own height, then the rest for the editor (the
   page's first box — a page's empty dialog hosts fall into rows of their own, zero tall). */
main.main--bleed:has(> .wallet-banner) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
}
main.main--bleed > .wallet-banner {
  margin: 0;
  border-radius: 0;
}

/* A page drawn alone under the bar — Sign in, Accept invite, Choose a new password: one form, one field wide, centered.
   What follows its heading (a notice, the form) sits one step below it. */
.auth-page {
  --auth-page-width: 26.25rem;
  --auth-page-top: 4rem;
  max-width: var(--auth-page-width);
  margin: var(--auth-page-top) auto 0;
}
.auth-page > .notice,
.auth-page > form { margin-top: var(--space-4, 1rem); }

code {
  font-family: var(--md-ref-typeface-code);
  font-size: 0.9em;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  padding: 0 0.25rem;
  border-radius: var(--md-sys-shape-corner-extra-small);
}

hr {
  border: 0;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  margin: 1.5rem 0;
}

/* Helper: muted text inline. Used for breadcrumbs, hints. */
.muted { color: var(--md-sys-color-on-surface-variant); }

/* Helper: a Material Symbol sitting in a line of text, sized and seated to it (in place of an inline style). */
.icon-inline { font-size: 1rem; vertical-align: -0.1875rem; }

/* A page's one-paragraph intro under its title: readable measure, and room before the content. */
.page-intro { max-width: 47.5rem; margin: .5rem 0 1.5rem; }

/* Global Alpine cloak: hide x-cloak elements until Alpine boots, so
   x-show'd panels (dropdowns, menus) don't flash open on load. */
[x-cloak] { display: none !important; }

/* BPDGo#354: the house controls (Material Web) upgrade only when material/all.js runs — a module, so after first
   paint. Until then a dropdown is a plain element and paints every option's text, stacked; a switch or checkbox is an
   empty box. Every page: invisible until defined, at the size it will have — the field's own top + bottom space (16px
   each, 8px on the compact ones) around its 24px line, plus its supporting text's line when it has one, and the
   component's 210px floor — so nothing below moves when it upgrades. Inline-level, as the upgraded host is
   (inline-flex). Zero specificity (:where): any page rule sizing a select — even one class, `.pd-start__as` — wins
   here exactly as it does on the upgraded control. */
:where(md-outlined-select, md-filled-select):not(:defined) {
  visibility: hidden;
  display: inline-block;
  vertical-align: top;
  overflow: hidden;
  min-width: 13.125rem;
  max-width: 100%;
  height: calc(var(--md-outlined-field-top-space, 1rem) + var(--md-outlined-field-bottom-space, 1rem)
    + var(--md-sys-typescale-body-large-line-height, 1.5rem));
}
:where(md-outlined-select, md-filled-select)[supporting-text]:not(:defined) {
  height: calc(var(--md-outlined-field-top-space, 1rem) + var(--md-outlined-field-bottom-space, 1rem)
    + var(--md-sys-typescale-body-large-line-height, 1.5rem) + 0.25rem + var(--md-sys-typescale-body-small-line-height, 1rem));
}
:where(md-switch, md-checkbox, md-radio, md-slider):not(:defined) { visibility: hidden; }
/* it-1350 (Aldo's QA: the New form painted as a page of bare labels, its boxes popping in after): on a form, a text
   field or a dropdown not yet upgraded is drawn as the outlined box it becomes — its height, outline and corners — so
   the form is whole from its first paint and nothing moves when the controls arrive. A text field shows its "$" / "%"
   and the value it carries (an edit form) or its placeholder; a dropdown its arrow and chosen option, never the list
   (BPDGo#354). A text area's height follows its rows: it is left as it was. Forms only: elsewhere a text field's width
   is its own, unknown before it upgrades. One class's weight, after #354's rule: a page's own sizing still wins. */
:where(.field-input, .field-cell) :where(md-outlined-text-field:not([type="textarea"], [hidden]), md-outlined-select:not([hidden])):not(:defined) {
  visibility: visible;
  display: block;
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
  height: calc(var(--md-outlined-text-field-top-space, 1rem) + var(--md-outlined-text-field-bottom-space, 1rem)
    + var(--md-sys-typescale-body-large-line-height, 1.5rem));
  border: var(--md-outlined-text-field-outline-width, 1px) solid var(--md-outlined-text-field-outline-color, var(--md-sys-color-outline));
  border-radius: var(--md-outlined-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 0.25rem));
  padding: calc(var(--md-outlined-text-field-top-space, 1rem) - 1px) calc(var(--md-outlined-text-field-leading-space, 1rem) - 1px) 0;
  font-family: var(--md-sys-typescale-body-large-font, inherit);
  font-size: var(--md-sys-typescale-body-large-size, 1rem);
  line-height: var(--md-sys-typescale-body-large-line-height, 1.5rem);
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
}
:where(.field-input, .field-cell) md-outlined-text-field:not(:defined)::before {
  content: attr(prefix-text);
  color: var(--md-sys-color-on-surface-variant);
}
:where(.field-input, .field-cell) md-outlined-text-field[prefix-text]:not(:defined)::before { padding-inline-end: 2px; }
:where(.field-input, .field-cell) md-outlined-text-field:not(:defined)::after { content: attr(value) attr(suffix-text); }
:where(.field-input, .field-cell) md-outlined-text-field[placeholder]:is(:not([value]), [value=""]):not(:defined)::after {
  content: attr(placeholder);
  color: var(--md-sys-color-on-surface-variant);
}
:where(.field-input, .field-cell) md-outlined-select:not(:defined) {
  border-color: var(--md-outlined-select-text-field-outline-color, var(--md-sys-color-outline));
}
:where(.field-input, .field-cell) md-outlined-select:not(:defined) > * { display: none; }
:where(.field-input, .field-cell) md-outlined-select:not(:defined) > md-select-option[selected]:not([value=""]) { display: block; }
/* The dropdown's arrow: Material's 10 × 5 triangle, centered in the trailing icon's box, its trailing space in from the
   edge. */
:where(.field-input, .field-cell) md-outlined-select:not(:defined)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(var(--md-outlined-select-text-field-trailing-space, 0.75rem)
    + var(--md-outlined-select-text-field-trailing-icon-size, 1.5rem) / 2 - 6px); /* fixed px: half the arrow + the outline */
  margin-top: -2.5px; /* fixed px: half the arrow's height — Material draws it in px, not with the Display size */
  border: 5px solid transparent; /* fixed px: Material's arrow is 10 × 5 px at every Display size */
  border-bottom: 0;
  border-top-color: var(--md-sys-color-on-surface-variant);
}
/* …and a button: invisible until it upgrades — its label would paint as plain words — at the height and padding it
   will have, so nothing beside or below it moves. No weight at all: any page rule on a button wins. */
:where(md-filled-button, md-filled-tonal-button, md-outlined-button, md-elevated-button, md-text-button):where(:not(:defined, [hidden])) {
  visibility: hidden;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 2.5rem;
  min-width: 64px; /* fixed px: Material's own button floor — its styles size it in px, not with the Display size */
  padding-inline: 1.5rem;
  font-family: var(--md-sys-typescale-label-large-font, inherit);
  font-size: var(--md-sys-typescale-label-large-size, 0.875rem);
  font-weight: var(--md-sys-typescale-label-large-weight, 500);
  white-space: nowrap;
}
:where(md-text-button):where(:not(:defined, [hidden])) { padding-inline: 0.75rem; }

/* Edit-form unsaved-changes banner. Sticks to the top of the form so it stays
   visible while scrolling; flipped by any field/tag/contactType/team change. */
.form-dirty-banner {
  position: sticky;
  top: var(--space-2, 0.5rem);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  margin-bottom: var(--space-4, 1rem);
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border-radius: var(--radius-md, 0.75rem);
  background: var(--md-sys-color-primary-container, #eaddff);
  color: var(--md-sys-color-on-primary-container, #21005d);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  font-size: 0.9rem;
}
.form-dirty-banner .material-symbols-outlined { font-size: 1.25rem; }

/* it-1460 (BPDGo#533) Settings › Company: a setting's one-line explanation and its switch row. */
.company-settings__lede { margin: 0; }
.company-settings__switch { display: inline-flex; align-items: center; gap: var(--space-3, 0.75rem); cursor: pointer; }
