/* Locksmith Rekey Matrix Design System */
:root {
  color-scheme: light;
  --page: #f7f4ee;
  --surface: #ffffff;
  --text: #17201b;
  --muted: #536259;
  --rule: #d8d0c2;
  --navy: #132738;
  --primary: #b8471b;
  --primary-hover: #9b3912;
  --sage: #4f7356;
  --sage-soft: #e5ede4;
  --error: #b42318;
  --error-soft: #fef3f2;
  --shadow: 0 16px 36px rgba(19, 39, 56, 0.08);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--text);
  line-height: 1.5;
}

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

button:active, .btn:active, .primary-action:active, .secondary-action:active, [data-action]:active, .preset-chip:active {
  transform: translateY(1px) scale(0.98);
}

.tabular-nums, table, th, td, .numeric-cells input, .deliverable-wo, .estimate-total {
  font-variant-numeric: tabular-nums;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 20px;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}

.wordmark-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1.5px solid var(--navy);
  border-radius: 6px;
  background: var(--surface);
  color: var(--navy);
  font-size: 0.85rem;
  font-weight: 900;
}

.job-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sage);
}

.header-handoff-link {
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: underline;
}

.intro {
  margin-bottom: 24px;
}

.privacy-note {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin: 0 0 6px;
}

h1#page-title {
  font-size: clamp(1.85rem, 3.5vw, 2.75rem);
  line-height: 1.18;
  color: var(--navy);
  margin: 0 0 12px;
  font-weight: 900;
  letter-spacing: -0.025em;
  max-width: 780px;
}

.headline-phrase {
  color: var(--primary);
}

.intro-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 680px;
}

/* Preset Strip */
.preset-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.preset-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
}

.preset-chip {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--navy);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: normal;
  text-wrap: wrap;
}

.preset-chip:hover {
  background: #f1ede4;
  border-color: var(--navy);
}

.validation-summary {
  padding: 12px 16px;
  background: var(--error-soft);
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 16px;
}

/* Workspace Layout */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}

.entry-ledger {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ledger-section {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}

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

.section-kicker {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin: 0 0 4px;
}

.section-heading h2 {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
  letter-spacing: -0.015em;
}

.progress-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1ede4;
  color: var(--muted);
  white-space: nowrap;
}

.progress-pill.complete {
  background: var(--sage-soft);
  color: var(--sage);
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

@media (max-width: 540px) {
  .field-grid.two-column {
    grid-template-columns: minmax(0, 1fr);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full-width {
  grid-column: 1 / -1;
}

.field span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
}

.field input, .field select, .field textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--rule);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  min-height: 42px;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184, 71, 27, 0.15);
}

.field.has-error input, .field.has-error select {
  border-color: var(--error);
  background: var(--error-soft);
}

.field-error {
  margin: 2px 0 0;
  color: var(--error);
  font-size: 0.78rem;
  font-weight: 700;
}

/* Numbered Cell Grids */
.numbered-grid {
  margin: 16px 0;
  background: #faf8f5;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 14px;
}

.grid-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 10px;
}

.grid-hint {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--muted);
}

.numeric-cells {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.numeric-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 44px;
}

.numeric-cell label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
}

.numeric-cell input {
  width: 46px;
  height: 44px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  border: 1.5px solid var(--rule);
  border-radius: 6px;
  padding: 0;
}

.numeric-cell input:focus {
  border-color: var(--primary);
  outline: none;
}

.macs-status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  background: #f1ede4;
}

.macs-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.macs-pass {
  background: var(--sage);
  color: #ffffff;
}

.macs-fail {
  background: var(--error);
  color: #ffffff;
}

.macs-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--navy);
}

/* Actions */
.primary-action {
  width: 100%;
  min-height: 48px;
  padding: 12px 24px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 1.02rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(184, 71, 27, 0.25);
  transition: background 0.15s ease;
}

.primary-action:hover {
  background: var(--primary-hover);
}

.disabled-note {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin: 6px 0 0;
}

.clear-local-action {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
  align-self: center;
}

/* Summary Panel */
.summary-panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 20px;
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.readiness-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f1ede4;
  color: var(--navy);
  text-transform: uppercase;
}

.summary-panel h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0 0 16px;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 20px;
  padding: 0;
}

.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #f1ede4;
  padding-bottom: 6px;
}

.summary-list dt {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.summary-list dd {
  font-size: 0.85rem;
  color: var(--navy);
  font-weight: 800;
  margin: 0;
  text-align: right;
}

.summary-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.check-row span {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--rule);
}

.check-row.complete {
  color: var(--sage);
}

.check-row.complete span {
  background: var(--sage);
  border-color: var(--sage);
}

/* Executive Deliverable */
.deliverable-sheet {
  margin-top: 36px;
  background: #ffffff;
  border: 2px solid var(--navy);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 24px 48px rgba(19, 39, 56, 0.12);
}

.deliverable-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 2px solid var(--navy);
  padding-bottom: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.logo-preview-box {
  min-height: 48px;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.logo-placeholder {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.logo-upload-wrapper {
  font-size: 0.78rem;
}

.logo-upload-label {
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
}

.logo-upload-wrapper input[type="file"] {
  display: none;
}

.deliverable-meta-block {
  text-align: right;
}

.deliverable-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--navy);
  color: #ffffff;
  margin-bottom: 4px;
}

.deliverable-wo {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--navy);
  margin: 2px 0;
}

.deliverable-timestamp {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.deliverable-intro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  background: #faf8f5;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}

@media (max-width: 680px) {
  .deliverable-intro-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.deliverable-intro-grid div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.deliverable-intro-grid strong {
  font-size: 0.95rem;
  color: var(--navy);
}

.deliverable-section {
  margin-bottom: 24px;
}

.deliverable-section-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
  margin: 0 0 12px;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
}

.pinning-table, .estimate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.pinning-table th, .estimate-table th {
  background: #f1ede4;
  color: var(--navy);
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
  border: 1px solid var(--rule);
}

.pinning-table td, .estimate-table td {
  padding: 9px 12px;
  border: 1px solid var(--rule);
  color: var(--text);
  font-weight: 600;
}

.pinning-table tbody tr:nth-child(even), .estimate-table tbody tr:nth-child(even) {
  background: #fbf9f6;
}

.deliverable-disclosure {
  font-size: 0.86rem;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 16px;
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  margin-top: 24px;
}

@media (max-width: 540px) {
  .signature-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.signature-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sig-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--navy);
}

.sig-line {
  border-bottom: 1.5px solid var(--navy);
  height: 36px;
}

.sig-meta {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0;
  font-weight: 600;
}

.deliverable-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.deliverable-btn {
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  background: var(--navy);
  color: #ffffff;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.deliverable-btn.secondary {
  background: var(--surface);
  color: var(--navy);
  border: 1.5px solid var(--navy);
}

/* Pro Upgrade Card */
.pro-upgrade-card {
  margin: 32px auto;
  max-width: 600px;
  padding: 24px;
  border-radius: 12px;
  background: #ffffff;
  border: 1.5px solid var(--rule);
  text-align: center;
  box-shadow: var(--shadow);
}

.pro-upgrade-card h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0 0 8px;
}

.pro-upgrade-card p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 16px;
}

.btn-primary {
  display: inline-block;
  padding: 12px 24px;
  font-weight: 800;
  text-decoration: none;
  border-radius: 8px;
  background: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(184, 71, 27, 0.25);
  cursor: pointer;
}

/* Print Rules */
@page {
  margin: 10mm;
  size: auto;
}

@media print {
  body, main, .page-shell, #executive-deliverable {
    display: block !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .site-header,
  .intro,
  .workspace,
  .pro-upgrade-card,
  .deliverable-toolbar,
  .logo-upload-wrapper,
  .header-handoff-link {
    display: none !important;
  }

  #executive-deliverable {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  .deliverable-section,
  .table-responsive,
  .pinning-table,
  .estimate-table,
  .signature-grid,
  .signature-block,
  tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}
