/* ==========================================================================
   Pump Selector — Engineering Workstation design system
   Three themes (engineering / light / dark) share one token set. Settings
   panel overrides land on individual custom properties at runtime; nothing
   here should be duplicated as literal hex elsewhere in the app CSS.
   ========================================================================== */

:root {
  color-scheme: light;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;

  /* ---- structural tokens (theme-independent) ---- */
  --radius-button: 7px;
  --radius-card: 14px;
  --glass-blur: blur(20px) saturate(1.6);
  --motion-fast: 140ms;
  --ease-std: cubic-bezier(0.2, 0.6, 0.2, 1);
  /* semantic action colours (buttons): primary = engineering blue,
     danger = engineering red. Brand red stays on --color-primary. */
  --color-action: #1a63d8;
  --color-action-strong: #1552bd;
  --color-danger: #c0261a;
  --color-danger-strong: #a51f14;
  --page-padding: clamp(16px, 2.4vw, 36px);
  --card-padding: clamp(16px, 2vw, 26px);
  --section-gap: clamp(18px, 2.2vw, 28px);
  --density-gap: 16px;
  --density-field-h: 42px;

  /* ---- status colors (shared across themes; settings can override) ---- */
  --status-suitable: #0d7a54;
  --status-suitable-bg: #e3f5ec;
  --status-near-suitable: #1d6fe8;
  --status-near-suitable-bg: #e8f0fe;
  --status-oversized: #b1720f;
  --status-oversized-bg: #fbf0dc;
  --status-undersized: #b0271a;
  --status-undersized-bg: #fbe6e3;

  /* ---- engineering theme (default): industrial navy ---- */
  --color-primary: #c92416;
  --color-primary-ink: #ffffff;
  --color-secondary: #1c2a36;
  --color-accent: #1d6fe8;
  --color-header: #16253f;
  --color-header-ink: #eef2f6;
  --color-footer: #16253f;
  --color-sidebar: #1a2c4a;
  --color-bg: #eef1f5;
  --color-card: #ffffff;
  --color-card-soft: #f4f6f9;
  --color-border: #dee3ea;
  --color-border-strong: #c3cdd7;
  --color-font: #29343d;
  --color-font-muted: #64717d;
  --color-heading: #10161d;
  --color-table: #ffffff;
  --color-table-head: #eef1f5;
  --shadow-flat: none;
  --shadow-soft: 0 1px 2px rgba(19, 32, 56, 0.06), 0 1px 3px rgba(19, 32, 56, 0.05);
  --shadow-elevated: 0 12px 30px rgba(19, 32, 56, 0.16);
  /* ---- glassmorphism layer ---- */
  --app-gradient:
    radial-gradient(1200px 760px at 4% -16%, #b9d2f6 0%, rgba(185, 210, 246, 0) 50%),
    radial-gradient(1100px 660px at 118% 2%, #cbc4ee 0%, rgba(203, 196, 238, 0) 48%),
    radial-gradient(940px 720px at 88% 120%, #bcdaef 0%, rgba(188, 218, 239, 0) 52%),
    linear-gradient(152deg, #d6e4f6 0%, #cfdaef 52%, #d8d0ee 100%);
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-shadow: 0 12px 36px rgba(19, 32, 56, 0.14), 0 2px 8px rgba(19, 32, 56, 0.08);
}

/* ---- light theme ---- */
:root[data-theme="light"] {
  --color-primary: #c92416;
  --color-secondary: #435464;
  --color-accent: #1d6fe8;
  --color-header: #ffffff;
  --color-header-ink: #10161d;
  --color-footer: #ffffff;
  --color-sidebar: #ffffff;
  --color-bg: #f6f7f9;
  --color-card: #ffffff;
  --color-card-soft: #f2f4f6;
  --color-border: #e1e6eb;
  --color-border-strong: #c9d1d9;
  --color-font: #29343d;
  --color-font-muted: #64717d;
  --color-heading: #131c25;
  --color-table: #ffffff;
  --color-table-head: #f2f4f6;
  --app-gradient:
    radial-gradient(1200px 720px at 6% -14%, #dbe7fb 0%, rgba(219, 231, 251, 0) 52%),
    radial-gradient(1100px 640px at 116% 4%, #e4e1f7 0%, rgba(228, 225, 247, 0) 50%),
    radial-gradient(900px 700px at 85% 115%, #dfebf5 0%, rgba(223, 235, 245, 0) 55%),
    linear-gradient(152deg, #eaf1fb 0%, #e6ecf6 52%, #ebe7f6 100%);
  --glass-bg: rgba(255, 255, 255, 0.66);
  --glass-bg-strong: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 10px 32px rgba(19, 32, 56, 0.1), 0 2px 8px rgba(19, 32, 56, 0.06);
}

/* ---- dark theme ---- */
:root[data-theme="dark"] {
  --color-primary: #e0473a;
  --color-secondary: #a9b7c4;
  --color-accent: #4d8dff;
  --color-header: #0a0f15;
  --color-header-ink: #eef2f6;
  --color-footer: #0a0f15;
  --color-sidebar: #0a0f15;
  --color-bg: #10161d;
  --color-card: #171f29;
  --color-card-soft: #1c2530;
  --color-border: #2a3542;
  --color-border-strong: #3a4856;
  --color-font: #cbd5e0;
  --color-font-muted: #8393a3;
  --color-heading: #f2f5f8;
  --color-table: #171f29;
  --color-table-head: #1c2530;
  --status-suitable-bg: #12312490;
  --status-near-suitable-bg: #12233f90;
  --status-oversized-bg: #3a2a1090;
  --status-undersized-bg: #3a161390;
  --app-gradient:
    radial-gradient(1100px 620px at 12% -12%, #16233a 0%, rgba(22, 35, 58, 0) 58%),
    radial-gradient(1000px 560px at 112% 6%, #14202f 0%, rgba(20, 32, 47, 0) 55%),
    linear-gradient(158deg, #0e141c 0%, #0b1119 100%);
  --glass-bg: rgba(24, 32, 43, 0.62);
  --glass-bg-strong: rgba(26, 35, 47, 0.86);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-shadow: 0 12px 34px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

/* ---- density presets ---- */
:root[data-density="compact"] {
  --density-gap: 10px;
  --density-field-h: 36px;
  --card-padding: clamp(12px, 1.6vw, 18px);
  --section-gap: clamp(12px, 1.6vw, 18px);
}

/* ---- shadow presets ---- */
:root[data-shadow="flat"] { --card-shadow: var(--shadow-flat); }
:root[data-shadow="soft"] { --card-shadow: var(--shadow-soft); }
:root[data-shadow="elevated"] { --card-shadow: var(--shadow-elevated); }
:root:not([data-shadow]) { --card-shadow: var(--shadow-flat); }

* {
  box-sizing: border-box;
}

html[dir="rtl"] {
  direction: rtl;
}

body {
  margin: 0;
  background: var(--app-gradient, var(--color-bg));
  background-attachment: fixed;
  color: var(--color-font);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  font-variant-numeric: tabular-nums;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--color-accent);
}

h1, h2, h3, h4 {
  color: var(--color-heading);
  margin: 0;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-font-muted);
}

/* ==========================================================================
   App shell / header
   ========================================================================== */

html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#app {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
}

/* min-width:0 is required on every flex ancestor of the main column: without
   it the default min-width:auto lets a wide child (the multi-column batch
   table) force the whole shell past the viewport, pushing the header controls
   off-screen. Wide tables scroll inside their own overflow-x wrappers. */
.selector-root {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
}

/* ==========================================================================
   App shell: permanent left Navigation Sidebar + main column, with a
   full-width application footer pinned beneath both (spanning under the
   sidebar too, not just the main column). Only .workspace scrolls - the
   sidebar, header, control bar, and footer stay fixed in place.
   ========================================================================== */

.app-viewport {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.app-shell {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
  width: 100%;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-main .workspace {
  flex: 1;
  overflow-y: auto;
}

/* ---- sidebar ---- */

.app-sidebar {
  flex: none;
  width: 284px;
  display: flex;
  flex-direction: column;
  background: var(--color-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  padding: 20px 16px;
  gap: 8px;
}

:root[data-theme="light"] .app-sidebar {
  border-right-color: var(--color-border);
}

.sidebar-brand {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .sidebar-brand {
  border-bottom-color: var(--color-border);
}

.sidebar-brand-mark {
  flex: none;
  width: 34px;
  height: 34px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-brand-mark img.is-broken {
  display: none;
}

.sidebar-brand-mark .logo-fallback {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 8px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--color-primary);
  text-align: center;
}

.sidebar-brand-divider {
  flex: none;
  align-self: stretch;
  width: 1px;
  background: rgba(255, 255, 255, 0.14);
}

:root[data-theme="light"] .sidebar-brand-divider {
  background: var(--color-border);
}

.sidebar-brand-copy {
  min-width: 0;
  flex: 1;
}

.sidebar-tagline {
  margin: 2px 0 0;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.3;
}

:root[data-theme="light"] .sidebar-tagline {
  color: var(--color-font-muted);
}

.sidebar-section {
  margin-bottom: 16px;
}

.sidebar-products {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.sidebar-products .sidebar-section-heading {
  flex: none;
}

.sidebar-section-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.44);
  margin: 0 0 10px;
}

:root[data-theme="light"] .sidebar-section-heading {
  color: var(--color-font-muted);
}

.sidebar-products .product-panel {
  min-width: 0;
  max-width: none;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-tools {
  flex: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}

:root[data-theme="light"] .sidebar-tools {
  border-top-color: var(--color-border);
}

.sidebar-tools-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-tool-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  padding: 9px 11px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--motion-fast) var(--ease-std),
    color var(--motion-fast) var(--ease-std);
}

.sidebar-tool-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  opacity: 0.7;
}

.sidebar-tool-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

.sidebar-tool-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar-tool-button:hover:not(:disabled) .sidebar-tool-icon,
.sidebar-tool-button.is-active .sidebar-tool-icon {
  opacity: 1;
  color: var(--color-accent);
}

.sidebar-tool-button.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

:root[data-theme="light"] .sidebar-tool-button.is-active {
  background: var(--color-card-soft);
  color: var(--color-heading);
}

:root[data-theme="light"] .sidebar-tool-button {
  color: var(--color-font);
}

:root[data-theme="light"] .sidebar-tool-button:hover:not(:disabled) {
  background: var(--color-card-soft);
  color: var(--color-heading);
}

.sidebar-tool-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sidebar-coming-soon {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-font-muted);
}

.sidebar-settings-block {
  flex: none;
  margin-bottom: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}

:root[data-theme="light"] .sidebar-settings-block {
  border-top-color: var(--color-border);
}

.sidebar-settings-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-button);
  padding: 11px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-header-ink);
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-std),
    border-color var(--motion-fast) var(--ease-std);
}

.sidebar-settings-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.sidebar-settings-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

.sidebar-settings-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

:root[data-theme="light"] .sidebar-settings-button:hover {
  background: var(--color-card-soft);
  border-color: var(--color-action);
}

:root[data-theme="light"] .sidebar-settings-button {
  background: var(--color-card-soft);
  border-color: var(--color-border);
  color: var(--color-font);
}

.sidebar-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.5);
}

:root[data-theme="light"] .sidebar-footer {
  border-top-color: var(--color-border);
  color: var(--color-font-muted);
}

/* ==========================================================================
   Mobile / tablet navigation: hamburger + off-canvas drawer (Tools,
   Settings, Language, Theme). Everything here is inert on desktop by
   default (display:none) - the @media (max-width: 860px) block further
   down is what actually turns it into a working drawer.
   ========================================================================== */

.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: var(--radius-button);
  background: transparent;
  color: var(--color-header-ink);
  flex: none;
  cursor: pointer;
}

.mobile-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .mobile-menu-toggle:hover {
  background: var(--color-card-soft);
}

.mobile-menu-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.drawer-backdrop {
  display: none;
}

.drawer-mobile-controls {
  display: none;
}

.drawer-control-row {
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-button);
  padding: 0 13px;
  height: 40px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-header-ink);
  cursor: pointer;
  text-align: left;
}

:root[data-theme="light"] .drawer-control-row {
  background: var(--color-card-soft);
  border-color: var(--color-border);
  color: var(--color-font);
}

.drawer-control-row select {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 12.5px;
  height: 100%;
}

.drawer-control-row select option {
  color: #111;
}

.drawer-header {
  display: none;
}

.drawer-dashboard {
  display: none;
}

.app-header {
  background: var(--color-header);
  color: var(--color-header-ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px var(--page-padding);
}

:root[data-theme="light"] .app-header {
  border-bottom-color: var(--color-border);
}

.brand-eyebrow {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

:root[data-theme="light"] .brand-eyebrow {
  color: var(--color-font-muted);
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.title-row h1 {
  font-size: 14.5px;
  line-height: 1.3;
  font-weight: 800;
  color: var(--color-header-ink);
  white-space: normal;
  overflow-wrap: break-word;
}

.pro-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--color-primary);
  color: #fff;
  flex: none;
  margin-top: 1px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.language-control {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-button);
  padding: 0 8px;
  height: 36px;
}

:root[data-theme="light"] .language-control {
  background: var(--color-card-soft);
  border-color: var(--color-border);
}

.language-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  opacity: 0.75;
}

.language-control select {
  background: transparent;
  border: none;
  color: var(--color-header-ink);
  font-size: 12.5px;
  height: 34px;
}

.language-control select option {
  color: #111;
}

.icon-toggle-button {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-button);
  color: var(--color-header-ink);
  cursor: pointer;
  transition: background 0.12s ease;
}

:root[data-theme="light"] .icon-toggle-button {
  background: var(--color-card-soft);
  border-color: var(--color-border);
}

.icon-toggle-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

:root[data-theme="light"] .icon-toggle-button:hover {
  background: var(--color-border);
}

.icon-toggle-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

.theme-toggle-label {
  font-size: 11.5px;
  font-weight: 600;
}

/* Header profile chip: round initials avatar + name/role, opens the
   profile/settings menu. Sits at the far right of the header. */
.header-profile {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 5px 0 12px;
  margin-left: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--color-header-ink);
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-std),
    border-color var(--motion-fast) var(--ease-std);
}

.header-profile:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.24);
}

.header-profile:focus-visible {
  outline: 2px solid var(--color-action);
  outline-offset: 2px;
}

:root[data-theme="light"] .header-profile {
  background: var(--color-card);
  border-color: var(--color-border);
}

:root[data-theme="light"] .header-profile:hover {
  border-color: var(--color-action);
}

.header-profile-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
  min-width: 0;
}

.header-profile-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-profile-role {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.62;
}

.header-profile-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(140deg, var(--color-accent) 0%, #0f3f8f 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

@media (max-width: 720px) {
  .header-profile-meta {
    display: none;
  }
  .header-profile {
    padding: 0 4px;
  }
}

/* ==========================================================================
   Control bar: product selector + spec strip
   ========================================================================== */

.control-bar {
  background: var(--color-sidebar);
  border-bottom: 1px solid var(--color-border);
  padding: 10px var(--page-padding);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
  z-index: 15;
}

:root[data-theme="engineering"] .control-bar,
:root[data-theme="dark"] .control-bar {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.spec-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 2px;
}

.spec-chip {
  display: flex;
  flex-direction: column;
  padding: 6px 12px;
  border-radius: var(--radius-button);
  border: 1px solid var(--color-border);
  background: var(--color-card);
  min-width: 74px;
}

:root[data-theme="engineering"] .spec-chip,
:root[data-theme="dark"] .spec-chip {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.spec-chip strong {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--color-heading);
}

:root[data-theme="engineering"] .spec-chip strong,
:root[data-theme="dark"] .spec-chip strong {
  color: #fff;
}

.spec-chip em {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-font-muted);
}

:root[data-theme="engineering"] .spec-chip em,
:root[data-theme="dark"] .spec-chip em {
  color: rgba(255, 255, 255, 0.5);
}

.spec-chip-status strong {
  position: relative;
  padding-left: 12px;
}

.spec-chip-status strong::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-undersized);
}

.spec-chip-status.is-online strong::before {
  background: var(--status-suitable);
}

/* ---- product panel: catalogue-style selected-product display ---- */

.product-panel {
  position: relative;
  min-width: 280px;
  flex: 1 1 320px;
  max-width: 460px;
}

.product-selector {
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: none;
}

.product-selected-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-card);
  padding: 14px 14px 14px 12px;
  box-shadow: var(--card-shadow);
}

.product-selected-card.is-coming-soon {
  border-left-color: var(--color-border-strong);
}

.product-selected-caption {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-font-muted);
}

.product-media-large {
  width: 100%;
  height: 176px;
  flex: none;
  border-radius: var(--radius-button);
  background: var(--color-card-soft);
  border: 1px solid var(--color-border);
  box-shadow: inset 0 1px 2px rgba(19, 32, 56, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}

:root[data-theme="dark"] .product-media-large {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.product-media-large img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
}

.product-media-large img.is-broken {
  display: none;
}

.product-media-large .product-fallback {
  font-size: 30px;
}

.product-media {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 4px;
  background: var(--color-card-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-media img.is-broken {
  display: none;
}

.product-fallback {
  font-size: 10px;
  font-weight: 800;
  color: var(--color-primary);
}

.product-selected-name {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-heading);
  white-space: normal;
  overflow-wrap: break-word;
}

.product-selected-series {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-font-muted);
  margin-top: -4px;
}

.product-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-chip {
  display: inline-flex;
  align-items: center;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-font-muted);
}

.product-chip.is-status {
  position: relative;
  padding-left: 16px;
}

.product-chip.is-status::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--status-undersized);
}

.product-chip.is-status.is-available::before {
  background: var(--status-suitable);
}

.product-chip.is-status.is-pending::before {
  background: var(--status-oversized);
}

.product-toggle-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  padding: 8px 10px;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-primary);
  cursor: pointer;
}

.product-toggle-button:hover {
  border-color: var(--color-primary);
  background: var(--color-card-soft);
}

.product-toggle-chevron {
  font-size: 8px;
  line-height: 1;
}

.selected-catalogue-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-action);
  border: none;
  padding: 0;
  background: transparent;
  text-decoration: none;
}

.selected-catalogue-link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

.selected-catalogue-link:hover {
  text-decoration: underline;
}

.product-list-wrap {
  flex: none;
  margin-top: 10px;
}

.sidebar-products .product-list {
  position: static;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  max-height: none;
  overflow-y: visible;
}

.product-list {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--color-card);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-card);
  box-shadow: 0 18px 40px rgba(16, 22, 29, 0.22);
  padding: 8px;
  max-height: 60vh;
  overflow-y: auto;
}

.product-list.is-open {
  display: grid;
  gap: 7px;
}

.product-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: var(--radius-button);
  padding: 9px 9px 9px 7px;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--motion-fast) var(--ease-std),
    border-color var(--motion-fast) var(--ease-std);
}

.product-card:hover:not(.is-coming-soon) {
  background: var(--color-card-soft);
  border-left-color: var(--color-border-strong);
}

.product-card.is-active {
  border-color: var(--color-border-strong);
  border-left-color: var(--color-primary);
  background: var(--color-card-soft);
}

.product-card.is-coming-soon {
  opacity: 0.5;
  cursor: not-allowed;
}

.product-card .product-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.product-card strong {
  font-size: 12.5px;
  color: var(--color-heading);
}

.product-card .catalogue-link,
.product-card .coming-soon {
  font-size: 10.5px;
  color: var(--color-font-muted);
}

.product-card .coming-soon {
  color: var(--status-oversized);
}

/* ==========================================================================
   Workspace layout
   ========================================================================== */

/* Outer scroll container: a vertical stack of the "top" row (selector form +
   Dashboard rail) and the Multiple Requirements batch section. Fills the
   full available width of .app-main - the form (flex:1) absorbs whatever
   space isn't used by the sidebar and the fixed-width Dashboard rail, so
   there's no dead margin on wide/ultra-wide monitors. */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  padding: var(--section-gap) var(--page-padding);
  width: 100%;
}

/* Top row: main selector column (flexible) + a fixed-width Dashboard rail on
   the right, matching the sidebar's fixed-width feel on the opposite side. */
.workspace-top {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--section-gap);
  width: 100%;
}

.workspace-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

.workspace-batch {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

/* ---- shared card recipe ---- */

.selector-form,
.message-panel,
.loading-panel,
.results-panel,
.status-strip,
.info-card,
.batch-panel,
.batch-results-card,
.settings-dialog,
.graph-dialog {
  background: var(--glass-bg, var(--color-card));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border, var(--color-border));
  border-radius: var(--radius-card);
  box-shadow: var(--glass-shadow, var(--card-shadow));
}

/* Modals sit over a blurred scrim — give them a more opaque glass so dense
   settings/graph content stays fully legible. */
.settings-dialog,
.graph-dialog {
  background: var(--glass-bg-strong, var(--color-card));
}

.selector-form,
.batch-panel,
.batch-results-card {
  padding: var(--card-padding);
}

.results-panel:not(:empty) {
  padding: var(--card-padding);
}

.card-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: var(--density-gap);
  padding-bottom: var(--density-gap);
  border-bottom: 1px solid var(--color-border);
}

.card-title h2 {
  font-size: 15px;
  font-weight: 700;
}

.card-title p,
.active-product-label {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--color-font-muted);
}

.title-icon {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 4px;
  background: var(--color-card-soft);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.title-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

/* ==========================================================================
   Filter form
   ========================================================================== */

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px 16px;
  margin-bottom: var(--density-gap);
}

.input-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-font-muted);
}

.input-grid label.is-hidden {
  display: none;
}

input,
select {
  height: var(--density-field-h);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-button);
  background: var(--color-card);
  color: var(--color-font);
  padding: 0 10px;
  font-size: 13.5px;
  transition: border-color var(--motion-fast) var(--ease-std),
    box-shadow var(--motion-fast) var(--ease-std);
}

input:hover:not(:focus),
select:hover:not(:focus) {
  border-color: var(--color-font-muted);
}

/* Premium, consistent checkbox / radio accent (engineering blue). */
input[type="checkbox"],
input[type="radio"] {
  height: auto;
  accent-color: var(--color-action);
  cursor: pointer;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--color-action);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-action) 18%, transparent);
}

/* Keyboard focus ring for interactive controls (mouse clicks stay clean via
   :focus-visible). Applies across every button variant + links. */
.primary-button:focus-visible,
.secondary-button:focus-visible,
.outline-button:focus-visible,
.danger-button:focus-visible,
.ghost-button:focus-visible,
.icon-button:focus-visible,
.sidebar-tool-button:focus-visible,
.sidebar-settings-button:focus-visible,
.product-toggle-button:focus-visible,
.product-card:focus-visible,
.social-link:focus-visible,
.footer-contact-item:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--color-action);
  outline-offset: 2px;
}

.danger-button:focus-visible {
  outline-color: var(--color-danger);
}

/* On dark surfaces (navy sidebar) lift the ring so it stays visible. */
.sidebar-tool-button:focus-visible,
.sidebar-settings-button:focus-visible {
  outline-color: #ffffff;
  outline-offset: 1px;
}

.filter-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: var(--density-gap);
  border-top: 1px solid var(--color-border);
}

.filter-action-left,
.filter-action-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--color-font-muted);
}

.checkbox-row input {
  width: 15px;
  height: 15px;
  padding: 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

button {
  cursor: pointer;
}

.primary-button,
.secondary-button,
.outline-button,
.danger-button,
.ghost-button,
.icon-button {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-button);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color var(--motion-fast) var(--ease-std),
    border-color var(--motion-fast) var(--ease-std),
    color var(--motion-fast) var(--ease-std),
    box-shadow var(--motion-fast) var(--ease-std);
}

.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active,
.outline-button:not(:disabled):active,
.danger-button:not(:disabled):active,
.ghost-button:not(:disabled):active,
.icon-button:not(:disabled):active {
  transform: translateY(1px);
}

/* Primary = strong engineering blue */
.primary-button {
  background: var(--color-action);
  color: #fff;
  box-shadow: 0 1px 2px rgba(19, 32, 56, 0.18);
}

.primary-button:hover {
  background: var(--color-action-strong);
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Secondary = neutral */
.secondary-button {
  background: var(--color-card);
  color: var(--color-font);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-soft);
}

.secondary-button:hover {
  border-color: var(--color-action);
  color: var(--color-action);
}

/* Outline / ghost = transparent */
.outline-button,
.ghost-button {
  background: transparent;
  color: var(--color-action);
  border-color: var(--color-action);
}

.ghost-button {
  border-color: transparent;
  color: var(--color-font);
}

.outline-button:hover,
.ghost-button:hover {
  background: color-mix(in srgb, var(--color-action) 8%, transparent);
}

/* Danger = engineering red */
.danger-button {
  background: var(--color-danger);
  color: #fff;
  box-shadow: 0 1px 2px rgba(19, 32, 56, 0.18);
}

.danger-button:hover {
  background: var(--color-danger-strong);
}

.outline-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.icon-button {
  height: 32px;
  padding: 0 10px;
  background: var(--color-card-soft);
  color: var(--color-font);
  border-color: var(--color-border);
  font-size: 11.5px;
}

.icon-button:hover {
  border-color: var(--color-action);
  color: var(--color-action);
}

/* Button icons: consistent sizing + stroke, aligned to the label. */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.primary-button svg,
.secondary-button svg,
.outline-button svg,
.danger-button svg,
.ghost-button svg,
.icon-button svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* button-style presets */
:root[data-button-style="outline"] .primary-button {
  background: transparent;
  color: var(--color-action);
  border-color: var(--color-action);
  box-shadow: none;
}

:root[data-button-style="soft"] .primary-button {
  background: color-mix(in srgb, var(--color-action) 14%, transparent);
  color: var(--color-action);
  box-shadow: none;
}

/* Respect the OS "reduce motion" preference: keep the UI legible and
   functional, but drop transitions/animations and press-nudge transforms. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .primary-button:not(:disabled):active,
  .secondary-button:not(:disabled):active,
  .outline-button:not(:disabled):active,
  .danger-button:not(:disabled):active,
  .ghost-button:not(:disabled):active,
  .icon-button:not(:disabled):active {
    transform: none;
  }
}

.form-message {
  min-height: 0;
  font-size: 12.5px;
  font-weight: 600;
}

.form-message:not(:empty) {
  padding: 10px 14px;
  border-radius: var(--radius-button);
  background: var(--color-card-soft);
  border: 1px solid var(--color-border);
}

.form-message.is-success {
  background: var(--status-suitable-bg);
  color: var(--status-suitable);
  border-color: transparent;
}

.form-message.is-warning {
  background: var(--status-oversized-bg);
  color: var(--status-oversized);
  border-color: transparent;
}

.form-message.is-error {
  background: var(--status-undersized-bg);
  color: var(--status-undersized);
  border-color: transparent;
}

/* ==========================================================================
   Status strip + badges (indicator-light instrumentation, not SaaS pills)
   ========================================================================== */

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 12px var(--card-padding);
}

.status-strip:empty {
  display: none;
  padding: 0;
  border: none;
}

.status-key {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-font-muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 9px 3px 7px;
  border-radius: 3px;
}

.status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

:root[data-badge-style="pill"] .status-badge {
  border-radius: 999px;
  padding: 4px 11px 4px 9px;
}

.status-badge.suitable {
  color: var(--status-suitable);
  background: var(--status-suitable-bg);
}

.status-badge.near-suitable {
  color: var(--status-near-suitable);
  background: var(--status-near-suitable-bg);
}

.status-badge.oversized {
  color: var(--status-oversized);
  background: var(--status-oversized-bg);
}

.status-badge.undersized {
  color: var(--status-undersized);
  background: var(--status-undersized-bg);
}

/* ==========================================================================
   Results
   ========================================================================== */

.results-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: var(--density-gap);
}

.results-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.results-title h2 {
  font-size: 16px;
}

.summary-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-metrics span {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 3px;
  background: var(--color-card-soft);
  border: 1px solid var(--color-border);
  color: var(--color-font-muted);
}

.result-context {
  margin: 0 0 var(--density-gap);
  font-size: 12.5px;
  color: var(--color-font-muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
}

.results-table,
.batch-input-table,
.graph-data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-table);
  font-size: 12.5px;
}

.results-table thead th,
.graph-data-table thead th {
  background: var(--color-table-head);
  color: var(--color-font-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.results-table td,
.graph-data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}

.results-table tbody tr {
  transition: background-color var(--motion-fast) var(--ease-std);
}

.results-table tbody tr:hover {
  background: var(--color-card-soft);
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

.results-table td strong {
  display: block;
  font-size: 12.5px;
  color: var(--color-heading);
}

.results-table td > span {
  display: block;
  font-size: 11px;
  color: var(--color-font-muted);
  margin-top: 2px;
}

/* status-driven left accent bar on result rows */
tr[class*="status-row-"] td:first-child {
  border-left: 3px solid transparent;
}

.status-row-suitable td:first-child { border-left-color: var(--status-suitable); }
.status-row-near-suitable td:first-child { border-left-color: var(--status-near-suitable); }
.status-row-oversized td:first-child { border-left-color: var(--status-oversized); }
.status-row-undersized td:first-child { border-left-color: var(--status-undersized); }

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.action-button {
  font-size: 10.5px;
  height: 28px;
  padding: 0 9px;
}

/* Favorite (star) toggle in the results actions column. */
.favorite-button {
  padding: 0 8px;
}

.favorite-button svg {
  fill: none;
  stroke: currentColor;
  transition: fill var(--motion-fast) var(--ease-std), stroke var(--motion-fast) var(--ease-std);
}

.favorite-button.is-favorited {
  color: #b1720f;
  border-color: color-mix(in srgb, #b1720f 45%, transparent);
  background: color-mix(in srgb, #b1720f 10%, transparent);
}

.favorite-button.is-favorited svg {
  fill: #e0a12a;
  stroke: #b1720f;
}

/* ==========================================================================
   Tools panels (Favorites / Saved Projects) - reuse the .admin-panel shell
   ========================================================================== */

.tools-panel-body {
  min-height: 120px;
}

.tools-empty {
  margin: 0;
  padding: 18px 2px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--color-font-muted);
}

.tools-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tools-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  background: var(--color-card-soft);
  transition: border-color var(--motion-fast) var(--ease-std);
}

.tools-list-item:hover {
  border-color: var(--color-border-strong);
}

.tools-item-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.tools-item-main strong {
  font-size: 12.5px;
  color: var(--color-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tools-item-meta {
  font-size: 11px;
  color: var(--color-font-muted);
}

.tools-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.tools-item-remove {
  color: var(--status-undersized);
}

.tools-item-remove:hover {
  border-color: var(--status-undersized);
}

.tools-panel-footer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px var(--card-padding);
  border-top: 1px solid var(--color-border);
}

.tools-save-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 220px;
  min-width: 0;
}

.tools-save-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-font-muted);
}

.info-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--color-font-muted);
}

/* ==========================================================================
   Batch panel
   ========================================================================== */

.batch-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  margin-bottom: var(--density-gap);
}

.batch-input-table th {
  background: var(--color-table-head);
  color: var(--color-font-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 9px;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}

.batch-input-table td {
  padding: 8px;
  border-bottom: 1px solid var(--color-border);
}

.batch-input-table input,
.batch-input-table select {
  height: 38px;
  min-width: 104px;
  font-size: 12.5px;
}

.requirement-no {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-font-muted);
}

.remove-row-button {
  color: var(--status-undersized);
}

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

.batch-graph-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: var(--density-gap) 0;
  border-top: 1px solid var(--color-border);
  margin-top: var(--density-gap);
  font-size: 12px;
  color: var(--color-font-muted);
}

.batch-result-list {
  display: flex;
  flex-direction: column;
  gap: var(--density-gap);
}

.batch-result-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  padding: var(--density-gap);
}

.batch-result-header h3 {
  font-size: 13.5px;
}

.batch-result-header p {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--color-font-muted);
}

.compact-table-wrap {
  margin-top: 10px;
}

.compact-message p {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--color-font-muted);
}

/* ==========================================================================
   Dashboard rail: fixed-width right-hand column (companion to the sidebar's
   Product Selection panel on the left), holding a single stacked column of
   compact reference/status cards instead of the old full-bleed single-row
   strip. 336px matches the sidebar's fixed-width feel on the opposite side.
   ========================================================================== */

.workspace-dashboard {
  flex: 0 0 280px;
  width: 280px;
  min-width: 0;
}

.dashboard-rail-heading {
  margin: 0 0 10px;
}

.workspace-dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: var(--density-gap);
}

.info-card {
  padding: var(--card-padding);
  transition: border-color var(--motion-fast) var(--ease-std),
    box-shadow var(--motion-fast) var(--ease-std);
}

.info-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-elevated);
}

.info-icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--color-action) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-action) 20%, transparent);
  color: var(--color-action);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 11px;
}

.info-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

.info-card h3 {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.info-card p {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--color-font-muted);
}

.support-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 700;
}

/* Slightly denser card recipe inside the rail than the main workspace cards,
   but full rail-width per card now (single column) so there's room to
   breathe compared to the old cramped 2-column attempt. Shared with the
   mobile drawer's Dashboard section (.drawer-dashboard) - same cards,
   same compact treatment. */
.workspace-dashboard .info-card,
.drawer-dashboard .info-card {
  padding: 16px 18px;
}

.workspace-dashboard .info-icon,
.drawer-dashboard .info-icon {
  width: 30px;
  height: 30px;
  margin-bottom: 9px;
}

.workspace-dashboard .info-icon svg,
.drawer-dashboard .info-icon svg {
  width: 16px;
  height: 16px;
}

.workspace-dashboard .info-card h3,
.drawer-dashboard .info-card h3 {
  font-size: 13px;
}

.workspace-dashboard .info-card p,
.drawer-dashboard .info-card p {
  font-size: 11.5px;
  margin-top: 5px;
}

.workspace-dashboard .info-card ul,
.drawer-dashboard .info-card ul {
  margin: 7px 0 0;
  padding-left: 16px;
  font-size: 11px;
}

.workspace-dashboard .info-card ul li,
.drawer-dashboard .info-card ul li {
  margin: 2px 0;
}

.drawer-dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: var(--density-gap);
}

.dashboard-activity-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dashboard-activity-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 7px;
  background: var(--color-card-soft);
  font-size: 10.5px;
}

.dashboard-activity-list li span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-activity-time {
  flex: none;
  color: var(--color-font-muted);
  font-size: 10px;
  white-space: nowrap;
}

.dashboard-activity-empty {
  margin-top: 8px;
  font-size: 11px;
}

/* ==========================================================================
   Empty / loading / error states
   ========================================================================== */

.message-panel {
  padding: 26px var(--card-padding);
  text-align: left;
}

.message-panel h2,
.message-panel h3 {
  font-size: 15px;
}

.message-panel p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--color-font-muted);
}

.loading-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 40px var(--card-padding);
  margin: var(--section-gap);
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-primary);
  animation: spin 0.8s linear infinite;
}

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

.error-panel {
  padding: 32px var(--card-padding);
  text-align: center;
}

.error-icon svg {
  width: 30px;
  height: 30px;
  stroke: var(--status-undersized);
  fill: none;
  stroke-width: 1.6;
  margin-bottom: 10px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  flex: none;
  width: 100%;
  background: var(--color-footer);
  color: rgba(255, 255, 255, 0.72);
  padding: 14px clamp(16px, 2.4vw, 36px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  font-size: 11.5px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

:root[data-theme="light"] .app-footer {
  color: var(--color-font-muted);
  border-top: 1px solid var(--color-border);
}

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 22px;
  justify-self: start;
}

.footer-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: inherit;
  text-decoration: none;
  line-height: 1;
  transition: color var(--motion-fast) var(--ease-std);
}

.footer-contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  transition: color var(--motion-fast) var(--ease-std);
}

:root[data-theme="light"] .footer-contact-icon {
  color: var(--color-action);
}

.footer-contact-item:hover {
  color: #fff;
}

:root[data-theme="light"] .footer-contact-item:hover {
  color: var(--color-heading);
}

.footer-contact-item:hover .footer-contact-icon {
  color: var(--color-action);
}

.footer-copyright-block {
  justify-self: center;
  text-align: center;
}

.footer-copyright {
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.footer-social {
  display: flex;
  gap: 9px;
  justify-self: end;
}

@media (max-width: 760px) {
  .app-footer {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 12px;
  }

  .footer-contact,
  .footer-copyright-block,
  .footer-social {
    justify-self: center;
  }

  .footer-contact {
    justify-content: center;
  }
}

.social-link {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.82);
  transition: background-color var(--motion-fast) var(--ease-std),
    border-color var(--motion-fast) var(--ease-std),
    color var(--motion-fast) var(--ease-std);
}

.social-link:hover {
  background: var(--color-action);
  border-color: var(--color-action);
  color: #fff;
}

:root[data-theme="light"] .social-link {
  background: var(--color-card-soft);
  border-color: var(--color-border);
  color: var(--color-font-muted);
}

:root[data-theme="light"] .social-link:hover {
  background: var(--color-action);
  border-color: var(--color-action);
  color: #fff;
}

.social-link svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  stroke: none;
}

.social-link:hover {
  background: var(--color-primary);
  color: #fff;
}

/* ==========================================================================
   Modal shell (graph + settings share this pattern)
   ========================================================================== */

.graph-modal,
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}

.graph-modal.is-open,
.settings-modal.is-open {
  display: block;
}

.graph-backdrop,
.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 20, 34, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.graph-dialog,
.settings-dialog {
  position: relative;
  margin: 3vh auto;
  width: min(1040px, 94vw);
  max-height: 94vh;
  overflow-y: auto;
  padding: var(--card-padding);
}

.settings-dialog {
  padding: 0;
  display: flex;
  flex-direction: column;
  width: min(920px, 94vw);
}

.graph-close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--color-card-soft);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.settings-dialog .graph-close-button {
  position: static;
}

.graph-close-button svg {
  width: 15px;
  height: 15px;
  stroke: var(--color-font);
  fill: none;
  stroke-width: 1.7;
}

.graph-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: var(--density-gap);
  margin-bottom: var(--density-gap);
  border-bottom: 1px solid var(--color-border);
}

.graph-header h2 {
  font-size: 17px;
}

.graph-header p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--color-font-muted);
}

.graph-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.graph-summary span {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 3px;
  background: var(--color-card-soft);
  border: 1px solid var(--color-border);
  color: var(--color-font-muted);
  font-family: var(--font-mono);
}

.graph-source-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--color-font-muted);
  margin-bottom: 10px;
}

.graph-chart-wrap {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  overflow-x: auto;
  padding: 10px;
  background: var(--color-card-soft);
}

.curve-chart {
  display: block;
  width: 100%;
  min-width: 680px;
  height: auto;
}

.graph-availability-note {
  margin-top: var(--density-gap);
  padding: 10px 14px;
  border-radius: var(--radius-button);
  background: var(--status-suitable-bg);
  color: var(--status-suitable);
  font-size: 12.5px;
}

.graph-availability-note.is-warning {
  background: var(--status-oversized-bg);
  color: var(--status-oversized);
}

.graph-data-table-wrap {
  margin-top: var(--density-gap);
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
}

.graph-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: var(--density-gap);
  padding-top: var(--density-gap);
  border-top: 1px solid var(--color-border);
}

.batch-graph-groups {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

.batch-graph-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--card-padding);
}

.batch-graph-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--density-gap);
}

.batch-graph-group-header h3 {
  font-size: 14.5px;
}

.batch-graph-group-header p {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--color-font-muted);
}

.batch-graph-group-header > span {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-font-muted);
}

.combined-graph-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--density-gap);
}

.batch-graph-info {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  padding: 12px;
  overflow-y: auto;
  max-height: 480px;
}

.batch-graph-info h4 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-font-muted);
  margin-bottom: 8px;
}

.batch-graph-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 11.5px;
}

.batch-graph-info-item strong {
  font-size: 12px;
  color: var(--color-heading);
}

/* ==========================================================================
   Settings panel
   ========================================================================== */

.settings-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
}

.settings-dialog-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.settings-back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 34px;
  padding: 0 12px 0 9px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-button);
  background: var(--color-card);
  color: var(--color-font);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-std),
    border-color var(--motion-fast) var(--ease-std), color var(--motion-fast) var(--ease-std);
}

.settings-back-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-back-button:hover {
  border-color: var(--color-action);
  color: var(--color-action);
}

.settings-back-button:focus-visible {
  outline: 2px solid var(--color-action);
  outline-offset: 2px;
}

.settings-tabs {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 13px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-font-muted);
  white-space: nowrap;
  transition: color var(--motion-fast) var(--ease-std),
    border-color var(--motion-fast) var(--ease-std);
}

.settings-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  opacity: 0.8;
}

.settings-tab-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

.settings-tab:hover {
  color: var(--color-heading);
}

.settings-tab.is-active {
  color: var(--color-action);
  border-bottom-color: var(--color-action);
}

.settings-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.settings-panel-tab {
  display: none;
}

.settings-panel-tab.is-active {
  display: block;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-font-muted);
}

.settings-field small {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 10.5px;
  color: var(--color-font-muted);
}

.settings-color-field {
  display: flex;
  gap: 6px;
}

.settings-color-field input[type="color"] {
  width: 40px;
  height: var(--density-field-h);
  padding: 3px;
}

.settings-color-field input[type="text"] {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
}

.settings-file-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-file-field img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-card-soft);
  display: none;
}

.settings-inline-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
  font-weight: 500;
}

.settings-inline-checkbox input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.settings-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
}

.settings-footer-left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-import-label {
  cursor: pointer;
}

/* ==========================================================================
   Motor Specifications panel (Phase 2, read-only information layer)
   ========================================================================== */

.motor-panel-slot:empty {
  display: none;
}

.motor-panel {
  margin-top: var(--section-gap);
  padding-top: var(--density-gap);
  border-top: 1px solid var(--color-border);
}

.motor-panel-unavailable {
  padding: var(--card-padding);
}

.motor-unavailable-message {
  color: var(--color-font-muted);
  font-size: 13px;
}

.motor-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: var(--density-gap);
}

.motor-panel-header h2 {
  font-size: 16px;
  margin: 2px 0 0;
}

.motor-badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.motor-badge {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--color-card-soft);
  border: 1px solid var(--color-border);
  color: var(--color-font-muted);
}

.motor-voltage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--density-gap);
}

.motor-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--color-font-muted);
}

.motor-field-value {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-font);
}

.motor-voltage-select {
  width: auto;
  min-width: 90px;
}

.motor-tab-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--density-gap);
}

.motor-tab-button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-font-muted);
  cursor: pointer;
  white-space: nowrap;
}

.motor-tab-button.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.motor-tab-panel[hidden] {
  display: none;
}

.motor-spec-table {
  width: 100%;
  border-collapse: collapse;
}

.motor-spec-table th,
.motor-spec-table td {
  text-align: left;
  padding: 7px 10px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--color-border);
}

.motor-spec-table th {
  width: 42%;
  color: var(--color-font-muted);
  font-weight: 600;
}

.motor-spec-table td {
  font-weight: 700;
  color: var(--color-font);
}

.motor-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--density-gap);
}

.motor-chart-cell {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  padding: 8px;
  background: var(--color-card-soft);
}

.motor-load-chart {
  display: block;
  width: 100%;
  height: auto;
}

.motor-graph-unavailable {
  padding: 18px;
  text-align: center;
  color: var(--color-font-muted);
  font-size: 12.5px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-button);
}

.motor-notes-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--color-font);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.motor-notes-empty {
  color: var(--color-font-muted);
  font-size: 12.5px;
}

/* ==========================================================================
   Motor Engineering layer (Phase 3): health card, badges, voltage
   comparison, note cards, extension placeholders, motor comparison mode
   ========================================================================== */

.motor-health-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-card-soft);
  padding: 14px 16px;
  margin-bottom: var(--density-gap);
}

.motor-health-card.is-unavailable {
  text-align: center;
  padding: 18px;
}

.motor-health-title {
  font-weight: 700;
  color: var(--color-font-muted);
  margin: 0;
}

.motor-health-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.motor-health-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.motor-confidence {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.motor-confidence-stars {
  color: #f0a93a;
  letter-spacing: 1px;
  font-size: 13px;
}

.motor-confidence-label {
  color: var(--color-font-muted);
  font-weight: 700;
}

.motor-health-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.motor-health-chip {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-font);
}

.motor-health-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.motor-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}

.motor-status-pill.is-compatible {
  color: var(--status-suitable);
  background: var(--status-suitable-bg);
}

.motor-lookup-explanation {
  font-size: 11.5px;
  color: var(--color-font-muted);
}

.motor-engineering-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--density-gap);
}

.motor-engineering-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid transparent;
}

.motor-engineering-badge.is-positive {
  color: var(--status-suitable);
  background: var(--status-suitable-bg);
}

.motor-engineering-badge.is-warning {
  color: var(--status-oversized);
  background: var(--status-oversized-bg);
}

.motor-engineering-badge.is-neutral {
  color: var(--color-font-muted);
  background: var(--color-card-soft);
  border-color: var(--color-border);
}

.motor-subsection-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-font-muted);
  margin: var(--density-gap) 0 8px;
}

.motor-operating-notes-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--color-font);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.motor-comparison-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
}

.motor-voltage-comparison-table th.is-selected-voltage,
.motor-voltage-comparison-table td.is-selected-voltage {
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
}

.motor-note-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.motor-note-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-button);
  border: 1px solid var(--color-border);
  background: var(--color-card-soft);
}

.motor-note-card-icon {
  flex: none;
  font-size: 15px;
  line-height: 1.4;
}

.motor-note-card-title {
  margin: 0 0 2px;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.motor-note-card-body {
  margin: 0;
  font-size: 12.5px;
  color: var(--color-font);
}

.motor-note-card.is-warning {
  background: var(--status-oversized-bg);
  border-color: color-mix(in srgb, var(--status-oversized) 40%, var(--color-border));
}

.motor-note-card.is-warning .motor-note-card-title {
  color: var(--status-oversized);
}

.motor-note-card.is-info .motor-note-card-title {
  color: var(--color-primary);
}

.motor-note-card.is-source .motor-note-card-title {
  color: var(--color-font-muted);
}

.motor-extensions {
  margin-top: var(--section-gap);
  padding-top: var(--density-gap);
  border-top: 1px dashed var(--color-border);
}

.motor-extensions-title {
  margin: 0 0 2px;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-font-muted);
}

.motor-extensions-hint {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--color-font-muted);
}

.motor-extension-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.motor-extension-chip {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px dashed var(--color-border);
  color: var(--color-font-muted);
  background: transparent;
}

.compare-motors-button {
  white-space: nowrap;
}

.motor-comparison-slot:empty {
  display: none;
}

.motor-comparison-title {
  font-size: 13px;
  font-weight: 800;
  margin: var(--density-gap) 0 8px;
}

.motor-comparison-loading {
  font-size: 12.5px;
  color: var(--color-font-muted);
}

.motor-compare-table th,
.motor-compare-table td {
  white-space: nowrap;
}

.motor-compare-unavailable {
  color: var(--color-font-muted);
  font-style: italic;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .combined-graph-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  /* Compact density lever: one place to shrink cards/gaps/inputs app-wide
     for touch screens, instead of overriding dozens of individual
     selectors. Desktop values (:root, above) are untouched. */
  :root {
    --card-padding: 14px;
    --section-gap: 14px;
    --density-gap: 10px;
    --density-field-h: 38px;
  }

  html, body {
    height: auto;
  }

  body {
    overflow: visible;
  }

  #app,
  .selector-root,
  .app-shell {
    display: block;
  }

  /* ---- hamburger + off-canvas drawer ---- */

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 13, 20, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--motion-fast) var(--ease-std);
    z-index: 55;
  }

  .drawer-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.drawer-open {
    overflow: hidden;
  }

  #app-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(300px, 82vw);
    background: var(--color-sidebar);
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--motion-fast) var(--ease-std);
    z-index: 60;
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.3);
  }

  #app-drawer.is-open {
    transform: translateX(0);
  }

  .drawer-mobile-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .drawer-control-row {
    display: flex;
  }

  .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  :root[data-theme="light"] .drawer-header {
    border-bottom-color: var(--color-border);
  }

  .drawer-header-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--color-header-ink);
  }

  :root[data-theme="light"] .drawer-header-title {
    color: var(--color-heading);
  }

  .drawer-close-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: none;
    border: none;
    border-radius: var(--radius-button);
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-header-ink);
    cursor: pointer;
  }

  :root[data-theme="light"] .drawer-close-button {
    background: var(--color-card-soft);
    color: var(--color-font);
  }

  .drawer-close-button svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
  }

  .drawer-dashboard {
    display: block;
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  :root[data-theme="light"] .drawer-dashboard {
    border-top-color: var(--color-border);
  }

  /* Language/Theme now live inside the drawer (.drawer-control-row above) -
     hide the desktop header's copies. */
  .header-controls .language-control,
  #theme-toggle {
    display: none;
  }

  .brand-eyebrow {
    display: none;
  }

  /* ---- compact top chrome: sidebar is now just brand + product bar ---- */

  .app-sidebar {
    width: 100%;
    height: auto;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 14px;
    gap: 10px;
  }

  .sidebar-brand {
    padding-bottom: 10px;
    margin-bottom: 0;
  }

  .sidebar-tagline {
    display: none;
  }

  .app-main {
    height: auto;
    overflow: visible;
  }

  .app-main .workspace {
    overflow-y: visible;
  }

  .app-header {
    flex-wrap: wrap;
    padding: 10px var(--page-padding);
  }

  .control-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .product-panel {
    flex: none;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  /* Compact product-switcher: a slim persistent bar instead of the big
     desktop showcase card. Same markup/toggle, tighter presentation. */
  .product-selected-card {
    padding: 10px;
  }

  .product-media-large {
    height: 96px;
  }

  .product-selected-name {
    font-size: 13px;
  }

  .spec-strip {
    width: 100%;
  }

  .input-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .workspace-top {
    flex-direction: column;
    align-items: stretch;
  }

  /* The desktop Dashboard rail is hidden entirely here - its cards
     (Recent Activity, Multilingual Access, Intelligent Selection, Need
     Help) live inside the hamburger drawer instead (.drawer-dashboard,
     see renderSidebar()) so they don't sit between the search form and
     Multiple Requirements. */
  .workspace-dashboard {
    display: none;
  }

  /* Buttons are hardcoded (not tied to --density-field-h) - compact them
     explicitly for touch screens. */
  .primary-button,
  .secondary-button,
  .outline-button,
  .danger-button,
  .ghost-button,
  .icon-button {
    height: 34px;
    padding: 0 12px;
    font-size: 11.5px;
  }
}

@media (max-width: 640px) {
  .results-table thead {
    display: none;
  }

  .results-table,
  .results-table tbody,
  .results-table tr,
  .results-table td {
    display: block;
    width: 100%;
  }

  .results-table tr {
    border-bottom: 1px solid var(--color-border);
    padding: 10px 0;
  }

  .results-table td {
    border-bottom: none;
    padding: 4px 12px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
  }

  .results-table td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-font-muted);
    flex: none;
  }

  .header-controls {
    flex-wrap: wrap;
  }

  /* Scoped to the desktop header's button specifically - #theme-toggle is
     already display:none by 860px anyway (see above), this just documents
     intent. Must NOT hit .theme-toggle-label generically: the drawer's
     #theme-toggle-mobile reuses that class and needs its label visible. */
  #theme-toggle .theme-toggle-label {
    display: none;
  }

  .motor-panel-header {
    flex-direction: column;
  }

  .motor-chart-grid {
    grid-template-columns: 1fr;
  }

  .motor-tab-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .motor-health-top {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Print (graph export sheet)
   ========================================================================== */

@media print {
  body * {
    visibility: hidden;
  }

  .graph-dialog,
  .graph-dialog * {
    visibility: visible;
  }

  .graph-dialog {
    position: absolute;
    inset: 0;
    margin: 0;
    box-shadow: none;
    border: none;
    max-height: none;
    overflow: visible;
    background: #fff;
  }

  .graph-actions,
  .graph-close-button {
    display: none;
  }
}
