:root {
  --blue-700: #0c65c7;
  --blue-600: #1185e7;
  --blue-100: #e8f4ff;
  --ink-900: #162033;
  --ink-700: #34415a;
  --ink-500: #667088;
  --line: #d8e1ee;
  --paper: #ffffff;
  --soft: #f5f8fc;
  --green-100: #eaf7e2;
  --green-600: #28a247;
  --orange-500: #ff8a3d;
  --orange-100: #fff2e7;
  --shadow: 0 18px 45px rgba(21, 55, 91, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  color: var(--ink-900);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 138, 61, 0.15), transparent 26rem),
    linear-gradient(145deg, #eaf6ff 0%, #f7fbff 44%, #edf6fb 100%);
}

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

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1540px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  color: #fff;
  background:
    linear-gradient(110deg, rgba(12, 101, 199, 0.98), rgba(16, 157, 232, 0.94)),
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 72%);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: var(--blue-600);
  font-size: 33px;
  font-weight: 800;
  line-height: 1;
  background: #fff;
  border-radius: 8px;
  box-shadow: inset 0 -4px 0 rgba(17, 133, 231, 0.11);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand p {
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
}

.toolbar {
  display: flex;
  gap: 12px;
}

.primary-button,
.ghost-button {
  min-width: 104px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 7px;
  font-weight: 700;
}

.primary-button {
  color: var(--blue-700);
  background: #fff;
}

.ghost-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
}

.quote-meta {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 14px;
  margin: 18px 0;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(21, 55, 91, 0.08);
}

.quick-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
  padding: 14px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(21, 55, 91, 0.08);
}

.quick-presets span {
  color: var(--ink-500);
  font-size: 13px;
  font-weight: 800;
}

.preset-button {
  height: 36px;
  padding: 0 14px;
  color: var(--blue-700);
  font-weight: 800;
  background: var(--blue-100);
  border: 1px solid #b9d9fb;
  border-radius: 7px;
}

.quote-meta label,
.compact-field,
.toggle-field {
  display: grid;
  gap: 7px;
  color: var(--ink-500);
  font-size: 13px;
  font-weight: 700;
}

.quote-meta input,
.compact-field input,
.quantity-control input,
.discount-control input,
.note-input {
  width: 100%;
  height: 40px;
  color: var(--ink-900);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.quote-meta input {
  padding: 0 12px;
}

.quote-meta input:focus,
.compact-field input:focus,
.quantity-control input:focus,
.discount-control input:focus,
.note-input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(17, 133, 231, 0.12);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.quote-builder,
.summary-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.quote-builder {
  min-width: 0;
  padding: 22px;
}

.summary-panel {
  position: sticky;
  top: 18px;
  padding: 22px;
}

.section-heading,
.summary-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--blue-700);
  font-size: 13px;
  font-weight: 800;
}

h2 {
  color: var(--ink-900);
  font-size: 23px;
}

.compact-field {
  width: 190px;
}

.table-controls {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 26px;
}

.toggle-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue-600);
}

.inline-input,
.discount-control,
.custom-price-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compact-field {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.compact-field > span {
  white-space: nowrap;
}

.inline-input input,
.discount-control input,
.custom-price-control input {
  padding: 0 8px;
  text-align: right;
}

.discount-control input:disabled {
  color: var(--ink-500);
  background: #edf2f7;
}

.inline-input span,
.discount-control span,
.custom-price-control span {
  color: var(--ink-500);
  font-size: 14px;
  font-weight: 800;
}

.table-card {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-title {
  padding: 16px 14px;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(130deg, var(--blue-700), var(--blue-600));
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.table-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px 14px;
  color: var(--ink-700);
  font-size: 21px;
  font-weight: 800;
  text-align: center;
  background: #f8fbff;
  border-bottom: 1px solid var(--line);
}

.table-meta b {
  color: var(--ink-900);
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.price-table th {
  height: 52px;
  padding: 10px 8px;
  color: #13233c;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  background: #b9cbe7;
  border-right: 1px solid rgba(31, 61, 97, 0.22);
}

.price-table th:last-child,
.price-table td:last-child {
  border-right: 0;
}

.price-table td {
  padding: 9px 8px;
  font-size: 13px;
  vertical-align: middle;
  text-align: center;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.price-table tfoot td {
  padding: 14px 8px;
  color: var(--ink-900);
  font-size: 16px;
  font-weight: 900;
  text-align: center;
  background: var(--orange-100);
  border-top: 1px solid #ffd5b2;
  border-right: 1px solid #ffd5b2;
}

.price-table tbody tr:nth-child(odd) {
  background: var(--green-100);
}

.price-table tbody tr:nth-child(even) {
  background: #eef6fb;
}

.price-table tbody tr.is-disabled {
  color: #778197;
  background: #f7f9fc;
}

.select-col {
  width: 54px;
  text-align: center;
}

.name-col {
  width: 118px;
}

.price-col {
  width: 210px;
}

.qty-col,
.time-col {
  width: 86px;
}

.discount-col {
  width: 92px;
}

.amount-col {
  width: 112px;
  text-align: right;
}

.note-col {
  width: 180px;
}

.is-hidden-row {
  display: none;
}

.check-control {
  display: grid;
  place-items: center;
}

.check-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue-600);
}

.item-name {
  min-width: 0;
  color: var(--ink-900);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.price-copy,
.note-copy {
  color: var(--ink-700);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.note-input {
  min-width: 0;
  height: 58px;
  padding: 8px;
  color: #d7263d;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  resize: vertical;
}

.quantity-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.quantity-control input {
  width: 54px;
  padding: 0 7px;
  font-size: 13px;
  text-align: right;
}

.quantity-control span {
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.option-checks {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.option-check {
  display: block;
}

.option-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-check span {
  display: block;
  padding: 6px 8px;
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.option-check input:checked + span {
  color: #fff;
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.option-check input:checked + span::before {
  content: "✓ ";
}

.custom-price-control {
  justify-content: center;
  margin-top: 8px;
}

.custom-price-control input {
  width: 88px;
  height: 36px;
  font-size: 13px;
}

.row-total {
  display: block;
  color: var(--ink-900);
  font-weight: 900;
  text-align: center;
}

.row-original {
  display: block;
  margin-top: 4px;
  color: var(--ink-500);
  font-size: 12px;
  text-align: center;
  text-decoration: line-through;
}

.is-small-seat .item-name {
  font-size: 11px;
}

.quote-preview {
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9fd 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.preview-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  color: #fff;
  background: linear-gradient(130deg, var(--blue-700), var(--blue-600));
}

.preview-subtitle {
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 800;
}

.preview-title h3 {
  font-size: 23px;
}

#previewDate {
  padding-top: 4px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  white-space: nowrap;
}

.preview-meta {
  display: grid;
  gap: 7px;
  padding: 14px 18px;
  color: var(--ink-500);
  font-size: 13px;
  text-align: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.preview-meta b {
  color: var(--ink-900);
}

.preview-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.preview-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.preview-item-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  justify-items: center;
}

.preview-item h4 {
  margin: 0;
  font-size: 15px;
  text-align: center;
}

.preview-item p {
  color: var(--ink-500);
  font-size: 12px;
  line-height: 1.45;
}

.preview-amount {
  color: var(--orange-500);
  font-size: 16px;
  font-weight: 900;
}

.preview-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.preview-tags span {
  padding: 3px 7px;
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 700;
  background: var(--soft);
  border-radius: 5px;
  white-space: normal;
}

.empty-state {
  display: none;
  padding: 46px 18px;
  color: var(--ink-500);
  text-align: center;
}

.empty-state.is-visible {
  display: block;
}

.total-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  text-align: center;
  background: var(--orange-100);
  border-top: 1px solid #ffd5b2;
}

.total-box span {
  color: var(--ink-700);
  font-weight: 800;
}

.total-box strong {
  color: var(--orange-500);
  font-size: 30px;
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    width: calc(100% - 24px);
    padding: 12px 0 24px;
  }

  .topbar,
  .quote-meta,
  .quick-presets,
  .layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 20px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .primary-button,
  .ghost-button {
    flex: 1 1 120px;
  }

  h1 {
    font-size: 25px;
  }

  .summary-panel {
    position: static;
  }
}
