/* Factory33 portal styles. Same colors and type as the public site, sized for working screens. */

:root {
  --ink: #111113;
  --ink-soft: #2a2a2e;
  --paper: #f6f5f1;
  --white: #ffffff;
  --muted: #5d5d63;
  --line: #d9d7d0;
  --accent: #ff5a1f;
  --accent-dark: #d9430c;
  --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-dark);
}

: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(--ink);
  font-weight: 700;
  z-index: 10;
}

.skip:focus {
  left: 16px;
}

.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-dark);
}

.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: 22px;
}

.wordmark span {
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.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);
}

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

.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(--ink);
  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(--ink);
}

.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-dark);
}

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

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

/* Forms */

.form {
  max-width: 40em;
}

.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"],
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;
}

/* 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-dark);
  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;
}

.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 20px;
  padding: 16px 20px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.order-design legend {
  padding: 0 6px;
  margin-left: -6px;
  font-size: 1.125rem;
  font-weight: 800;
}

.order-design-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

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

.order-design-head p {
  margin: 0;
}

.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;
  color: var(--accent-dark);
  font-weight: 700;
}

.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);
}

.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);
}

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

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

/* 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;
  }

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

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

  .wordmark img {
    height: 18px;
  }
}
