:root {
  --ink: #14130f;
  --coal: #1a1813;
  --night: #0e0e0b;
  --paper: #fffaf1;
  --porcelain: #f6efe3;
  --mist: #e8dece;
  --line: #d6c6ab;
  --gold: #c0a067;
  --gold-dark: #8a6632;
  --sage: #657268;
  --wine: #713f3a;
  --error: #a13d36;
  --success: #386a50;
  --radius: 8px;
  --shadow: 0 26px 70px rgba(9, 8, 5, 0.22);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(14, 14, 11, 0.98) 0%, rgba(23, 22, 18, 0.96) 42%, rgba(55, 47, 35, 0.94) 100%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 84px);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.intake-shell {
  min-height: 100vh;
}

.brand-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 14px clamp(16px, 3vw, 42px);
  color: var(--paper);
  background: rgba(14, 14, 11, 0.9);
  border-bottom: 1px solid rgba(192, 160, 103, 0.36);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: inline-grid;
  min-width: 0;
  gap: 3px;
  color: inherit;
  text-decoration: none;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand-lockup small {
  margin-top: 2px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.header-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 250, 241, 0.78);
  font-size: 13px;
}

.header-meta a {
  min-height: 36px;
  padding: 8px 12px;
  color: var(--paper);
  text-decoration: none;
  border: 1px solid rgba(192, 160, 103, 0.5);
  border-radius: 6px;
}

.intake-grid {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 34px);
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 40px);
}

.summary-panel {
  position: sticky;
  top: 104px;
  align-self: start;
  display: grid;
  gap: 16px;
  color: var(--paper);
}

.summary-top {
  padding: 18px 0 6px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.summary-top h1 {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0.035em;
}

.summary-top p {
  max-width: 31em;
  margin: 16px 0 0;
  color: rgba(255, 250, 241, 0.72);
  font-size: 15px;
  line-height: 1.8;
}

.summary-card,
.review-panel {
  border: 1px solid rgba(192, 160, 103, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px);
}

.summary-card {
  overflow: hidden;
}

.summary-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(192, 160, 103, 0.24);
}

.summary-card-head span {
  color: rgba(255, 250, 241, 0.72);
  font-size: 13px;
  font-weight: 800;
}

.summary-card-head strong {
  color: var(--gold);
  font-size: 12px;
  white-space: nowrap;
}

.summary-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.summary-list div {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 250, 241, 0.08);
}

.summary-list dt,
.summary-list dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.summary-list dt {
  color: rgba(255, 250, 241, 0.5);
  font-weight: 800;
}

.summary-list dd {
  color: var(--paper);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.summary-services {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 50px;
  padding: 14px 16px 16px;
}

.service-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  color: var(--paper);
  background: rgba(101, 114, 104, 0.42);
  border: 1px solid rgba(255, 250, 241, 0.16);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.review-panel {
  padding: 16px;
}

.review-panel ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: rgba(255, 250, 241, 0.76);
  font-size: 13px;
  line-height: 1.65;
}

.intake-form {
  display: grid;
  gap: 18px;
}

.form-section {
  padding: clamp(18px, 2.4vw, 30px);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 250, 241, 0.96));
  border: 1px solid rgba(214, 198, 171, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-document-title {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(192, 160, 103, 0.28);
}

.form-document-title h2 {
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
  font-size: clamp(24px, 2.15vw, 32px);
  font-weight: 800;
  line-height: 1.24;
  letter-spacing: 0.045em;
}

.form-document-title p {
  margin: 8px 0 0;
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.6;
  text-transform: uppercase;
}

.section-heading {
  display: flex;
  align-items: start;
  gap: 14px;
  margin-bottom: 18px;
}

.section-heading > span {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  color: var(--paper);
  background: var(--coal);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(21px, 2vw, 28px);
  line-height: 1.2;
  letter-spacing: 0;
}

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

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

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.field span,
.option-group legend {
  color: #5d564b;
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid #cfc0a8;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: calc(36px + 5%);
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.5 6.75L9 11.25L13.5 6.75' stroke='%2314130f' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5% center;
  background-size: 12.6px 12.6px;
}

textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  background-color: #ffffff;
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 3px rgba(192, 160, 103, 0.18);
}

input::placeholder,
textarea::placeholder {
  color: #9b9284;
}

.option-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
}

.option-group legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.option-group label {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--ink);
  background: #f5ecdf;
  border: 1px solid #d4c2a7;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
}

.option-group input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  opacity: 0;
}

.option-group label:has(input:checked) {
  color: var(--paper);
  background: linear-gradient(135deg, #1a1813, #3b3020);
  border-color: var(--gold);
}

.returning-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
  padding: 14px;
  background: #f2e6d4;
  border: 1px solid #d4c2a7;
  border-radius: var(--radius);
}

.returning-panel strong,
.returning-panel span {
  display: block;
}

.returning-panel strong {
  font-size: 15px;
}

.returning-panel span {
  margin-top: 4px;
  color: #655b4d;
  font-size: 13px;
  line-height: 1.5;
}

.secondary-action.light {
  color: var(--ink);
  background: #fffaf1;
  border-color: #c8b798;
}

.lookup-status {
  min-height: 21px;
  margin: 8px 0 0;
  color: var(--success);
  font-size: 13px;
  font-weight: 800;
}

.lookup-status.error {
  color: var(--error);
}

.autosave-status {
  min-height: 20px;
  margin: 4px 0 0;
  color: #6f6251;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.autosave-status.error {
  color: var(--error);
}

.submit-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 4px;
  padding: 16px;
  color: var(--paper);
  background: linear-gradient(135deg, var(--coal), #31291c);
  border: 1px solid rgba(192, 160, 103, 0.46);
  border-radius: var(--radius);
}

.submit-band strong,
.submit-band span {
  display: block;
}

.submit-band strong {
  font-size: 16px;
}

.submit-band span {
  margin-top: 4px;
  color: rgba(255, 250, 241, 0.7);
  font-size: 13px;
}

.submit-button,
.primary-action,
.secondary-action {
  min-height: 44px;
  border-radius: 6px;
  font-weight: 900;
  white-space: nowrap;
}

.submit-button,
.primary-action {
  padding: 0 18px;
  color: #17130d;
  background: linear-gradient(135deg, #d6bd82, #9d7439);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-action {
  padding: 0 14px;
  color: var(--paper);
  background: #26221a;
  border: 1px solid rgba(255, 250, 241, 0.18);
}

.success-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 9, 7, 0.66);
  backdrop-filter: blur(12px);
}

.success-modal[hidden] {
  display: none;
}

.success-dialog {
  width: min(440px, 100%);
  padding: 28px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.success-dialog h2 {
  margin: 0;
  font-size: 28px;
}

.success-dialog p:not(.eyebrow) {
  margin: 12px 0 0;
  color: #5d564b;
  line-height: 1.7;
}

.edit-link-box {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  padding: 12px;
  background: #f2e6d4;
  border: 1px solid #d4c2a7;
  border-radius: var(--radius);
}

.edit-link-box[hidden] {
  display: none;
}

.edit-link-box span {
  color: #5d564b;
  font-size: 12px;
  font-weight: 900;
}

.edit-link-box input {
  min-height: 38px;
  font-size: 13px;
}

.success-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 1180px) {
  .intake-grid {
    grid-template-columns: 1fr;
  }

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

  .summary-top {
    grid-column: 1 / -1;
  }

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

@media (max-width: 760px) {
  .brand-header {
    min-height: 68px;
    padding: 12px 14px;
  }

  .brand-lockup strong {
    font-size: 16px;
  }

  .header-meta span {
    display: none;
  }

  .brand-lockup small {
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  .header-meta a {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .intake-grid {
    gap: 14px;
    padding: 16px 12px 28px;
  }

  .summary-panel {
    gap: 12px;
    grid-template-columns: 1fr;
  }

  .summary-top {
    padding: 8px 2px 0;
  }

  .summary-top h1 {
    font-size: 32px;
    letter-spacing: 0.025em;
  }

  .summary-top p {
    max-width: 20em;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.65;
  }

  .summary-card {
    display: none;
  }

  .review-panel {
    display: none;
  }

  .form-section {
    padding: 17px 14px;
    scroll-margin-top: 76px;
  }

  .form-document-title {
    margin-bottom: 16px;
    padding-bottom: 15px;
  }

  .form-document-title h2 {
    font-size: 23px;
    line-height: 1.35;
    letter-spacing: 0.035em;
  }

  .form-document-title p {
    font-size: 9px;
    letter-spacing: 0.11em;
  }

  .section-heading {
    gap: 10px;
    margin-bottom: 16px;
  }

  .section-heading > span {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .field-grid.two,
  .field-grid.three,
  .field-grid.four,
  .option-group {
    grid-template-columns: 1fr;
  }

  .field {
    gap: 8px;
    margin-bottom: 13px;
  }

  .field span,
  .option-group legend {
    font-size: 13px;
    line-height: 1.45;
  }

  input,
  select,
  textarea,
  .submit-button,
  .primary-action,
  .secondary-action {
    min-height: 48px;
    font-size: 16px;
  }

  textarea {
    min-height: 126px;
  }

  .option-group {
    gap: 8px;
  }

  .option-group label {
    min-height: 50px;
    padding: 11px 12px;
  }

  .submit-band {
    align-items: stretch;
    flex-direction: column;
    padding: 15px;
  }

  .returning-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 13px;
  }

  .returning-panel .secondary-action {
    width: 100%;
  }

  .submit-button {
    width: 100%;
  }

  .summary-list div {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .success-dialog {
    padding: 22px;
    max-height: calc(100dvh - 24px);
    overflow: auto;
  }

  .success-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .brand-header {
    gap: 10px;
  }

  .brand-lockup strong {
    font-size: 15px;
  }

  .header-meta a {
    min-width: 76px;
    padding: 7px 8px;
    text-align: center;
  }

  .summary-top h1 {
    font-size: 29px;
  }

  .section-heading h2 {
    font-size: 20px;
  }
}
