/* ==========================================================================
   ARDesign Editorial Spatial Management — Contract Generator (/contract/style.css)
   Palette: Warm Cream (#FEFCF7) × Warm Sand (#F7F3EA) × Charcoal Ink (#4C4C4C)
            × Signature Orange (#EA5504) × Hairline (#E5E0D8)
   ========================================================================== */
:root {
  --bg-canvas: #FEFCF7;
  --bg-surface: #FFFFFF;
  --bg-Warm: #F7F3EA;
  --bg-soft: #F6F2E9;
  --text-ink: #4C4C4C;
  --text-strong: #262625;
  --text-muted: #888888;
  --accent-orange: #EA5504;
  --accent-orange-hover: #D14800;
  --accent-orange-soft: #FDF3EB;
  --stage-closed: #217A50;
  --line-hair: #E5E0D8;
  --line-strong: #D5CFC4;
  font-family: "Plus Jakarta Sans", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--text-ink);
  background: var(--bg-canvas);
  font-size: 14px;
  letter-spacing: 0.015em;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--text-ink);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-orange);
  color: #FFFFFF;
}

@media (pointer: fine) and (hover: hover) {
  body {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Ccircle cx='14' cy='14' r='11' fill='none' stroke='%23EA5504' stroke-width='1.4' stroke-opacity='0.85'/%3E%3Ccircle cx='14' cy='14' r='3' fill='%23EA5504'/%3E%3C/svg%3E") 14 14, auto;
  }
  a, button, label.quote-drop, input[type="checkbox"], select {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Ccircle cx='18' cy='18' r='15' fill='%23EA5504' fill-opacity='0.15' stroke='%23EA5504' stroke-width='1.6'/%3E%3Ccircle cx='18' cy='18' r='4' fill='%23EA5504'/%3E%3C/svg%3E") 18 18, pointer;
  }
}

button, input, select {
  font: inherit;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-orange); }

/* Editorial Top Header */
header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 64px;
  background: rgba(254, 252, 247, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-hair);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 40px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  font-weight: 800;
  background: var(--bg-Warm);
  color: var(--text-strong);
  border: 1px solid var(--line-hair);
  border-top: 2.5px solid var(--accent-orange);
  padding: 8px 11px;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.brand-copy {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-strong);
}

.brand-copy strong span {
  font-family: ui-monospace, "IBM Plex Mono", monospace;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.brand b {
  padding-left: 12px;
  border-left: 1px solid var(--line-hair);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-ink);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.online {
  font-family: ui-monospace, "IBM Plex Mono", monospace;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.online i,
.status-dot {
  display: inline-block;
  background: var(--accent-orange);
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line-hair);
  background: var(--bg-Warm);
  color: var(--accent-orange);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.22s ease;
}

.back-link:hover {
  border-color: var(--accent-orange);
  background: var(--accent-orange);
  color: #FFFFFF;
}

/* Main Container & Heading */
main {
  max-width: 1440px;
  margin: auto;
  padding: 24px 40px 48px;
}

.heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-hair);
}

.eyebrow {
  font-family: ui-monospace, "IBM Plex Mono", monospace;
  color: var(--accent-orange);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0 0 6px;
}

h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

h1 span {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Buttons (LAS Entry 5px Orange Button & Pill Secondary) */
button {
  border: 1px solid var(--accent-orange);
  background: var(--accent-orange);
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: 5px;
  font-weight: 700;
  white-space: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

button:hover:not(:disabled) {
  background: var(--accent-orange-hover);
  border-color: var(--accent-orange-hover);
  transform: translateY(-1px);
}

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

button.quiet {
  background: var(--bg-surface);
  color: var(--text-ink);
  border-color: var(--line-hair);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12.5px;
}

button.quiet:hover:not(:disabled) {
  background: var(--accent-orange-soft);
  border-color: var(--accent-orange);
  color: var(--accent-orange);
}

button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Step Progress Strip */
.steps {
  padding: 0;
  list-style: none;
  display: flex;
  margin: 0 0 22px;
  border-bottom: 1px solid var(--line-hair);
  gap: 36px;
}

.steps li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 0 13px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 2.5px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.steps li.active {
  color: var(--accent-orange);
  font-weight: 800;
  border-bottom-color: var(--accent-orange);
}

.steps li span {
  font-family: ui-monospace, "IBM Plex Mono", monospace;
  border: 1px solid currentColor;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.steps li.active span {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  color: #FFFFFF;
}

/* Split Editorial Workspace */
.workspace {
  display: grid;
  grid-template-columns: 410px minmax(0, 1fr);
  background: var(--bg-surface);
  border: 1px solid var(--line-hair);
  border-top: 3px solid var(--accent-orange);
}

.input-section {
  padding: 22px 24px;
  background: var(--bg-Warm);
  border-right: 1px solid var(--line-hair);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.review-section {
  padding: 24px 28px;
  background: var(--bg-surface);
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-hair);
}

h2 {
  font-size: 14.5px;
  margin: 0;
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: 0.02em;
}

.muted {
  font-size: 12px;
  color: var(--text-muted);
}

.tag {
  font-family: ui-monospace, "IBM Plex Mono", monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-orange);
  background: var(--bg-surface);
  border: 1px solid rgba(234, 85, 4, 0.3);
  border-radius: 999px;
  padding: 2px 9px;
}

/* Form Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-ink);
  margin-bottom: 13px;
}

.field input {
  width: 100%;
  height: 38px;
  background: var(--bg-surface);
  border: 1px solid var(--line-hair);
  border-radius: 4px;
  padding: 7px 10px;
  color: var(--text-strong);
  font-weight: 500;
  transition: border-color 0.2s ease;
}

.field input:focus {
  outline: 2px solid rgba(234, 85, 4, 0.2);
  border-color: var(--accent-orange);
}

input:disabled {
  background: var(--bg-soft);
  color: var(--text-muted);
}

.form-heading {
  margin-top: 24px;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.payment-input {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
}

.template-info {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line-hair);
  margin-top: 8px;
  font-size: 12px;
}

.template-info .status-dot {
  margin-top: 5px;
}

.template-info strong {
  font-weight: 700;
  color: var(--text-strong);
}

.template-info small {
  display: block;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Review Panel & Summary Table */
.empty-state {
  min-height: 380px;
  border: 1px dashed var(--line-strong);
  background: var(--bg-canvas);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 8px;
}

.empty-state svg {
  width: 38px;
  height: 38px;
  color: var(--accent-orange);
  margin-bottom: 4px;
}

.empty-state strong {
  font-weight: 800;
  color: var(--text-strong);
}

.empty-state span {
  font-size: 12px;
}

.summary {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line-hair);
  border-bottom: 0;
}

.summary div {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line-hair);
  border-right: 1px solid var(--line-hair);
  background: var(--bg-canvas);
}

.summary div:nth-child(2n) {
  border-right: 0;
}

.summary dt {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.summary dd {
  margin: 0;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  background: var(--accent-orange-soft);
  border: 1px solid rgba(234, 85, 4, 0.28);
  border-left: 4px solid var(--accent-orange);
  padding: 16px 20px;
  margin: 20px 0;
}

.total span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-ink);
}

.total strong {
  font-family: ui-monospace, "IBM Plex Mono", monospace;
  font-size: 28px;
  color: var(--accent-orange);
  font-weight: 800;
}

.table-heading {
  margin-top: 22px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-hair);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 12.5px;
}

th {
  background: var(--bg-Warm);
  padding: 11px 10px;
  text-align: right;
  font-weight: 700;
  color: var(--text-ink);
  border-bottom: 1px solid var(--line-hair);
  white-space: nowrap;
}

th:first-child,
th:last-child {
  text-align: left;
}

td {
  padding: 13px 10px;
  text-align: right;
  border-bottom: 1px solid var(--line-hair);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: 0;
}

td:first-child,
td:last-child {
  text-align: left;
}

td:last-child {
  min-width: 250px;
  line-height: 1.55;
}

.party-b {
  margin-top: 20px;
  border: 1px solid var(--line-hair);
  border-left: 3px solid var(--line-strong);
  background: var(--bg-Warm);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 4px 12px;
}

.party-b span {
  grid-row: 1 / 3;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.party-b strong {
  font-weight: 800;
  color: var(--text-strong);
}

.party-b small {
  color: var(--text-muted);
  line-height: 1.5;
}

.warnings {
  background: #FFF8EC;
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-left: 3.5px solid #D97706;
  padding: 14px 18px;
  margin-top: 20px;
  font-size: 12px;
  color: #78350F;
}

.warnings h3 {
  font-size: 13px;
  margin: 0 0 8px;
}

.warnings ul {
  padding-left: 18px;
  line-height: 1.75;
}

.warnings label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.6;
  font-weight: 700;
}

.output-heading {
  margin-top: 24px;
}

.checks {
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  font-size: 12px;
}

.checks li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line-hair);
  padding: 0 0 10px;
}

.checks span {
  font-family: ui-monospace, "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.checks.passed span {
  color: var(--stage-closed);
  font-weight: 700;
}

.actions {
  margin-top: 24px;
  border-top: 1px solid var(--line-hair);
  padding-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.actions #progress {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: auto;
}

.actions button {
  min-height: 40px;
}

footer {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-family: ui-monospace, "IBM Plex Mono", "Noto Sans TC", monospace;
  font-size: 11px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line-hair);
}

#error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-left: 3.5px solid #DC2626;
  padding: 13px 16px;
  margin-bottom: 18px;
  line-height: 1.65;
  font-weight: 600;
}

input[type=checkbox] {
  accent-color: var(--accent-orange);
}

[hidden] {
  display: none !important;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-orange);
  outline-offset: 2px;
}

@media (max-width: 1050px) {
  main { padding: 20px; }
  .workspace { grid-template-columns: 350px minmax(0, 1fr); }
  .review-section { padding: 20px 18px; }
  .checks { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  header { padding: 10px 16px; min-height: 56px; }
  .brand b { display: none; }
  .online { display: none; }
  main { padding: 18px 12px; }
  .heading { gap: 12px; align-items: center; }
  h1 { font-size: 21px; }
  .heading button { padding: 7px 11px; font-size: 12px; }
  .steps { gap: 0; justify-content: space-between; font-size: 12px; }
  .steps li { gap: 6px; }
  .workspace { display: block; }
  .input-section { border-right: 0; border-bottom: 1px solid var(--line-hair); max-height: none; padding: 18px; }
  .review-section { padding: 20px 14px; }
  .summary { grid-template-columns: 1fr; }
  .summary div { border-right: 0; }
  .actions { flex-wrap: wrap; }
  .actions #progress { width: 100%; }
  .actions button { flex: 1; }
  .total strong { font-size: 22px; }
  .party-b { grid-template-columns: 1fr; }
  .party-b span { grid-row: auto; }
  footer { gap: 10px; line-height: 1.5; flex-wrap: wrap; }
}
