/* ---------- Brand variables ---------- */
:root {
  --color-primary: #E84C3D;   /* red - CTAs, active states */
  --color-black: #1A1A1A;     /* primary text, headers */
  --color-grey: #808080;      /* secondary text */
  --color-offwhite: #F5F5F5;  /* backgrounds */
  --color-white: #FFFFFF;

  --sidebar-width: 200px;

  --font-family: 'Montserrat', sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-family);
  font-weight: 500;
  color: var(--color-black);
  background-color: var(--color-white);
}

a {
  text-decoration: none;
  color: inherit;
}

/* Form controls don't automatically inherit body's font-weight in every
   browser (only font-family is inherited by default), so the app-wide
   "slightly thicker" bump above would otherwise miss every input, select,
   textarea, and button — a large share of the app's actual visible text. */
input,
select,
textarea,
button {
  font-family: var(--font-family);
  font-weight: inherit;
}

/* ---------- App layout ---------- */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app__body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.user-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: var(--color-white);
  font-weight: 500;
  font-size: 12px;
  flex: 0 0 auto;
  margin: 0 auto;
}

/* ---------- Sidebar ---------- */
/* Navigation only lives here now — no separate top bar, so this spans the
   full viewport height and every page gets that strip of height back. */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--color-offwhite);
  padding: 16px 0 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__logo {
  padding: 0 20px 18px 20px;
}

.sidebar__logo img {
  height: 34px;
  width: auto;
  display: block;
}

/* Pushes the user badge below to the bottom of the sidebar regardless of
   how many nav links there are. */
.sidebar__spacer {
  flex: 1;
}

.sidebar__link {
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 400;
  color: var(--color-black);
  border-left: 3px solid transparent;
}

.sidebar__link:hover {
  background-color: #ECECEC;
}

.sidebar__link.is-active {
  color: var(--color-primary);
  font-weight: 500;
  border-left-color: var(--color-primary);
  background-color: #FCEBE9;
}

/* ---------- Main content ---------- */
.content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 32px;
  background-color: var(--color-white);
}

/* Reserves scroll room while a catalog dropdown is open, so a row near the
   bottom of an already-fully-scrolled page still has somewhere to scroll to
   (see attachCatalogTypeahead in js/app.js). */
.content.has-open-typeahead {
  padding-bottom: 320px;
}

/* Toggled on #content (via JS, in openQuotationWorkspace/showQuotationPicker)
   whenever the quotation workspace is the visible view. Removes .content's
   own padding/scroll so .quotation-workspace can fill the full remaining
   viewport itself -- otherwise the 32px bottom padding here is what keeps
   the sticky footer from ever reaching the true bottom of the browser, and
   .content's own overflow-y:auto would be a second, competing scrollbar
   alongside the workspace's single internal one. */
.content.content--flush {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Targets whichever page is actually active, not just "quotation" by name —
   .content--flush is now also toggled by the Orders workspace (see
   openOrderWorkspace in orders.js), and without :not([hidden]) here this
   rule's specificity (0,3,0) beat the plain [hidden] UA rule (0,1,0)
   outright, forcing the quotation page to stay rendered with display:flex
   underneath the Orders page even while genuinely hidden — the exact cause
   of the two pages' content visibly overlapping. */
.content--flush .page:not([hidden]) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page h1 {
  font-weight: 500;
  font-size: 22px;
  color: var(--color-black);
  margin: 0 0 8px 0;
}

.page__placeholder {
  color: var(--color-grey);
  font-size: 14px;
}

.status-badge {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

/* Same author-vs-UA [hidden] gotcha as .login-overlay[hidden] above — this
   one only bit once Settings started toggling a hidden .status-badge
   (every prior use just swapped text, never hidden it). */
.status-badge[hidden] {
  display: none;
}

.status-badge--checking {
  background-color: var(--color-offwhite);
  color: var(--color-grey);
}

.status-badge--ok {
  background-color: #E7F5EA;
  color: #2E7D32;
}

.status-badge--error {
  background-color: #FCEBE9;
  color: var(--color-primary);
}

.preview-note {
  font-size: 12px;
  color: var(--color-grey);
  margin: -4px 0 20px 0;
}

/* ---------- Dashboard: stat tiles ---------- */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 0 0 32px 0;
}

.stat-tile {
  background-color: var(--color-offwhite);
  border-radius: 8px;
  padding: 20px 24px;
  min-width: 0;
}

.stat-tile__value {
  font-size: 28px;
  font-weight: 500;
  color: var(--color-primary);
  line-height: 1.2;
}

.stat-tile__label {
  font-size: 13px;
  color: var(--color-grey);
  margin-top: 4px;
}

.stat-tile__delta {
  font-size: 11px;
  color: #2E7D32;
  margin-top: 10px;
}

.stat-tile__delta--down {
  color: var(--color-primary);
}

.section-heading {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-black);
  margin: 0 0 12px 0;
}

/* ---------- Shared: "×" clear button wrapped around a search input ---------- */
/* display:flex (block-level by default, unless the parent itself is a flex
   row) makes this behave as a full-width box in a plain block parent AND as
   a growing flex item (flex:1) in a flex-row parent -- covers every context
   these inputs already live in without needing per-context overrides. */
.clearable-input {
  display: flex;
  flex: 1 1 0%;
  min-width: 0;
  position: relative;
}

.clearable-input input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding-right: 26px !important;
}

.clearable-input__clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-grey);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.clearable-input__clear:hover {
  color: var(--color-primary);
}

/* ---------- Dashboard: clickable quick-view rows/tiles ---------- */
.stat-tile--clickable,
.activity-row--clickable,
.order-progress-row--clickable,
.lookup-row--clickable {
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.1s ease;
}

.stat-tile--clickable:hover {
  background-color: #ECECEC;
}

.activity-row--clickable:hover,
.order-progress-row--clickable:hover,
.lookup-row--clickable:hover {
  background-color: #E5E5E5;
}

/* Keyboard-focus ring for custom clickable elements that aren't a native
   <button>/<a> — these all get tabindex + Enter/Space activation via
   makeKeyboardClickable() in app.js, so they need a visible focus state to
   actually be usable by keyboard, not just clickable by mouse. */
.stat-tile--clickable:focus-visible,
.activity-row--clickable:focus-visible,
.order-progress-row--clickable:focus-visible,
.lookup-row--clickable:focus-visible,
.quotation-list-row:focus-visible,
.product-card:focus-visible,
.search-result-row:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* ---------- Dashboard: content grid ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  margin-bottom: 36px;
}

.dashboard-grid__side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background-color: var(--color-offwhite);
  border-radius: 8px;
  padding: 20px 24px;
}

.panel__head {
  margin-bottom: 4px;
}

/* Recent activity */
.activity-row {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid #E5E5E5;
  font-size: 13px;
}

.activity-row:first-child {
  border-top: none;
}

.activity-time {
  flex: 0 0 auto;
  width: 100px;
  color: var(--color-grey);
  font-size: 12px;
  padding-top: 1px;
}

.activity-desc {
  color: var(--color-black);
  line-height: 1.5;
}

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background-color: #E5E5E5;
  color: var(--color-black);
  font-size: 11px;
  font-weight: 500;
  margin-right: 6px;
}

/* Shared: client badge used in orders-in-progress and quick lookup */
.client-badge {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: #E5E5E5;
  color: var(--color-black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 12px;
}

/* Orders in progress */
.order-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid #E5E5E5;
}

.order-progress-row:first-child {
  border-top: none;
}

.order-progress-info {
  flex: 1;
  min-width: 0;
}

.order-progress-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-black);
}

.order-progress-company {
  font-weight: 400;
  color: var(--color-grey);
}

.progress-track {
  width: 100%;
  max-width: 140px;
  height: 5px;
  background-color: #E5E5E5;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background-color: var(--color-primary);
}

.order-progress-pct {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--color-grey);
}

/* Quick lookup */
.lookup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid #E5E5E5;
}

.lookup-row:first-child {
  border-top: none;
}

.lookup-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-black);
}

.lookup-status {
  font-size: 12px;
  color: var(--color-grey);
  margin-top: 2px;
}

/* ---------- Dashboard: clients table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-weight: 500;
  color: var(--color-grey);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.4px;
  padding: 10px 12px;
  border-bottom: 1px solid #E5E5E5;
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid #F0F0F0;
  color: var(--color-black);
  vertical-align: top;
}

.data-table tr:hover td,
.data-table tr.is-active td {
  background-color: var(--color-offwhite);
}

.data-table__company {
  color: var(--color-grey);
  font-size: 12px;
  margin-top: 2px;
}

.brand-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background-color: #FCEBE9;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 500;
}

.stock-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
}

.stock-badge--in {
  background-color: #E7F5EA;
  color: #2E7D32;
}

.stock-badge--out {
  background-color: #FCEBE9;
  color: var(--color-primary);
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-family);
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
}

.btn--primary {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn--primary:hover {
  background-color: #D6402F;
}

.btn--secondary {
  background-color: var(--color-offwhite);
  color: var(--color-black);
  border: 1px solid #DDDDDD;
}

.btn--secondary:hover {
  background-color: #ECECEC;
}

.btn--ghost {
  background-color: transparent;
  color: var(--color-grey);
  border: 1px solid #DDDDDD;
}

.btn--ghost:hover {
  color: var(--color-black);
  border-color: var(--color-black);
}

.btn--small {
  padding: 5px 12px;
  font-size: 12px;
}

/* ---------- Shared: live item-table row filter (Quotation & Order) ---------- */
.item-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.item-filter-bar__input {
  flex: 1;
  max-width: 320px;
  padding: 8px 12px;
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--color-black);
}

.item-filter-bar__input::placeholder {
  color: var(--color-grey);
}

.item-filter-bar__input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.item-filter-bar__clear {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  background-color: var(--color-white);
  color: var(--color-grey);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.item-filter-bar__clear:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ---------- Selection: search rows ---------- */
.picker-row {
  display: flex;
  gap: 12px;
  margin: 20px 0 0 0;
}

.picker-search {
  flex: 1;
  max-width: 420px;
}

/* addClearButton() wraps the input in a .clearable-input span; without this,
   that wrapper has no max-width of its own and stretches to fill the row
   while the input stays capped at 420px, leaving the × (positioned inside
   the wrapper) stranded past the input's visible right edge. */
.picker-row .clearable-input {
  max-width: 420px;
}

/* Orders picker search: an autofill dropdown anchored under just the input
   (not the whole picker-row, which also has the + Order button) -- same
   capped-to-~6-rows-then-scroll panel look as .quotation-search-bar's
   product dropdown. */
.order-search-bar {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.order-search-bar .picker-search {
  width: 100%;
  max-width: none;
}

.order-search-bar .search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 300px;
  overflow-y: auto;
  background-color: var(--color-white);
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 8px;
}

.order-search-bar .search-results:empty {
  display: none;
}

.catalog-search {
  padding: 8px 14px;
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  background-color: var(--color-white);
  font-size: 13px;
  color: var(--color-black);
}

.catalog-search::placeholder {
  color: var(--color-grey);
}

.catalog-search:focus {
  outline: none;
  border-color: var(--color-primary);
}

.search-results {
  margin-top: 8px;
}

.search-results:empty {
  margin-top: 0;
}

.search-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background-color: var(--color-offwhite);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
}

/* Rows with a leading thumbnail (Quotation's catalog search) want the
   thumb + text block adjacent, not pushed to opposite ends like the plain
   title/meta two-column rows (e.g. the row-level catalog typeahead) use
   space-between for. */
.search-result-row--with-image {
  justify-content: flex-start;
}

.search-result-row__body {
  flex: 1;
  min-width: 0;
}

.search-result-row__image {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  overflow: hidden;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-white);
  border: 1px dashed #DDDDDD;
  color: #BBBBBB;
}

.search-result-row__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-result-row:hover,
.search-result-row.is-active {
  background-color: #ECECEC;
}

.search-result-row__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-black);
}

.search-result-row__meta {
  font-size: 12px;
  color: var(--color-grey);
  margin-top: 2px;
}

.search-result-empty {
  font-size: 13px;
  color: var(--color-grey);
  padding: 8px 2px;
}

/* ---------- Catalog typeahead (Selection + Quotation item rows) ---------- */
/* position/left/top/min-width are set inline by attachCatalogTypeahead() in
   js/app.js, tracking the input's live position — fixed (not absolute)
   so the panel escapes the item table's clipping scroll container. */
.catalog-typeahead__panel {
  position: fixed;
  max-width: 360px;
  max-height: 280px;
  overflow-y: auto;
  background-color: var(--color-white);
  border: 1px solid #E5E5E5;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 1000;
}

.catalog-typeahead__panel .search-result-row {
  margin-bottom: 4px;
}

.catalog-typeahead__panel .search-result-row:last-child {
  margin-bottom: 0;
}

/* ---------- Selection: inline add forms ---------- */
.inline-form {
  background-color: var(--color-offwhite);
  border-radius: 8px;
  padding: 18px 20px;
  margin-top: 12px;
}

.inline-form__row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-form__row input,
.inline-form__row select {
  font-family: var(--font-family);
  padding: 8px 12px;
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  background-color: var(--color-white);
  font-size: 13px;
  color: var(--color-black);
  flex: 1;
  min-width: 160px;
}

.inline-form__row input:focus,
.inline-form__row select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Account Details (and any other bare .cell-input) inside a .contact-panel
   used to render completely unstyled -- .cell-input is deliberately bare by
   default (see the .modal scope below) and nothing scoped it for this
   context, so it looked like a different, cheaper form than the
   .inline-form__row fields right above it. This matches that look exactly. */
.contact-panel input.cell-input,
.contact-panel select.cell-input {
  font-family: var(--font-family);
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  background-color: var(--color-white);
  font-size: 13px;
  color: var(--color-black);
}

.contact-panel input.cell-input:hover,
.contact-panel select.cell-input:hover {
  border-color: #BBBBBB;
}

.contact-panel input.cell-input:focus,
.contact-panel select.cell-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Consistent vertical rhythm between stacked field rows/pairs within a
   .contact-panel (Project name row, Account Details pairs, the trailing
   Account Number field) -- previously only .inline-form__row had any
   spacing of its own, so everything below it sat cramped with no gap. */
.contact-panel .inline-form__row + .inline-form__row,
.contact-panel .quotation-field-pair,
.contact-panel > input.cell-input {
  margin-top: 12px;
}

.inline-form__actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.form-error {
  color: var(--color-primary);
  font-size: 12px;
  margin: 10px 0 0 0;
}

/* ---------- Selection: back button ---------- */
.back-btn {
  font-size: 16px;
  padding: 8px 14px;
  margin: 20px 0 16px 0;
}

/* ---------- Selection: new client page ---------- */
.contact-panel {
  background-color: var(--color-offwhite);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 24px;
}

.client-code-preview {
  font-size: 12px;
  color: var(--color-grey);
  margin: 12px 0 0 0;
}

.save-bar {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

.btn--danger {
  color: var(--color-primary);
  border-color: #F0C6C0;
}

.btn--danger:hover {
  color: var(--color-white);
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ---------- Selection: client banner ---------- */
.client-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--color-offwhite);
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 20px;
}

.client-banner__name {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-black);
  display: flex;
  align-items: center;
  gap: 6px;
}

.client-banner__name .icon-btn {
  font-size: 14px;
}

.client-banner__meta {
  font-size: 12px;
  color: var(--color-grey);
  margin-top: 4px;
}

.client-code-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-primary);
  background-color: #FCEBE9;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
}

.client-list-heading {
  margin-top: 20px;
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}

.pagination-info {
  font-size: 12px;
  color: var(--color-grey);
}

/* ---------- Shared item-table horizontal scroll controls ---------- */
/* Toolbar lives outside .table-scroll entirely (not inside the scrolled
   region), so it can't scroll out of view horizontally -- that was never
   part of what scrolls. `position: sticky` handles the other axis: without
   it, scrolling <main class="content"> down to later rows carries the
   toolbar away with the page, defeating "always accessible" the moment you
   actually need it (looking at a row below the fold, scrolled right).
   Hidden via JS (setupTableScrollControls in js/app.js) whenever the table
   doesn't actually overflow. */
.table-scroll-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
  position: sticky;
  top: 8px;
  z-index: 15;
}

.table-scroll-toolbar__back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-family);
  font-size: 12px;
  color: var(--color-grey);
  background-color: var(--color-offwhite);
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

.table-scroll-toolbar__back-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Bounded height + overflow on BOTH axes (not just overflow-x) is what
   actually makes the sticky header/frozen columns work correctly -- CSS
   forces overflow-y to become 'auto' the moment overflow-x is non-visible
   (there's no way to keep one axis truly 'visible' while the other
   scrolls), so without an explicit max-height here the table's own
   (invisible, since nothing overflows it -- it just grows forever) vertical
   "scroll context" ends up as the nearest one for position:sticky, instead
   of the page's real one -- and a sticky header stuck to a container that
   never itself scrolls just scrolls away with the page instead of freezing.
   Bounding the height is also literally what "freeze panes" means: a fixed
   viewport onto the rows, not an ever-growing block. */
.table-scroll {
  overflow: auto;
  max-height: 60vh;
  -webkit-overflow-scrolling: touch;
}

/* Freeze pane: the first N columns (measured + positioned by
   applyFrozenColumns in js/app.js, since their widths aren't fixed) stay
   put while the rest of the table scrolls under them. td's own background
   has to be opaque (inherit == the row's actual resolved color, zebra
   stripe or group tint) so scrolled-under cells don't show through. */
.is-frozen-col {
  position: sticky;
  z-index: 2;
}

.is-frozen-col-last {
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.08);
}

.item-table td.is-frozen-col {
  background-color: inherit;
}

.item-table th.is-frozen-col {
  background-color: var(--color-white);
  z-index: 6;
}

.quotation-item-table td.is-frozen-col {
  background-color: inherit;
}

.quotation-item-table th.is-frozen-col {
  z-index: 6;
}

.item-table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 740px;
  width: 100%;
}

.item-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background-color: var(--color-white);
  text-align: left;
  font-weight: 500;
  color: var(--color-grey);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.4px;
  padding: 10px 8px;
  border-bottom: 1px solid #E5E5E5;
  white-space: nowrap;
}

.item-table td {
  padding: 4px;
  border-bottom: 1px solid #F0F0F0;
  vertical-align: middle;
}

.item-table td.sn-cell {
  color: var(--color-grey);
  font-size: 12px;
  text-align: center;
  width: 32px;
}

.item-table tbody tr:nth-child(even) {
  background-color: var(--color-offwhite);
}

.item-table tr.is-new-row td {
  border-bottom: 1px solid #E5E5E5;
}

.item-table input.cell-input,
.item-table select.cell-input {
  font-family: var(--font-family);
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background-color: transparent;
  font-size: 13px;
  color: var(--color-black);
  min-width: 50px;
}

.item-table input.cell-input:hover,
.item-table select.cell-input:hover {
  border-color: #DDDDDD;
}

.item-table input.cell-input:focus,
.item-table select.cell-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background-color: var(--color-white);
}

.item-table input.cell-input--qty {
  min-width: 40px;
}

.icon-btn {
  border: none;
  background-color: transparent;
  color: var(--color-grey);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.icon-btn:hover {
  color: var(--color-primary);
  background-color: #FCEBE9;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.icon-btn:disabled:hover {
  background-color: transparent;
  color: var(--color-grey);
}

/* Two-step delete's armed state — a clearly different look from the
   ordinary hover state so a second, deliberate click is obviously what's
   needed, not an accidental double-click. See makeTwoStepDeleteButton in
   js/orders.js. */
.icon-btn--confirm-delete,
.icon-btn--confirm-delete:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
  font-size: 13px;
  font-weight: 700;
}

.icon-btn {
  border: none;
  background-color: transparent;
  color: var(--color-grey);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.icon-btn:hover {
  color: var(--color-primary);
  background-color: #FCEBE9;
}

/* ---------- Selection: history panel ---------- */
.history-toggle {
  font-family: var(--font-family);
  border: none;
  background-color: transparent;
  color: var(--color-grey);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 12px 0;
}

.history-toggle:hover {
  color: var(--color-black);
}

.history-panel {
  background-color: var(--color-offwhite);
  border-radius: 8px;
  padding: 6px 20px;
  margin-top: 4px;
}

.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid #E5E5E5;
}

.history-row:first-child {
  border-top: none;
}

.history-row__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-black);
}

.history-row__meta {
  font-size: 12px;
  color: var(--color-grey);
  margin-top: 2px;
}

/* ---------- Quotation workspace: single flex column ---------- */
/* Fills whatever height .content--flush leaves it (see style.css's .content
   rules) so the header/scroll/footer split below actually has real space to
   divide -- without this, "flex: 1; min-height: 0" on the scroll region has
   nothing to be a fraction OF. */
.quotation-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* [hidden] and .quotation-workspace{display:flex} tie on specificity, so
   without this the class rule (later in the cascade) would win and the
   workspace would stay visible even while the [hidden] attribute is set. */
.quotation-workspace[hidden] {
  display: none;
}

.quotation-workspace__header {
  flex: 0 0 auto;
  padding: 12px 32px 0 32px;
}

/* Back arrow + search bar share one line right below the nav, instead of
   each claiming a row of their own — the single biggest win for leaving
   more of the viewport to the item rows below. */
.quotation-workspace__topline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.quotation-workspace__topline .back-btn {
  flex: 0 0 auto;
  margin: 0;
}

.quotation-workspace__topline .quotation-search-bar {
  flex: 1;
  margin: 0;
}

/* The one scroll region for the whole workspace -- both axes, so the table's
   position:sticky header/frozen-columns resolve against THIS container
   (matching the .table-scroll gotcha documented above .table-scroll: sticky
   needs a real bounded scrolling ancestor, and this is now the only one). */
.quotation-workspace__scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 32px;
  -webkit-overflow-scrolling: touch;
}

/* #quotationItemsWrap's own .table-scroll (built by setupTableScrollControls,
   shared with Selection) is de-fanged down to a plain block here -- see
   #quotationItemsWrap .table-scroll below -- so it never competes with
   .quotation-workspace__scroll as a second scrollport. */
#quotationItemsWrap .table-scroll {
  overflow: visible;
  max-height: none;
}

/* Pushed below the sticky table header's own height so the two don't overlap
   now that both stick to the same shared scroll container. */
#quotationItemsWrap .table-scroll-toolbar {
  top: 88px;
}

/* Same reasoning as #quotationItemsWrap above — the Orders workspace reuses
   .quotation-workspace / .quotation-workspace__scroll for its single-scroll
   layout, so its own item table needs the same de-fanging. */
#orderItemsWrap .table-scroll {
  overflow: visible;
  max-height: none;
}

/* Same again for the Selection workspace — #itemsTableWrap's own .table-scroll
   used to be the ONLY scroll region (the page itself, .content, scrolled too),
   which is what caused the double-scrollbar bug. Now .quotation-workspace__scroll
   is the one true scroll region. */
#itemsTableWrap .table-scroll {
  overflow: visible;
  max-height: none;
}

#itemsTableWrap .table-scroll-toolbar {
  top: 44px;
}

/* The back button used to carry its own top/bottom margin (see .back-btn)
   which, stacked on top of .quotation-workspace__header's own padding, was
   the large empty gap above the Selection workspace's content. */
.quotation-workspace__header > .back-btn {
  margin: 0 0 12px 0;
}

.quotation-toolbar {
  margin-top: 16px;
}

/* Unstyled by default (deliberately, like .cell-input) -- this is Selection's
   scope, made wide/full-width per the "make this field longer" request. */
.quotation-catalog-search {
  position: relative;
}

.quotation-catalog-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--color-black);
}

.quotation-catalog-search input:focus {
  outline: none;
  border-color: var(--color-primary);
}

#orderItemsWrap .table-scroll-toolbar {
  top: 44px;
}

/* Three independent fieldsets side by side -- Client / Date / Attended By
   each get their own border and legend now, instead of sharing one box. */
.quotation-client-fieldset-row {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.quotation-client-fieldset {
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  padding: 0 14px 8px 14px;
  margin: 0;
  display: flex;
  align-items: center;
}

.quotation-client-fieldset--identity {
  flex: 1 1 240px;
  min-width: 200px;
}

.quotation-client-fieldset legend {
  padding: 0 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-grey);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.quotation-client-fieldset > input.cell-input {
  border: none;
  padding: 5px 0;
  min-width: 140px;
}

.quotation-client-fieldset > input.cell-input:hover,
.quotation-client-fieldset > input.cell-input:focus {
  border: none;
}

/* Tighter than the default .client-banner__name/__meta sizing (that's built
   for the standalone banner on its own line) -- here it sits inside a
   compact fieldset, so it needs to be no taller than the other two. */
.quotation-client-fieldset__identity .client-banner__name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  line-height: 1.3;
}

.quotation-client-fieldset__identity .client-banner__name .icon-btn {
  font-size: 12px;
  padding: 2px 4px;
}

.quotation-client-fieldset__identity .client-banner__meta {
  font-size: 11px;
  margin-top: 1px;
  line-height: 1.3;
}

.quotation-search-bar {
  position: relative;
  display: flex;
  gap: 10px;
  margin: 0;
}

.quotation-search-bar input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  font-family: var(--font-family);
  font-size: 13px;
}

.quotation-search-bar input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Capped to ~6 rows at a glance -- the rest scroll instead of the dropdown
   just growing to fit however many results (up to 10) came back. A solid
   background + border + shadow here (matching .quotation-share-menu's
   panel look) is what actually makes it read as one dropdown -- the rows
   themselves only paint their own background, so without this the gaps
   between rows (their margin-bottom) let the table underneath show through. */
.quotation-search-bar .search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 96px;
  z-index: 10;
  max-height: 360px;
  overflow-y: auto;
  background-color: var(--color-white);
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 8px;
}

/* With no results (including the very first render, before anything's been
   typed), the panel's own border/shadow/padding would otherwise still
   render as a small empty box floating under the search input. */
.quotation-search-bar .search-results:empty {
  display: none;
}

.quotation-group {
  margin-bottom: 28px;
}

.quotation-group__header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-black);
  margin-bottom: 8px;
}

/* border-collapse: separate + border-spacing is what makes each row read as
   its own separate, rounded-corner card rather than one continuous grid --
   collapse merges adjacent borders into shared lines, which is incompatible
   with independently-rounded per-row boxes and with any gap between rows. */
.quotation-item-table {
  min-width: 760px;
  border: none;
  border-collapse: separate;
  border-spacing: 0 10px;
}

/* Header gets a bottom rule (only) instead of a full box -- thin dividers
   between labels, one solid line under the whole row, nothing else. The
   border-spacing above already puts room between this and the first row. */
.quotation-item-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background-color: var(--color-white);
  border: none;
  border-bottom: 2px solid var(--color-black);
  color: var(--color-black);
  vertical-align: top;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
}

.quotation-item-table th:not(:last-child) {
  border-right: 1px solid #E5E5E5;
}

/* Each row: solid dark border top/bottom, internal light dividers between
   its own columns, and dark border + rounded corners only on the first/last
   cell -- which (since border-collapse is separate, so each <tr> never
   shares an edge with its neighbor) is what makes the whole row read as one
   independently-rounded card. */
.quotation-item-table td {
  border-top: 1px solid var(--color-black);
  border-bottom: 1px solid var(--color-black);
  border-left: none;
  border-right: none;
  padding: 8px 10px;
}

.quotation-item-table td:not(:last-child) {
  border-right: 1px solid #E0E0E0;
}

.quotation-item-table td:first-child {
  border-left: 1px solid var(--color-black);
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.quotation-item-table td:last-child {
  border-right: 1px solid var(--color-black);
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

/* Plain white card by default; a grouped row's inline background (set in
   JS, on the <tr> itself) overrides this the normal cascade way. */
.quotation-item-table tbody tr {
  background-color: var(--color-white);
}

.quotation-item-table input.cell-input,
.quotation-item-table select.cell-input {
  min-width: 44px;
  border: 1px solid #999999;
  background-color: var(--color-white);
}

.quotation-item-table input.cell-input:hover,
.quotation-item-table select.cell-input:hover {
  border-color: var(--color-black);
}

.quotation-item-table input.cell-input:focus,
.quotation-item-table select.cell-input:focus {
  border-color: var(--color-primary);
  background-color: var(--color-white);
}

.quotation-item-table input.cell-input::placeholder {
  color: #999999;
}

.quotation-price-type-badge {
  border: 1px solid #CCCCCC;
  border-radius: 4px;
  padding: 3px 6px;
  background-color: var(--color-white);
}

.quotation-subfield-label {
  color: var(--color-black);
  font-weight: 500;
}

.quotation-computed-line {
  color: var(--color-black);
}

.quotation-final-price {
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
  padding-right: 10px !important;
}

.price-type-radios {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--color-grey);
  white-space: nowrap;
}

.price-type-radios label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cell-inline-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

.cell-inline-group .cell-input--qty {
  min-width: 38px;
}

.cell-inline-group select.cell-input {
  min-width: 34px;
}

.quotation-group__subtotal {
  text-align: right;
  font-size: 12px;
  color: var(--color-grey);
  padding: 8px 4px;
  border-top: 1px solid #E5E5E5;
}

.quotation-grand-total {
  text-align: right;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-black);
  padding: 12px 4px;
  border-top: 2px solid var(--color-black);
  margin-top: 4px;
}

/* A plain flex item at the end of .quotation-workspace, not the scrollable
   part -- since .quotation-workspace__scroll is the only thing that scrolls,
   this never needs position:sticky to stay in place, and (with .content's
   own padding removed via .content--flush) its bottom edge is the true
   bottom of the browser viewport, no gap.
   Everything (notes, total, every action) sits in this one row instead of
   three stacked ones -- notes takes whatever space the buttons don't need. */
.quotation-sticky-footer {
  flex: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--color-white);
  border-top: 1px solid #E5E5E5;
  padding: 8px 32px;
}

.quotation-footer-notes {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  font-family: var(--font-family);
  font-size: 12px;
  color: var(--color-black);
}

.quotation-footer-notes:focus {
  outline: none;
  border-color: var(--color-primary);
}

.quotation-sticky-footer .quotation-grand-total {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border-top: none;
  font-size: 12px;
  white-space: nowrap;
}

.quotation-sticky-footer .btn {
  flex: 0 0 auto;
  padding: 7px 14px;
  font-size: 12px;
}

/* ---------- Quotation: picker list table ---------- */
.quotation-list-table {
  min-width: 760px;
}

.quotation-list-row {
  cursor: pointer;
}

.quotation-list-table tbody tr:nth-child(even) {
  background-color: var(--color-offwhite);
}

/* Extra .quotation-list-table qualifier (not just .quotation-list-row) is
   deliberate -- these tables also carry the generic .data-table class (see
   "data-table tr:hover td" above, used by the Dashboard clients table),
   which otherwise wins the cascade on specificity ties and silently paints
   the SAME pale off-white the row already has (invisible on even rows,
   barely perceptible on odd ones) instead of this darker gray. */
.quotation-list-table .quotation-list-row:hover td,
.quotation-list-table .quotation-list-row.is-active td {
  background-color: #DDDDDD;
}

.quotation-list-row__actions {
  white-space: nowrap;
}

.quotation-list-row__actions .icon-btn {
  padding: 4px 6px;
}

.quotation-share-menu {
  position: fixed;
  z-index: 100;
  background-color: var(--color-white);
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 6px;
  min-width: 170px;
}

.quotation-share-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--color-black);
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.quotation-share-menu__item:hover {
  background-color: var(--color-offwhite);
}

/* ---------- Quotation: "Import by" fields + autocomplete dropdown ---------- */
.import-by-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.import-by-field {
  flex: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}


.import-by-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-grey);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.import-by-field input.cell-input {
  background-color: var(--color-white);
  border: 1px solid #DDDDDD;
  padding: 9px 10px;
}

.import-by-field input.cell-input:hover {
  border-color: #BBBBBB;
}

.import-by-field input.cell-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.import-by-results-table {
  margin-top: 12px;
}

/* + Order popup's results: narrow fixed columns sized to fit without
   horizontal scroll, capped to ~7 rows tall with vertical-only scroll for
   the rest (unlike .table-scroll elsewhere, which also allows horizontal
   scroll — not wanted here). */
.import-quotation-results-scroll {
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #E5E5E5;
  border-radius: 8px;
}

.import-quotation-results-table {
  table-layout: fixed;
  width: 100%;
}

.import-quotation-results-table th,
.import-quotation-results-table td {
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-quotation-results-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: var(--color-white);
}

.import-quotation-results-table tr.quotation-list-row {
  cursor: pointer;
}

.import-quotation-results-table th:nth-child(1),
.import-quotation-results-table td:nth-child(1) { width: 20%; }
.import-quotation-results-table th:nth-child(2),
.import-quotation-results-table td:nth-child(2) { width: 26%; }
.import-quotation-results-table th:nth-child(3),
.import-quotation-results-table td:nth-child(3) { width: 26%; }
.import-quotation-results-table th:nth-child(4),
.import-quotation-results-table td:nth-child(4) { width: 12%; text-align: center; }
.import-quotation-results-table th:nth-child(5),
.import-quotation-results-table td:nth-child(5) { width: 16%; }

/* ---------- Modal (generic — first use is Assign Group) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(26, 26, 26, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

/* The [hidden] attribute has the same specificity as the class above, and
   this rule comes later in the cascade, so it's needed to actually win —
   otherwise "display: flex" above keeps the modal visible regardless of
   whether the hidden attribute is set. */
.modal-overlay[hidden] {
  display: none;
}

.modal {
  background-color: var(--color-white);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
}

.modal--large {
  width: 640px;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #E5E5E5;
}

.modal__title {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-black);
  margin: 0;
}

.modal__body {
  padding: 18px 20px;
  overflow-y: auto;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #E5E5E5;
}

/* Grows to fill the remaining space, pinning whatever comes before it (e.g.
   Delete Product) to the left while everything after stays right-aligned. */
.modal__footer-spacer {
  flex: 1;
}

/* ---------- Products: detail modal (opened by clicking a card) ---------- */
.product-detail-body {
  display: flex;
  gap: 20px;
}

.product-detail-image {
  flex: 0 0 220px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background-color: var(--color-offwhite);
  border: 1px dashed #DDDDDD;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #BBBBBB;
  font-size: 36px;
  overflow: hidden;
}

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

.product-detail-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-detail-field {
  font-size: 13px;
}

.product-detail-field__label {
  color: var(--color-grey);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}

.product-detail-field__value {
  color: var(--color-black);
}

.product-detail-field__value--price {
  font-weight: 600;
  font-size: 15px;
}

/* .cell-input is deliberately unstyled on its own everywhere in this
   codebase — every context that uses it scopes its own look (.item-table,
   .quotation-item-table, .import-by-field, etc.). This is that scope for
   modal forms (currently just Edit Product). */
.modal input.cell-input,
.modal select.cell-input,
.modal textarea.cell-input {
  font-family: var(--font-family);
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #DDDDDD;
  border-radius: 4px;
  background-color: var(--color-white);
  font-size: 13px;
  color: var(--color-black);
  margin-bottom: 8px;
}

.modal input.cell-input:hover,
.modal select.cell-input:hover,
.modal textarea.cell-input:hover {
  border-color: #BBBBBB;
}

.modal input.cell-input:focus,
.modal select.cell-input:focus,
.modal textarea.cell-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ---------- Advanced Settings modal ---------- */
.advanced-settings-tabs {
  display: flex;
  gap: 20px;
  padding: 0 20px;
  border-bottom: 1px solid #E5E5E5;
}

.advanced-settings-tab {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-grey);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 0;
  cursor: pointer;
}

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

.advanced-settings-field {
  flex: 1;
  min-width: 0;
}

.advanced-settings-field label {
  display: block;
  font-size: 12px;
  color: var(--color-grey);
  margin-bottom: 4px;
}

.advanced-settings-computed {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-black);
  margin: 4px 0 16px;
}

.advanced-settings-section-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-black);
  margin: 16px 0 8px;
}

.advanced-settings-section-label:first-child {
  margin-top: 0;
}

.advanced-settings-section-label__hint {
  font-weight: 400;
  color: var(--color-grey);
}

.advanced-settings-radio-row {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--color-black);
  margin-bottom: 8px;
}

.advanced-settings-radio-row label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.advanced-settings-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-flow: column;
  grid-template-rows: repeat(7, auto);
  gap: 8px 16px;
}

.advanced-settings-checkbox-grid--rows {
  grid-template-rows: repeat(2, auto);
}

.advanced-settings-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-black);
  cursor: pointer;
}

.advanced-settings-terms-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  max-height: 220px;
  overflow-y: auto;
}

.advanced-settings-term-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  background-color: var(--color-offwhite);
}

.advanced-settings-term-row input[type="checkbox"] {
  margin-top: 2px;
  flex: 0 0 auto;
}

.advanced-settings-term-row__text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--color-black);
}

.advanced-settings-term-row .icon-btn {
  flex: 0 0 auto;
  font-size: 13px;
}

.advanced-settings-term-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

/* ---------- Assign Group modal contents ---------- */
.assign-group-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.assign-group-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 6px;
}

.assign-group-row:hover {
  background-color: var(--color-offwhite);
}

.assign-group-row__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.assign-group-row__name {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--color-black);
  cursor: pointer;
  padding: 0;
}

.assign-group-empty {
  font-size: 13px;
  color: var(--color-grey);
  padding: 8px 6px;
}

/* ---------- Quotation item table: checkboxes, group badges, header controls ---------- */
/* SN is always the 1st column — its width is also the basis the Product
   Image column (2nd) doubles, per the th:nth-child(2)/td:nth-child(2) rule
   below. */
.quotation-item-table th:nth-child(1),
.quotation-row-checkbox-cell {
  width: 76px;
  max-width: 76px;
  text-align: center;
  vertical-align: middle;
}

/* Drag handle, above the SN number (see buildQuotationItemRow /
   reorderQuotationItem in quotation.js). */
.quotation-row-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white);
  border: 1px solid #CCCCCC;
  border-radius: 4px;
  color: var(--color-grey);
  padding: 3px;
  margin: 0 auto 4px auto;
  cursor: grab;
}

.quotation-row-drag-handle:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.quotation-row-drag-handle:active {
  cursor: grabbing;
}

/* The row currently being dragged -- faded so the drop targets underneath
   read clearly. */
.quotation-item-table tbody tr.is-dragging {
  opacity: 0.4;
}

/* Insertion-point indicator on whichever row is currently under the
   pointer, shown on the edge (top or bottom) the drop would land on. */
.quotation-item-table tbody tr.is-drag-over-top td {
  box-shadow: inset 0 2px 0 0 var(--color-primary);
}

.quotation-item-table tbody tr.is-drag-over-bottom td {
  box-shadow: inset 0 -2px 0 0 var(--color-primary);
}

/* Product Image is always the 2nd column (SN, Image, Info, ...) — twice the
   width of the SN column (1st), so the thumbnail has real room. The header
   label wraps onto 2 lines (overriding .item-table th's nowrap) so the
   column doesn't need to be wide just to fit "Product Image" on one line.
   max-width (not just width) is needed because the table uses
   table-layout: auto -- when there's leftover space to distribute, auto
   layout treats a plain "width" as a hint it's free to stretch past, not a
   cap; max-width is what actually keeps it capped at exactly double SN. */
.quotation-item-table th:nth-child(2),
.quotation-item-table td:nth-child(2) {
  width: 152px;
  max-width: 152px;
  padding-left: 6px;
  padding-right: 6px;
}

.quotation-item-table th:nth-child(2) {
  white-space: normal;
  text-align: center;
}

/* Quantity (4th) and GST (7th) narrowed to make room for the wider Product
   Image column — Quantity still fits its 3 stacked fields (Qty/Unit/Note),
   GST only ever holds one input + one computed line so it can go tighter. */
.quotation-item-table th:nth-child(4),
.quotation-item-table td:nth-child(4) {
  width: 84px;
  max-width: 84px;
}

/* 72px was too narrow to actually fit the header's "GST %" label + bordered
   Reset button side by side -- the button was overflowing straight out of
   the column, past Final Price, effectively unclickable in its rendered
   spot. 110px is the least that comfortably fits both. */
.quotation-item-table th:nth-child(7),
.quotation-item-table td:nth-child(7) {
  width: 110px;
  max-width: 110px;
}

.quotation-row-checkbox-cell input[type="checkbox"] {
  display: block;
  margin: 0 auto 4px auto;
}

/* SN number, now editable — kept visually close to the plain text it
   replaced (no spinner, no border until focused). */
.quotation-row-sn-input {
  width: 32px;
  border: 1px solid transparent;
  background: transparent;
  text-align: center;
  font: inherit;
  color: inherit;
  padding: 0;
  margin: 0 auto 2px auto;
  display: block;
  -moz-appearance: textfield;
}

.quotation-row-sn-input::-webkit-outer-spin-button,
.quotation-row-sn-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quotation-row-sn-input:hover {
  border-color: #DDDDDD;
}

.quotation-row-sn-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-white);
}

.quotation-row-group-badge {
  display: inline-block;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-black);
  padding: 1px 6px;
  border-radius: 999px;
}

.quotation-th-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.quotation-th-btn {
  font-family: var(--font-family);
  background-color: var(--color-black);
  color: var(--color-white);
  border: none;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  cursor: pointer;
}

.quotation-th-btn:hover {
  background-color: #333333;
}

.quotation-th-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.quotation-th-reset {
  font-family: var(--font-family);
  background: none;
  border: 1px solid #CCCCCC;
  border-radius: 4px;
  color: var(--color-grey);
  font-size: 10px;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  padding: 2px 5px;
}

.quotation-th-reset:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.quotation-th-toggle-group {
  display: flex;
  border: 1px solid #DDDDDD;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 2px;
}

.quotation-th-toggle-btn {
  flex: 1;
  font-family: var(--font-family);
  background-color: var(--color-white);
  color: var(--color-grey);
  border: none;
  border-right: 1px solid #DDDDDD;
  font-size: 9px;
  font-weight: 500;
  padding: 2px 6px;
  cursor: pointer;
}

.quotation-th-toggle-btn:last-child {
  border-right: none;
}

.quotation-th-toggle-btn.is-active {
  background-color: var(--color-black);
  color: var(--color-white);
}

.quotation-th-applyall {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--color-grey);
}

.quotation-th-value-input {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-family);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid #DDDDDD;
  border-radius: 4px;
  margin-bottom: 2px;
}

.quotation-th-value-input:disabled {
  background-color: #F5F5F5;
  color: #BBBBBB;
}

.quotation-product-info-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 60px;
}

/* Both input AND select -- select was missing from this rule before, which
   is exactly why the category dropdown (a <select>) rendered taller than
   the Product Name field (an <input>) next to it: it was falling through to
   .item-table's looser base padding instead of matching here. An explicit
   height is also needed on top of matching padding/border/font -- browsers
   apply their own minimum content height to <select> that padding alone
   doesn't override, so without this it stayed ~2px taller regardless. */
.quotation-product-info-cell input.cell-input,
.quotation-product-info-cell select.cell-input {
  padding: 5px 8px;
  height: 28px;
}

.quotation-product-info-cell input.cell-input--secondary {
  font-size: 11px;
  color: var(--color-grey);
}

/* 80px in a 152px-wide column (see th:nth-child(2)/td:nth-child(2) above) —
   >50% fill, and >75% bigger than the 42px this was before. margin: 0 auto
   centers it in that leftover column width -- it's a block-level flex
   container (for its own centering of the <img> inside), so without this it
   just sits flush against the cell's left padding instead, leaving all the
   slack on one side. */
.quotation-product-image,
.quotation-product-image-upload {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
}

.quotation-product-image-upload {
  background-color: var(--color-offwhite);
  border: 1px dashed #DDDDDD;
  color: #BBBBBB;
  font-size: 16px;
}

.quotation-product-image-upload:hover,
.quotation-product-image-upload:focus {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.quotation-product-image-upload.is-drag-over {
  border-style: solid;
  border-color: var(--color-primary);
  background-color: #FCEBE9;
  color: var(--color-primary);
}

.quotation-product-image {
  overflow: hidden;
  border: 1px solid #E5E5E5;
}

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

.quotation-product-image.is-uploading,
.quotation-product-image-upload.is-uploading {
  opacity: 0.5;
  pointer-events: none;
}

.quotation-group-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
}

.quotation-field-pair {
  display: flex;
  gap: 4px;
}

.quotation-field-pair > input,
.quotation-field-pair > select {
  flex: 1;
  min-width: 0;
}

.quotation-subfield {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quotation-subfield-label {
  font-size: 9px;
  color: var(--color-grey);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.quotation-price-type-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-black);
}

.quotation-price-type-badge input[type="radio"] {
  margin: 0;
}

.quotation-computed-line {
  font-size: 10px;
  color: var(--color-grey);
  line-height: 1.25;
}

.quotation-computed-line--bold {
  font-weight: 600;
  color: var(--color-black);
}

.quotation-group-summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--color-grey);
  padding: 4px 4px;
}

.quotation-group-summary__label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-black);
  font-weight: 500;
}

.quotation-group-summary__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

/* ---------- Products tab: most-added card grid ---------- */
.product-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.product-card {
  position: relative;
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.product-card:hover,
.product-card.is-active {
  background-color: var(--color-offwhite);
  border-color: #DDDDDD;
}

.product-card__edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background-color: var(--color-white);
  color: var(--color-grey);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.product-card__edit-btn:hover {
  color: var(--color-primary);
}

.product-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background-color: var(--color-offwhite);
  border: 1px dashed #DDDDDD;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #BBBBBB;
  font-size: 28px;
  overflow: hidden;
  margin-bottom: 6px;
}

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

.product-card__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-black);
}

.product-card__meta {
  font-size: 12px;
  color: var(--color-grey);
}

.product-card__price {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-black);
  margin-top: 4px;
}

/* ---------- Products tab: toolbar, breadcrumb, brand folders, edit modal ---------- */
.products-toolbar {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.products-toolbar input {
  flex: 1;
  max-width: 360px;
  padding: 9px 12px;
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  font-family: var(--font-family);
  font-size: 13px;
}

/* Same fix as .picker-row .clearable-input above -- the addClearButton()
   wrapper needs to match the input's own max-width or the × ends up
   stranded past the input's visible right edge. */
.products-toolbar .clearable-input {
  max-width: 360px;
}

.products-toolbar input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.products-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-grey);
  margin-top: 16px;
}

.products-breadcrumb__link {
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--color-primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.products-breadcrumb__link:hover {
  text-decoration: underline;
}

.brand-folder-card {
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  cursor: pointer;
}

.brand-folder-card:hover {
  border-color: var(--color-primary);
}

.brand-folder-card__icon {
  color: var(--color-grey);
  font-size: 32px;
  line-height: 1;
}

.brand-folder-card__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-black);
}

.brand-folder-card__count {
  font-size: 11px;
  color: var(--color-grey);
}

.edit-product-image-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.edit-product-image-preview {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  font-size: 24px;
}

.edit-product-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.edit-product-image-hint {
  font-size: 12px;
  color: var(--color-grey);
}

.edit-product-description {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-family: var(--font-family);
  padding: 6px 8px;
}

/* ---------- Orders & Delivery ---------- */
/* Slim bar used both in the picker list (one per row) and the order
   workspace's footer summary — same look, different context via the
   --footer modifier for sizing. */
.order-progress-bar {
  position: relative;
  width: 100px;
  height: 8px;
  border-radius: 4px;
  background-color: var(--color-offwhite);
  overflow: hidden;
}

.order-progress-bar__fill {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: 4px;
}

.order-progress-bar--footer {
  flex: 0 0 160px;
  width: 160px;
}

.order-progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-progress-cell__label {
  font-size: 12px;
  color: var(--color-grey);
  white-space: nowrap;
}

.order-progress-summary {
  flex: 1;
  font-size: 13px;
  color: var(--color-black);
  white-space: nowrap;
}

/* Same card-row visual language as .quotation-item-table (dark borders,
   rounded per-row cards, bold header with a bottom rule) but defined fresh
   rather than shared -- the two tables have different column counts/
   positions, so quotation's nth-child column-width rules would misapply if
   this just reused that class. */
.order-item-table {
  min-width: 700px;
  border: none;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.order-item-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background-color: var(--color-white);
  border: none;
  border-bottom: 2px solid var(--color-black);
  color: var(--color-black);
  font-weight: 700;
  font-size: 12px;
  vertical-align: top;
  padding: 8px 10px;
}

.order-item-table th:not(:last-child) {
  border-right: 1px solid #E5E5E5;
}

.order-item-table td {
  border-top: 1px solid var(--color-black);
  border-bottom: 1px solid var(--color-black);
  padding: 8px 10px;
  vertical-align: middle;
}

.order-item-table td:not(:last-child) {
  border-right: 1px solid #E0E0E0;
}

.order-item-table td:first-child {
  border-left: 1px solid var(--color-black);
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.order-item-table td:last-child {
  border-right: 1px solid var(--color-black);
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.order-item-table tbody tr {
  background-color: var(--color-white);
}

.order-item-table .quotation-product-image {
  width: 60px;
  height: 60px;
}

.order-total-qty-cell,
.order-status-cell {
  font-size: 13px;
  white-space: nowrap;
}

.order-ordered-cell {
  text-align: center;
}

/* Dispatched/Returned/Reorder cells: a large toggle button (replaces a tiny
   checkbox) stacked above a +/- stepper, so the column stays narrow while
   the button itself stays full-width and easy to hit. */
.order-qty-toggle-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.order-toggle-btn {
  padding: 6px 12px;
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  background-color: var(--color-white);
  color: var(--color-grey);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.order-toggle-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Same light-red tint as the sidebar's active tab (.sidebar__link.is-active)
   -- a filled solid color (black or the full brand red) read as too heavy/
   chunky for a state that's just "on", not an alarm. */
.order-toggle-btn.is-active {
  background-color: #FCEBE9;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.order-qty-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.order-qty-stepper__btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 1px solid #DDDDDD;
  border-radius: 4px;
  background-color: var(--color-white);
  color: var(--color-black);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.order-qty-stepper__btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.order-qty-stepper__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.order-qty-toggle-cell .cell-input--qty {
  width: 56px;
  min-width: 56px;
}

/* Deactivated (toggle button off) — grayed out and inert until activated. */
.order-qty-toggle-cell .cell-input--qty:disabled {
  background-color: #F0F0F0;
  color: #AAAAAA;
  cursor: not-allowed;
}

/* Active but still at 0 — the field is required and leaving the order is
   blocked until it's filled (see hasIncompleteOrderFields in orders.js). */
.cell-input--required-empty {
  border-color: var(--color-primary);
  background-color: #FCEBE9;
}

/* One color per status so they're distinguishable at a glance in the table. */
.order-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.order-status-badge--pending {
  background-color: #EFEFEF;
  color: #6B6B6B;
}

.order-status-badge--placed {
  background-color: #E3F2FD;
  color: #1565C0;
}

.order-status-badge--partial {
  background-color: #FFF3E0;
  color: #B26A00;
}

.order-status-badge--full {
  background-color: #E6F6EC;
  color: #1E8449;
}

.order-status-badge--returned {
  background-color: #FDECEC;
  color: #C0392B;
}

.order-status-badge--reorder {
  background-color: #F3E8FD;
  color: #7D3C98;
}

.order-status-note {
  margin-top: 4px;
  font-size: 11px;
  color: var(--color-grey);
}

/* Sticky footer stat summary: Progress / Items Dispatched / Qty Returned /
   Qty Reordered, laid out as one row of tiles that can wrap on narrow
   viewports (the base .quotation-sticky-footer rule doesn't wrap, but this
   footer carries more content than the Quotation one). */
.order-sticky-footer {
  flex-wrap: wrap;
}

.order-summary-stats {
  display: flex;
  gap: 20px;
  flex: 1;
}

.order-stat {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.order-stat__value {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-black);
}

.order-stat__label {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-grey);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* ---------- Login gate ---------- */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-offwhite);
}

/* Author display:flex above otherwise beats the UA [hidden] rule outright
   (author styles always win over UA styles, regardless of specificity) —
   same gotcha .modal-overlay[hidden] already works around elsewhere. */
.login-overlay[hidden] {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 320px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  background-color: var(--color-white);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.login-card__logo {
  width: 120px;
  margin: 0 auto 4px auto;
  display: block;
}

.login-card__subtitle {
  text-align: center;
  color: var(--color-grey);
  font-size: 13px;
  margin: 0 0 8px 0;
}

.login-card__input {
  border: 1px solid #DDDDDD;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 15px;
}

.login-card__input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.login-card__submit {
  margin-top: 8px;
  padding: 12px;
  font-size: 15px;
}

/* ---------- Settings page ---------- */
.settings-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid #E5E5E5;
  margin-bottom: 20px;
  overflow-x: auto;
}

.settings-tab {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-grey);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 0;
  cursor: pointer;
  white-space: nowrap;
}

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

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 720px;
}

/* Same author-vs-UA [hidden] gotcha as .login-overlay[hidden] above. */
.settings-panel[hidden] {
  display: none;
}

.settings-panel-hint {
  font-size: 12px;
  color: var(--color-grey);
  margin: 0 0 16px 0;
}

.settings-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 8px;
}

.settings-field--full {
  grid-column: 1 / -1;
}

.settings-field label {
  display: block;
  font-size: 12px;
  color: var(--color-grey);
  margin-bottom: 4px;
}

.settings-field input.cell-input {
  border: 1px solid #DDDDDD;
  width: 100%;
}

.settings-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid #E5E5E5;
  font-size: 13px;
}

.settings-list-row:first-child {
  border-top: none;
}

.settings-list-row__main {
  flex: 1;
  min-width: 0;
}

.settings-list-row__title {
  font-weight: 500;
  color: var(--color-black);
  word-break: break-word;
}

.settings-list-row__meta {
  font-size: 11px;
  color: var(--color-grey);
  margin-top: 2px;
}

.settings-list-row__actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

/* ---------- iPad / tablet responsiveness ----------
   No fixed pixel layout breaks outright at these widths (the sidebar is a
   modest 200px and every wide table already lives in its own horizontal-
   scroll region — see .table-scroll / .quotation-workspace__scroll above),
   so this isn't a structural rework: it's reclaiming padding and un-
   cramming multi-column grids so touch targets stay comfortable. */
@media (max-width: 1024px) {
  .content {
    padding: 20px;
  }

  .quotation-workspace__scroll {
    padding: 0 20px;
  }

  .stat-tiles {
    gap: 12px;
  }
}

@media (max-width: 820px) {
  .content {
    padding: 16px;
  }

  .quotation-workspace__scroll {
    padding: 0 16px;
  }

  .stat-tiles {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .settings-field-grid {
    grid-template-columns: 1fr;
  }

  .settings-tabs {
    gap: 12px;
  }

  .modal {
    width: 100%;
  }
}
