:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #69736f;
  --line: #d7ddd8;
  --line-strong: #c5d0c8;
  --panel: #fffefb;
  --soft: #eef4ef;
  --page: #f7f4ec;
  --green: #1f7a4a;
  --green-dark: #145f39;
  --green-soft: #e8f3eb;
  --orange: #f0a51a;
  --red: #b83a2e;
  --gold: #b7791f;
  --shadow: 0 18px 42px rgba(33, 43, 38, 0.1);
  --shadow-soft: 0 8px 22px rgba(33, 43, 38, 0.07);
}

.manager-home-page {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 24px 0 calc(104px + env(safe-area-inset-bottom));
}

.manager-home-heading,
.manager-home-chart > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.manager-home-greeting { margin: 0; color: var(--muted); font-size: 15px; font-weight: 750; }
.manager-home-heading h2 { margin: 5px 0 0; overflow: hidden; font-size: clamp(26px, 5vw, 40px); color: #123f2d; text-overflow: ellipsis; white-space: nowrap; }
.membership-home-entry {
  min-height: 44px;
  border: 1px solid #b9d4c3;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 800;
}

.manager-date-tabs,
.manager-list-date-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 9px;
  margin: 20px 0;
}

.manager-date-tabs button,
.manager-list-date-tabs button {
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}
.manager-date-tabs button.active,
.manager-list-date-tabs button.active { border-color: var(--green); background: var(--green); color: white; box-shadow: 0 8px 18px rgba(31, 122, 74, 0.16); }

.manager-home-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 12px;
}
.manager-home-metrics article {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}
.manager-home-metrics span,
.manager-home-metrics strong { display: block; }
.manager-home-metrics span { color: var(--muted); font-weight: 750; }
.manager-home-metrics strong { margin-top: 9px; font-size: clamp(23px, 4vw, 34px); color: var(--green-dark); }
.manager-home-metrics .manager-home-hero {
  position: relative;
  display: grid;
  align-content: center;
  overflow: hidden;
  min-height: 214px;
  padding: 28px;
  border: 0;
  background: linear-gradient(145deg, #126a41, #0c4f31);
  color: #fff;
  box-shadow: 0 20px 42px rgba(12, 79, 49, 0.22);
}
.manager-home-metrics .manager-home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 84% 18%, rgba(255,255,255,.16) 0 34px, transparent 35px),
    radial-gradient(circle at 73% 82%, rgba(255,255,255,.08) 0 62px, transparent 63px),
    linear-gradient(118deg, transparent 52%, rgba(255,255,255,.06) 52% 57%, transparent 57%);
  pointer-events: none;
}
.manager-home-metrics .manager-home-hero > * { position: relative; z-index: 1; }
.manager-home-metrics .manager-home-hero span,
.manager-home-metrics .manager-home-hero strong,
.manager-home-metrics .manager-home-hero small { color: #fff; }
.manager-home-metrics .manager-home-hero strong { margin: 14px 0 12px; font-size: clamp(42px, 8vw, 68px); line-height: 1; }
.manager-home-metrics .manager-home-hero small { color: rgba(255,255,255,.78); line-height: 1.6; }
.manager-home-supporting-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.manager-home-supporting-metrics article:last-child { grid-column: 1 / -1; }
.manager-home-supporting-metrics article { position: relative; min-height: 100px; padding-left: 54px; }
.manager-home-supporting-metrics article::before { position: absolute; top: 19px; left: 18px; }
.manager-home-chart {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
}
.manager-home-chart-heading { align-items: center; }
.manager-home-chart svg { display: block; width: 100%; min-height: 220px; margin-top: 14px; }
.home-trend-switch { display: flex; gap: 6px; padding: 4px; border-radius: 12px; background: var(--soft); }
.home-trend-switch button { min-height: 36px; border: 0; border-radius: 9px; padding: 0 12px; background: transparent; color: var(--muted); font-weight: 800; white-space: nowrap; }
.home-trend-switch button.active { background: #fff; color: var(--green-dark); box-shadow: 0 3px 10px rgba(23,33,28,.09); }
.manager-home-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.manager-quick-action { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; min-height: 82px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: #fff; text-align: left; box-shadow: var(--shadow-soft); }
.manager-quick-action > span { grid-row: 1 / span 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--green-soft); color: var(--green-dark); font-size: 24px; font-weight: 900; }
.manager-quick-action strong { color: var(--green-dark); font-size: 16px; }
.manager-quick-action small { color: var(--muted); }

.view-page { width: min(1040px, 100%); margin: 0 auto; padding: 20px 0 calc(106px + env(safe-area-inset-bottom)); }
.manager-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.manager-section-heading h2 { margin-top: 4px; color: #123f2d; font-size: clamp(26px, 5vw, 38px); }
.manager-heading-action { width: auto; min-width: 148px; border-radius: 14px; }
.manager-section-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin: 0 0 18px; padding: 5px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.76); }
.manager-section-tabs-three { grid-template-columns: repeat(3, 1fr); }
.manager-section-tabs button { min-height: 46px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 850; }
.manager-section-tabs button.active { background: var(--green); color: #fff; box-shadow: 0 8px 18px rgba(31,122,74,.16); }
.view-page .entry-panel,
.view-page .table-panel { border-radius: 20px; box-shadow: var(--shadow-soft); }
.view-page .entry-panel { padding: 22px; }
.view-page .table-panel { padding: 20px; }
.view-page input,
.view-page textarea,
.view-page select { min-height: 48px; border-radius: 13px; font-size: 16px; }
.nav-icon { height: 22px; }
.nav-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.manager-bottom-nav,
.staff-bottom-nav {
  position: fixed;
  z-index: 50;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -8px 24px rgba(23, 33, 28, 0.08);
  backdrop-filter: blur(14px);
}
.manager-bottom-nav { grid-template-columns: repeat(4, 1fr); }
.staff-bottom-nav { grid-template-columns: repeat(2, 1fr); }
.manager-bottom-nav button,
.staff-bottom-nav button {
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}
.manager-bottom-nav button span,
.staff-bottom-nav button span { display: block; margin-bottom: 3px; font-size: 19px; }
.manager-bottom-nav button.active,
.staff-bottom-nav button.active { background: var(--green-soft); color: var(--green-dark); }

.staff-sales-page { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }

.date-range-dialog {
  width: min(560px, calc(100% - 24px));
  border: 0;
  border-radius: 22px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(23, 33, 28, 0.24);
}
.date-range-dialog::backdrop { background: rgba(23, 33, 28, 0.46); }
.date-range-dialog form { position: relative; padding: 22px; }
.date-range-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.date-range-dialog h2 { margin: 3px 0 0; font-size: 22px; }
.date-range-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.date-range-picker fieldset { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 7px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.date-range-picker legend { padding: 0 5px; color: var(--green-dark); font-weight: 800; }
.date-range-picker select { min-width: 0; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 9px; background: white; }
.date-year-trigger { min-width: 0; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 9px; background: white; color: var(--ink); font: inherit; font-weight: 750; }
.year-picker-panel { position: absolute; inset: 14px; z-index: 5; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--page); box-shadow: 0 20px 55px rgba(23, 33, 28, .24); }
.year-picker-panel.hidden { display: none; }
.year-picker-panel header { margin-bottom: 10px; }
.year-picker-panel h3 { margin: 2px 0 0; color: var(--green-dark); font-size: 20px; }
.year-picker-list { display: grid; gap: 7px; min-height: 260px; max-height: min(58vh, 440px); overflow-y: auto; overscroll-behavior: contain; padding: 2px 4px 12px; scrollbar-gutter: stable; }
.year-picker-list button { min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-weight: 800; }
.year-picker-list button[aria-selected="true"] { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); box-shadow: inset 0 0 0 1px var(--green); }

.record-filter-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: initial; }
.record-filter-actions button { display: grid; align-content: center; gap: 2px; padding: 6px 10px; line-height: 1.15; }
.record-filter-actions button > span,
.record-filter-actions button > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-filter-actions button > span { color: var(--muted); font-size: 12px; font-weight: 750; }
.record-filter-actions button > strong { color: inherit; font-size: 14px; }
.record-filter-actions button.active > span { color: rgba(255, 255, 255, .78); }
.staff-record-filter-actions { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.record-filter-picker-dialog { width: min(520px, calc(100% - 24px)); background: var(--page); }
.record-filter-picker-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.record-filter-picker-fields fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--panel); }
.record-filter-picker-fields legend { padding: 0 5px; color: var(--green-dark); font-weight: 800; }
.record-filter-picker-fields select,
.record-filter-picker-fields .date-year-trigger { width: 100%; min-height: 46px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-weight: 750; }
.record-filter-picker-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }

@media (max-width: 720px) {
  .app-shell {
    width: 100%;
    padding: max(43px, env(safe-area-inset-top)) 19px calc(86px + env(safe-area-inset-bottom));
  }
  .app-shell { padding: 14px 14px calc(104px + env(safe-area-inset-bottom)); }
  .manager-home-page { padding: 12px 0 calc(96px + env(safe-area-inset-bottom)); }
  .manager-home-heading { align-items: flex-start; }
  .membership-home-entry { min-height: 40px; padding-inline: 12px; }
  .manager-home-metrics { grid-template-columns: 1fr; }
  .manager-home-metrics .manager-home-hero { min-height: 180px; padding: 24px 22px; }
  .manager-home-supporting-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .manager-home-supporting-metrics article:last-child { grid-column: auto; }
  .manager-home-supporting-metrics article { min-height: 104px; padding: 15px 10px; }
  .manager-home-supporting-metrics article::before { position: static; margin-bottom: 9px; }
  .manager-home-supporting-metrics strong { font-size: clamp(19px, 5.5vw, 26px); }
  .manager-date-tabs,
  .manager-list-date-tabs { gap: 6px; }
  .manager-date-tabs button,
  .manager-list-date-tabs button { min-height: 46px; padding: 0 6px; font-size: 14px; }
  .manager-home-chart { padding: 17px 12px; }
  .manager-home-chart-heading { align-items: flex-start; flex-direction: column; }
  .home-trend-switch { width: 100%; }
  .home-trend-switch button { flex: 1; padding-inline: 6px; }
  .manager-home-actions { grid-template-columns: 1fr; }
  .manager-quick-action { min-height: 72px; }
  .view-page { padding-top: 10px; }
  .manager-section-heading { align-items: flex-start; }
  .manager-heading-action { min-width: 132px; min-height: 46px; padding-inline: 12px; }
  .manager-section-heading h2 { font-size: 30px; }
  .manager-list-date-tabs { grid-auto-flow: initial; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
  .manager-section-tabs { position: sticky; top: 0; z-index: 9; backdrop-filter: blur(14px); }
  .view-page .entry-panel,
  .view-page .table-panel { padding: 17px 15px; }
  .date-range-picker { grid-template-columns: 1fr; }
  .record-filter-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .staff-record-filter-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .record-filter-actions button { min-height: 48px; padding: 5px 7px; font-size: 12px; }
  .record-filter-actions button > span { font-size: 10px; }
  .record-filter-actions button > strong { font-size: 12px; }
  .record-filter-picker-fields { grid-template-columns: 1fr; }
}

/* Staff accounts and performance */
.staff-feature-page,
.staff-sales-page {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 24px 0 48px;
}

.staff-page-summary { margin: -4px 0 16px; color: var(--muted); text-align: center; }

.staff-create-form,
.staff-performance-filters,
.staff-sale-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.staff-create-form label,
.staff-performance-filters label,
.staff-sale-form label { display: grid; gap: 7px; }

.staff-create-form label span,
.staff-performance-filters label span,
.staff-sale-form label span { color: var(--muted); font-size: 14px; font-weight: 700; }

.staff-create-form .primary-button,
.staff-filter-wide,
.staff-sale-form > .primary-button,
.staff-sale-form > .login-error,
.staff-date-note { grid-column: 1 / -1; }

.staff-member-list {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.staff-member-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.staff-member-row:last-child { border-bottom: 0; }

.staff-member-avatar,
.staff-sales-avatar {
  display: grid;
  place-items: center;
  border: 1px solid #b9d4c3;
  border-radius: 50%;
  background: #eef6f0;
  color: var(--green);
  font-weight: 800;
}
.staff-member-avatar { width: 42px; height: 42px; }
.staff-member-copy strong,
.staff-member-copy span { display: block; }
.staff-member-copy span { margin-top: 3px; color: var(--muted); font-size: 13px; }

.staff-member-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.staff-member-actions button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}
.staff-member-actions .danger { color: #a54238; }

.staff-performance-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.staff-performance-summary article { padding: 16px; border-right: 1px solid var(--line); }
.staff-performance-summary article:last-child { border-right: 0; }
.staff-performance-summary span { display: block; color: var(--muted); font-size: 13px; }
.staff-performance-summary strong { display: block; margin-top: 7px; font-size: 23px; }

.staff-ranking {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.staff-ranking-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.staff-ranking-row:last-child { border-bottom: 0; }
.staff-ranking-bar { height: 8px; overflow: hidden; border-radius: 4px; background: #e5ebe7; }
.staff-ranking-bar span { display: block; height: 100%; background: var(--green); }
.staff-detail-table { margin-top: 18px; }

.staff-sales-page h1 { margin: 4px 0 18px; text-align: center; }
.staff-sales-brand { color: var(--green); text-align: center; font-weight: 800; }
.staff-sales-profile {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}
.staff-sales-avatar { width: 50px; height: 50px; }
.staff-sales-profile strong,
.staff-sales-profile span { display: block; }
.staff-sales-profile span { color: var(--muted); font-size: 13px; }
.staff-sales-profile button { border: 0; background: transparent; color: #a54238; font-weight: 800; }
.staff-stock-hint { grid-column: 1 / -1; margin: -5px 0 0; color: var(--green); font-weight: 750; }
.staff-date-note { margin: -3px 0 0; color: var(--muted); font-size: 13px; }
.staff-today-panel { margin-top: 24px; }
.staff-today-panel h2 { font-size: 21px; }
.staff-today-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.staff-today-summary article { padding: 15px; border-right: 1px solid var(--line); }
.staff-today-summary article:last-child { border-right: 0; }
.staff-today-summary span { display: block; color: var(--muted); font-size: 13px; }
.staff-today-summary strong { display: block; margin-top: 6px; font-size: 22px; }
.staff-own-sales {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.staff-own-sale-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.staff-own-sale-row:last-child { border-bottom: 0; }
.staff-own-sale-row span { color: var(--muted); font-size: 13px; }
.staff-own-sale-row button {
  border: 1px solid #e0b9b4;
  border-radius: 5px;
  background: white;
  color: #a54238;
}

@media (max-width: 720px) {
  .staff-feature-page,
  .staff-sales-page { padding: 16px 0 36px; }
  .staff-create-form,
  .staff-performance-filters,
  .staff-sale-form { grid-template-columns: 1fr; padding: 14px; }
  .staff-create-form .primary-button,
  .staff-filter-wide,
  .staff-sale-form > .primary-button,
  .staff-sale-form > .login-error,
  .staff-date-note { grid-column: 1; }
  .staff-performance-summary { grid-template-columns: 1fr 1fr; }
  .staff-performance-summary article:nth-child(2) { border-right: 0; }
  .staff-performance-summary article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .staff-member-row { grid-template-columns: 42px 1fr; }
  .staff-member-actions { grid-column: 1 / -1; justify-content: stretch; }
  .staff-member-actions button {
    flex: 1;
    padding-inline: 5px;
    font-size: 12px;
    white-space: nowrap;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--page);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(31, 122, 74, 0.24);
  outline-offset: 2px;
}

a {
  text-decoration: none;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 22px;
}

.login-panel {
  display: grid;
  width: min(430px, 100%);
  gap: 16px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-mode-switch,
.phone-intent-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #e9eee9;
}

.login-mode-button,
.phone-intent {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.login-mode-button.active,
.phone-intent.active {
  background: var(--panel);
  color: var(--green-dark);
  box-shadow: 0 5px 14px rgba(33, 43, 38, 0.08);
}

.login-mode-button:active,
.phone-intent:active,
#requestPhoneCodeBtn:active,
#requestLegacyBindCodeBtn:active {
  transform: translateY(1px);
}

.auth-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.auth-panel > label,
.account-subcard > label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.auth-panel > label > span:first-child,
.account-subcard > label > span:first-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.phone-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.phone-code-row input {
  min-width: 0;
}

.phone-code-row button {
  min-width: 112px;
  white-space: nowrap;
}

.auth-panel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-bottom: 2px;
}

.auth-panel-heading strong {
  min-width: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.auth-back-button {
  font-size: 13px;
  white-space: nowrap;
}

.auth-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  gap: 12px;
}

.auth-link-row .text-button:first-child {
  min-width: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.auth-link-row .text-button:last-child {
  text-align: right;
  white-space: nowrap;
}

.auth-divider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid var(--green);
  border-radius: 9px;
  background: var(--panel);
  color: var(--green-dark);
  font-weight: 750;
}

.secondary-button:hover {
  background: var(--green-soft);
}

.legacy-upgrade-entry {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px dashed rgba(31, 122, 74, 0.42);
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.other-account-entry {
  justify-self: center;
  padding: 3px 0;
  font-size: 13px;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
}

.password-field:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 74, 0.12);
}

.password-field input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.password-field input:focus {
  outline: 0;
  box-shadow: none;
}

.password-toggle {
  min-width: 58px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--line);
  background: #f8faf8;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
}

.password-strength {
  margin-top: -6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.password-strength[data-strength="weak"] {
  color: var(--red);
}

.password-strength[data-strength="ready"] {
  color: var(--green-dark);
}

.sms-pending-note,
.legacy-entry-note {
  margin: 0;
  color: #765a25;
  font-size: 12px;
  line-height: 1.65;
}

.sms-pending-note {
  padding: 9px 11px;
  border-left: 3px solid #c5973d;
  background: #fbf5e8;
}

.legacy-entry-note {
  color: var(--muted);
}

.login-brand {
  display: grid;
  justify-items: start;
  gap: 7px;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(31, 122, 74, 0.18);
}

.login-tagline {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.login-error {
  margin: -6px 0 0;
  color: var(--red);
  font-size: 13px;
}

.login-notice {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.agreement-consent {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.agreement-consent input {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--green);
}

.agreement-consent label {
  display: inline;
  white-space: nowrap;
}

.agreement-consent .text-button {
  text-align: left;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 700;
}

.app-shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 22px 22px 96px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 92px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.topbar-main {
  display: grid;
  justify-items: center;
  text-align: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.top-actions,
.row-actions,
.panel-heading,
.panel-actions,
.tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
  width: min(420px, 100%);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.view-tab {
  min-width: 150px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.view-tab.active {
  background: var(--green);
  color: #fff;
}

.admin-home {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 28px 0;
}

.admin-card {
  display: grid;
  gap: 14px;
  width: min(620px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-card h2 {
  font-size: 28px;
}

.admin-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.admin-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.subnav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.subnav-button {
  --icon-color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.subnav-button.active {
  --icon-color: #fff;
  background: var(--green);
  color: #fff;
  box-shadow: 0 8px 18px rgba(31, 122, 74, 0.13);
}

[data-icon]::before {
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  background: var(--icon-color, currentColor);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

[data-icon="stats"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4 20.5a1 1 0 0 1-1-1v-15a1 1 0 0 1 2 0v14h15a1 1 0 1 1 0 2H4Z'/%3E%3Cpath d='M8.3 15.9a1 1 0 0 1-.75-1.66l3.2-3.7a1 1 0 0 1 1.27-.2l2.3 1.37 3.78-5.1a1 1 0 0 1 1.61 1.18l-4.32 5.83a1 1 0 0 1-1.31.25l-2.4-1.43-2.62 3.03a1 1 0 0 1-.76.43Z'/%3E%3Cpath d='M18 10.5a2.6 2.6 0 1 1 0 5.2 2.6 2.6 0 0 1 0-5.2Zm0 1.7a.9.9 0 1 0 0 1.8.9.9 0 0 0 0-1.8Z'/%3E%3Cpath d='M16.9 16.9h2.2a2.4 2.4 0 0 1 2.4 2.4v.2h-7v-.2a2.4 2.4 0 0 1 2.4-2.4Z'/%3E%3C/svg%3E");
}

[data-icon="sale"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M7 2.8h7.8a1 1 0 0 1 .7.3l3.7 3.7a1 1 0 0 1 .3.7v12.7a1 1 0 0 1-1 1H7a2.5 2.5 0 0 1-2.5-2.5V5.3A2.5 2.5 0 0 1 7 2.8Zm0 2a.5.5 0 0 0-.5.5v13.4a.5.5 0 0 0 .5.5h10.5V8.1L14.2 4.8H7Z'/%3E%3Cpath d='M13.8 3.3a1 1 0 0 1 1 1v3.1h3.1a1 1 0 1 1 0 2h-4.1a1 1 0 0 1-1-1V4.3a1 1 0 0 1 1-1Z'/%3E%3Cpath d='M12 10.5a1 1 0 0 1 1 1V14h2.5a1 1 0 1 1 0 2H13v2.5a1 1 0 1 1-2 0V16H8.5a1 1 0 1 1 0-2H11v-2.5a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E");
}

[data-icon="purchase"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 2h6a1 1 0 0 1 1 1v2h2.5A2.5 2.5 0 0 1 21 7.5V20a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7.5A2.5 2.5 0 0 1 5.5 5H8V3a1 1 0 0 1 1-1Zm1 3h4V4h-4v1ZM5.5 7a.5.5 0 0 0-.5.5V20h14V7.5a.5.5 0 0 0-.5-.5h-13Z'/%3E%3Cpath d='M12 10a1 1 0 0 1 1 1v2.5h2.5a1 1 0 1 1 0 2H13V18a1 1 0 1 1-2 0v-2.5H8.5a1 1 0 1 1 0-2H11V11a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E");
}

[data-icon="inventory"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7 12 3l9 4-9 4z'/%3E%3Cpath d='M3 7v10l9 4 9-4V7'/%3E%3Cpath d='M12 11v10'/%3E%3Cpath d='M7 9.2v4'/%3E%3C/svg%3E");
}

[data-icon="search"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m16.5 16.5 4 4'/%3E%3C/svg%3E");
}

[data-icon="avatar"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E");
}

[data-icon="store"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='m5 10 1-6h12l1 6'/%3E%3Cpath d='M5 10v10h14V10'/%3E%3Cpath d='M9 20v-6h6v6'/%3E%3Cpath d='M3 10a3 3 0 0 0 6 0 3 3 0 0 0 6 0 3 3 0 0 0 6 0'/%3E%3C/svg%3E");
}

[data-icon="device"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='2.5' width='12' height='19' rx='2.5'/%3E%3Cpath d='M10 5h4'/%3E%3Cpath d='M11 18.5h2'/%3E%3C/svg%3E");
}

[data-icon="lock"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='10' width='14' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
}

[data-icon="export"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2.5a1 1 0 0 1 1 1v10.1l3.1-3.1a1 1 0 0 1 1.4 1.4l-4.8 4.8a1 1 0 0 1-1.4 0l-4.8-4.8a1 1 0 0 1 1.4-1.4l3.1 3.1V3.5a1 1 0 0 1 1-1Z'/%3E%3Cpath d='M5 19.5a1 1 0 0 1 1-1h12a1 1 0 1 1 0 2H6a1 1 0 0 1-1-1Z'/%3E%3C/svg%3E");
}

[data-icon="staff"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Cpath d='M3 20a6 6 0 0 1 12 0'/%3E%3Ccircle cx='17' cy='10' r='2.5'/%3E%3Cpath d='M15 16a5 5 0 0 1 6 4'/%3E%3C/svg%3E");
}

[data-icon="performance"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19h16'/%3E%3Cpath d='M6 16V9'/%3E%3Cpath d='M12 16V5'/%3E%3Cpath d='M18 16v-4'/%3E%3Cpath d='m7 8 5-4 5 7'/%3E%3C/svg%3E");
}

[data-icon="logout"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 17 15 12 10 7'/%3E%3Cpath d='M15 12H3'/%3E%3Cpath d='M12 3h7a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-7'/%3E%3C/svg%3E");
}

[data-icon="revenue"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 2.8h6a1 1 0 0 1 .87 1.5L14.9 6h1.35A4.75 4.75 0 0 1 21 10.75v6A4.25 4.25 0 0 1 16.75 21h-9.5A4.25 4.25 0 0 1 3 16.75v-6A4.75 4.75 0 0 1 7.75 6H9.1l-.97-1.7A1 1 0 0 1 9 2.8Zm1.72 3.2h2.56l.69-1.2h-3.94l.69 1.2ZM7.75 8A2.75 2.75 0 0 0 5 10.75v6A2.25 2.25 0 0 0 7.25 19h9.5A2.25 2.25 0 0 0 19 16.75v-6A2.75 2.75 0 0 0 16.25 8h-8.5Z'/%3E%3Cpath d='M12 9.6a1 1 0 0 1 1 1v.45h1.3a1 1 0 1 1 0 2H13v.9h1.3a1 1 0 1 1 0 2H13v.45a1 1 0 1 1-2 0v-.45H9.7a1 1 0 1 1 0-2H11v-.9H9.7a1 1 0 1 1 0-2H11v-.45a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E");
}

[data-icon="cost"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M3.7 4.5a1 1 0 0 1 1.2.75l.38 1.75H20a1 1 0 0 1 .95 1.31l-1.9 5.9A2.7 2.7 0 0 1 16.48 16H8.32a2.7 2.7 0 0 1-2.64-2.13L4.25 7.3 3.95 6H2.8a1 1 0 0 1 0-2h2a1 1 0 0 1 .2.02Zm2.02 4.5 1.92 8.82a.7.7 0 0 0 .68.55h8.16a.7.7 0 0 0 .67-.48L18.62 9H5.72Z'/%3E%3Ccircle cx='8.6' cy='20' r='1.6'/%3E%3Ccircle cx='17.1' cy='20' r='1.6'/%3E%3C/svg%3E");
}

[data-icon="profit"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 17 9 12l4 3 7-8'/%3E%3Cpath d='M16 7h4v4'/%3E%3Cpath d='M4 21h16'/%3E%3C/svg%3E");
}

[data-icon="sold"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9.2 3h5.6a1 1 0 0 1 .76.35l2.36 2.75 2.33.95a1 1 0 0 1 .56 1.25l-1.6 4.45a1 1 0 0 1-1.24.62L16.5 12.9V20a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1v-7.1l-1.47.47a1 1 0 0 1-1.24-.62L3.2 8.3a1 1 0 0 1 .56-1.25l2.33-.95 2.36-2.75A1 1 0 0 1 9.2 3Zm.46 2L7.5 7.53a1 1 0 0 1-.38.28l-1.71.7.94 2.6 1.85-.6A1 1 0 0 1 9.5 11.45V19h5v-7.55a1 1 0 0 1 1.3-.95l1.85.6.94-2.6-1.71-.7a1 1 0 0 1-.38-.28L14.34 5H9.66Z'/%3E%3C/svg%3E");
}

[data-icon="purchase-total"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7 12 3l8 4-8 4z'/%3E%3Cpath d='M4 7v10l8 4 8-4V7'/%3E%3Cpath d='M12 11v10'/%3E%3Cpath d='M8 13h2'/%3E%3Cpath d='M8 16h2'/%3E%3C/svg%3E");
}

[data-icon="purchase-sold"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8h14l-1 12H6z'/%3E%3Cpath d='M9 8a3 3 0 0 1 6 0'/%3E%3Cpath d='m9 14 2 2 4-5'/%3E%3C/svg%3E");
}

[data-icon="purchase-remain"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7 12 3l8 4-8 4z'/%3E%3Cpath d='M4 7v10l8 4 8-4V7'/%3E%3Cpath d='M12 11v10'/%3E%3Cpath d='M15 15h4'/%3E%3C/svg%3E");
}

[data-icon="purchase-amount"] {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='14' rx='2'/%3E%3Cpath d='M8 9h8'/%3E%3Cpath d='M8 13h8'/%3E%3Cpath d='M12 9v8'/%3E%3C/svg%3E");
}

.icon-button,
.mini-button,
.ghost-button,
.primary-button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  font-size: 24px;
}

.danger {
  color: var(--red);
}

.section-kicker {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.profile-entry {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 10px 8px;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.profile-entry:hover {
  background: rgba(255, 255, 255, 0.5);
}

.profile-entry img,
.my-profile-summary img {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(31, 122, 74, 0.55);
  border-radius: 50%;
  background: var(--soft);
  object-fit: cover;
}

.membership-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin: 18px 0;
  padding: 20px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 255, 255, 0.22), transparent 34%),
    var(--green-dark);
  color: #fff;
  box-shadow: 0 16px 32px rgba(20, 95, 57, 0.18);
}

.membership-card-copy {
  display: grid;
  gap: 6px;
}

.membership-overline {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.membership-card-copy strong {
  font-size: clamp(21px, 3vw, 28px);
  letter-spacing: -0.03em;
}

.membership-card-copy small {
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
}

.membership-card .primary-button {
  border-color: rgba(255, 255, 255, 0.38);
  background: #fff;
  color: var(--green-dark);
}

.membership-page {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow-y: auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  background: #f7f4ec;
}

.membership-page-shell {
  width: min(960px, 100%);
  margin: 0 auto;
}

.membership-page .history-header {
  position: static;
  margin-bottom: 18px;
  padding: 10px 0 14px;
  background: transparent;
}

.membership-page-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefb;
  color: var(--green-dark);
  font-weight: 800;
}

.membership-page-back span[aria-hidden="true"] {
  font-size: 28px;
  line-height: 0.7;
}

.membership-center-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.membership-orders-entry { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 72px; margin-top: 8px; padding: 14px 16px; border: 1px solid rgba(255,255,255,.34); border-radius: 14px; background: rgba(255,255,255,.12); color: #fff; text-align: left; }
.membership-orders-entry span:first-child { display: grid; gap: 3px; }
.membership-orders-entry small { color: rgba(255,255,255,.76); }
.membership-orders-entry strong { font-size: 17px; }
.membership-orders-entry span[aria-hidden="true"] { font-size: 30px; line-height: 1; }
.membership-orders-shell { max-width: 720px; }

.membership-center-summary,
.membership-order-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.membership-center-summary {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 20px;
  background:
    radial-gradient(circle at 88% 8%, rgba(255, 255, 255, 0.2), transparent 34%),
    var(--green-dark);
  color: #fff;
}

.membership-center-summary > strong {
  font-size: clamp(22px, 3vw, 29px);
  letter-spacing: -0.03em;
}

#membershipCenterDate {
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.membership-plan-card {
  display: grid;
  gap: 16px;
  margin-top: 12px;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
}

.membership-plan-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.membership-plan-heading div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.membership-plan-heading div > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.membership-plan-heading strong {
  color: var(--green-dark);
  font-size: 30px;
  letter-spacing: -0.04em;
}

.membership-plan-duration {
  flex: none;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.membership-plan-rules {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.membership-benefits-title {
  color: var(--green-dark);
  font-size: 15px;
}

.membership-benefits-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 18px;
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.membership-rule-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.membership-rule-links a {
  color: var(--green-dark);
  font-size: 13px;
  text-underline-offset: 3px;
}

.membership-purchase-row {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.membership-purchase-row .primary-button {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.membership-payment-notice {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #e5b24f;
  border-radius: 8px;
  background: #fff8e6;
  color: #835a0d;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.membership-payment-notice.is-error {
  border-color: #e0aaa5;
  background: #fff2f0;
  color: var(--red);
}

.membership-payment-notice.membership-payment-guide {
  border-color: #9bc9ae;
  background: #eff8f2;
  color: var(--green-dark);
}

.membership-payment-notice.membership-payment-disabled {
  border-color: var(--line);
  background: #f7f5ef;
  color: var(--muted);
}

.membership-wechat-guide {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #aad0b8;
  border-radius: 14px;
  background: #f2f9f4;
  color: var(--green-dark);
}

.membership-wechat-guide ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 22px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.membership-service-account {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 12px;
  padding: 12px;
  border-radius: 10px;
  background: #fff;
}

.membership-service-account > span,
.membership-copy-status {
  color: var(--muted);
  font-size: 12px;
}

.membership-service-account > strong {
  grid-column: 1;
  font-size: 20px;
}

.membership-service-account > button {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.membership-copy-status {
  grid-column: 1 / -1;
  min-height: 1.3em;
}

.membership-qr-panel {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 14px;
  border-radius: 12px;
  background: #fff;
  text-align: center;
}

.membership-qr-panel img {
  width: min(240px, 100%);
  height: auto;
  border-radius: 8px;
}

.membership-wechat-guide .secondary-button {
  width: 100%;
}

.membership-wechat-guide small {
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 560px) {
  .membership-benefits-list {
    grid-template-columns: 1fr;
  }

  .membership-service-account {
    grid-template-columns: 1fr;
  }

  .membership-service-account > button,
  .membership-copy-status {
    grid-column: 1;
    grid-row: auto;
  }
}

.membership-support-copy {
  margin: 9px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  line-height: 1.55;
}

.membership-support-copy a {
  color: #fff;
  font-weight: 800;
  text-underline-offset: 3px;
}

.membership-order-panel {
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.membership-order-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.membership-order-heading h3 {
  margin: 3px 0 0;
  font-size: 20px;
}

.membership-order-heading small {
  color: var(--muted);
  text-align: right;
}

.membership-order-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.membership-order-item {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.membership-order-topline,
.membership-order-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 7px 12px;
  min-width: 0;
}

.membership-order-number {
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.membership-order-number span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.membership-order-status {
  flex: none;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.membership-order-status.is-pending {
  border-color: #e5b24f;
  background: #fff8e6;
  color: #835a0d;
}

.membership-order-status.is-paid {
  border-color: #b9d4c3;
  background: var(--green-soft);
  color: var(--green-dark);
}

.membership-order-status.is-refunded,
.membership-order-status.is-failed {
  border-color: #e0aaa5;
  background: #fff2f0;
  color: var(--red);
}

.membership-order-detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.membership-order-amount {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.membership-order-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 42px 14px;
  color: var(--muted);
  text-align: center;
}

.membership-order-empty strong {
  color: var(--ink);
}

.account-subcard {
  display: grid;
  gap: 13px;
  margin: 14px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
}

.account-subcard-heading strong,
.account-subcard-heading small {
  display: block;
}

.account-subcard-heading small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.55;
}

.session-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.session-row-copy {
  min-width: 0;
}

.session-row-copy strong,
.session-row-copy small {
  display: block;
}

.session-row-copy strong {
  overflow-wrap: anywhere;
}

.session-row-copy small,
.session-empty {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.session-current {
  color: var(--green);
  font-weight: 700;
}

.profile-entry-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.profile-entry-copy small {
  color: var(--muted);
  font-size: 13px;
}

.current-user {
  max-width: 100%;
  color: var(--ink);
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-entry-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 16px;
}

.profile-entry-link span {
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}

.admin-quick-actions {
  display: flex;
  justify-content: center;
}

#avatarInput,
.hidden-file {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.summary-panel {
  display: grid;
  gap: 16px;
  padding: 20px 0;
}

.summary-heading,
.summary-controls,
.chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segmented {
  display: inline-flex;
  min-height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segment {
  min-width: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment.active {
  background: var(--green);
  color: #fff;
}

.date-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 190px;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.date-option span {
  white-space: nowrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  column-gap: 13px;
  align-items: center;
  min-height: 96px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric[data-icon]::before,
.purchase-summary article[data-icon]::before {
  grid-row: 1 / span 2;
  width: 40px;
  height: 40px;
  margin-bottom: 0;
  background: var(--green);
}

[data-icon="cost"]::before,
[data-icon="sold"]::before,
[data-icon="purchase-amount"]::before,
[data-icon="performance"]::before {
  --icon-color: var(--orange);
  background: var(--orange);
}

[data-icon="logout"]::before {
  --icon-color: var(--red);
  background: var(--red);
}

.metric span,
label span,
.live-profit span,
.empty-state span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(20px, 2.5vw, 28px);
  line-height: 1.05;
  word-break: break-word;
}

.metric.accent {
  border-color: rgba(31, 122, 74, 0.45);
  background: #f1faf3;
}

.chart-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chart-heading {
  margin-bottom: 10px;
}

.chart-heading span {
  color: var(--muted);
  font-size: 13px;
}

.chart-wrap {
  position: relative;
  height: 240px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

#trendChart {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-axis,
.chart-grid {
  stroke: #d8dfda;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: #fff;
  stroke: var(--green);
  stroke-width: 2;
  cursor: pointer;
}

.chart-dot-hit {
  fill: transparent;
  cursor: pointer;
}

.chart-dot.active {
  fill: var(--green-soft);
  stroke-width: 4;
}

.chart-tooltip-box {
  fill: #fff;
  stroke: var(--line);
  stroke-width: 1;
  filter: drop-shadow(0 4px 8px rgba(23, 33, 28, 0.12));
}

.chart-tooltip-guide {
  stroke: rgba(31, 122, 74, 0.55);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.chart-tooltip-date {
  fill: var(--muted);
  font-size: 12px;
}

.chart-tooltip-value {
  fill: var(--green-dark);
  font-size: 14px;
  font-weight: 700;
}

.chart-label,
.chart-value,
.chart-empty {
  fill: var(--muted);
  font-size: 12px;
}

.chart-value {
  fill: var(--ink);
  font-weight: 700;
}

.chart-empty {
  font-size: 14px;
}

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

.workspace[data-sales-panel="entry"],
.purchase-workspace[data-purchase-panel="entry"] {
  grid-template-columns: minmax(300px, 560px);
  justify-content: center;
}

.purchase-workspace {
  padding-top: 22px;
}

.entry-panel,
.table-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.entry-panel {
  display: grid;
  gap: 15px;
  padding: 18px;
}

.panel-heading {
  justify-content: space-between;
}

.panel-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

label {
  display: grid;
  gap: 7px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cbd3ce;
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input {
  min-height: 42px;
}

select {
  min-height: 42px;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 74, 0.13);
}

.scan-panel {
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(31, 122, 74, 0.32);
  border-radius: 10px;
  background: #f4faf5;
}

.scan-toolbar,
.scan-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scan-preview {
  width: 100%;
  max-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.scan-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.draft-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.draft-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfb;
}

.draft-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.draft-heading span {
  color: var(--muted);
  font-size: 13px;
}

.draft-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.draft-row {
  display: grid;
  grid-template-columns: 0.58fr 1fr 1.1fr 0.72fr 0.72fr 0.78fr 0.9fr auto;
  gap: 6px;
  align-items: center;
}

.draft-row input {
  min-height: 36px;
  padding: 8px;
  font-size: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.live-profit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
  padding: 12px;
  border-radius: 10px;
  background: var(--green-soft);
}

.live-profit strong {
  color: var(--green-dark);
  font-size: 22px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(31, 122, 74, 0.16);
}

.ghost-button,
.mini-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.ghost-button:hover,
.mini-button:hover,
.icon-button:hover,
.avatar-button:hover {
  border-color: var(--line-strong);
  background: #f8faf8;
}

.table-panel {
  min-width: 0;
  padding: 16px;
}

.purchase-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.purchase-summary article {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  column-gap: 11px;
  align-items: center;
  min-height: 76px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfb;
}

.purchase-summary article[data-icon]::before {
  grid-row: 1 / span 2;
  width: 34px;
  height: 34px;
  margin-bottom: 0;
}

.purchase-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.purchase-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 21px;
  line-height: 1.05;
  word-break: break-word;
}

.tools {
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.search-heading {
  margin-bottom: 14px;
}

.search-box {
  width: min(420px, 100%);
}

.select-box {
  width: 180px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f0f4f1;
  color: #44504a;
  font-size: 13px;
  font-weight: 700;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.numeric {
  text-align: right;
  white-space: nowrap;
}

.profit {
  color: var(--green-dark);
  font-weight: 700;
}

.actions-cell {
  width: 120px;
  text-align: right;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 48px 16px;
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
}

.history-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 26px 70px rgba(33, 43, 38, 0.22);
}

.account-dialog {
  width: min(860px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 26px 70px rgba(33, 43, 38, 0.22);
}

.payment-orders-dialog {
  width: min(1160px, calc(100vw - 28px));
}

.payment-orders-heading {
  align-items: center;
}

.payment-orders-heading .form-hint {
  margin: 0;
}

.payment-order-table {
  max-height: 520px;
  overflow: auto;
}

.payment-order-table table {
  min-width: 1060px;
}

.payment-order-table td {
  overflow-wrap: anywhere;
}

.my-page {
  width: min(680px, 100%);
  min-height: 620px;
  margin: 0 auto;
  padding: 8px 0 28px;
}

.my-page:focus { outline: none; }

.admin-my-header {
  display: flex;
  align-items: center;
  min-height: 52px;
  margin-bottom: 8px;
}

.admin-my-home-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--green-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.admin-my-home-button span {
  font-size: 26px;
  line-height: 1;
}

.admin-my-home-button:focus-visible {
  outline: 3px solid rgba(45, 122, 82, .22);
  outline-offset: 2px;
}

.admin-my-privacy-note {
  margin: 12px 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.my-page-header {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

.my-page-header h2 {
  font-size: 26px;
}

.my-back-button {
  position: absolute;
  left: 0;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 40px;
  line-height: 1;
}

.my-profile-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 28px 12px;
  border-bottom: 1px solid var(--line);
}

.my-profile-summary img {
  width: 80px;
  height: 80px;
}

.my-profile-summary div {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.my-profile-summary strong {
  font-size: 26px;
  overflow-wrap: anywhere;
}

.my-profile-summary span {
  color: var(--muted);
  font-size: 16px;
}

.account-action-list {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.account-action-row {
  --icon-color: var(--green);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  width: 100%;
  min-height: 72px;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.account-action-row::before {
  width: 26px;
  height: 26px;
  padding: 9px;
  border-radius: 12px;
  background-color: var(--icon-color, var(--green));
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0);
}

.account-action-row.danger::before {
  background-color: var(--red);
}

.account-action-row:last-child {
  border-bottom: 0;
}

.account-action-row:hover {
  background: var(--soft);
}

.account-action-row > span:first-child {
  display: grid;
  flex: 1;
  gap: 5px;
  min-width: 0;
}

.account-action-row strong {
  font-size: 17px;
  overflow-wrap: anywhere;
}

.account-action-row small {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.account-action-row.danger strong {
  color: var(--red);
}

.account-action-chevron {
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}

.my-page-footnote {
  margin: 36px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.export-dialog {
  width: min(560px, calc(100vw - 28px));
}

.export-note {
  margin: 0;
  padding: 12px;
  border-left: 3px solid var(--green);
  background: var(--green-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.export-ready-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
  text-align: center;
}

.account-dialog::backdrop {
  background: rgba(23, 33, 28, 0.36);
}

.account-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.form-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.policy-content {
  max-height: min(600px, calc(100vh - 180px));
  margin: 0;
  overflow: auto;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.account-table-wrap table {
  min-width: 760px;
}

.authorization-history {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.compact-heading {
  margin-bottom: 0;
}

.compact-heading h3 {
  margin: 0;
  font-size: 18px;
}

.account-log-wrap {
  max-height: 260px;
  overflow: auto;
}

.account-log-wrap table {
  min-width: 680px;
}

.history-dialog::backdrop {
  background: rgba(23, 33, 28, 0.36);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.history-dialog .table-wrap {
  max-height: 480px;
  overflow: auto;
}

.hidden {
  display: none !important;
}

.manager-mobile-record-list {
  display: none;
}

.record-detail-dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  padding: 22px;
  border: 0;
  border-radius: 24px;
  background: var(--page);
  color: var(--ink);
}

.record-detail-dialog::backdrop { background: rgba(20, 31, 26, .42); }
.record-detail-header { position: relative; display: grid; place-items: center; min-height: 42px; }
.record-detail-header h2 { margin: 0; font-size: 20px; }
.record-detail-close { position: absolute; left: 0; width: 38px; height: 38px; border: 0; background: transparent; color: var(--green-dark); font-size: 32px; }
.record-detail-hero { display: grid; justify-items: center; gap: 5px; padding: 16px 0 14px; }
.record-detail-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--green-soft); color: var(--green-dark); font-weight: 900; }
.record-detail-hero strong { font-size: 16px; }
.record-detail-hero small { color: var(--muted); font-size: 10px; }
.record-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.record-detail-grid article { display: grid; gap: 5px; padding: 11px; border-radius: 13px; background: #f7f5ef; }
.record-detail-grid span { color: var(--muted); font-size: 9px; }
.record-detail-grid strong { font-size: 13px; }
.record-detail-grid .highlight strong { color: #a66a0c; }
.record-detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 10px; }
.record-detail-row span { color: var(--muted); }
.record-detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }

@media (max-width: 960px) {
  .app-shell {
    padding: 18px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
    padding-bottom: 0;
  }

  .purchase-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
    padding-bottom: 0;
  }

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

  .entry-panel,
  .table-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
  }

  .tools,
  .summary-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ghost-button,
  .icon-button {
    flex: 0 0 auto;
  }

  .view-switch {
    width: 100%;
  }

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

  .view-tab {
    min-width: 0;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .draft-actions {
    grid-template-columns: 1fr;
  }

  .draft-row {
    grid-template-columns: 0.7fr 1fr 1fr;
  }

  .draft-row .remove-draft-item-btn {
    grid-column: 1 / -1;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
  }

  .purchase-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: visible;
  }

  .metric {
    min-height: 82px;
    padding: 13px;
  }

  .metric[data-icon]::before {
    width: 22px;
    height: 22px;
    margin-bottom: 9px;
  }

  .summary-controls,
  .date-option,
  .date-range {
    width: 100%;
  }

  .segmented {
    width: 100%;
  }

  .segment {
    flex: 1;
  }

  .chart-wrap {
    height: 260px;
  }

  .chart-heading {
    align-items: flex-start;
  }

  .chart-heading span {
    max-width: 132px;
    text-align: right;
  }

  .my-page {
    min-height: calc(100vh - 28px);
  }

  .my-profile-summary {
    padding-inline: 8px;
  }

  .select-box,
  .search-box {
    width: 100%;
  }

  .table-wrap {
    border: 0;
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    word-break: break-word;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
  }

  td.numeric {
    text-align: left;
  }

  .actions-cell {
    width: auto;
  }

  .row-actions {
    justify-content: end;
  }

  .history-dialog {
    padding: 14px;
  }
}

/* Formal purchase + inventory query experience (approved 2026-08-03). */
.purchase-query-tools,
.inventory-query-tools {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: end;
  margin: 18px 0 14px;
}

.purchase-filter-actions,
.inventory-status-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.purchase-filter-actions > button,
.inventory-status-actions > button {
  min-height: 48px;
  padding: 8px 15px;
  border: 1px solid #d9d1c2;
  border-radius: 15px;
  background: #fff;
  color: #52615a;
  font: inherit;
  font-weight: 800;
}

.purchase-filter-actions > button:not(.ghost-button) {
  display: grid;
  gap: 2px;
  text-align: left;
}

.purchase-filter-actions span { font-size: 11px; color: var(--muted); }
.record-filter-actions.purchase-filter-actions button > strong { font-size: 13px; color: var(--green-dark); white-space: nowrap; }
.inventory-status-actions > button.active { background: #167649; border-color: #167649; color: #fff; }

.purchase-query-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.purchase-query-summary article {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 11px;
  min-height: 92px;
  padding: 15px;
  border: 1px solid #e2dacd;
  border-radius: 20px;
  background: #fff;
}

.summary-vector-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #e8f3ed;
  color: #147047;
}
.summary-vector-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.purchase-query-summary article > span:not(.summary-vector-icon) { color: #707b75; font-size: 13px; }
.purchase-query-summary strong { color: #123e2e; font-size: 24px; line-height: 1.1; overflow-wrap: anywhere; }

.query-feedback {
  margin: 10px 0;
  padding: 13px 15px;
  border-radius: 14px;
  background: #edf5f0;
  color: #35604c;
  font-weight: 700;
}
.query-feedback.query-error { background: #fff0ed; color: #9e382f; }

.manager-record-just-saved {
  border-color: #c79a36 !important;
  box-shadow: 0 0 0 3px rgba(199, 154, 54, 0.2), 0 12px 28px rgba(29, 88, 59, 0.12);
  animation: manager-record-saved-pulse 1.4s ease-out 1;
}

@keyframes manager-record-saved-pulse {
  0% { transform: translateY(0); }
  40% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}
.query-feedback button { margin-left: 8px; border: 0; background: transparent; color: inherit; font-weight: 900; text-decoration: underline; }

.manager-record-card-inventory,
.manager-record-card-purchase { cursor: pointer; }
.manager-record-icon svg,
.record-detail-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

.inventory-detail-dialog { overflow-x: hidden; }
.inventory-detail-dialog .record-detail-shell { width: 100%; max-width: 100%; max-height: min(86vh, 820px); overflow-x: hidden; overflow-y: auto; }
.inventory-detail-summary { display: grid; gap: 16px; }
.inventory-detail-heading { display: flex; align-items: center; gap: 12px; padding: 15px; border-radius: 18px; background: #f6f1e8; }
.inventory-detail-heading > span:last-child { display: grid; gap: 4px; min-width: 0; }
.inventory-detail-heading strong { color: #123e2e; font-size: 20px; overflow-wrap: anywhere; }
.inventory-detail-heading small { color: #737d77; }
.inventory-detail-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.inventory-detail-metrics article { display: grid; gap: 5px; padding: 12px; border: 1px solid #e2dacd; border-radius: 15px; background: #fff; }
.inventory-detail-metrics span { color: #737d77; font-size: 12px; }
.inventory-detail-metrics strong { color: #123e2e; font-size: 17px; }
.inventory-detail-metrics .inventory-abnormal { border-color: #e6a49a; background: #fff0ed; }
.inventory-detail-metrics .inventory-abnormal strong { color: #9e382f; }
.inventory-ledger-section { margin-top: 20px; }
.inventory-ledger-section h3 { margin: 0 0 9px; color: #123e2e; }
.inventory-ledger-section > div { display: grid; gap: 8px; }
.inventory-ledger-card { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 13px 14px; border: 1px solid #e2dacd; border-radius: 15px; background: #fff; }
.inventory-ledger-card > span { display: grid; min-width: 0; gap: 3px; }
.inventory-ledger-card small { color: #737d77; overflow-wrap: anywhere; }
.inventory-ledger-card > strong { white-space: nowrap; color: #147047; }

@media (max-width: 720px) {
  .purchase-query-tools,
  .inventory-query-tools { grid-template-columns: 1fr; gap: 10px; }
  .purchase-filter-actions,
  .inventory-status-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inventory-status-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .purchase-filter-actions > button,
  .inventory-status-actions > button { min-width: 0; padding: 8px 6px; font-size: 11px; }
  .purchase-query-summary { gap: 7px; }
  .purchase-query-summary article { grid-template-columns: 30px minmax(0, 1fr); min-height: 78px; padding: 10px 7px; column-gap: 6px; border-radius: 15px; }
  .summary-vector-icon { width: 30px; height: 30px; border-radius: 10px; }
  .summary-vector-icon svg { width: 18px; height: 18px; }
  .purchase-query-summary article > span:not(.summary-vector-icon) { font-size: 9px; }
  .purchase-query-summary strong {
    grid-column: 1 / -1;
    margin-top: 2px;
    font-size: clamp(13px, 3.6vw, 17px);
    white-space: nowrap;
  }
  .inventory-detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Approved mobile auth composition */
.login-screen {
  align-items: start;
  justify-items: center;
  padding: max(47px, env(safe-area-inset-top)) 23px 25px;
  background: linear-gradient(180deg, #e6f0ea 0, #f7f4ec 43%);
}

.login-panel {
  width: min(385px, 100%);
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

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

.login-logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(18, 106, 67, 0.17);
}

.login-brand-copy strong,
.login-brand-copy small { display: block; }
.login-brand-copy strong { font-size: 26px; line-height: 1.12; }
.login-brand-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.auth-panel {
  gap: 0;
  margin-top: 25px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: white;
  box-shadow: 0 15px 40px rgba(28, 49, 39, 0.07);
}

.auth-panel-heading strong { font-size: 22px; }
.auth-back-button { font-size: 11px; }
.manager-login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 16px 0 0;
  padding: 4px;
  border-radius: 12px;
  background: #eeeae1;
}
.manager-login-tabs button {
  min-height: 35px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #6d7972;
  font-size: 11px;
}
.manager-login-tabs button.active {
  background: white;
  color: var(--green);
  font-weight: 800;
}
.auth-panel > label { gap: 6px; margin-top: 13px; }
.auth-panel > label > span:first-child { color: var(--ink); font-size: 11px; font-weight: 800; }
.auth-panel input,
.auth-panel select,
.password-field { min-height: 46px; border-radius: 13px; font-size: 13px; }
.password-field input { min-height: 44px; }
.auth-panel .primary-button { min-height: 48px; margin-top: 16px; border-radius: 14px; font-size: 13px; }
.auth-link-row { margin-top: 13px; }
.auth-link-row .text-button { color: #627269; font-size: 10px; }
.login-migration-tip {
  margin: 14px 0 0;
  padding: 10px 11px;
  border-left: 4px solid #c88a21;
  border-radius: 10px;
  background: #faf0d8;
  color: #654918;
  font-size: 10px;
  line-height: 1.55;
}

/* Approved staff-only layout */
.staff-sales-page {
  width: min(390px, 100%);
  margin: 0 auto;
  padding: 18px 18px calc(88px + env(safe-area-inset-bottom));
}
.staff-entry-topbar,
.staff-records-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.staff-entry-topbar small,
.staff-records-topbar small { display: block; color: #78857d; font-size: 10px; }
.staff-entry-topbar strong { display: block; font-size: 20px; }
.staff-entry-topbar > span,
.staff-records-topbar > span {
  padding: 7px 9px;
  border-radius: 10px;
  background: #e3eee7;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
}
.staff-records-topbar h2 { margin: 1px 0 0; font-size: 20px; }
.staff-today-hero {
  padding: 17px;
  border-radius: 22px;
  background: linear-gradient(135deg, #155f40, #0e7b4a);
  color: white;
  box-shadow: 0 12px 28px rgba(17, 106, 67, 0.18);
}
.staff-today-hero small { opacity: 0.8; }
.staff-today-hero div { margin: 8px 0 5px; font-size: 24px; font-weight: 800; }
.staff-today-hero div span { font-size: inherit; }
.staff-today-hero p { margin: 0; opacity: 0.82; font-size: 11px; line-height: 1.6; }
.staff-entry-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 2px 9px;
}
.staff-entry-heading strong { font-size: 16px; }
.staff-entry-heading span { color: var(--green); font-size: 11px; }
.staff-sale-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
}
.staff-sale-form label { gap: 6px; margin-top: 14px; }
.staff-sale-form > label:first-child { margin-top: 0; }
.staff-sale-form label span { color: var(--ink); font-size: 12px; font-weight: 800; }
.staff-sale-form input,
.staff-sale-form select { min-height: 48px; border-radius: 14px; font-size: 14px; }
.staff-sale-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.staff-stock-hint {
  grid-column: 1;
  margin: 6px 0 0;
  padding: 10px;
  border: 1px solid #d6e5dc;
  border-radius: 12px;
  background: #f1f6f3;
  color: #496357;
  font-size: 11px;
}
.staff-date-note { grid-column: 1; margin: 10px 0 0; font-size: 11px; }
.staff-sale-form > .primary-button { grid-column: 1; min-height: 49px; margin-top: 16px; border-radius: 14px; }
.staff-sales-page .manager-list-date-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin: 4px 0 12px;
}
.staff-sales-page .manager-list-date-tabs button {
  min-height: 39px;
  border-radius: 12px;
  font-size: 12px;
}
.staff-record-search {
  display: grid;
  gap: 7px;
  margin-bottom: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
}
.staff-record-search label {
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 800;
}
.staff-record-search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.staff-filter-reset {
  border-color: #d9cfbf !important;
  background: #fffaf4 !important;
  color: #765d3a !important;
}
.staff-today-summary {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  overflow: visible;
  border: 0;
  background: transparent;
}
.staff-today-summary article {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 11px 9px;
  border: 1px solid var(--line) !important;
  border-radius: 16px;
  background: white;
}
.staff-today-summary article > div {
  display: contents;
  min-width: 0;
}
.staff-summary-icon {
  display: grid !important;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 9px;
  background: #e7f1eb;
  color: var(--green);
}
.staff-summary-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.staff-today-summary article > div > span {
  grid-column: 2;
  min-width: 0;
  font-size: 9px;
}
.staff-summary-value {
  display: block;
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
  margin-top: 4px;
  color: var(--green-dark);
  font-size: 16px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.staff-summary-value.is-long { font-size: 13px; letter-spacing: -0.02em; }
.staff-summary-value.is-very-long { font-size: 11px; letter-spacing: -0.04em; }
.staff-own-sales { margin-top: 0; overflow: visible; border: 0; border-radius: 0; background: transparent; }
.staff-own-sale-row {
  display: grid;
  grid-template-columns: 39px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  padding: 13px;
  border: 1px solid var(--line) !important;
  border-radius: 17px;
  background: white;
}
.staff-record-avatar {
  display: grid !important;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 13px;
  background: #e6f1ea;
  color: var(--green-dark) !important;
  font-size: 16px !important;
  font-weight: 850;
}
.staff-record-avatar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.staff-record-copy { min-width: 0; }
.staff-record-copy strong,
.staff-record-copy span,
.staff-record-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.staff-record-copy strong { font-size: 12px; }
.staff-record-copy span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.staff-record-copy small { margin-top: 4px; color: #829087; font-size: 9px; }
.staff-record-actions { display: grid; justify-items: end; gap: 7px; }
.staff-record-actions strong { color: var(--green-dark); font-size: 12px; white-space: nowrap; }
.staff-record-actions button {
  min-height: 28px;
  border: 1px solid #e2c5c0;
  border-radius: 9px;
  padding: 0 9px;
  background: #fffafa;
  color: #9a5048;
  font-size: 10px;
}
.staff-record-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 22px 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}
.staff-loading-dot {
  width: 22px;
  height: 22px;
  border: 3px solid #dce9e1;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: staff-record-spin .8s linear infinite;
}
@keyframes staff-record-spin { to { transform: rotate(360deg); } }
.staff-record-error strong { color: #8e413b; }
.staff-record-error span { font-size: 10px; }
.staff-record-error button,
.staff-record-load-more {
  min-height: 39px;
  border: 1px solid #bdd5c7;
  border-radius: 12px;
  padding: 0 17px;
  background: #eef6f1;
  color: var(--green-dark);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}
.staff-record-load-more { display: block; width: 100%; margin: 10px 0 0; }
.staff-record-empty { display: grid; gap: 6px; padding: 30px 15px; }
.staff-record-empty span { color: var(--muted); font-size: 10px; }
.staff-logout-button {
  width: 100%;
  min-height: 43px;
  margin-top: 13px;
  border: 1px solid #dccfc0;
  border-radius: 13px;
  background: white;
  color: #8a4942;
  font-size: 12px;
}
.staff-sales-page .staff-bottom-nav { max-width: 390px; margin: 0 auto; }

@media (max-width: 640px) {
  .login-screen { padding: max(47px, env(safe-area-inset-top)) 23px 25px; }
  .login-panel { margin-top: 0; padding: 0; }
  .staff-sales-page { padding: 18px 18px calc(88px + env(safe-area-inset-bottom)); }
  .staff-sale-form { padding: 16px; }
}

/* Approved mobile layout — matched to the reviewed 385px design board. */
@media (max-width: 720px) {
  .app-shell {
    width: 100%;
    padding: max(43px, env(safe-area-inset-top)) 19px calc(86px + env(safe-area-inset-bottom));
  }
  .manager-home-page {
    width: 100%;
    padding: 12px 0 calc(96px + env(safe-area-inset-bottom));
  }

  .manager-home-greeting { margin-bottom: 3px; font-size: 11px; line-height: 1.35; }
  .manager-home-heading { align-items: center; }
  .manager-home-heading h2 { max-width: calc(100vw - 142px); font-size: 20px; line-height: 1.16; }
  .membership-home-entry { min-height: 32px; padding: 7px 10px; border-radius: 12px; font-size: 10px; }

  .manager-date-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 14px 0 13px;
    padding: 4px;
    border-radius: 14px;
    background: #ebe7dc;
  }
  .manager-date-tabs button {
    min-height: 35px;
    padding: 2px 3px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    font-size: 10px;
    line-height: 1.15;
  }
  .manager-date-tabs button.active { background: #fff; color: var(--green-dark); box-shadow: 0 1px 5px rgba(20, 49, 34, .1); }

  .manager-home-metrics { display: block; }
  .manager-home-metrics .manager-home-hero {
    min-height: 0;
    padding: 17px 18px;
    border-radius: 23px;
  }
  .manager-home-metrics .manager-home-hero span { font-size: 10px; }
  .manager-home-metrics .manager-home-hero strong { margin-top: 7px; font-size: 30px; line-height: 1; }
  .manager-home-metrics .manager-home-hero small { margin-top: 10px; font-size: 9px; line-height: 1.45; }
  .manager-home-supporting-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 9px; }
  .manager-home-supporting-metrics article,
  .manager-home-supporting-metrics article:last-child {
    grid-column: auto;
    min-height: 74px;
    padding: 10px 8px;
    border-radius: 15px;
  }
  .manager-home-supporting-metrics article::before { position: static; width: 16px; height: 16px; margin-bottom: 5px; padding: 0; }
  .manager-home-supporting-metrics span { font-size: 8px; }
  .manager-home-supporting-metrics strong { margin-top: 4px; font-size: 13px; }

  .manager-home-chart { margin-top: 14px; padding: 10px 12px 15px; border-radius: 17px; }
  .manager-home-chart-heading { align-items: center; flex-direction: row; gap: 8px; }
  .manager-home-chart-heading h3 { font-size: 12px; }
  .home-trend-switch { width: auto; padding: 2px; border-radius: 10px; }
  .home-trend-switch button { min-height: 26px; padding: 3px 8px; font-size: 9px; }
  .manager-home-chart svg { min-height: 0; height: 118px; margin-top: 2px; }

  .manager-home-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
  .manager-quick-action {
    display: grid;
    justify-items: center;
    min-height: 70px;
    padding: 10px 3px;
    border-radius: 14px;
    text-align: center;
  }
  .manager-quick-action::before { width: 27px; height: 27px; margin: 0 0 5px; }
  .manager-quick-action strong { font-size: 11px; }
  .manager-quick-action small { margin-top: 2px; font-size: 8px; }

  .my-page { width: 100%; min-height: 0; padding: 8px 0 calc(90px + env(safe-area-inset-bottom)); }
  .my-profile-summary { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 11px; padding: 12px 3px 15px; border: 0; }
  .my-profile-summary img { width: 52px; height: 52px; border-radius: 16px; }
  .my-profile-summary .my-profile-copy { gap: 4px; }
  .my-profile-summary strong { font-size: 18px; line-height: 1.2; }
  .my-profile-summary span { font-size: 10px; }
  .my-role-badge { align-self: start; padding: 5px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark) !important; font-size: 9px !important; font-weight: 800; }

  .my-page .membership-card { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 0 0 14px; padding: 14px; border-radius: 18px; }
  .my-page .membership-overline { font-size: 9px; }
  .my-page .membership-card-copy { gap: 3px; }
  .my-page .membership-card-copy strong { font-size: 17px; }
  .my-page .membership-card-copy small { font-size: 9px; }
  .my-page .membership-card .primary-button { width: auto; min-height: 34px; padding: 7px 10px; font-size: 10px; white-space: nowrap; }

  .my-menu-section { margin-top: 13px; }
  .my-section-title { margin: 0 0 7px 3px; font-size: 11px; color: var(--muted); }
  .my-menu-panel,
  .my-logout-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
  .my-logout-panel { margin-top: 13px; }
  .my-page .account-action-list { margin: 0; }
  .my-page .account-action-row,
  .my-detail-dialog .account-action-row { min-height: 51px; padding: 9px 12px; gap: 9px; }
  .my-page .account-action-row::before,
  .my-detail-dialog .account-action-row::before { width: 18px; height: 18px; padding: 6px; border-radius: 9px; }
  .my-page .account-action-row strong,
  .my-detail-dialog .account-action-row strong { font-size: 12px; }
  .my-page .account-action-row small,
  .my-detail-dialog .account-action-row small { font-size: 9px; }
  .my-page .account-action-chevron,
  .my-detail-dialog .account-action-chevron { font-size: 20px; }
  .my-page-footnote { margin-top: 18px; font-size: 9px; }

  .my-detail-dialog {
    width: min(385px, 100vw);
    min-height: 100dvh;
    max-height: 100dvh;
    margin: 0 auto;
    padding: max(43px, env(safe-area-inset-top)) 20px calc(30px + env(safe-area-inset-bottom));
    border: 0;
    background: var(--page);
  }
  .my-detail-dialog::backdrop { background: rgba(16, 31, 24, .34); }
  .my-detail-header { position: relative; display: grid; place-items: center; min-height: 44px; margin-bottom: 14px; }
  .my-detail-header h2 { margin: 0; font-size: 18px; }
  .my-detail-close { position: absolute; left: -7px; width: 38px; height: 38px; border: 0; background: transparent; color: var(--green-dark); font-size: 30px; }
  .my-detail-card,
  .my-detail-dialog .account-subcard { display: grid; gap: 7px; margin-bottom: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
  .my-detail-card span { color: var(--muted); font-size: 10px; }
  .my-detail-card strong { font-size: 14px; }
  .store-profile-form { display: grid; gap: 12px; margin-bottom: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
  .store-profile-form label { display: grid; gap: 7px; color: var(--ink); font-weight: 700; }
  .store-profile-form input { min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink); font: inherit; }
  .store-profile-required .my-detail-header { margin-top: 10px; }

  .view-page { width: 100%; padding: 0 0 calc(88px + env(safe-area-inset-bottom)); }
  .manager-section-heading { align-items: center; gap: 10px; margin: 0 0 13px; }
  .manager-section-heading .section-kicker { margin: 0 0 2px; font-size: 9px; }
  .manager-section-heading h2 { margin: 0; font-size: 23px; line-height: 1.15; }
  .manager-heading-action { min-width: 0; min-height: 39px; padding: 8px 12px; border-radius: 13px; font-size: 11px; }

  .manager-list-date-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin: 0 0 13px; }
  .manager-list-date-tabs button { min-height: 36px; padding: 3px 2px; border-radius: 10px; font-size: 9px; line-height: 1.12; }
  .manager-section-tabs { position: static; gap: 0; margin: 0 0 11px; padding: 4px; border-radius: 13px; background: #ebe7dd; backdrop-filter: none; }
  .manager-section-tabs button { min-height: 37px; padding: 4px 2px; border-radius: 10px; font-size: 11px; }
  .manager-section-tabs button.active { background: #fff; color: var(--green-dark); box-shadow: 0 3px 10px rgba(27,47,37,.08); }

  .view-page .entry-panel,
  .view-page .table-panel { padding: 13px; border-radius: 19px; box-shadow: none; }
  .view-page .panel-heading { margin-bottom: 10px; }
  .view-page .panel-heading h2 { font-size: 13px; }
  .view-page .panel-heading .section-kicker,
  .view-page .filter-help { font-size: 9px; line-height: 1.45; }
  .view-page .tools { gap: 7px; margin-bottom: 10px; }
  .view-page .search-box,
  .view-page .select-box { gap: 5px; }
  .view-page .search-box span,
  .view-page .select-box span,
  .view-page .entry-panel label > span { font-size: 10px; }
  .view-page input,
  .view-page textarea,
  .view-page select { min-height: 40px; padding: 8px 10px; border-radius: 11px; font-size: 11px; }
  .view-page textarea { min-height: 90px; }
  .view-page .form-row { gap: 8px; }
  .view-page .entry-panel label { gap: 5px; }
  .view-page .entry-panel .primary-button { min-height: 44px; border-radius: 13px; font-size: 12px; }
  .view-page .ghost-button { min-height: 34px; padding: 6px 9px; font-size: 10px; }
  .view-page .live-profit { padding: 10px 12px; border-radius: 14px; }
  .view-page .live-profit span { font-size: 9px; }
  .view-page .live-profit strong { font-size: 15px; }

  .view-page .table-wrap { border: 0; }
  .view-page .table-wrap { display: none; }
  .manager-mobile-record-list { display: grid; gap: 9px; }
  .manager-record-card {
    width: 100%;
    padding: 12px;
    border: 1px solid #e7e1d6;
    border-radius: 17px;
    background: #fff;
    color: var(--ink);
    text-align: left;
  }
  .manager-record-card-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
  .manager-record-product { display: flex; min-width: 0; gap: 9px; }
  .manager-record-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: var(--green-soft); color: var(--green-dark); font-size: 12px; font-weight: 900; }
  .manager-record-product > span:last-child { display: grid; min-width: 0; gap: 4px; }
  .manager-record-product strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .manager-record-product small { color: var(--muted); font-size: 8px; }
  .manager-record-amount { flex: 0 0 auto; font-size: 13px; }
  .manager-record-card-footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; padding-top: 8px; border-top: 1px solid #f0ece5; color: var(--muted); font-size: 8px; }
  .manager-record-card-action { color: var(--green-dark); font-weight: 800; }
  .view-page tbody { gap: 9px; }
  .view-page tr { overflow: hidden; border-color: #e7e1d6; border-radius: 17px; }
  .view-page td { grid-template-columns: 82px minmax(0, 1fr); gap: 8px; padding: 8px 10px; font-size: 10px; }
  .view-page td::before { font-size: 9px; }
  .view-page .row-actions button { min-height: 30px; padding: 4px 8px; font-size: 9px; }
  .view-page .empty-state { padding: 24px 12px; border-radius: 16px; font-size: 10px; }

  .purchase-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 9px 0 11px; }
  .purchase-summary article { min-height: 68px; padding: 10px; border-radius: 13px; }
  .purchase-summary article[data-icon]::before { width: 17px; height: 17px; }
  .purchase-summary span { font-size: 9px; }
  .purchase-summary strong { margin-top: 4px; font-size: 14px; }
  .draft-actions { gap: 7px; }
  .draft-panel { border-radius: 14px; }

  .record-detail-dialog {
    width: min(385px, 100vw);
    min-height: 100dvh;
    max-height: 100dvh;
    margin: 0 auto;
    padding: max(43px, env(safe-area-inset-top)) 19px calc(24px + env(safe-area-inset-bottom));
    border-radius: 0;
  }

  .manager-bottom-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .manager-bottom-nav,
  .staff-bottom-nav { min-height: 70px; padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .manager-bottom-nav button,
  .staff-bottom-nav button { min-width: 0; min-height: 52px; padding: 3px 1px; border-radius: 12px; font-size: 9px; }
  .manager-bottom-nav button span,
  .staff-bottom-nav button span { margin-bottom: 2px; font-size: 9px; }
  .nav-icon svg { width: 20px; height: 20px; }
}

@media (max-width: 640px) {
  .login-screen {
    align-items: start;
    padding: 14px;
  }

  .login-panel {
    margin-top: 8px;
    padding: 22px 18px 24px;
  }

  .phone-code-row {
    grid-template-columns: minmax(0, 1fr) 108px;
  }

  .phone-code-row button {
    min-width: 0;
    padding-inline: 8px;
  }

  .auth-panel-heading {
    align-items: start;
  }

  .auth-link-row {
    gap: 8px;
  }

  .membership-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-card-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-table-wrap { overflow: visible; }
  .account-table-wrap table { min-width: 0; }
  .account-log-wrap { overflow: visible; }
  .account-log-wrap table { min-width: 0; }

  .payment-order-table {
    max-height: none;
    overflow: visible;
  }

  .payment-order-table table {
    min-width: 0;
  }

  .payment-orders-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .membership-page {
    padding: max(10px, env(safe-area-inset-top)) 12px max(22px, env(safe-area-inset-bottom));
  }

  .membership-center-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .membership-center-summary,
  .membership-order-panel {
    padding: 15px;
  }

  .membership-order-heading {
    align-items: start;
    flex-direction: column;
  }

  .membership-order-heading small {
    text-align: left;
  }

  .membership-card .primary-button,
  #confirmLegacyBindBtn {
    width: 100%;
  }
}

/* Manager sales history: approved searchable-record layout. */
.sales-query-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) repeat(3, max-content);
  align-items: end;
  gap: 10px;
}

.sales-query-tools .search-box {
  width: 100%;
}

.sales-filter-button {
  display: grid;
  min-width: 132px;
  min-height: 58px;
  gap: 4px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.sales-filter-button span {
  color: var(--muted);
  font-size: 11px;
}

.sales-filter-button strong {
  overflow: hidden;
  max-width: 150px;
  color: var(--green-dark);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-filter-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.sales-filter-summary article {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  min-width: 0;
  min-height: 88px;
  padding: 14px;
  border: 1px solid #e5ddd0;
  border-radius: 18px;
  background: #fff;
}

.sales-summary-icon {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--green-soft);
  color: var(--green-dark);
}

.sales-summary-icon svg,
.sales-table-avatar svg,
.manager-record-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sales-filter-summary article > span:not(.sales-summary-icon) {
  color: var(--muted);
  font-size: 12px;
}

.sales-filter-summary strong {
  min-width: 0;
  color: var(--green-dark);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.sales-filter-summary article[data-sales-metric="profit"] .sales-summary-icon,
.sales-filter-summary article[data-sales-metric="profit"] strong {
  color: #a96d09;
}

.sales-query-error,
.sales-mutation-notice {
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 13px;
  font-size: 13px;
}

.sales-query-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #ebc8c2;
  background: #fff5f3;
  color: #9d3f34;
}

.sales-mutation-notice {
  border: 1px solid #bedbcc;
  background: #eef8f2;
  color: var(--green-dark);
}

.sales-loading-state {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 13px;
}

.sales-loading-state span {
  height: 74px;
  border-radius: 16px;
  background: linear-gradient(100deg, #f0ece4 20%, #faf8f3 42%, #f0ece4 64%);
  background-size: 220% 100%;
  animation: sales-loading-shimmer 1.25s ease-in-out infinite;
}

@keyframes sales-loading-shimmer {
  to { background-position: -220% 0; }
}

.sales-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.sales-record-row {
  cursor: pointer;
}

.sales-record-row:focus-visible {
  outline: 3px solid rgba(24, 126, 80, .28);
  outline-offset: -3px;
}

.sales-product {
  display: flex;
  align-items: center;
  min-width: 190px;
  gap: 10px;
}

.sales-product > span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.sales-product strong,
.sales-product small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-product small {
  color: var(--muted);
  font-size: 11px;
}

.sales-table-avatar {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 900;
}

@media (max-width: 720px) {
  .sales-query-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 7px;
  }

  .sales-query-tools .search-box {
    grid-column: 1 / -1;
  }

  .sales-query-tools #resetSalesFiltersBtn {
    min-height: 44px;
  }

  .sales-filter-button {
    min-width: 0;
    min-height: 44px;
    padding: 7px 9px;
    border-radius: 11px;
  }

  .sales-filter-button span { font-size: 9px; }
  .sales-filter-button strong { max-width: none; font-size: 10px; }

  .sales-filter-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 11px;
  }

  .sales-filter-summary article {
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 67px;
    padding: 8px 6px;
    border-radius: 13px;
  }

  .sales-summary-icon {
    width: 25px;
    height: 25px;
    border-radius: 8px;
  }

  .sales-summary-icon svg { width: 16px; height: 16px; }
  .sales-filter-summary article > span:not(.sales-summary-icon) { font-size: 8px; }
  .sales-filter-summary strong { font-size: clamp(13px, 4.2vw, 17px); }

  .sales-loading-state {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .sales-loading-state span { height: 83px; }

  .sales-query-error {
    align-items: stretch;
    flex-direction: column;
  }

  .sales-pagination {
    justify-content: space-between;
    font-size: 9px;
  }

  .manager-record-card-sales .manager-record-product strong {
    max-width: 42vw;
  }
}

@media (max-width: 360px) {
  .sales-filter-summary article {
    grid-template-columns: 1fr;
    grid-template-rows: 24px auto auto;
  }
  .sales-summary-icon { grid-row: auto; }
}

/* Keep the approved auth board authoritative over legacy narrow-screen rules. */
@media (max-width: 640px) {
  .login-screen {
    align-items: start;
    padding: max(47px, env(safe-area-inset-top)) 23px 25px;
  }
  .login-panel {
    margin-top: 0;
    padding: 0;
  }
}
