:root {
  color-scheme: light;
  --ink: #292c2a;
  --muted: #7d827f;
  --line: #ead9ca;
  --paper: #fff;
  --canvas: #f8eddf;
  --apricot: #f1d6bc;
  --apricot-deep: #e5c8ad;
  --red: #b94f3d;
  --red-dark: #a54130;
  --green: #4f7959;
  --shadow: 0 12px 32px rgb(42 39 34 / 9%);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #b36b51; outline-offset: 2px; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; display: flex; width: 238px; flex-direction: column; border-right: 1px solid var(--line); background: linear-gradient(165deg, #fae9d8 0%, #f1d6c2 100%); padding: 24px 16px 18px; }
.brand { display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 0 4px 43px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; width: 40px; height: 40px; flex: none; place-items: center; border-radius: 8px; background: var(--red); color: #fff; box-shadow: 0 4px 0 #e2b69a; font-family: "Microsoft YaHei", sans-serif; font-size: 19px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; font-weight: 700; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.nav-label { padding: 0 12px 10px; color: #a2a29e; font-size: 11px; font-weight: 700; }
.primary-nav { display: grid; gap: 5px; }
.nav-item { display: flex; min-height: 44px; align-items: center; gap: 11px; border: 0; border-radius: 6px; background: transparent; padding: 0 12px; color: #656a67; text-align: left; cursor: pointer; }
.nav-item:hover { background: #f8f6f2; }
.nav-item.active { background: #fff6ec; color: #a24835; box-shadow: inset 3px 0 var(--red); font-weight: 700; }
.nav-icon { display: grid; width: 23px; height: 23px; place-items: center; border: 1px solid currentColor; border-radius: 6px; font-size: 11px; }
.sidebar-foot { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 14px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.status-dot, .live-indicator { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.workspace { min-height: 100vh; margin-left: 238px; }
.topbar { position: sticky; top: 0; z-index: 3; display: flex; height: 62px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgb(255 250 244 / 96%); padding: 0 32px; backdrop-filter: blur(8px); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; color: #8a8e8a; font-size: 12px; }
.breadcrumbs strong { color: #383b39; font-weight: 600; }
.crumb-separator { color: #c0c1bd; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.environment-label { display: flex; align-items: center; gap: 7px; color: #777d79; font-size: 11px; }
.environment-label i { width: 6px; height: 6px; border-radius: 50%; background: #c98a55; }
.avatar { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: #e5eee7; color: #496b55; font-size: 12px; font-weight: 700; }
#main-content { width: min(100%, 1450px); min-height: calc(100vh - 62px); margin: 0 auto; padding: 32px 36px 18px; }
.view { display: none; }
.view.active:not([hidden]) { display: block; }
.page-heading { display: flex; min-height: 85px; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: #aa8b70; font-size: 9px; font-weight: 700; letter-spacing: 0; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 24px; line-height: 1.25; font-weight: 650; }
.subheading { margin: 0; color: var(--muted); font-size: 12px; }
.heading-meta { display: flex; align-items: center; gap: 8px; color: #717874; font-size: 12px; }
.live-indicator { display: inline-block; box-shadow: 0 0 0 3px #e5efe7; }
.filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.search-field { display: flex; width: min(410px, 100%); height: 38px; align-items: center; gap: 10px; border: 1px solid #e2e1dc; border-radius: 5px; background: #fff; padding: 0 11px; }
.search-field:focus-within { border-color: #b89a80; box-shadow: 0 0 0 3px rgb(184 154 128 / 12%); }
.search-field input { width: 100%; min-width: 0; border: 0; outline: none; color: var(--ink); font-size: 12px; }
.search-field input::placeholder { color: #aaaead; }
.search-icon { position: relative; width: 13px; height: 13px; flex: none; border: 1.5px solid #858b87; border-radius: 50%; }
.search-icon::after { position: absolute; right: -4px; bottom: -3px; width: 6px; height: 1.5px; transform: rotate(45deg); background: #858b87; content: ""; }
kbd { display: none; }
.secondary-button { display: inline-flex; flex-shrink: 0; min-height: 36px; align-items: center; justify-content: center; gap: 7px; border: 1px solid #deddd8; border-radius: 5px; background: #fff; padding: 0 12px; color: #555b57; font-size: 12px; cursor: pointer; }
.secondary-button:hover { border-color: #c8b4a2; background: #fdfbf9; }
.secondary-button:disabled { opacity: .55; cursor: wait; }
.refresh-icon { display: inline-block; color: #737a75; font-size: 18px; line-height: 1; }
.content-grid { display: grid; grid-template-columns: minmax(270px, 0.84fr) minmax(430px, 1.6fr); align-items: start; gap: 15px; }
.panel { min-width: 0; overflow: hidden; border: 1px solid #ead9ca; border-radius: 7px; background: var(--paper); box-shadow: 0 8px 24px rgb(102 74 49 / 5%); }
.member-panel { min-height: 416px; }
.panel-heading { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid #f0efeb; padding: 14px 17px; }
.panel-heading h2 { margin: 0 0 5px; font-size: 14px; font-weight: 650; }
.panel-heading h2::before { display: inline-block; width: 3px; height: 13px; margin-right: 8px; border-radius: 2px; background: var(--red); vertical-align: -1px; content: ""; }
.panel-heading p { margin: 0; color: #969a96; font-size: 11px; }
.subtle-count { flex: none; color: #949995; font-size: 11px; }
.member-list { padding: 5px 8px; }
.member-row { display: flex; width: 100%; min-height: 63px; align-items: center; gap: 11px; border: 0; border-bottom: 1px solid #f2f1ee; background: transparent; padding: 8px 9px; text-align: left; cursor: pointer; }
.member-row:last-child { border-bottom: 0; }
.member-row:hover { background: #faf9f7; }
.member-row.selected { border-radius: 5px; background: #f9e9dd; box-shadow: inset 3px 0 var(--red); }
.member-avatar { display: grid; width: 34px; height: 34px; flex: none; place-items: center; border-radius: 50%; background: #efe4d9; color: #755c47; font-size: 13px; font-weight: 700; }
.member-info { display: grid; min-width: 0; gap: 4px; }
.member-info strong { overflow: hidden; color: #414643; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.member-info small { color: #969b97; font-size: 10px; }
.row-arrow { margin-left: auto; color: #b1b4b1; font-size: 20px; }
.detail-panel { padding-bottom: 3px; }
.detail-heading { min-height: 84px; padding: 16px 20px; }
.detail-heading .eyebrow { margin-bottom: 5px; }
.detail-heading h2 { margin-bottom: 4px; font-size: 16px; }
.member-status { flex: none; border-radius: 12px; background: #eff5f0; padding: 4px 10px; color: #52765d; font-size: 10px; }
.member-status.closed { background: #f3f0ec; color: #88837d; }
.asset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 19px 20px 12px; }
.asset-tile { display: grid; min-height: 105px; align-content: start; gap: 6px; border: 1px solid #efdfd1; border-top: 3px solid #c58468; border-radius: 5px; background: linear-gradient(135deg, #fffaf5, #fae9dc); padding: 12px; }
.asset-tile > span { color: #7f8580; font-size: 10px; }
.asset-tile strong { overflow-wrap: anywhere; color: #343936; font-size: 19px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.asset-tile small { color: #a2a5a1; font-size: 9px; }
.gift-tile { background: #fffaf5; }
.gift-tile strong { color: #9a704e; }
.points-tile { border-top-color: var(--green); background: linear-gradient(135deg, #f8fbf7, #e4f0e5); }
.points-tile strong { color: #55775f; }
.balance-breakdown { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto; align-items: center; gap: 8px; margin: 1px 20px 13px; border-top: 1px solid #f0efeb; border-bottom: 1px solid #f0efeb; padding: 12px 0; }
.balance-breakdown span { color: #929792; font-size: 10px; }
.balance-breakdown strong { color: #515753; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rule-note { display: flex; align-items: flex-start; gap: 9px; margin: 0 20px; border-left: 2px solid #d5b89e; background: #faf7f3; padding: 10px 12px; color: #777b77; font-size: 10px; line-height: 1.7; }
.rule-note strong { color: #8b573e; }
.note-icon { display: grid; width: 15px; height: 15px; flex: none; place-items: center; border-radius: 50%; background: #e9ded2; color: #84674e; font-family: serif; font-size: 11px; font-weight: 700; }
.panel-actions { display: flex; min-height: 70px; align-items: center; gap: 12px; padding: 13px 20px; }
.refund-button, .confirm-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 5px; background: var(--red); padding: 0 17px; color: white; font-size: 12px; font-weight: 600; cursor: pointer; }
.refund-button:hover, .confirm-button:hover { background: var(--red-dark); }
.refund-button:disabled, .confirm-button:disabled { background: #c7c6c2; cursor: not-allowed; }
.action-hint { color: #9a9e9a; font-size: 10px; }
.settlement-panel { margin-top: 6px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { height: 42px; background: #faf9f7; color: #7e847f; font-size: 10px; font-weight: 600; }
td { height: 52px; border-top: 1px solid #f0efeb; color: #535955; font-size: 11px; }
th, td { padding: 0 15px; }
.amount-cell { color: var(--red); font-weight: 700; font-variant-numeric: tabular-nums; }
.settled-badge { display: inline-block; border-radius: 10px; background: #eef4ef; padding: 4px 8px; color: #52745a; font-size: 10px; }
.empty-state { display: grid; min-height: 220px; align-content: center; justify-items: center; gap: 8px; color: #979c98; font-size: 11px; }
.empty-state strong { color: #5f6560; font-size: 13px; }
.empty-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #e8e8e3; border-radius: 50%; color: #9ba09c; font-size: 17px; }
.hidden { display: none !important; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; padding: 13px 0 3px; color: #aaaeaa; font-size: 9px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 12; max-width: min(440px, calc(100vw - 32px)); transform: translateY(12px); border: 1px solid #dcded9; border-radius: 6px; background: #fff; padding: 12px 16px; box-shadow: var(--shadow); color: #454a46; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.error { border-left: 3px solid var(--red); }
.toast.success { border-left: 3px solid var(--green); }
.confirm-dialog { position: fixed; width: min(450px, calc(100vw - 30px)); max-height: min(90vh, 680px); overflow: auto; border: 1px solid #e4e0d9; border-radius: 8px; background: white; padding: 25px 28px 21px; color: var(--ink); box-shadow: 0 24px 70px rgb(26 27 25 / 24%); }
.confirm-dialog::backdrop { background: rgb(30 33 30 / 42%); backdrop-filter: blur(2px); }
.dialog-close-form { position: absolute; top: 12px; right: 12px; }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 5px; background: transparent; color: #7e847f; cursor: pointer; }
.icon-button:hover { background: #f1f0ed; }
.close-button { font-size: 24px; }
.dialog-symbol { display: grid; width: 43px; height: 43px; place-items: center; margin-bottom: 17px; border-radius: 50%; background: #f6e9e2; color: var(--red); font-size: 21px; font-weight: 600; }
.confirm-dialog h2 { margin-bottom: 8px; font-size: 19px; }
.dialog-intro { margin-bottom: 18px; color: #7f8580; font-size: 11px; line-height: 1.7; }
.refund-summary { display: grid; grid-template-columns: 1fr auto; gap: 12px; border: 1px solid #efede8; border-radius: 5px; background: #fcfbf9; padding: 14px; }
.refund-summary span { color: #858b86; font-size: 11px; }
.refund-summary strong { color: #454a46; font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.refund-summary .refund-total-label { align-self: center; border-top: 1px solid #ece9e3; margin-top: 1px; padding-top: 12px; color: #555a56; font-weight: 700; }
.refund-summary .refund-total { border-top: 1px solid #ece9e3; margin-top: 1px; padding-top: 8px; color: var(--red); font-size: 22px; }
.destructive-note { display: flex; gap: 9px; margin-top: 14px; border: 1px solid #f0e2dc; border-radius: 5px; background: #fdf8f6; padding: 10px; color: #8b6254; font-size: 10px; line-height: 1.7; }
.destructive-note > span:first-child { display: grid; width: 16px; height: 16px; flex: none; place-items: center; border-radius: 50%; background: #f1ddd6; color: #9c5144; font-weight: 700; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 19px; }
.dialog-actions .secondary-button, .dialog-actions .confirm-button { min-height: 38px; }
.dialog-actions .confirm-button { padding: 0 13px; font-size: 11px; }
.dialog-footnote { margin: 14px 0 0; color: #a0a39f; font-size: 9px; text-align: right; }
.menu-toggle { display: none; }
.drawer-scrim { display: none; }

@media (max-width: 1000px) {
  .sidebar { width: 205px; }
  .workspace { margin-left: 205px; }
  #main-content { padding-right: 22px; padding-left: 22px; }
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  .asset-grid { gap: 7px; padding-right: 14px; padding-left: 14px; }
  .balance-breakdown { gap: 5px; margin-right: 14px; margin-left: 14px; }
}

@media (max-width: 720px) {
  .sidebar { width: min(280px, calc(100vw - 58px)); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 12px 0 34px rgb(40 36 31 / 10%); }
  .sidebar.drawer-open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .topbar { height: 56px; justify-content: flex-start; gap: 10px; padding: 0 14px; }
  .menu-toggle { display: flex; width: 34px; flex: none; flex-direction: column; gap: 4px; }
  .menu-toggle span { display: block; width: 17px; height: 1.5px; border-radius: 1px; background: #626965; }
  .topbar-right { gap: 9px; margin-left: auto; }
  .environment-label { font-size: 10px; }
  .avatar { width: 27px; height: 27px; }
  .breadcrumbs { gap: 6px; font-size: 11px; }
  #main-content { min-height: calc(100vh - 56px); padding: 22px 14px 16px; }
  .page-heading { min-height: 72px; align-items: flex-start; margin-bottom: 17px; }
  h1 { font-size: 21px; }
  .subheading { max-width: 275px; font-size: 11px; line-height: 1.55; }
  .heading-meta { padding-top: 25px; font-size: 10px; white-space: nowrap; }
  .filter-row { margin-bottom: 12px; }
  .search-field { height: 36px; }
  .content-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .member-panel { min-height: 0; }
  #member-list { display: flex; gap: 4px; overflow-x: auto; padding: 7px; }
  #member-list .member-row { width: 190px; min-width: 190px; min-height: 55px; border: 1px solid #f0efeb; border-radius: 5px; }
  .detail-heading { min-height: 77px; padding: 13px 14px; }
  .asset-grid { gap: 7px; padding: 13px 12px 10px; }
  .asset-tile { min-height: 91px; gap: 5px; padding: 9px 8px; }
  .asset-tile > span { font-size: 9px; }
  .asset-tile strong { font-size: 16px; }
  .asset-tile small { font-size: 8px; }
  .balance-breakdown { grid-template-columns: 1fr auto; gap: 9px; margin: 1px 13px 11px; padding: 11px 0; }
  .balance-breakdown span { font-size: 10px; }
  .balance-breakdown strong { font-size: 10px; }
  .rule-note { margin: 0 13px; }
  .panel-actions { min-height: 62px; padding: 11px 13px; }
  .page-footer { flex-direction: column; gap: 5px; margin-top: 20px; }
  .drawer-scrim.visible { position: fixed; inset: 0; z-index: 4; display: block; background: rgb(34 37 34 / 34%); }
  .confirm-dialog { padding: 22px 18px 17px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
  .table-wrap { margin-right: -1px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
.coach-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); align-items: start; gap: 20px; }
.coach-panel { padding: 20px; }
.coach-panel .panel-heading { padding: 0 0 16px; flex-wrap: wrap; }
.coach-panel > h2 { margin: 0; font-size: 16px; }
.coach-panel .member-row { min-width: 0; gap: 12px; }
.coach-panel .member-info { flex: 1; }
.coach-panel .member-info strong, .coach-panel .member-info small { white-space: normal; overflow-wrap: anywhere; }
.coach-panel .member-row > .subtle-count { margin-left: auto; }
.coach-form { display: grid; gap: 16px; margin-top: 20px; }
.coach-form label { display: grid; gap: 6px; font-size: 14px; }
.coach-form label { min-width: 0; }
.coach-form > button { position: sticky; bottom: 12px; min-height: 42px; box-shadow: 0 3px 12px rgb(42 39 34 / 12%); }
.coach-form input:not([type=checkbox]), .coach-form textarea, .coach-form select { width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid #d8d2cb; border-radius: 5px; background: #fff; color: var(--ink); font: inherit; box-sizing: border-box; }
.coach-form textarea { min-height: 86px; resize: vertical; }
.coach-form input[type=number] { font-variant-numeric: tabular-nums; }
.coach-form .member-row { text-align: left; }
.coach-form .coach-check { display: flex; align-items: center; }
@media (max-width: 1100px) { .coach-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .coach-panel { padding: 16px; } }
html[data-api-mode="session"]:not(.session-authenticated) .app-shell { display: none; }
.login-screen { min-height: 100dvh; display: grid; align-items: center; padding: 32px 20px; }
.login-screen[hidden] { display: none; }
.login-content { width: min(100%, 360px); margin: 0 auto; min-width: 0; }
.login-content h1 { font-size: 26px; margin-bottom: 12px; }
.login-content h2 { font-size: 18px; margin-bottom: 24px; }
.login-content input { width: 100%; box-sizing: border-box; min-height: 44px; }
.login-content button { min-height: 44px; width: 100%; }
#login-error { min-height: 24px; color: #a52424; overflow-wrap: anywhere; }
#sign-out { white-space: nowrap; }
