/* Approved workspace design: warm paper, graphite, and mineral teal.
   The buyer's comparison is the focal surface. Navigation and occasional tools
   stay quiet; package bases, source dates, and numbers retain clear hierarchy.
   Borders supply depth, Avenir / Iowan supply type, and spacing uses a 4px base.
   Loaded after legacy page styles so existing routes share this same system. */
:root {
  color-scheme: light;
  --paper: #f7f7f2;
  --surface: #fffefa;
  --text: #252f2d;
  --faint: #ebeee7;
  --ink: var(--text);
  --muted: #64716b;
  --line: #dce1d8;
  --bg: var(--paper);
  --white: var(--surface);
  --accent: #276152;
  --accent-hover: #1b4d40;
  --accent-soft: #edf3ed;
  --teal: var(--accent);
  --teal-dark: var(--accent-hover);
  --teal-light: var(--accent-soft);
  --amber: #805a2b;
  --amber-bg: #faf1e2;
  --red: #974537;
  --focus: var(--accent);
  --radius: 8px;
  --sans: "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --type-body: .875rem;
  --type-table: .875rem;
  --leading-body: 1.5;
}

body.approved-design {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
h1, .page-heading h1 {
  font: 400 36px/1.12 var(--serif);
  letter-spacing: -.7px;
  color: var(--ink);
  margin: 0 0 12px;
  text-wrap: pretty;
}
h2 { font-size: 18px; font-weight: 600; letter-spacing: -.2px; }
h3 { font-size: 15px; font-weight: 600; }
p { line-height: 1.65; }
button, input, select, textarea { font-family: var(--sans); }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input::placeholder, textarea::placeholder { color: #78827b; opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
button { transition: background-color .15s, color .15s, border-color .15s; }
button:not(:disabled):active { transform: translateY(1px); }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: 1.6px; margin-bottom: 12px; }
.micro, .subtext, .source-note { color: var(--muted); font-size: 12px; }
.positive { color: var(--accent) !important; }
.num, .ui-amount, .stat-value { font-variant-numeric: tabular-nums; }
.skip-link { border-radius: 6px; background: var(--accent); color: var(--surface); z-index: 100; }

/* Shared navigation: two destinations, one secondary chooser, one account menu. */
.app-shell { margin-left: 0; min-height: 100dvh; display: flex; flex-direction: column; }
.app-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 56px;
  padding: 0 40px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: relative;
  z-index: 10;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.9px;
  white-space: nowrap;
  color: var(--ink);
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand svg.brand-mark {
  width: 31px;
  height: 31px;
  display: block;
  padding: 0;
  color: var(--accent);
  background: none;
  border-radius: 0;
}
.brand-dot { color: var(--accent); }
.primary-nav { display: flex; align-self: stretch; gap: 32px; }
.primary-nav a {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  min-height: 76px;
}
.primary-nav a:hover { color: var(--accent); }
.primary-nav a.active { color: var(--ink); font-weight: 600; }
.primary-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}
.header-end { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.workspace-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.header-utility {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.header-utility .icon { width: 18px; height: 18px; }
.header-utility:hover { color: var(--accent); background: var(--faint); text-decoration: none; }
.header-search, .account-menu { position: relative; }
.header-search > summary::-webkit-details-marker,
.account-menu > summary::-webkit-details-marker { display: none; }
.header-search-panel, .account-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.header-search-panel { width: min(460px, calc(100vw - 32px)); }
.account-menu > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px;
  cursor: pointer;
  list-style: none;
  border-radius: 6px;
}
.account-menu > summary:hover { background: var(--faint); }
.account-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}
.account-chevron { font-size: 14px; color: var(--muted); }
.account-panel { width: 232px; padding: 8px; }
.account-identity { padding: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-wrap: anywhere; }
.account-identity strong, .account-identity span { display: block; }
.account-identity strong { font-size: 13px; font-weight: 600; }
.account-identity span { font-size: 11px; color: var(--muted); margin-top: 4px; text-transform: capitalize; }
.account-panel a, .account-panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  min-height: 40px;
  font-size: 13px;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 4px;
  text-decoration: none;
}
.account-panel a:hover, .account-panel button:hover { background: var(--faint); color: var(--accent); }

/* Page framing and the familiar catalog search remain consistent on secondary pages. */
.main { width: 100%; max-width: 1800px; padding: 36px 40px 0; margin: 0 auto; flex: 1; }
.workspace-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.workspace-toolbar .ui-breadcrumbs { margin: 0; flex: 1; font-size: 12px; }
.ui-breadcrumbs { color: var(--muted); font-size: 12px; margin-bottom: 24px; }
.ui-breadcrumbs a { color: var(--muted); }
.ui-breadcrumbs li[aria-current="page"] { color: var(--ink); }
.global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 420px;
  max-width: 100%;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.global-search > .icon { width: 16px; height: 16px; color: var(--muted); }
.global-search input { width: 100%; min-width: 0; min-height: 38px; padding: 8px 0; border: 0; background: none; font-size: 12px; box-shadow: none; }
.global-search .button { min-height: 30px; padding: 4px 8px; font-size: 11px; border-color: transparent; background: transparent; }
.global-search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.global-search input:focus-visible { outline: none; }
.page-heading { align-items: start; gap: 24px; margin-bottom: 28px; }
.page-heading p { max-width: 72ch; font-size: 14px; color: var(--muted); }
.page-heading .actions { padding-top: 8px; }
.footer {
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 40px 24px;
  background: none;
  border: 0;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
}
.footer-divider { margin: 0 12px; color: #aab4aa; }
.workspace-details { text-align: right; }
.workspace-details summary { cursor: pointer; }
.workspace-details > div { margin-top: 8px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.ui-environment { color: var(--muted); background: var(--faint); padding: 2px 6px; font-size: 10px; font-weight: 500; border: 0; border-radius: 4px; }

/* Shared controls, data surfaces, and status states. */
.button, .button.compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: none;
}
.button.compact { padding: 8px 12px; }
.button:hover { color: var(--accent); background: var(--faint); border-color: #bcc9be; }
.button.primary, .button[aria-current="true"] { color: var(--surface); background: var(--accent); border-color: var(--accent); box-shadow: none; }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.quiet { background: transparent; border-color: transparent; }
.button.quiet:hover { background: var(--faint); }
.button .icon { width: 16px; height: 16px; }
label { color: var(--ink); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { color: var(--ink); border-color: var(--line); background-color: var(--surface); border-radius: 6px; font-size: 14px; box-shadow: none; }
textarea { resize: vertical; }
.form-grid { gap: 16px 24px; }
.form-section { padding-top: 24px; margin-top: 24px; }
.form-section legend { font-size: 17px; font-weight: 600; }
.form-actions { gap: 12px; padding-top: 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; margin-bottom: 24px; }
.panel.padded, .panel-heading, .panel-head { padding: 24px; }
.panel-heading h2, .panel-head h2 { font-size: 18px; }
.panel-heading p { color: var(--muted); font-size: 13px; }
.panel-foot { padding: 12px 24px; color: var(--muted); background: none; border-color: var(--line); font-size: 12px; }
.stat-grid { gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; background: var(--surface); }
.stat { min-width: 0; border: 0; border-right: 1px solid var(--line); border-radius: 0; padding: 24px; min-height: 0; background: none; box-shadow: none; }
.stat:last-child { border-right: 0; }
.stat.green-tint { background: var(--accent-soft); border-color: var(--line); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat-value { color: var(--ink); font-size: 28px; font-weight: 500; letter-spacing: -.8px; }
.stat small, .stat-foot { font-size: 12px; color: var(--muted); }
.filter-bar { padding: 20px 24px; gap: 12px; border-color: var(--line); background: var(--surface); }
.research-toolbar { padding: 16px 20px; background: var(--surface); font-size: 13px; }
.research-status, .ui-update-status { font-size: 13px; }
.ui-update-status:empty { margin: 0; min-height: 0; }
.table-scroll-help { font-size: 11px; color: var(--muted); margin: 8px 0 16px; }
.density-settings { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
#density-form select, #density-form button { min-height: 36px; font-size: 12px; }
table { font-size: 14px; font-variant-numeric: tabular-nums; }
th { background: #f3f4ee; border-color: var(--line); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0; }
th, td { padding: 16px; line-height: 1.5; }
td { color: var(--ink); background: var(--surface); border-bottom-color: var(--line); font-size: 14px; }
tbody tr:hover > td { background: #f6f7f0; }
body[data-table-page="true"] .table-wrap thead th { background: #f3f4ee; }
.product-title { color: var(--ink); font-size: 14px; font-weight: 600; }
.product-title:hover { color: var(--accent); }
.badge { border-radius: 4px; font-size: 11px; font-weight: 500; }
.badge.green, .badge.approved { color: var(--accent); background: var(--accent-soft); }
.notice, .warning, .form-error-summary, .ui-feedback-error:not([hidden]) { box-shadow: none; border-radius: 6px; line-height: 1.6; }
.notice { color: var(--accent-hover); background: var(--accent-soft); border-color: var(--line); }
.warning { color: var(--amber); background: var(--amber-bg); border-color: #e2ceb0; }
.preview-banner { background: var(--amber-bg); color: var(--amber); border-color: #e2ceb0; }
.empty, .empty-state { padding: 48px 24px; color: var(--muted); }
.context-strip, .item-summary { background: var(--accent-soft); border-color: var(--line); }
.context-strip a, .item-summary dd { color: var(--ink); }
.workspace-tabs { border-color: var(--line); }
.workspace-tabs a { color: var(--muted); }
.workspace-tabs a.active { color: var(--accent); border-color: var(--accent); }

/* The full destination chooser preserves every permitted workflow. */
.ui-destinations { gap: 24px; }
.ui-destinations .ui-nav-group { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.ui-destinations .nav-item { background: none; padding: 8px 12px; margin: 0; min-height: 36px; border-radius: 4px; font-size: 13px; color: var(--ink); }
.ui-destinations .nav-item:hover, .ui-destinations .nav-item.active { background: var(--accent-soft); color: var(--accent); }
#ui-go-to { width: min(800px, calc(100vw - 32px)); padding: 28px; background: var(--surface); color: var(--ink); border-radius: 10px; }
#ui-go-to::backdrop { background: rgb(37 47 45 / .28); }
.ui-dialog-heading h2 { font: 28px/1.2 var(--serif); }
.ui-source-labels, .ui-source-labels dt, .ui-source-labels dd, .ui-source-note, .ui-copy-label { font-size: 12px; }
.ui-blockers { font-size: 12px; border-left-width: 2px; }
.ui-copy { gap: 8px 12px; }

/* Account entry shares the same paper surface and typographic voice. */
.auth-shell { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-story { min-height: 100dvh; background: var(--paper); color: var(--ink); border-right: 1px solid var(--line); padding: 48px 64px; }
.login-story h1 { font: 400 clamp(40px, 4.5vw, 64px)/1.08 var(--serif); letter-spacing: -1.2px; color: var(--ink); margin: 20px 0 24px; }
.login-story p { color: var(--muted); font-size: 15px; line-height: 1.8; max-width: 380px; }
.login-story .eyebrow, .login-story .micro, .login-story > small { color: var(--muted); }
.login-story .micro, .login-story > small { font-size: 12px; }
.story-line { background: var(--accent); height: 2px; width: 48px; margin: 32px 0; }
.login-panel { padding: 64px 48px; background: var(--surface); }
.login-card { max-width: 360px; }
.login-card h2 { font: 32px/1.2 var(--serif); letter-spacing: -.5px; margin: 12px 0; }
.login-card > p { font-size: 13px; line-height: 1.7; }
.login-card label { font-size: 12px; font-weight: 500; }
.login-card input { margin-top: 8px; min-height: 44px; background: var(--paper); }
.login-card form { margin: 28px 0 24px; }
.login-card .button.full { min-height: 44px; justify-content: center; }

@media (max-width: 1150px) {
  .app-header { padding: 0 24px; gap: 32px; }
  .header-end { gap: 8px; }
  .workspace-label { display: none; }
  .main { padding: 28px 24px 0; }
  .footer { padding: 28px 24px 24px; }
  h1, .page-heading h1 { font-size: 32px; }
  .login-story { padding: 40px; }
}
@media (max-width: 800px) {
  .app-header { padding: 12px 20px 0; min-height: 108px; flex-wrap: wrap; gap: 0; }
  .brand { font-size: 21px; }
  .brand svg.brand-mark { width: 28px; height: 28px; }
  .primary-nav { order: 3; width: 100%; height: 48px; gap: 28px; }
  .primary-nav a { min-height: 48px; font-size: 13px; }
  .header-end { gap: 8px; }
  .tools-link .icon { display: none; }
  .account-avatar { width: 28px; height: 28px; }
  .header-search { position: static; }
  .header-search-panel { left: 20px; right: 20px; top: calc(100% + 8px); width: auto; }
  .workspace-toolbar { flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
  .workspace-toolbar .ui-breadcrumbs { flex-basis: 100%; }
  .workspace-toolbar .global-search { flex: 1 1 100%; }
  .page-heading { flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
  .page-heading .actions { padding-top: 0; }
  .panel.padded, .panel-heading, .panel-head { padding: 20px; }
  .panel-foot { padding: 12px 20px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 20px; border-bottom: 1px solid var(--line); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:last-child { border-bottom: 0; }
  .stat-grid.three { grid-template-columns: 1fr; gap: 0; }
  .stat-grid.three .stat { min-height: 0; border-right: 0; }
  .footer { flex-wrap: wrap; font-size: 10px; }
  .auth-shell { grid-template-columns: 1fr; }
  .login-story { min-height: 0; padding: 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-story > div, .login-story > small { display: none; }
  .login-panel { padding: 48px 24px; }
}
@media (max-width: 480px) {
  .app-header { padding: 12px 16px 0; }
  .brand { font-size: 20px; gap: 8px; }
  .brand svg.brand-mark { width: 25px; height: 25px; }
  .header-end { gap: 0; }
  .header-utility { padding: 8px; }
  .account-chevron { display: none; }
  .header-search-panel { left: 16px; right: 16px; padding: 16px; }
  .main { padding: 24px 16px 0; }
  h1, .page-heading h1 { font-size: 30px; line-height: 1.15; }
  .page-heading p { font-size: 13px; }
  .button, .button.compact { font-size: 12px; padding: 8px 12px; }
  .panel.padded, .panel-heading, .panel-head { padding: 16px; }
  .panel-foot, .filter-bar { padding: 12px 16px; }
  .stat { padding: 16px; }
  .stat-value { font-size: 24px; }
  .footer { padding: 28px 16px 20px; gap: 8px; }
  .workspace-details { text-align: left; }
  .workspace-details > div { justify-content: flex-start; }
  #ui-go-to { padding: 20px; }
  .ui-destinations { grid-template-columns: 1fr; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .app-header, .workspace-toolbar, .footer, .skip-link { display: none !important; }
  .app-shell, .main { margin: 0; padding: 0; max-width: none; }
  body.approved-design { background: white; }
  .panel, .stat { box-shadow: none; }
}
