@font-face {
  font-family: "Noto Sans Thai Local";
  src: url("./fonts/NotoSansThai-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg-page: #eef2f6;
  --card-bg: #ffffff;
  --text-main: #152033;
  --text-sub: #4c5d76;
  --accent: #3a86c4;
  --accent-soft: #efeefe;
  --focus: #5a4db2;
  --border: #d8dee9;
  --border-strong: #bcc7d8;
  --error: #c93b3b;
  --warn: #b86c00;
  --shadow: 0 20px 50px rgba(17, 36, 69, 0.12);
  --radius-card: 18px;
  --radius-control: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: "Noto Sans Thai Local", "Leelawadee UI", "Tahoma", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 8% 8%, rgba(44, 143, 190, 0.22) 0, rgba(44, 143, 190, 0) 28%),
    radial-gradient(circle at 85% 0%, rgba(120, 96, 195, 0.14) 0, rgba(120, 96, 195, 0) 24%),
    var(--bg-page);
}

.login-page {
  background:
    radial-gradient(circle at 15% 15%, rgba(44, 143, 190, 0.22) 0, rgba(44, 143, 190, 0) 35%),
    radial-gradient(circle at 80% 8%, rgba(121, 94, 204, 0.2) 0, rgba(121, 94, 204, 0) 26%),
    radial-gradient(circle at 90% 5%, rgba(7, 96, 139, 0.18) 0, rgba(7, 96, 139, 0) 28%),
    linear-gradient(160deg, #f5f9fc, #e7eef6 40%, #f7fbfe);
}

.login-shell {
  min-height: 100vh;
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 1.5rem 0;
}

.login-card {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(17, 36, 69, 0.14);
  padding: 2rem 1.55rem 1.65rem;
  text-align: center;
}

.login-logo-wrap {
  margin: 0 auto 1.25rem;
  width: fit-content;
  border-radius: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.login-logo-wrap img {
  display: block;
  height: auto;
  max-width: min(230px, 100%);
  filter: none;
}

.login-card h1 {
  font-size: clamp(1.35rem, 3.8vw, 1.9rem);
  margin-bottom: 0.5rem;
}

.login-subtitle {
  margin: 0;
  color: var(--text-sub);
}

.login-form {
  margin-top: 1.2rem;
  display: grid;
  gap: 0.85rem;
}

.login-field {
  text-align: left;
}

.login-btn {
  width: 100%;
}

.page {
  width: min(920px, calc(100% - 2rem));
  margin: 2rem auto 3rem;
}

.quote-card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-strip {
  height: 116px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.18) 0, rgba(255, 255, 255, 0) 40%),
    linear-gradient(130deg, rgba(14, 98, 148, 0.9), rgba(104, 91, 195, 0.82));
  position: relative;
}

.hero-strip::before,
.hero-strip::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(1px);
}

.hero-strip::before {
  width: 280px;
  height: 280px;
  right: -100px;
  top: -165px;
  background: rgba(255, 255, 255, 0.1);
}

.hero-strip::after {
  width: 220px;
  height: 220px;
  left: -80px;
  top: -120px;
  background: rgba(255, 255, 255, 0.08);
}

.card-header {
  text-align: center;
  padding: 1.5rem 1.5rem 0.5rem;
}

.step-pill {
  margin: 0 auto 0.75rem;
  width: fit-content;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(110, 90, 198, 0.35);
  border-radius: 999px;
  padding: 0.33rem 0.78rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4.2vw, 2.5rem);
  line-height: 1.2;
}

.subtitle {
  margin: 0.55rem 0 0;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  color: var(--text-sub);
}

.top-alert {
  margin: 1rem 1.5rem 0;
  padding: 0.6rem 0.9rem;
  border-radius: 11px;
  font-size: 0.94rem;
  color: #6a1f1f;
  background: #ffecec;
  border: 1px solid #f3c3c3;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  padding: 1.2rem 1.5rem 1.5rem;
}

.form-panel {
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fff;
  padding: 1.1rem;
}

.field-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.field-group + .field-group,
.rider-details,
.button-row {
  margin-top: 1rem;
}

.field-label {
  display: inline-block;
  margin-bottom: 0.42rem;
  font-weight: 700;
  color: #2d3a4f;
}

.field-label.small {
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

.input-wrap {
  position: relative;
}

.input-control {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  padding: 0.82rem 0.95rem;
  font: inherit;
  color: var(--text-main);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.input-control::placeholder {
  color: #8b98ad;
}

.input-control:hover {
  border-color: #9fb0c8;
}

.input-control:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(110, 90, 198, 0.18);
}


.gender-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.gender-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 82px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.gender-shell:hover {
  border-color: #8ca1bd;
  transform: translateY(-1px);
}

.gender-input:focus-visible + .gender-shell {
  outline: none;
  box-shadow: 0 0 0 4px rgba(110, 90, 198, 0.18);
  border-color: var(--focus);
}

.gender-input:checked + .gender-shell {
  border-color: var(--accent);
  background: linear-gradient(180deg, #f7f3ff, #eff3ff);
  box-shadow: inset 0 0 0 1px rgba(110, 90, 198, 0.18);
}

.gender-icon {
  width: 2rem;
  height: 2rem;
  color: #9b6ce3;
}

.gender-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.gender-icon .stroke-fill {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gender-text {
  font-size: 1.85rem;
  font-weight: 700;
  color: #31415a;
  letter-spacing: 0.01em;
}

.rider-details {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.rider-details summary {
  cursor: pointer;
  list-style: none;
  padding: 0.8rem 0.95rem;
  font-weight: 700;
  color: #2a3a52;
  background: #f7fafc;
  border-bottom: 1px solid var(--border);
}

.rider-details summary::-webkit-details-marker {
  display: none;
}

.rider-details summary::after {
  content: "▾";
  float: right;
  color: #5f718c;
  transition: transform 0.2s ease;
}

.rider-details[open] summary::after {
  transform: rotate(180deg);
}

.rider-group {
  padding: 0.9rem;
  display: grid;
  gap: 1rem;
}

.rider-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}

.rider-item-simple {
  grid-template-columns: 1fr;
}

.switch-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 125px;
  cursor: pointer;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.switch-slider {
  position: relative;
  width: 44px;
  height: 25px;
  border-radius: 999px;
  border: 1px solid #a9b4c4;
  background: #d8e1ee;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.switch-slider::after {
  content: "";
  position: absolute;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(11, 31, 61, 0.25);
  left: 2px;
  top: 2px;
  transition: transform 0.2s ease;
}

.switch-input:focus-visible + .switch-slider {
  box-shadow: 0 0 0 4px rgba(110, 90, 198, 0.2);
  border-color: var(--focus);
}

.switch-input:checked + .switch-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.switch-input:checked + .switch-slider::after {
  transform: translateX(18px);
}

.switch-text {
  font-weight: 700;
  color: #36455f;
}

.rider-input-block {
  min-width: 0;
}

.rider-input:disabled {
  background: #f4f7fb;
  color: #95a3b8;
  cursor: not-allowed;
}

.button-row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(110, 90, 198, 0.22);
}

.btn-primary {
  background: linear-gradient(180deg, #3a8fc8, #4f66bc);
  color: #fff;
  box-shadow: 0 8px 18px rgba(67, 96, 181, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #4297d1, #495cb0);
}

.btn-primary:disabled {
  cursor: not-allowed;
  background: #a5b8cb;
  box-shadow: none;
}

.btn-secondary {
  background: #fff;
  color: #37506f;
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: #f7fbff;
}

.field-msg {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
}

.field-msg.error {
  color: var(--error);
}

.field-msg.warn {
  color: var(--warn);
}

.field-msg.helper {
  color: #49637f;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.input-control.invalid,
.gender-grid.invalid .gender-shell {
  border-color: var(--error);
  background: #fff7f7;
}

.sum-slider-wrap {
  margin-top: 0.66rem;
}

.sum-range {
  width: 100%;
  height: 30px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}

.sum-range:focus-visible {
  outline: none;
}

.sum-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #d9e3f0, #ccdaec);
}

.sum-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: linear-gradient(180deg, #429fd0, #5b58be);
  box-shadow: 0 3px 10px rgba(52, 76, 152, 0.35);
}

.sum-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(110, 90, 198, 0.2), 0 3px 10px rgba(52, 76, 152, 0.35);
}

.sum-range::-moz-range-track {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #d9e3f0, #ccdaec);
}

.sum-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: linear-gradient(180deg, #429fd0, #5b58be);
  box-shadow: 0 3px 10px rgba(52, 76, 152, 0.35);
}

.sum-range-meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: #60718b;
}

.range-bound:last-child {
  text-align: right;
}

.range-current {
  font-weight: 700;
  color: #4f4f9e;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #d2d2ec;
  background: #f7f4ff;
}

.preview-page {
  background:
    radial-gradient(circle at 8% 10%, rgba(44, 143, 190, 0.14) 0, rgba(44, 143, 190, 0) 30%),
    radial-gradient(circle at 88% 7%, rgba(121, 94, 204, 0.14) 0, rgba(121, 94, 204, 0) 26%),
    #f3f6fa;
}

.preview-shell {
  width: min(980px, calc(100% - 2rem));
  margin: 1.5rem auto 2rem;
}

.preview-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(17, 36, 69, 0.1);
  padding: 1.2rem;
}

.preview-header h1 {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
}

.preview-generated {
  margin: 0.35rem 0 0;
  color: #5f6f86;
  font-size: 0.9rem;
}

.preview-empty {
  border: 1px dashed #c5d1df;
  border-radius: 14px;
  padding: 1.2rem;
  text-align: center;
  background: #f9fbfd;
}

.preview-empty p {
  margin: 0 0 0.8rem;
}

.preview-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.preview-actions .btn {
  text-decoration: none;
}

.customer-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 1rem;
}

.customer-table th,
.customer-table td {
  border: 1px solid var(--border);
  padding: 0.62rem 0.7rem;
  vertical-align: top;
}

.summary-table th {
  width: 38%;
  background: #f4f8fc;
  text-align: left;
  font-weight: 700;
}

.summary-table td {
  text-align: right;
}

.detail-table .row-header th {
  background: #ebf4fb;
  font-weight: 700;
  text-align: center;
  color: #2b405f;
}

.detail-table .row-section td {
  background: #f0f4f8;
  font-weight: 700;
}

.detail-table .row-section-sub td {
  background: #f8fafc;
  font-weight: 700;
  color: #4b5d77;
}

.detail-table .row-strong td {
  font-weight: 700;
}

.detail-table .row-sub td:first-child {
  padding-left: 1.4rem;
}

.detail-table td.money {
  text-align: right;
  white-space: nowrap;
}

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

  .preview-shell {
    width: min(100%, calc(100% - 1rem));
  }
}

@media (max-width: 680px) {
  .login-card {
    padding: 1.4rem 1rem 1.2rem;
    border-radius: 16px;
  }

  .login-btn {
    width: 100%;
    min-width: 0;
  }

  .page {
    width: min(100%, calc(100% - 1rem));
    margin-top: 1rem;
  }

  .card-header {
    padding-top: 1rem;
  }

  h1 {
    font-size: clamp(1.35rem, 6vw, 1.8rem);
  }

  .subtitle {
    font-size: 1rem;
  }

  .content-grid {
    padding: 0.95rem;
    gap: 0.95rem;
  }

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

  .gender-shell {
    min-height: 72px;
  }

  .gender-text {
    font-size: 1.55rem;
  }

  .rider-item {
    grid-template-columns: 1fr;
  }

  .button-row .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .preview-card {
    padding: 0.85rem;
    border-radius: 14px;
  }

  .preview-actions .btn {
    flex: 1 1 100%;
    text-align: center;
  }
}

@media print {
  @page {
    margin: 10mm;
    size: A4;
  }

  body {
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .preview-shell {
    width: 100%;
    margin: 0;
  }

  .preview-card {
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .customer-table {
    page-break-inside: avoid;
  }
}
