/* Page-specific styles. */

/* Sign in */
body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--ground);
}
.auth__panel {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.auth__brand { display: flex; align-items: center; gap: 10px; }
.auth__mark { width: 36px; height: 36px; }
.auth__name { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.auth__title { font-size: 20px; }
.auth__panel .flash { margin-bottom: 0; }
.auth__links { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }

/* Home */
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.home-links { display: flex; flex-direction: column; }
.home-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  font-weight: 500;
}
.home-links a:first-child { border-top: 0; }
.home-links a:hover { background: var(--surface-2); text-decoration: none; }
.home-links a .icon { color: var(--accent); }
.home-links a span:last-child { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 12.5px; }

/* Coming soon */
.coming-soon { max-width: 520px; }

/* Lookups */
.lookup-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.pill-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-card); color: var(--ink); font-weight: 500; }
.pill-link:hover { text-decoration: none; background: var(--surface-2); }
.pill-link .count { color: var(--muted); font-weight: 400; font-size: 12.5px; }

/* Filters row above lists */
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { flex: 1 1 220px; max-width: 360px; }
.narrow { max-width: 760px; }

/* Pictures: CAD and product photos */
.picture { position: relative; width: 100%; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.picture img { width: 100%; height: 100%; object-fit: contain; }
.picture--thumb { width: 44px; border-radius: 6px; }
.picture--large { max-width: 420px; margin: 0 auto; }
.picture__empty { opacity: 0.6; }

/* Designs grid */
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.design-card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; color: var(--ink); }
.design-card:hover { text-decoration: none; color: var(--ink); box-shadow: var(--shadow-pop); }
.design-card__cad { border-radius: 0; }
.design-card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.design-card__ref { font-family: var(--font-display); font-weight: 600; font-size: 13.5px; }
.design-card__name { font-size: 13.5px; }
.design-card__meta { font-size: 12px; }

/* Product page */
.product-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
.product-layout--detail { grid-template-columns: minmax(0, 1fr) 340px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.gallery__item { display: flex; flex-direction: column; gap: 6px; }
.gallery__remove { width: 100%; }

/* Product size rows in the form */
.size-rows { display: flex; flex-direction: column; gap: 10px; }
.size-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); }
.size-row .field { flex: 1 1 150px; }
.size-row .field--narrow { flex: 0 1 120px; }
.size-row__remove { color: var(--muted); flex-shrink: 0; }
.size-row__remove:hover { color: var(--bad); background: var(--bad-soft); }

@media (max-width: 900px) {
  .product-layout, .product-layout--detail { grid-template-columns: minmax(0, 1fr); }
  .picture--large { max-width: 320px; }
}

/* Order form packs */
.pack-row { border: 1px solid var(--rule-strong); border-radius: var(--radius-lg); background: var(--surface); }
.pack-row__head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.pack-row__body:empty { display: none; }
.pack-row__body { border-top: 1px solid var(--rule); }
.pack-body .table td, .pack-body .table th { padding-top: 8px; padding-bottom: 8px; }

/* Order page packs */
.pack-card { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding: 16px 18px; }
.pack-card__cad { display: flex; flex-direction: column; gap: 6px; }
.pack-card__letter { width: 36px; height: 36px; border-radius: 9px; background: var(--sidebar); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; font-size: 16px; flex-shrink: 0; }
.pack-card__cad .pack-card__letter { margin-bottom: 2px; }

/* Quantity chart on a product */
.qty-chart svg { display: block; width: 100%; height: auto; }
.qty-chart .bar { fill: var(--accent); }
.qty-chart .bar:hover, .qty-chart .bar:focus { fill: var(--accent-strong); outline: none; }
.qty-chart .grid { stroke: var(--rule); }
.qty-chart .axis { stroke: var(--rule-strong); }
.qty-chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.qty-chart .value { fill: var(--ink); font-weight: 600; }

@media (max-width: 720px) {
  .pack-card { grid-template-columns: 1fr; }
  .pack-card__cad { flex-direction: row; align-items: center; }
  .pack-card__cad .picture { width: 72px; }
}

/* Mandatory requirements on the order page: same red-rail block the factory sees on the sheet */
.mandatory { margin-top: 16px; border-left: 3px solid var(--bad); background: var(--bad-tint); padding: 10px 14px 6px; border-radius: 0 var(--radius) var(--radius) 0; }
.mandatory__head { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--bad); }
.mandatory__head span { font-family: var(--font-body); font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }
.mandatory__row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid rgba(169, 58, 58, 0.14); font-size: 13.5px; }
.mandatory__head + .mandatory__row { border-top: 0; margin-top: 4px; }
.mandatory__k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--bad); padding-top: 2px; }
.mandatory__v { font-weight: 500; white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 640px) { .mandatory__row { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* Order activity: the add-update form and the timeline of approvals, notes and milestones */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--radius); }
.segmented__item { position: relative; }
.segmented__item input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented__item span { display: inline-block; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink-2); }
.segmented__item input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); font-weight: 600; }
.segmented__item input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.activity { display: flex; flex-direction: column; }
.event { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-top: 1px solid var(--rule); font-size: 13px; }
.event:first-child { border-top: 0; padding-top: 0; }
.event__marker { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--rule-strong); }
.event__head { display: flex; flex-direction: column; gap: 1px; }
.event__when { font-size: 12px; }
.event__body { white-space: pre-line; color: var(--ink-2); }
.event__foot { display: flex; gap: 10px; align-items: center; font-size: 12px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--bad); }
.disclosure summary { list-style: none; cursor: pointer; justify-content: center; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure[open] summary { margin-bottom: 10px; }
.disclosure__body { padding: 12px; background: var(--surface-2); border-radius: var(--radius); }
.disclosure .segmented { background: var(--surface); }
.event__marker--ok { background: var(--ok); }
.event__marker--bad { background: var(--bad); }
.event__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.event__photos { display: flex; flex-wrap: wrap; gap: 8px; }
.event__photos img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); display: block; }
.approvals { display: flex; flex-direction: column; }
.approvals__row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--rule); font-size: 13.5px; font-weight: 500; }
.approvals__row:first-child { border-top: 0; padding-top: 0; }
.approvals__packs { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.tick--bad { color: var(--bad); }
.design-card.is-inactive { opacity: 0.6; }
.legacy-notice { display: flex; align-items: center; gap: 8px; margin: -8px 0 16px; font-size: 12.5px; color: var(--muted); }
.legacy-notice .icon { flex-shrink: 0; }
.picture__doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 100%; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-decoration: none; }
.picture__doc:hover { color: var(--accent); text-decoration: none; }

/* Bulk update bar above the orders and samples lists */
.t-check { width: 36px; padding-right: 0 !important; }
.t-check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; vertical-align: middle; }
.bulk-bar { padding: 14px 20px; border-bottom: 1px solid var(--rule); background: var(--accent-soft); }
.bulk-bar__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13.5px; }
.bulk-bar .event-form { background: var(--surface); border-radius: var(--radius); padding: 12px; }
