:root {
  --green: #76b82a;
  --green-dark: #4c8917;
  --ink: #111820;
  --muted: #667085;
  --line: #cfd5ca;
  --paper: #ffffff;
  --wash: #eef2ea;
  --danger: #b42318;
  --blue: #1164d8;
  --gold: #f2b705;
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--wash);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #050505;
  color: #fff;
  border-bottom: 5px solid var(--green);
}

.top-nav-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 10px 0;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}

.brand img {
  width: 58px;
  height: 44px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 4px;
}

.brand span {
  display: block;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.tab,
.button,
.icon-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: #fff;
  color: #050505;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.tab.active,
.button.primary {
  background: var(--green);
  color: #050505;
}

.button.dark {
  background: #050505;
  color: #fff;
}

.button.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
}

.button.danger {
  background: var(--danger);
  color: #fff;
}

.nav-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.page {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
}

.notice.success {
  border-color: #a6d87f;
  background: #f0ffe8;
}

.notice.error {
  border-color: #f3b3ae;
  background: #fff2f1;
  color: var(--danger);
}

.login-shell,
.signature-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card,
.signature-card {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

.login-card img,
.signature-card img.logo {
  display: block;
  width: min(220px, 100%);
  margin: 0 auto 14px;
}

.login-card h1,
.signature-card h1,
.page-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 0.96;
  font-weight: 900;
  text-transform: uppercase;
}

.subtitle {
  color: var(--muted);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 5px;
  grid-column: span 6;
}

.field.full {
  grid-column: span 12;
}

.field.third {
  grid-column: span 4;
}

.field.quarter {
  grid-column: span 3;
}

.field.small {
  grid-column: span 2;
}

.field.check {
  align-content: end;
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 9px 0;
}

.field.check input {
  width: 20px;
  min-height: 20px;
}

.field label,
.field > span {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #b9c1b2;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

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

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 16px;
}

.work-header {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.work-header img {
  width: 100%;
  max-height: 130px;
  object-fit: contain;
}

.rule {
  height: 13px;
  margin: 12px 0;
  border-top: 5px solid var(--green);
  border-bottom: 5px solid var(--green);
}

.items-wrap {
  overflow-x: auto;
}

.items-table,
.orders-table,
.sizes-table {
  width: 100%;
  border-collapse: collapse;
}

.items-table th,
.items-table td,
.orders-table th,
.orders-table td,
.sizes-table th,
.sizes-table td {
  border: 1px solid #111;
  padding: 7px;
  vertical-align: top;
}

.items-table th,
.orders-table th,
.sizes-table th {
  background: #050505;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.items-table input,
.sizes-table input {
  min-height: 36px;
  border-radius: 4px;
}

.items-table .num {
  width: 42px;
  text-align: center;
  font-weight: 900;
}

.items-table .compact-column {
  width: 1%;
  padding-left: 3px;
  padding-right: 3px;
  white-space: nowrap;
}

.items-table .compact-column:nth-child(2) {
  width: 64px;
  min-width: 64px;
}

.items-table .compact-column:nth-child(4) {
  width: 94px;
  min-width: 94px;
}

.items-table .compact-column:nth-child(7) {
  width: 92px;
  min-width: 92px;
}

.items-table .compact-column input {
  width: 0;
  min-width: 100%;
  padding-left: 2px;
  padding-right: 2px;
  font-size: 12px;
}

.items-table .laminated-head {
  width: 66px;
  min-width: 66px;
  max-width: 66px;
  padding-left: 3px;
  padding-right: 3px;
  text-align: center;
  text-transform: none;
  white-space: nowrap;
}

.items-table .laminated-cell {
  width: 66px;
  min-width: 66px;
  max-width: 66px;
  padding-left: 3px;
  padding-right: 3px;
  text-align: center;
  vertical-align: middle;
}

.items-table .laminated-cell input[type="checkbox"] {
  display: block;
  width: 18px;
  height: 18px;
  min-height: auto;
  margin: 8px auto;
  accent-color: #76b82a;
}

.totals {
  display: grid;
  gap: 8px;
}

.work-order-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.work-order-pair > .panel {
  min-width: 0;
  margin-bottom: 0;
}

.signature-pad,
.designer-pad {
  border: 2px solid #111;
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.signature-pad canvas,
.designer-pad canvas {
  display: block;
  width: 100%;
  height: 180px;
  touch-action: none;
}

.designer-pad canvas {
  height: 360px;
  background:
    radial-gradient(circle at 50% 18%, transparent 0 54px, rgba(0,0,0,.08) 55px, transparent 58px),
    linear-gradient(135deg, rgba(255,255,255,.25), rgba(255,255,255,0)),
    var(--shirt-color, #111);
}

.draw-tools,
.signature-tools,
.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

.swatch {
  width: 34px;
  height: 34px;
  border: 2px solid #111;
  border-radius: 50%;
}

.qr-box {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf6;
}

.qr-box img {
  width: 120px;
  height: 120px;
}

.orders-list {
  display: grid;
  gap: 12px;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.users-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8faf6;
}

.user-row strong,
.user-row span {
  display: block;
}

.user-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.order-card-head {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 5px 9px;
  background: #edf7e6;
  color: #264f0f;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.pill.error {
  background: #fff1f0;
  color: var(--danger);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.summary-box {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px;
  background: #f8faf6;
}

.summary-box span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-box strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  .top-nav-inner {
    grid-template-columns: 1fr;
  }

  .brand,
  .nav-actions {
    justify-content: center;
  }

  .page {
    width: min(100% - 16px, 720px);
    padding-top: 12px;
  }

  .work-header {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .work-header img {
    max-height: 100px;
  }

  .field,
  .field.third,
  .field.quarter,
  .field.small {
    grid-column: span 12;
  }

  .panel {
    padding: 12px;
  }

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

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-card-head,
  .panel-head,
  .user-row {
    display: grid;
  }

  .user-actions {
    justify-content: stretch;
  }
}

@media (max-width: 560px) {
  .tabs,
  .nav-actions,
  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tab,
  .button {
    width: 100%;
  }

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

  .qr-box {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

@media print {
  .top-nav,
  .form-actions,
  .notice {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .page {
    width: 100%;
    padding: 0;
  }

  .panel {
    border-radius: 0;
    break-inside: avoid;
  }
}
