:root {
  --bg: #f3f5f8;
  --panel: #fff;
  --ink: #172033;
  --ink2: #4b5563;
  --muted: #7b8494;
  --line: #e4e8ef;
  --orange: #ef501f;
  --orange2: #ff8446;
  --orange-soft: #fff3ed;
  --blue: #2563eb;
  --green: #079455;
  --red: #d92d20;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 14px/1.5 "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.site-header {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--orange);
  font-weight: 800;
}
.brand strong { display: block; font-size: 16px; }
.brand span { display: block; color: var(--muted); font-size: 11px; }
.role-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #e7eaf0;
}
.role-switch button {
  min-width: 86px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #667085;
}
.role-switch button.on {
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

main { padding: 0 24px 40px; }
.view { display: none; }
.view.on { display: block; }

/* Client */
body.is-client {
  min-height: 100vh;
  background: #f5f6fa;
}
body.is-client .site-header { display: none; }
body.is-client main { padding: 0; }
.client-app {
  width: 100%;
  min-height: 100vh;
  background: #f5f6fa;
}
.client-login-view {
  min-height: 100vh;
  padding: 24px 16px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 0, rgba(239,80,31,.10), transparent 38%),
    #f5f6fa;
}
.client-login-card {
  width: min(400px, 100%);
  padding: 28px;
  border-radius: 18px;
}
.client-login-card label + label { margin-top: 12px; }
.client-login-card .button { margin-top: 18px; }

.client-page {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 0 max(32px, env(safe-area-inset-bottom));
}
.client-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 20px 14px;
  background: #fff;
  border-bottom: 1px solid #eef1f5;
}
.client-head h1 { margin: 0; font-size: 21px; line-height: 1.2; letter-spacing: 0; }
.client-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.client-avatar {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #c64a18;
  background: var(--orange-soft);
  font-weight: 800;
}
.member-card {
  margin: 0 16px;
  padding: 18px;
  color: #fff;
  border-radius: 26px;
  background:
    linear-gradient(130deg, rgba(255,255,255,.16), transparent 38%),
    linear-gradient(135deg, #ff8c4d, #ef501f 60%, #d53818);
  box-shadow: 0 18px 34px rgba(239,80,31,.20);
}
.member-top { display: flex; align-items: center; gap: 12px; }
.member-avatar {
  width: 43px;
  height: 43px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
  font-weight: 800;
}
.member-top strong { font-size: 16px; }
.member-top span { display: block; margin-top: 3px; color: rgba(255,255,255,.78); font-size: 11px; }
.member-badge {
  margin-left: auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.17);
  font-size: 10px;
  font-weight: 700;
}
.member-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 17px;
  padding: 12px 0;
  border-radius: 18px;
  background: rgba(255,255,255,.15);
  text-align: center;
}
.member-metric + .member-metric { border-left: 1px solid rgba(255,255,255,.18); }
.member-metric b { display: block; font-size: 20px; }
.member-metric b i { margin-left: 2px; font-size: 10px; font-style: normal; opacity: .8; }
.member-metric span { display: block; margin-top: 4px; color: rgba(255,255,255,.78); font-size: 10px; }
.client-tabs {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 3px;
  margin: 16px 16px 12px;
  padding: 3px;
  border-radius: 15px;
  background: #e8eaf1;
}
.client-tabs button {
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #667085;
}
.client-tabs button.on {
  color: var(--ink);
  background: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
}
.section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 13px 20px 9px;
}
.section-title h2 { margin: 0; font-size: 15px; }
.section-title span { color: var(--muted); font-size: 10.5px; }
.package-list { display: grid; gap: 12px; padding: 0 16px; }
.package-card {
  padding: 15px;
  border: 1px solid #eef1f5;
  border-radius: 21px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15,23,42,.04);
}
.package-card.primary-surface { border-color: #ffe1d7; background: linear-gradient(135deg,#fffaf8,#fff); }
.package-card-head { display: flex; align-items: center; gap: 12px; }
.package-icon {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.icon-hc { background: linear-gradient(135deg,#ff8c4d,#ef501f); }
.icon-hys { background: linear-gradient(135deg,#4ed493,#079455); }
.icon-xhlc { background: linear-gradient(135deg,#55c6ff,#1d76e8); }
.package-main { flex: 1; min-width: 0; }
.package-title { display: flex; align-items: center; gap: 6px; }
.package-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.status-badge {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
}
.status-pending { color: #df3a2f; background: #fff0ef; }
.status-active { color: var(--green); background: #eaf9f1; }
.status-expired, .status-recycled, .status-stopped { color: #7c8595; background: #f1f3f6; }
.package-meta { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.package-actions { display: flex; gap: 7px; justify-content: flex-end; margin-top: 12px; }
.account-panel {
  margin: 0 16px;
  overflow: hidden;
  border: 1px solid #eef1f5;
  border-radius: 14px;
  background: #fff;
}
.account-panel .section-title { padding-top: 16px; }
.account-form {
  padding: 0 16px 18px;
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 12px;
}
.account-form.panel-form {
  margin-top: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.account-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.button {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.button.primary { color: #fff; background: var(--orange); }
.button.primary:hover { background: #d94317; }
.button.secondary { color: var(--ink2); background: #fff; border-color: #dfe3ea; }
.button.subtle { color: #667085; background: #f5f7fa; }
.button.danger { color: var(--red); background: #fff; border-color: #fecaca; }
.button.small { min-height: 30px; padding: 0 10px; font-size: 12px; }
.button.wide { width: 100%; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.empty-state {
  margin: 16px;
  padding: 30px 20px;
  border: 1px dashed #d9dee7;
  border-radius: 18px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}
.loading-state { padding: 60px 20px; color: var(--muted); text-align: center; }
.error-state { margin: 20px; padding: 18px; border-radius: 15px; color: #b42318; background: #fff1f0; }

.events-list { display: grid; gap: 10px; padding: 0 16px; }
.event-item {
  display: flex;
  gap: 10px;
  padding: 14px;
  border: 1px solid #eef1f5;
  border-radius: 16px;
  background: #fff;
}
.event-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--orange); }
.event-main { flex: 1; min-width: 0; }
.event-main strong { display: block; font-size: 13px; }
.event-main p { margin: 3px 0 0; color: var(--ink2); font-size: 11px; }
.event-main time { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }

/* Admin */
.admin-login { min-height: 70vh; display: grid; place-items: center; }
.login-card {
  width: min(380px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 20px 44px rgba(15,23,42,.08);
}
.login-icon {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--orange);
  font-weight: 800;
}
.login-card h1 { margin: 18px 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
.login-card label { display: grid; gap: 6px; }
.login-card label + label { margin-top: 12px; }
.login-card label span { color: var(--ink2); font-size: 12px; }
.login-card input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d8dde6;
  border-radius: 11px;
  outline: none;
}
.login-card input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239,80,31,.08); }
.login-card .button { margin-top: 16px; }
.form-error { display: block; min-height: 18px; margin-top: 9px; color: var(--red); }

.admin-layout {
  max-width: 1380px;
  min-height: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 224px minmax(0,1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f5f6fa;
}
.admin-sidebar {
  padding: 14px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fff;
}
.admin-brand { display: flex; align-items: center; gap: 9px; padding: 2px 4px 15px; border-bottom: 1px solid var(--line); }
.admin-logo { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--orange); font-weight: 800; }
.admin-brand strong { display: block; font-size: 13px; }
.admin-brand span { color: var(--muted); font-size: 10px; }
.admin-nav { display: grid; gap: 4px; margin-top: 14px; }
.admin-nav button {
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  color: var(--ink2);
  background: transparent;
  text-align: left;
}
.admin-nav button.on { color: var(--orange); background: var(--orange-soft); font-weight: 700; }
.logout { margin-top: auto; }
.admin-main { min-width: 0; }
.admin-topbar {
  height: 54px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb b { color: var(--ink); }
.admin-user { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.admin-avatar { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: #f1f3f6; font-weight: 700; }
.admin-content { padding: 18px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.stat-card p { margin: 0; color: var(--muted); font-size: 11px; }
.stat-card b { display: block; margin-top: 7px; font-size: 24px; line-height: 1; }
.stat-card span { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.admin-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.admin-page-head h2 { margin: 0; font-size: 18px; }
.admin-page-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.admin-page-actions { display: flex; gap: 8px; }
.table-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 12px 14px; border-bottom: 1px solid #eef1f5; text-align: left; vertical-align: middle; }
th { color: #667085; background: #f8fafc; font-size: 11px; font-weight: 700; white-space: nowrap; }
td { color: #344054; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
.table-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.tag { display: inline-flex; padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.tag.green { color: var(--green); background: #eaf9f1; }
.tag.gray { color: #667085; background: #f1f3f6; }
.tag.orange { color: #c85421; background: #fff3ed; }
.tag.red { color: var(--red); background: #fff1f0; }
.tag.blue { color: var(--blue); background: #eff6ff; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.issue-form {
  margin-top: 14px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.field { display: grid; gap: 5px; }
.field label { color: var(--muted); font-size: 11px; }
.field input, .field select { height: 36px; padding: 0 10px; border: 1px solid #d8dde6; border-radius: 10px; background: #fff; outline: none; }
.field input:focus, .field select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239,80,31,.08); }
.check-field { display: flex; align-items: center; gap: 8px; padding-top: 20px; color: var(--ink2); font-size: 12px; }
.check-field input { width: 16px; height: 16px; accent-color: var(--orange); }
.issue-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.detail-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.detail-toolbar button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid #e2e6ee;
  border-radius: 999px;
  background: #fff;
  color: #667085;
  font-size: 11px;
}
.detail-toolbar button.on { border-color: #ffd6c4; background: var(--orange-soft); color: var(--orange); font-weight: 700; }
.service-sections { display: grid; gap: 12px; }
.service-section { border: 1px solid #eef1f5; border-radius: 14px; overflow: hidden; background: #fff; }
.service-section h3 { margin: 0; padding: 12px 14px; background: #f8fafc; font-size: 13px; }
.service-item { padding: 12px 14px; border-top: 1px solid #eef1f5; }
.service-item strong { display: block; font-size: 13px; }
.service-item p { margin: 5px 0 0; color: #667085; font-size: 11.5px; line-height: 1.7; }
.service-item small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.notice-box { padding: 12px 14px; border: 1px solid #ffe2cd; border-radius: 14px; color: #9a5b12; background: #fff8f2; font-size: 11.5px; line-height: 1.7; }
.travel-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.travel-card, .hotel-card { overflow: hidden; border: 1px solid #eef1f5; border-radius: 14px; background:#fff; }
.travel-card img { display:block; width:100%; height:130px; object-fit:cover; background:#eef1f5; }
.travel-card-body { padding: 10px; }
.travel-card strong { display:block; min-height:36px; font-size:12px; line-height:1.4; }
.travel-card span { display:block; margin-top:4px; color:var(--muted); font-size:10px; }
.travel-card a { display:inline-block; margin-top:8px; color:var(--blue); font-size:10.5px; text-decoration:none; }
.hotel-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.hotel-card { padding:0; text-align:left; }
.hotel-card img { display:block; width:100%; height:120px; object-fit:cover; background:#eef1f5; }
.hotel-card div { padding:10px; }
.hotel-card strong { display:block; font-size:12px; }
.hotel-card span { display:block; margin-top:4px; color:var(--muted); font-size:10px; }
.gallery-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.gallery-grid a { display:block; aspect-ratio:1; overflow:hidden; border-radius:10px; background:#eef1f5; }
.gallery-grid img { width:100%; height:100%; object-fit:cover; }
.loading-inline { padding:30px; color:var(--muted); text-align:center; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop { position:absolute; inset:0; background:rgba(15,23,42,.46); backdrop-filter:blur(3px); }
.modal-panel {
  position:relative;
  width:min(900px,100%);
  max-height:min(88vh,900px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border-radius:22px;
  background:#fff;
  box-shadow:0 30px 80px rgba(15,23,42,.25);
}
.modal-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:18px 20px; border-bottom:1px solid var(--line); }
.modal-head h2 { margin:0; font-size:18px; }
.modal-head p { margin:4px 0 0; color:var(--muted); font-size:11px; }
.icon-button { width:32px; height:32px; border:1px solid #e2e6ee; border-radius:10px; background:#fff; color:#667085; font-size:18px; }
.modal-body { overflow:auto; padding:18px 20px 24px; }

.toast {
  position:fixed;
  left:50%;
  bottom:28px;
  z-index:200;
  max-width:min(520px,calc(100vw - 32px));
  padding:10px 14px;
  border-radius:10px;
  color:#fff;
  background:#111827;
  font-size:12px;
  opacity:0;
  pointer-events:none;
  transform:translate(-50%,14px);
  transition:.2s ease;
}
.toast.on { opacity:1; transform:translate(-50%,0); }

@media (max-width: 1000px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .issue-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .travel-grid, .hotel-grid, .gallery-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { border-right:0; border-bottom:1px solid var(--line); }
  .admin-nav { grid-template-columns: repeat(3,1fr); }
  .logout { margin-top: 12px; }
}

@media (max-width: 640px) {
  .site-header { padding: 14px 14px 10px; }
  main { padding: 0 10px 24px; }
  .brand span { display:none; }
  .role-switch button { min-width:72px; }
  body.is-client main { padding: 0; }
  .client-head { padding-left: 16px; padding-right: 16px; }
  .member-card { margin-left: 12px; margin-right: 12px; }
  .client-tabs { margin-left: 12px; margin-right: 12px; }
  .package-list, .events-list { padding-left: 12px; padding-right: 12px; }
  .section-title { padding-left: 16px; padding-right: 16px; }
  .admin-content { padding:12px; }
  .admin-page-head { align-items:flex-start; flex-direction:column; }
  .stats-grid, .issue-form { grid-template-columns:1fr; }
  .account-form { grid-template-columns:1fr; }
  .table-panel { overflow:auto; }
  table { min-width:760px; }
  .modal { padding:10px; }
  .modal-panel { max-height:95vh; }
  .travel-grid, .hotel-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .gallery-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
