:root {
  color-scheme: light;
  --pb-ink: #172033;
  --pb-muted: #64748b;
  --pb-line: #d9e2ef;
  --pb-card: #ffffff;
  --pb-shadow: 0 12px 28px rgba(23, 32, 51, 0.12);
  --pb-radius: 8px;
  --pb-inquiry: #18a5a7;
  --pb-quotes: #4f7df7;
  --pb-design: #ec4899;
  --pb-deposit: #18a058;
  --pb-vectored: #f97316;
  --pb-scheduled: #d39a12;
  --pb-complete: #8b5cf6;
  --pb-closed: #64748b;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--pb-ink);
  background:
    radial-gradient(circle at top left, rgba(24, 165, 167, 0.13), transparent 34rem),
    linear-gradient(135deg, #f5fbff 0%, #fbfff7 48%, #fff9fb 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.pb-production-board {
  min-height: 100vh;
}

.pb-shell {
  width: min(1780px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.pb-topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.pb-title-block {
  min-width: 220px;
}

.pb-title {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.pb-subtitle {
  margin: 10px 0 0;
  color: var(--pb-muted);
  font-size: 1rem;
  max-width: 680px;
}

.pb-actions {
  display: flex;
  flex-wrap: wrap;
  justify-self: end;
  justify-content: flex-end;
  gap: 10px;
}

.pb-home-button {
  justify-self: center;
  white-space: nowrap;
  border-color: var(--pb-line);
}

.pb-home-panel {
  display: grid;
  justify-self: center;
  justify-items: center;
  gap: 10px;
  width: min(300px, 100%);
}

.pb-live-counters {
  display: grid;
  gap: 8px;
  width: 100%;
}

.pb-live-counter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--pb-line);
  border-radius: var(--pb-radius);
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.08);
}

.pb-live-label {
  min-width: 0;
  color: var(--pb-muted);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.15;
}

.pb-live-value {
  min-width: 44px;
  padding: 7px 10px;
  color: #ffffff;
  background: var(--pb-ink);
  border-radius: var(--pb-radius);
  text-align: center;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

.pb-live-counter:first-child .pb-live-value {
  background: var(--pb-complete);
}

.pb-live-counter:last-child .pb-live-value {
  background: var(--pb-scheduled);
}

.pb-button,
.pb-mini,
.pb-x-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--pb-ink);
  background: var(--pb-card);
  border: 1px solid transparent;
  border-radius: var(--pb-radius);
  box-shadow: 0 1px 0 rgba(23, 32, 51, 0.04);
  font-weight: 750;
  line-height: 1.1;
  text-decoration: none;
}

.pb-button {
  min-height: 42px;
  padding: 10px 13px;
}

.pb-button.pb-primary {
  background: var(--pb-ink);
  color: #ffffff;
}

.pb-button.pb-home-button {
  border-color: var(--pb-line);
}

.pb-button:hover,
.pb-button:focus-visible,
.pb-mini:hover,
.pb-mini:focus-visible,
.pb-x-button:hover,
.pb-x-button:focus-visible {
  border-color: rgba(23, 32, 51, 0.28);
  outline: none;
}

.pb-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(217, 226, 239, 0.88);
  border-radius: var(--pb-radius);
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.07);
  backdrop-filter: blur(12px);
}

.pb-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 12px;
  background: #ffffff;
  border: 1px solid var(--pb-line);
  border-radius: var(--pb-radius);
}

.pb-search span {
  color: var(--pb-muted);
  font-weight: 800;
}

.pb-search input {
  width: 100%;
  min-height: 42px;
  color: var(--pb-ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.pb-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  color: var(--pb-muted);
  font-weight: 700;
}

.pb-summary span,
.pb-readonly {
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid var(--pb-line);
  border-radius: var(--pb-radius);
}

.pb-readonly {
  color: var(--pb-muted);
  font-weight: 850;
}

.pb-status {
  color: var(--pb-muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.pb-status.pb-saving { color: #775000; }
.pb-status.pb-saved { color: #176b3a; }
.pb-status.pb-error { color: #9b1230; }

.pb-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(190px, 1fr));
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.pb-column {
  min-height: 640px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(217, 226, 239, 0.9);
  border-radius: var(--pb-radius);
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.08);
  overflow: hidden;
}

.pb-column-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  color: #ffffff;
}

.pb-column-header h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1.15;
}

.pb-count {
  min-width: 34px;
  padding: 4px 9px;
  text-align: center;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  font-weight: 850;
}

.pb-column[data-stage="inquiry"] .pb-column-header { background: var(--pb-inquiry); }
.pb-column[data-stage="quotes"] .pb-column-header { background: var(--pb-quotes); }
.pb-column[data-stage="design"] .pb-column-header { background: var(--pb-design); }
.pb-column[data-stage="deposit"] .pb-column-header { background: var(--pb-deposit); }
.pb-column[data-stage="vectored"] .pb-column-header { background: var(--pb-vectored); }
.pb-column[data-stage="scheduled"] .pb-column-header { background: var(--pb-scheduled); }
.pb-column[data-stage="complete"] .pb-column-header { background: var(--pb-complete); }
.pb-column[data-stage="closed"] .pb-column-header { background: var(--pb-closed); }

.pb-dropzone {
  min-height: 572px;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.pb-dropzone.pb-drag-over {
  background: rgba(24, 165, 167, 0.08);
  box-shadow: inset 0 0 0 2px rgba(24, 165, 167, 0.35);
}

.pb-empty {
  min-height: 126px;
  padding: 18px 12px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--pb-muted);
  background: rgba(255, 255, 255, 0.56);
  border: 1px dashed #c9d5e5;
  border-radius: var(--pb-radius);
  line-height: 1.35;
}

.pb-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  background: var(--pb-card);
  border: 1px solid #e1e8f2;
  border-left-width: 7px;
  border-radius: var(--pb-radius);
  box-shadow: 0 7px 18px rgba(23, 32, 51, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.pb-card[draggable="true"] {
  cursor: grab;
}

.pb-card.pb-dragging {
  opacity: 0.52;
  transform: rotate(1deg) scale(0.99);
}

.pb-card:hover,
.pb-card:focus-within {
  box-shadow: var(--pb-shadow);
}

.pb-card-stage-inquiry { border-left-color: var(--pb-inquiry); }
.pb-card-stage-quotes { border-left-color: var(--pb-quotes); }
.pb-card-stage-design { border-left-color: var(--pb-design); }
.pb-card-stage-deposit { border-left-color: var(--pb-deposit); }
.pb-card-stage-vectored { border-left-color: var(--pb-vectored); }
.pb-card-stage-scheduled { border-left-color: var(--pb-scheduled); }
.pb-card-stage-complete { border-left-color: var(--pb-complete); }
.pb-card-stage-closed { border-left-color: var(--pb-closed); }

.pb-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.pb-card h3 {
  margin: 0;
  color: var(--pb-ink);
  font-size: 1.02rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.pb-pill {
  flex: 0 0 auto;
  padding: 4px 8px;
  color: #152238;
  background: #eef4fb;
  border: 1px solid #dae5f2;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 850;
  white-space: nowrap;
}

.pb-pill.pb-high { background: #ffe5e8; border-color: #ffc3cc; color: #9b1230; }
.pb-pill.pb-medium { background: #fff4ce; border-color: #f4d56b; color: #775000; }
.pb-pill.pb-low { background: #e5f9ee; border-color: #b7ebcb; color: #176b3a; }

.pb-detail-list {
  display: grid;
  gap: 5px;
  color: var(--pb-muted);
  font-size: 0.9rem;
  line-height: 1.25;
}

.pb-detail-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.pb-detail-label {
  flex: 0 0 auto;
  color: #42526c;
  font-weight: 800;
}

.pb-detail-line span:last-child {
  overflow-wrap: anywhere;
}

.pb-notes {
  margin: 0;
  color: #364761;
  line-height: 1.35;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.pb-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 9px;
  border-top: 1px solid #edf2f7;
}

.pb-mini {
  min-height: 32px;
  padding: 6px 9px;
  color: #26354d;
  background: #f8fbff;
  border-color: #d9e2ef;
  font-size: 0.84rem;
  font-weight: 800;
}

.pb-mini:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.pb-dialog {
  width: min(680px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--pb-radius);
  box-shadow: 0 28px 88px rgba(23, 32, 51, 0.32);
}

.pb-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.pb-dialog[open] {
  display: block;
}

.pb-dialog-inner {
  padding: 18px;
  color: var(--pb-ink);
  background: #ffffff;
}

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

.pb-dialog-title h2 {
  margin: 0;
  color: var(--pb-ink);
  font-size: 1.35rem;
}

.pb-x-button {
  width: 38px;
  height: 38px;
  color: var(--pb-ink);
  background: #f8fbff;
  border-color: var(--pb-line);
  font-size: 1.1rem;
  font-weight: 900;
}

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

.pb-form label {
  display: grid;
  gap: 6px;
  color: #31415a;
  font-size: 0.86rem;
  font-weight: 800;
}

.pb-form input,
.pb-form select,
.pb-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--pb-ink);
  background: #ffffff;
  border: 1px solid #cdd9e8;
  border-radius: var(--pb-radius);
}

.pb-form textarea {
  min-height: 96px;
  resize: vertical;
}

.pb-wide {
  grid-column: 1 / -1;
}

.pb-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.pb-note {
  margin: 0;
  color: var(--pb-muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.pb-users-dialog {
  width: min(780px, calc(100vw - 28px));
}

.pb-users-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.pb-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #f8fbff;
  border: 1px solid var(--pb-line);
  border-radius: var(--pb-radius);
}

.pb-user-row strong,
.pb-user-row span {
  display: block;
  overflow-wrap: anywhere;
}

.pb-user-row span {
  margin-top: 3px;
  color: var(--pb-muted);
  font-size: 0.86rem;
  font-weight: 760;
}

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

.pb-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 10px;
  background: #ffffff;
  border: 1px solid #cdd9e8;
  border-radius: var(--pb-radius);
}

.pb-check input {
  width: auto;
  min-height: 0;
  padding: 0;
}

.pb-restore-input {
  display: none;
}

.pb-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 99999;
  max-width: min(520px, calc(100vw - 28px));
  padding: 12px 14px;
  color: #ffffff;
  background: #172033;
  border-radius: var(--pb-radius);
  box-shadow: var(--pb-shadow);
  opacity: 0;
  transform: translateX(-50%) translateY(90px);
  transition: transform 0.18s ease, opacity 0.18s ease;
  font-weight: 750;
}

.pb-toast.pb-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1120px) {
  .pb-topbar {
    grid-template-columns: 1fr;
  }

  .pb-actions,
  .pb-summary {
    justify-content: flex-start;
  }

  .pb-actions {
    justify-self: stretch;
  }

  .pb-home-panel {
    width: min(320px, 100%);
  }

  .pb-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    background:
      radial-gradient(circle at top left, rgba(24, 165, 167, 0.12), transparent 22rem),
      linear-gradient(135deg, #f5fbff 0%, #fbfff7 52%, #fff9fb 100%);
  }

  .pb-shell {
    width: 100%;
    padding: 12px 10px 28px;
  }

  .pb-topbar {
    gap: 12px;
    margin-bottom: 12px;
  }

  .pb-title-block {
    min-width: 0;
  }

  .pb-title {
    font-size: clamp(1.7rem, 9vw, 2.35rem);
    line-height: 1;
  }

  .pb-subtitle {
    margin-top: 8px;
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .pb-actions,
  .pb-form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .pb-home-button {
    width: min(220px, 100%);
    justify-self: center;
  }

  .pb-home-panel {
    width: 100%;
  }

  .pb-live-counters {
    width: min(340px, 100%);
  }

  .pb-live-counter {
    padding: 8px 9px;
  }

  .pb-live-label {
    font-size: 0.8rem;
  }

  .pb-button {
    width: 100%;
    min-height: 44px;
    padding: 10px 9px;
    font-size: 0.9rem;
  }

  .pb-button.pb-home-button {
    width: min(220px, 100%);
    justify-self: center;
  }

  .pb-toolbar {
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px;
  }

  .pb-search {
    padding: 0 10px;
  }

  .pb-search span {
    font-size: 0.88rem;
  }

  .pb-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
    width: 100%;
  }

  .pb-summary span,
  .pb-readonly {
    min-width: 0;
    padding: 8px;
    text-align: center;
    font-size: 0.82rem;
  }

  .pb-status {
    font-size: 0.86rem;
  }

  .pb-board {
    grid-template-columns: repeat(8, minmax(238px, 86vw));
    gap: 10px;
    margin: 0 -10px;
    padding: 0 10px 14px;
    scroll-padding-inline: 10px;
    scroll-snap-type: x mandatory;
  }

  .pb-column {
    min-height: min(72vh, 600px);
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .pb-column-header {
    min-height: 52px;
    padding: 11px 12px;
  }

  .pb-column-header h2 {
    font-size: 0.96rem;
  }

  .pb-dropzone {
    min-height: calc(min(72vh, 600px) - 52px);
    padding: 8px;
    gap: 8px;
  }

  .pb-card {
    gap: 8px;
    padding: 10px;
  }

  .pb-card h3 {
    font-size: 0.98rem;
  }

  .pb-detail-line {
    display: grid;
    gap: 2px;
  }

  .pb-card-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pb-mini {
    width: 100%;
    padding: 7px 6px;
    font-size: 0.8rem;
  }

  .pb-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 20px);
  }

  .pb-dialog-inner {
    max-height: calc(100dvh - 20px);
    overflow: auto;
    padding: 14px;
  }

  .pb-form {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .pb-wide,
  .pb-form-actions {
    grid-column: auto;
  }

  .pb-form-actions {
    grid-template-columns: 1fr;
  }

  .pb-toast {
    bottom: 12px;
    max-width: calc(100vw - 20px);
  }
}

@media (max-width: 380px) {
  .pb-actions {
    grid-template-columns: 1fr;
  }

  .pb-board {
    grid-template-columns: repeat(8, minmax(226px, 88vw));
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .pb-actions,
  .pb-toolbar,
  .pb-card-actions,
  .pb-dialog,
  .pb-toast {
    display: none !important;
  }

  .pb-shell {
    width: 100%;
    padding: 0;
  }

  .pb-board {
    grid-template-columns: repeat(3, 1fr);
    overflow: visible;
  }

  .pb-column,
  .pb-card {
    box-shadow: none;
    break-inside: avoid;
  }

  .pb-column,
  .pb-dropzone {
    min-height: 0;
  }
}
