/* ButterflyX portal styles. The red is the logo's red, on the dark header the logo is made for. */

:root {
  --ink: #111113;
  --ink-soft: #2a2a2e;
  --paper: #f6f5f1;
  --white: #ffffff;
  --muted: #5d5d63;
  --line: #d9d7d0;
  --accent: #d22027;
  --accent-dark: #a8191f;
  /* Red for text on white and paper. The logo red already meets WCAG AA contrast there (4.8:1 or more). */
  --accent-text: #d22027;
  /* Red for text on the dark header. The logo red is too dark for small text there, so this is lighter (6.2:1). */
  --accent-on-dark: #ff5a60;
  --error: #b3261e;
  --ok: #1e6b3a;
  --radius: 6px;
  --wrap: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--white);
  font-weight: 700;
  z-index: 10;
}

.skip:focus {
  left: 16px;
}

/* Hidden rows and messages stay hidden, even where a layout sets their display. */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Type */

h1,
h2,
h3 {
  margin: 0 0 0.5em;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  text-transform: uppercase;
}

h2 {
  font-size: 1.375rem;
}

h3 {
  font-size: 1.0625rem;
}

p {
  margin: 0 0 1em;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.eyebrow a {
  color: var(--accent-text);
}

.lede {
  max-width: 40em;
  font-size: 1.125rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

.danger {
  color: var(--error);
}

.notes {
  white-space: pre-line;
}

address {
  margin-bottom: 16px;
  font-style: normal;
}

/* Header */

.portal-header {
  background: var(--ink);
  color: var(--white);
}

.portal-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.wordmark img {
  width: auto;
  height: 28px;
}

.portal-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.portal-nav a {
  text-decoration: none;
}

.portal-nav a:hover,
.portal-nav .link-button:hover {
  color: var(--accent-on-dark);
}

.portal-nav a[aria-current="page"] {
  color: var(--accent-on-dark);
}

/* How many design requests are waiting on the owner, next to Requests in the menu and on the overview. */
.nav-count {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-text);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
  vertical-align: 0.15em;
}

.portal-nav .link-button {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.portal-main {
  padding-top: 32px;
  padding-bottom: 64px;
}

/* Messages */

.notice {
  margin-bottom: 24px;
  padding: 12px 16px;
  border-left: 4px solid var(--ok);
  background: #e7f2ea;
  color: var(--ok);
  font-weight: 600;
}

.error-box {
  margin-bottom: 24px;
  padding: 12px 16px;
  border-left: 4px solid var(--error);
  background: #fbeceb;
  color: var(--error);
  font-weight: 600;
}

.error-box p,
.error-box ul {
  margin: 0;
}

.error-box ul {
  padding-left: 1.25em;
  font-weight: 500;
}

/* Buttons */

.btn {
  display: inline-block;
  padding: 11px 20px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--white);
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: var(--white);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.btn-secondary {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover {
  color: var(--accent-text);
}

.link-button.danger {
  color: var(--error);
}

.inline-form {
  display: inline;
  margin: 0;
}

/* Forms */

.form {
  max-width: 40em;
}

/* Under a client's settings: the products with the client's own prices, and a link to them. */
.own-prices {
  margin-top: 16px;
}

.field {
  margin-bottom: 20px;
}

.field label,
.field legend,
.field .label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.field .hint,
.hint {
  display: block;
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.optional {
  color: var(--muted);
  font-weight: 400;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #b9b7ae;
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font: inherit;
}

input[readonly] {
  background: var(--paper);
}

input[type="file"] {
  max-width: 100%;
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ink);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 6px;
  font-weight: 700;
  cursor: pointer;
}

.choice input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent-dark);
}

.sub {
  margin-left: 28px;
}

.form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0 16px;
  max-width: none;
}

.form-inline .field {
  flex: 1 1 220px;
}

.form-inline .btn {
  margin-bottom: 20px;
}

.copy-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.copy-row input {
  flex: 1;
  min-width: 0;
}

.add-to-page {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 6px;
}

.add-to-page select {
  width: auto;
  max-width: 100%;
  padding: 4px 8px;
  font-size: 0.875rem;
}

/* Layout */

.narrow {
  max-width: 32em;
  margin: 24px auto 0;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 40px;
}

.two-col.wide-left {
  grid-template-columns: 2fr 1fr;
}

.two-col > *,
.design-detail > * {
  min-width: 0;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 16px;
}

.heading-row h1,
.heading-row h2 {
  margin: 0;
}

.panel .heading-row {
  flex-wrap: nowrap;
  align-items: flex-start;
  margin-bottom: 12px;
}

.panel .heading-row .btn {
  flex-shrink: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.page-heading {
  margin-bottom: 24px;
}

section {
  margin-bottom: 32px;
}

form + h2,
form + h3,
table + h3 {
  margin-top: 32px;
}

.plain-list {
  margin: 0 0 1em;
  padding: 0;
  list-style: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

/* Search and sort above a list */

.list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 8px;
}

.search-form {
  flex: 1 1 320px;
  max-width: 520px;
}

.search-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.sort-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding-bottom: 10px;
  font-size: 0.9375rem;
}

.sort-links a {
  font-weight: 600;
}

.sort-links a[aria-current="true"] {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 3px solid var(--accent);
}

.narrow-panel {
  max-width: 560px;
}

/* Search and dates above the orders and invoices lists */

.list-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0 12px;
}

.list-filters .filter-search {
  flex: 2 1 280px;
}

.list-filters .filter-date {
  flex: 1 1 150px;
}

.list-filters .filter-buttons {
  margin-bottom: 20px;
}

.list-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.list-summary p {
  margin: 0;
}

.pager {
  display: flex;
  gap: 24px;
  margin: 0 0 12px;
  font-weight: 600;
}

.list-footer {
  margin-top: 16px;
}

.danger-panel {
  margin-top: 40px;
  max-width: 640px;
  border-color: #e0b4b0;
}

/* Tabs */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  margin-bottom: -1px;
  padding: 8px 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

/* Badges */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.status-approved {
  background: #d7eedd;
  color: var(--ok);
}

.status-draft {
  background: #fde3d6;
  color: #8a2f08;
}

.status-archived {
  background: var(--line);
  color: var(--muted);
}

/* Tables */

.data-table,
.price-table,
.tier-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  background: var(--white);
}

.data-table th,
.data-table td,
.price-table th,
.price-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th,
.price-table th,
.tier-table th {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.price-table {
  max-width: 28em;
}

.price-table td:last-child {
  font-weight: 700;
}

.tier-table {
  max-width: 24em;
  table-layout: fixed;
  background: none;
}

.tier-table input {
  min-width: 0;
}

.tier-table th {
  padding: 0 8px 6px 0;
  text-align: left;
}

.tier-table td {
  padding: 0 8px 8px 0;
}

/* Cards */

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card-link {
  display: block;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 1.125rem;
  font-weight: 800;
  text-decoration: none;
}

.card-link:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.design-card a {
  display: block;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  text-decoration: none;
}

.design-card a:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.design-card img,
.design-card .no-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: var(--paper);
}

.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  color: var(--muted);
  font-size: 0.875rem;
}

.design-card-body {
  display: grid;
  gap: 2px;
  padding: 12px 14px 14px;
}

.design-card-body span {
  color: var(--muted);
  font-size: 0.875rem;
}

.design-card-body .price {
  color: var(--accent-text);
  font-weight: 700;
}

.design-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.design-images {
  display: grid;
  gap: 12px;
}

.design-images img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.design-images .no-image {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* Files and uploads */

.file-list {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.file-list a {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.upload {
  padding: 20px;
  border: 1px dashed #b9b7ae;
  border-radius: var(--radius);
  background: var(--white);
}

.upload-status {
  margin: 12px 0 0;
  font-weight: 600;
}

.upload-status:empty {
  display: none;
}

.upload-status.is-error {
  color: var(--error);
}

/* Addresses */

.address-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.address-list li {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.address-list address {
  margin-bottom: 12px;
  font-style: normal;
}

/* Overview */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.stat {
  display: grid;
  gap: 2px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  text-decoration: none;
}

.stat:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.stat strong {
  font-size: 2rem;
  line-height: 1;
}

.stat span {
  color: var(--muted);
  font-size: 0.875rem;
}

.waiting-box {
  margin-bottom: 32px;
  padding: 16px 20px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--white);
}

.waiting-box h2 {
  margin-bottom: 4px;
}

.waiting-box p {
  margin: 12px 0 0;
}

.waiting-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.waiting-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.waiting-list li:last-child {
  border-bottom: 0;
}

.waiting-list a {
  font-weight: 700;
}

.waiting-list strong {
  color: var(--accent-text);
  font-size: 0.875rem;
}

.waiting-list time {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.875rem;
}

.sales {
  margin-bottom: 32px;
}

.sales .stats {
  margin-bottom: 16px;
}

.sales .stat strong {
  font-size: 1.5rem;
}

.top-clients {
  max-width: 640px;
}

.activity {
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.activity time {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Prices */

.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.price-grid .panel {
  margin: 0;
}

.price-grid h2 {
  font-size: 1.125rem;
}

.price-grid .price-table {
  margin-bottom: 0;
}

.panel.is-editing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* Orders */

.order-form {
  max-width: 52em;
}

.order-design {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.order-design[open] {
  border-color: #b9b7ae;
}

.order-design summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}

.order-design summary::-webkit-details-marker {
  display: none;
}

/* A chevron that points down when closed and up when open. */
.order-design summary::after {
  content: "";
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin: 0 4px 4px 0;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
}

.order-design[open] summary::after {
  margin: 4px 4px 0 0;
  transform: rotate(-135deg);
}

.order-design summary:hover .order-design-title strong {
  color: var(--accent-text);
}

.order-design summary img,
.no-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.order-design-title {
  display: grid;
  flex: 1;
  min-width: 0;
}

.order-design-title strong {
  font-size: 1.0625rem;
}

.order-design-title span {
  color: var(--muted);
  font-size: 0.875rem;
}

.order-design-count {
  color: var(--accent-text);
  font-weight: 700;
  white-space: nowrap;
}

.order-design-body {
  padding: 4px 16px 8px;
  border-top: 1px solid var(--line);
}

.order-design-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 12px 0 14px;
}

.order-design-info {
  display: grid;
  flex: 1 1 140px;
  gap: 2px;
  margin: 0;
  font-weight: 700;
}

.order-design-info span {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.tier-cards {
  display: grid;
  gap: 4px;
}

.tier-caption {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tier-cards ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tier-cards li {
  display: grid;
  justify-items: center;
  min-width: 92px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  line-height: 1.25;
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s;
}

.tier-qty {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.tier-price {
  font-size: 1.25rem;
  font-weight: 800;
}

.tier-each {
  color: var(--muted);
  font-size: 0.75rem;
}

.tier-cards li.is-active {
  border-color: var(--accent);
  background: #fdecec;
  box-shadow: 0 0 0 1px var(--accent);
}

.tier-cards li.is-active .tier-price {
  color: var(--accent-text);
}

.size-group {
  margin-bottom: 10px;
}

.size-group-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 6px;
}

.size-cell {
  display: grid;
  gap: 2px;
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: center;
}

.size-cell input {
  padding: 8px 4px;
  text-align: center;
}

.belt-row {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}

.belt-color {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 8px;
  font-weight: 700;
}

.belt-color select {
  width: auto;
  min-width: 12em;
}

.design-total {
  min-height: 1.5em;
  margin: 4px 0 8px;
  font-weight: 700;
}

.linked-note {
  color: var(--accent-text);
  font-weight: 600;
}

.design-total span {
  display: block;
  color: var(--accent-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.choice-hint {
  align-items: flex-start;
  font-weight: 700;
}

.choice-hint input {
  margin-top: 3px;
}

.choice-hint .hint {
  margin: 2px 0 0;
}

.pay-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--white);
}

.publish-box {
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--white);
}

.publish-box p {
  max-width: 44em;
}

.publish-box .data-table {
  margin-bottom: 16px;
}

/* The bar above a client's designs for publishing drafts together. */
.publish-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 12px;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  background: var(--white);
}

.publish-bar p {
  margin: 0;
  max-width: 44em;
}

.tick-cell {
  width: 2.5em;
}

.tick-cell input {
  width: 1.25em;
  height: 1.25em;
  accent-color: var(--accent-dark);
}

.pay-box p {
  margin: 0;
  max-width: 36em;
}

.order-table tfoot th,
.order-table tfoot td {
  padding: 12px;
  border-top: 2px solid var(--ink);
  text-align: right;
}

.order-table tfoot th {
  font-size: 1rem;
  color: var(--ink);
}

.invoice-list li,
.history li {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.history time {
  color: var(--muted);
  font-size: 0.875rem;
}

.admin-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.admin-actions .panel {
  margin: 0;
}

.admin-actions h2 {
  font-size: 1.125rem;
}

.danger-button {
  border-color: var(--error);
  color: var(--error);
}

.danger-button:hover {
  background: var(--error);
  border-color: var(--error);
  color: var(--white);
}

.order-awaiting_payment {
  background: #fde3d6;
  color: #8a2f08;
}

.order-in_production {
  background: #dfe8fb;
  color: #1d3f8a;
}

.order-shipped {
  background: #d7eedd;
  color: var(--ok);
}

.order-delivered {
  background: var(--ok);
  color: var(--white);
}

.delivered-panel p {
  margin-bottom: 12px;
}

.badge-rush {
  background: var(--error);
  color: var(--white);
}

.badge-test {
  background: #ede3fb;
  color: #5a2a9c;
}

.order-cancelled {
  background: var(--line);
  color: var(--muted);
}

/* Footer */

.portal-footer {
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

.portal-footer .wrap {
  display: flex;
  gap: 20px;
}

.portal-footer a {
  color: var(--muted);
}

/* Invoices */

.invoice-open {
  background: #fde3d6;
  color: #8a2f08;
}

.invoice-paid {
  background: #d7eedd;
  color: var(--ok);
}

.invoice-void,
.invoice-creating {
  background: var(--line);
  color: var(--muted);
}

/* Manufacturer screens and people */

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.side-panel {
  max-width: 40em;
  margin-top: 32px;
}

.production-design {
  margin-bottom: 28px;
}

.design-grid + .two-col {
  margin-top: 32px;
}

.production-design h2 {
  margin-bottom: 2px;
}

.production-design .muted {
  margin-top: 0;
}

.qty-grid-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.qty-grid {
  border-collapse: collapse;
  background: var(--white);
}

.qty-grid th,
.qty-grid td {
  min-width: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: center;
}

.qty-grid th {
  background: var(--paper);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
}

.qty-grid .total {
  font-weight: 700;
}

.options-table th {
  font-size: inherit;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

/* Design requests */

.request-draft,
.request-withdrawn,
.request-declined {
  background: var(--line);
  color: var(--muted);
}

.request-submitted,
.request-changes_requested {
  background: #dfe8fb;
  color: #1d3f8a;
}

.request-mockup_ready,
.request-approved {
  background: #fde3d6;
  color: #8a2f08;
}

.request-published {
  background: #d7eedd;
  color: var(--ok);
}

.request-item {
  margin-bottom: 28px;
}

.request-item h2 {
  margin-bottom: 4px;
}

.mockup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.mockup-grid img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.mockup-grid .mockup-file {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  overflow-wrap: anywhere;
}

.pending-mockups {
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
}

.pending-mockups h3 {
  margin-top: 0;
}

.earlier-mockups {
  margin-bottom: 24px;
}

.earlier-mockups summary {
  cursor: pointer;
  font-weight: 700;
}

.review-box {
  margin-bottom: 24px;
  padding: 16px 20px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--white);
}

.review-box > p {
  margin-top: 0;
}

.review-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
  gap: 16px;
}

.review-actions h3 {
  margin-top: 0;
}

.history .event-message {
  display: block;
  margin-top: 4px;
  padding-left: 10px;
  border-left: 3px solid var(--line);
  white-space: pre-line;
}

.request-close {
  display: block;
  margin-top: 24px;
}

.request-prompt {
  margin-top: 24px;
}

/* Address checks */

.address-check {
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--white);
}

.address-check > p {
  margin-top: 0;
}

.address-check ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

.address-suggestion {
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--paper);
}

.address-suggestion .small {
  margin: 0 0 4px;
}

.address-verified,
.address-unverified {
  margin: 0 0 12px;
  font-size: 0.875rem;
  font-weight: 600;
}

.address-verified {
  color: var(--ok);
}

.address-unverified {
  color: #8a2f08;
}

/* Phones */

@media (max-width: 760px) {
  .two-col,
  .two-col.wide-left,
  .design-detail {
    grid-template-columns: 1fr;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }

  .data-table td {
    padding: 4px 12px;
    border: 0;
  }

  .data-table td:empty {
    display: none;
  }

  .data-table td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-weight: 600;
  }

  .activity li {
    flex-direction: column;
    gap: 0;
  }

  .order-table tfoot,
  .order-table tfoot tr {
    display: block;
  }

  .order-table tfoot th,
  .order-table tfoot td {
    display: inline-block;
    border-top: 0;
  }
}

@media (max-width: 600px) {
  .row {
    grid-template-columns: 1fr;
  }

  .tier-cards {
    flex: 1 1 100%;
  }

  .tier-cards li {
    flex: 1 1 0;
    min-width: 64px;
    padding: 8px 4px;
  }

  .tier-price {
    font-size: 1.0625rem;
  }

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

@media (max-width: 400px) {
  .wrap {
    padding: 0 16px;
  }

  .wordmark img {
    height: 22px;
  }
}

/* Order again: what was filled in from the past order. */
.again-note p {
  margin: 0;
}

.again-note ul {
  margin: 6px 0 0;
  padding-left: 20px;
  font-weight: 400;
}

/* Work order: one printable page per order for the factory floor. */
.work-order-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.work-order-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--ink);
}

.work-order-head h1,
.work-order-head p {
  margin: 0;
}

.work-order-client {
  font-size: 1.25rem;
  font-weight: 700;
}

.work-order-facts {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 4px 24px;
  margin: 0;
}

.work-order-facts dt {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
}

.work-order-facts dd {
  margin: 0;
  font-weight: 700;
}

.work-order-head + .error-box {
  margin-top: 16px;
}

.work-order-design {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.work-order-design h2 {
  margin-bottom: 4px;
}

.work-order-mockups {
  display: grid;
  gap: 8px;
  align-content: start;
}

.work-order-mockups img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: var(--white);
}

.work-order-foot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 32px;
  padding-top: 8px;
}

@media (max-width: 600px) {
  .work-order-design {
    grid-template-columns: 1fr;
  }

  .work-order-facts {
    grid-template-columns: repeat(2, auto);
  }
}

@page {
  margin: 12mm;
}

@media print {
  .portal-header,
  .portal-footer,
  .skip,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .portal-main {
    padding: 0;
  }

  .work-order-design {
    break-inside: avoid;
  }

  .work-order a {
    color: inherit;
    text-decoration: none;
  }
}

/* The mockup viewer opened from a design's or request's images. */
.zoom-viewer {
  max-width: 96vw;
  max-height: 96vh;
  padding: 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--white);
}

.zoom-viewer::backdrop {
  background: rgba(17, 17, 19, 0.82);
}

.zoom-viewer img {
  display: block;
  max-width: calc(96vw - 24px);
  max-height: calc(96vh - 96px);
  margin: 8px auto;
  object-fit: contain;
}

.zoom-close {
  display: block;
  margin-left: auto;
}

.zoom-full {
  display: block;
  text-align: center;
  font-weight: 600;
}

a[data-zoom] {
  cursor: zoom-in;
}

.people-search {
  margin-bottom: 8px;
}

.attention-box .waiting-list li {
  justify-content: space-between;
  align-items: center;
}

.duplicate-panel {
  margin-top: 24px;
}

/* Messages on an order */
.order-messages {
  max-width: 760px;
  margin-top: 32px;
}

.message-list {
  display: grid;
  gap: 12px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.message {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.message.from-butterflyx {
  border-left: 4px solid var(--accent);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 0 6px;
}

.message-meta time {
  color: var(--muted);
  font-size: 0.875rem;
}

.message-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Leads */
.lead-new {
  background: #fde3d6;
  color: #8a2f08;
}

.lead-client {
  background: #d7eedd;
  color: var(--ok);
}

.lead-dismissed {
  background: var(--line);
  color: var(--muted);
}

.lead-table {
  margin-bottom: 24px;
}

.lead-unread {
  background: var(--accent-text);
  color: var(--white);
}

tr.unread a {
  font-weight: 800;
}
