:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #5f6b7a;
  --line: #d9dee7;
  --action: #0f766e;
  --action-dark: #115e59;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

.page-shell {
  width: min(100% - 24px, 960px);
  margin: 0 auto;
  padding: 24px 0;
}

.panel,
.gallery-header {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

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

.form-stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select,
textarea,
button,
.button-link {
  min-height: 44px;
  border-radius: 6px;
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  padding: 8px 10px;
}

textarea {
  resize: vertical;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: var(--action);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button-link:hover {
  background: var(--action-dark);
}

.secondary-button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--action-dark);
  padding: 0 10px;
  font-size: 0.85rem;
}

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

.messages {
  margin-bottom: 16px;
}

.message {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff7ed;
  color: #7c2d12;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 300px));
  gap: 12px;
  justify-content: center;
}

.image-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.image-card img,
.image-placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  display: grid;
  place-items: center;
  background: #e8eef4;
  color: var(--muted);
}

.image-card-landscape img,
.image-card-landscape .image-placeholder {
  aspect-ratio: 4 / 3;
}

.image-card-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.image-card-body p {
  margin: 0;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.selected-image {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  align-items: center;
  margin: 16px 0 20px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.selected-image img,
.selected-image .image-placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  border-radius: 6px;
  background: #e8eef4;
}

.selected-image-landscape {
  grid-template-columns: minmax(180px, 260px) 1fr;
}

.selected-image-landscape img,
.selected-image-landscape .image-placeholder {
  aspect-ratio: 4 / 3;
}

.selected-image h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.checkout-header,
.order-header {
  margin-bottom: 18px;
}

.checkout-header p {
  max-width: 620px;
  margin: 4px 0 0;
}

.checkout-step {
  display: block;
  margin-bottom: 4px;
  color: var(--action-dark);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.choose-photo-button {
  min-height: 44px;
}

.order-lines {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.payment-form {
  margin-top: 18px;
}

.cart-products {
  display: grid;
  gap: 10px;
}

.cart-product {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbfd;
}

.cart-product-selected {
  border-color: var(--action);
  background: #eefdfa;
}

.cart-product-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.cart-product-name {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.cart-product-category {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.cart-product-info span,
.cart-product-info small {
  color: var(--muted);
}

.quantity-control {
  display: grid;
  grid-template-columns: 40px 64px 40px;
  gap: 4px;
}

.quantity-control input {
  width: 64px;
  padding: 6px;
  text-align: center;
}

.quantity-button,
.remove-cart-item {
  min-height: 40px;
}

.remove-cart-item {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--action-dark);
}

.remove-cart-item:hover {
  border-color: var(--action);
  background: #ffffff;
}

.form-errors,
.errorlist {
  margin: 0;
  color: #b91c1c;
}

.confirmation-message {
  padding: 12px;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 700;
}

.order-navigation {
  margin-top: 18px;
}

.order-navigation form {
  display: flex;
}

.order-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #e8eef4;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.order-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.order-meta-grid div {
  display: grid;
  gap: 3px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbfd;
}

.order-meta-grid span {
  color: var(--muted);
  font-size: 0.85rem;
}

.order-meta-grid strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.order-line {
  display: grid;
  grid-template-columns: 1.3fr 1fr auto auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbfd;
}

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

.metric-card {
  display: grid;
  gap: 4px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-card strong {
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1.15;
}

.metric-card small,
.metric-label {
  color: var(--muted);
}

.metric-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.dashboard-grid h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.metric-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.metric-list dt {
  color: var(--muted);
}

.metric-list dd {
  margin: 0;
  font-weight: 700;
}

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

.metric-table th,
.metric-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.metric-table th:last-child,
.metric-table td:last-child {
  text-align: right;
}

.readiness-table th:last-child,
.readiness-table td:last-child {
  text-align: left;
}

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

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

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

.section-heading-row h2 {
  margin: 0;
}

.issue-section {
  margin-top: 18px;
}

.issue-section h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.issue-section p {
  margin: 0;
}

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

.filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  align-items: end;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.filter-summary {
  margin: 12px 0 0;
}

.filter-row a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.filter-row a:hover {
  border-color: var(--action);
  color: var(--action-dark);
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--action-dark);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

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

.table-scroll {
  overflow-x: auto;
}

.launch-table {
  min-width: 860px;
  table-layout: fixed;
}

.fulfilment-table {
  min-width: 940px;
  table-layout: fixed;
}

.readiness-table {
  min-width: 900px;
  table-layout: fixed;
}

.launch-table th,
.launch-table td,
.fulfilment-table th,
.fulfilment-table td {
  padding: 10px 8px;
  vertical-align: top;
}

.launch-table th:last-child,
.launch-table td:last-child,
.fulfilment-table th:last-child,
.fulfilment-table td:last-child {
  text-align: left;
}

.fulfilment-table .col-order {
  width: 150px;
}

.launch-table .col-gallery {
  width: 180px;
}

.fulfilment-table .col-gallery {
  width: 190px;
}

.launch-table .col-class {
  width: 120px;
}

.launch-table .col-contact {
  width: 190px;
}

.fulfilment-table .col-contact {
  width: 150px;
}

.fulfilment-table .col-images {
  width: 220px;
}

.launch-table .col-state {
  width: 130px;
}

.fulfilment-table .col-state {
  width: 110px;
}

.launch-table .col-orders {
  width: 112px;
}

.fulfilment-table .col-orders {
  width: 90px;
}

.launch-table .col-notes {
  width: 190px;
}

.fulfilment-table .col-notes {
  width: 210px;
}

.launch-table td,
.fulfilment-table td {
  overflow-wrap: anywhere;
}

.launch-table .col-contact,
.launch-table .col-state,
.launch-table .col-orders,
.fulfilment-table .col-order,
.fulfilment-table .col-contact,
.fulfilment-table .col-gallery {
  display: table-cell;
}

.launch-table .col-contact strong,
.launch-table .col-contact span,
.launch-table .col-state strong,
.launch-table .col-state span,
.launch-table .col-orders span,
.fulfilment-table .col-order a,
.fulfilment-table .col-order span,
.fulfilment-table .col-gallery strong,
.fulfilment-table .col-gallery span {
  display: block;
}

.launch-table .col-contact span,
.launch-table .col-state span,
.launch-table .col-orders span,
.fulfilment-table .col-order span,
.fulfilment-table .col-gallery span {
  color: var(--muted);
  font-size: 0.9rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin: 2px 4px 2px 0;
  padding: 0 8px;
  border-radius: 999px;
  background: #e8eef4;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

.status-pill-warning {
  background: #fff7ed;
  color: #9a3412;
}

.status-pill-success {
  background: #ecfdf5;
  color: #047857;
}

.status-pill-danger {
  background: #fef2f2;
  color: #b91c1c;
}

.inline-action-form {
  margin-top: 8px;
}

.follow-up-log-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 16px, 960px);
    padding: 10px 0 20px;
  }

  .panel,
  .gallery-header {
    padding: 16px;
  }

  h1 {
    font-size: 1.45rem;
  }

  .gallery-header {
    align-items: stretch;
    flex-direction: column;
  }

  .selected-image,
  .order-line,
  .cart-product {
    grid-template-columns: 1fr;
  }

  .selected-image {
    gap: 12px;
    padding: 10px;
  }

  .selected-image img,
  .selected-image .image-placeholder {
    max-height: 360px;
  }

  .selected-image > div {
    display: grid;
    gap: 8px;
  }

  .selected-image form,
  .choose-photo-button {
    width: 100%;
  }

  .cart-products {
    gap: 12px;
  }

  .cart-product {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

  .cart-product-name {
    font-size: 1rem;
  }

  .quantity-control {
    grid-template-columns: 52px minmax(72px, 1fr) 52px;
    width: 100%;
    gap: 8px;
  }

  .quantity-control input {
    width: 100%;
    min-height: 52px;
    font-size: 1.1rem;
  }

  .quantity-button {
    min-height: 52px;
    padding: 0;
    font-size: 1.4rem;
  }

  .remove-cart-item,
  .checkout-submit,
  .payment-form button {
    width: 100%;
    min-height: 52px;
  }

  .checkout-panel input[type="tel"],
  .checkout-panel input[type="text"],
  .checkout-panel input[type="email"] {
    min-height: 52px;
    font-size: 1rem;
  }

  .order-meta-grid {
    grid-template-columns: 1fr;
  }

  .order-navigation {
    align-items: stretch;
    flex-direction: column;
  }

  .order-navigation > *,
  .order-navigation form,
  .order-navigation a,
  .order-navigation button {
    width: 100%;
    min-height: 50px;
  }

  .section-heading-row {
    align-items: stretch;
    flex-direction: column;
  }
}
