:root {
  --ink: #10283d;
  --muted: #607482;
  --paper: #f4f7f8;
  --white: #fff;
  --gold: #f2b84b;
  --gold-dark: #b66f12;
  --line: #dbe3e8;
  --success: #245d4b;
  --danger: #a84a45;
  --shadow: 0 18px 50px rgba(16, 40, 61, .09);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: linear-gradient(90deg, var(--gold) 0 7px, transparent 7px), var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell { width: min(100%, 1160px); min-height: 100vh; margin: 0 auto; padding: 26px 24px 116px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 5px; color: #c47c16; font-size: .78rem; font-weight: 900; letter-spacing: .12em; }
.topbar h1 { margin: 0; font-size: clamp(2.2rem, 5vw, 3.5rem); line-height: 1; letter-spacing: -.055em; }
.secure-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 6px 12px; border: 1px solid #cfe1da; border-radius: 999px; color: var(--success); background: #e9f5f0; font-size: .82rem; font-weight: 800; }

.surface, .summary-card, .loading-card, .login-card { border: 1px solid rgba(16,40,61,.08); border-radius: 23px; background: var(--white); box-shadow: var(--shadow); }
.surface { padding: 25px; }
.home-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(290px,.75fr); gap: 22px; }
.section-head { margin-bottom: 20px; }
.section-head h2, .booking-title h2, .form-header h2, .chart-card h2 { margin: 0 0 7px; font-size: clamp(1.4rem,3vw,2rem); line-height: 1.15; letter-spacing: -.025em; }
.section-head > span, .booking-title > div > span { color: var(--muted); }

.action-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.action-card { min-height: 126px; padding: 17px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); text-align: left; background: var(--white); transition: 160ms ease; }
.action-card:hover { transform: translateY(-2px); border-color: #c47c16; box-shadow: 0 10px 26px rgba(16,40,61,.09); }
.action-card:last-child:nth-child(odd) { grid-column: 1/-1; }
.action-card i { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 14px; border-radius: 12px; color: #82500f; background: #fff0c9; font-size: 1.2rem; font-style: normal; }
.action-card strong, .action-card span { display: block; }
.action-card span { margin-top: 3px; color: var(--muted); font-size: .84rem; }

.summary-card { padding: 27px; color: var(--white); background: var(--ink); }
.summary-card > p { margin: 0; color: #ffd77e; font-size: .8rem; font-weight: 900; letter-spacing: .12em; }
.summary-card h2 { margin: 5px 0 22px; font-size: 1.8rem; }
.summary-kpis { display: grid; gap: 10px; margin-bottom: 18px; }
.summary-kpis > div { padding: 16px; border: 1px solid rgba(255,255,255,.14); border-radius: 15px; background: rgba(255,255,255,.06); }
.summary-kpis span, .summary-kpis strong { display: block; }
.summary-kpis span { color: #c8d3dc; font-size: .84rem; }
.summary-kpis strong { margin-top: 3px; font-size: 1.45rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 17px; border: 1px solid var(--ink); border-radius: 11px; color: var(--white); background: var(--ink); font-weight: 800; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { color: var(--ink); border-color: var(--line); background: var(--white); }
.btn.danger { color: var(--danger); border-color: #e8c4c1; background: var(--white); }
.btn.full { width: 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .85rem; }

.form-surface { padding: 0; overflow: hidden; }
.form-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 21px 25px; color: var(--white); background: var(--ink); }
.form-header .eyebrow { color: #ffd77e; }
.form-header h2 { margin: 0; }
.record-form { padding: 25px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.form-subgrid { display: contents; }
.field { display: grid; align-content: start; gap: 8px; color: var(--ink); font-size: .9rem; font-weight: 800; }
.field.full, .linked-booking, .choice-wrap { grid-column: 1/-1; }
.field b { color: var(--danger); }
.field small { color: var(--muted); font-size: .78rem; font-weight: 400; }
.form-control { width: 100%; min-height: 49px; padding: 10px 12px; border: 1px solid #c9d5dc; border-radius: 12px; color: var(--ink); background: var(--white); font-size: 1rem; }
textarea.form-control { min-height: 94px; resize: vertical; }
.form-control:focus { outline: 3px solid rgba(242,184,75,.25); border-color: #c47c16; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 22px; }
.choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.choice-card { display: flex; align-items: center; gap: 10px; min-height: 66px; padding: 13px; border: 1px solid #c9d5dc; border-radius: 14px; cursor: pointer; }
.choice-card.selected { border-color: #c47c16; background: #fff8e8; }
.choice-card span, .choice-card strong, .choice-card small { display: block; }
.choice-card small { color: var(--muted); font-size: .78rem; font-weight: 400; }
.linked-booking { display: grid; gap: 4px; padding: 15px; border: 1px solid #d0e5dc; border-radius: 14px; background: #eef8f4; }
.linked-booking span { color: #526b61; font-size: .85rem; }

.booking-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.booking-list { display: grid; gap: 12px; }
.booking-row { display: grid; grid-template-columns: minmax(170px,.8fr) minmax(240px,1.2fr) auto; align-items: center; gap: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 17px; }
.booking-row.closed { opacity: .68; background: #f7f9fa; }
.booking-row strong, .booking-row small, .booking-row span { display: block; }
.booking-row small, .booking-row span { color: var(--muted); font-size: .82rem; }
.status { display: inline-flex !important; width: fit-content; margin-top: 7px; padding: 4px 9px; border-radius: 99px; color: var(--success); background: #d9efe7; font-size: .75rem; font-style: normal; font-weight: 900; }
.status.cancelled { color: #8d403a; background: #fae4e2; }
.status.paid { color: #705013; background: #fff0c9; }
.booking-buttons { display: flex; gap: 8px; }
.history-title { margin-top: 20px; }
.history-title h3 { margin: 0; font-size: 1.2rem; }
.empty-state { padding: 34px 18px; border: 1px dashed #c9d5dc; border-radius: 16px; color: var(--muted); text-align: center; }
.success-state { margin-top: 20px; color: var(--success); border-color: #b8d8cb; background: #eef8f4; }

.receipt-list { display: grid; gap: 12px; }
.receipt-row { display: grid; grid-template-columns: minmax(175px,.85fr) minmax(210px,1fr) minmax(150px,.6fr) 18px; align-items: center; gap: 18px; width: 100%; padding: 18px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); text-align: left; background: var(--white); }
.receipt-row:hover { border-color: #c47c16; box-shadow: 0 8px 24px rgba(16,40,61,.08); }
.receipt-row strong, .receipt-row small, .receipt-row span { display: block; }
.receipt-row small, .receipt-row span { color: var(--muted); font-size: .8rem; }
.receipt-money { text-align: right; }
.receipt-money strong { margin: 3px 0; font-size: 1.35rem; }
.chevron { color: #a2afb7; font-size: 1.8rem; text-align: right; }
.receipt-detail { padding: 0; overflow: hidden; }
.receipt-detail-head { margin: 0; }
.receipt-detail-body { padding: 25px; }
.receipt-total-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.receipt-total-grid > div { padding: 18px; border: 1px solid var(--line); border-radius: 16px; }
.receipt-total-grid span, .receipt-total-grid strong { display: block; }
.receipt-total-grid span { color: var(--muted); font-size: .82rem; }
.receipt-total-grid strong { margin-top: 6px; font-size: 1.55rem; }
.receipt-total-grid .featured { color: var(--white); border-color: var(--ink); background: var(--ink); }
.receipt-total-grid .featured span { color: #c8d3dc; }
.receipt-meta { display: grid; grid-template-columns: repeat(2,1fr); margin: 22px 0; border-top: 1px solid var(--line); }
.receipt-meta > div { display: grid; grid-template-columns: 125px 1fr; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.receipt-meta dt { color: var(--muted); }
.receipt-meta dd { margin: 0; font-weight: 800; word-break: break-all; }
.refund-history { margin: 22px 0; padding: 18px; border-radius: 16px; background: #f7f9fa; }
.refund-history h3 { margin: 0 0 10px; }
.refund-history > div { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0; border-top: 1px solid var(--line); }
.refund-history span { color: var(--muted); }
.refund-history strong { color: var(--danger); }
.refund-panel { margin-top: 25px; padding-top: 25px; border-top: 2px solid var(--ink); }

.dashboard { display: grid; gap: 18px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.review-kpis { grid-template-columns: repeat(5,minmax(0,1fr)); }
.kpi { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.kpi.featured { color: var(--white); border-color: var(--ink); background: var(--ink); }
.kpi span, .kpi strong, .kpi small { display: block; }
.kpi span, .kpi small { color: var(--muted); }
.kpi.featured span, .kpi.featured small { color: #c8d3dc; }
.kpi strong { margin: 7px 0 3px; font-size: clamp(1.8rem,5vw,2.6rem); line-height: 1; }
.bars { display: grid; gap: 16px; margin-top: 22px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 90px; align-items: center; gap: 12px; font-size: .87rem; }
.bar-row > i { height: 12px; overflow: hidden; border-radius: 99px; background: #edf1f3; }
.bar-row > i > b { display: block; height: 100%; border-radius: inherit; background: var(--gold); }
.bar-row > i > b.negative { background: #d97970; }
.bar-row > strong { text-align: right; }
.range-panel { display: grid; gap: 14px; }
.range-fields { display: grid; grid-template-columns: minmax(180px,1fr) minmax(180px,1fr) auto; align-items: end; gap: 14px; }
.range-shortcuts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.range-shortcuts span { margin-right: 4px; color: var(--muted); font-size: .82rem; }
.range-shortcuts button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink); background: var(--white); font-weight: 800; }
.range-shortcuts button:hover { border-color: #c47c16; background: #fff8e8; }
.definition-list { display: grid; }
.definition-list > div { display: grid; grid-template-columns: minmax(150px,.28fr) 1fr; gap: 20px; padding: 19px 0; border-bottom: 1px solid var(--line); }
.definition-list > div:last-child { border-bottom: 0; }
.definition-list p { margin: 0 0 10px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span { padding: 7px 11px; border: 1px solid var(--line); border-radius: 99px; color: #526673; background: var(--white); font-size: .82rem; }
.personal-note { margin: 22px 0 0; padding: 14px 16px; border-radius: 14px; color: #526673; background: #f2f6f7; font-size: .84rem; text-align: center; }

.bottom-nav { position: fixed; z-index: 20; right: 18px; bottom: 18px; left: 18px; display: grid; grid-template-columns: repeat(5,1fr); width: min(calc(100% - 36px),760px); margin: auto; padding: 7px; border: 1px solid rgba(16,40,61,.12); border-radius: 18px; background: rgba(255,255,255,.94); box-shadow: 0 15px 42px rgba(16,40,61,.18); backdrop-filter: blur(15px); }
.bottom-nav button { min-height: 52px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; font-weight: 900; }
.bottom-nav button.active { color: var(--white); background: var(--ink); }
.error-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; padding: 13px 15px; border: 1px solid #ecc5c2; border-radius: 14px; color: #7a3a35; background: #fdf0ef; }
.notice-toast { position: fixed; z-index: 60; bottom: 92px; left: 50%; min-width: 180px; padding: 12px 18px; border-radius: 99px; color: var(--white); text-align: center; background: var(--success); box-shadow: 0 12px 32px rgba(16,40,61,.2); transform: translateX(-50%); }
.loading-card { display: grid; place-items: center; min-height: 280px; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(8,25,39,.56); }
.modal { width: min(100%, 430px); padding: 24px; border-radius: 20px; background: var(--white); box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.modal h2 { margin: 0 0 8px; }
.modal p { margin: 0 0 20px; color: var(--muted); line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #fff4d4, transparent 34%), var(--paper); }
.login-card { width: min(100%, 420px); padding: 30px; }
.login-logo { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 22px; border-radius: 15px; color: var(--ink); background: var(--gold); font-size: 1.5rem; font-weight: 900; }
.login-card h1 { margin: 0 0 7px; }
.login-card > p { margin: 0 0 24px; color: var(--muted); }
.login-card form { display: grid; gap: 13px; }
.login-note { margin-top: 18px; color: var(--muted); font-size: .78rem; text-align: center; }

@media (max-width: 800px) {
  .home-grid { grid-template-columns: 1fr; }
  .booking-row { grid-template-columns: 1fr 1fr; }
  .booking-buttons { grid-column: 1/-1; }
  .review-kpis { grid-template-columns: repeat(2,1fr); }
  .receipt-row { grid-template-columns: 1fr 1fr; }
  .receipt-money { text-align: left; }
  .chevron { display: none; }
}

@media (max-width: 560px) {
  body { background: var(--paper); }
  .app-shell { padding: 20px 15px 106px; }
  .secure-pill { font-size: .75rem; }
  .surface { padding: 20px; border-radius: 20px; }
  .action-grid, .form-grid, .choice-grid, .kpi-grid, .receipt-total-grid, .receipt-meta, .range-fields { grid-template-columns: 1fr; }
  .action-card:last-child:nth-child(odd), .field.full, .linked-booking, .choice-wrap { grid-column: auto; }
  .action-card { min-height: 108px; }
  .form-surface { padding: 0; }
  .form-header, .record-form { padding: 20px; }
  .booking-title { align-items: stretch; flex-direction: column; }
  .booking-row { grid-template-columns: 1fr; }
  .booking-buttons { grid-column: auto; }
  .receipt-row { grid-template-columns: 1fr; }
  .receipt-meta > div { grid-template-columns: 112px 1fr; }
  .bar-row { grid-template-columns: 92px 1fr 72px; gap: 8px; }
  .definition-list > div { grid-template-columns: 1fr; gap: 7px; }
  .bottom-nav { right: 10px; bottom: 10px; left: 10px; width: calc(100% - 20px); }
  .bottom-nav button { font-size: .8rem; }
}
