:root {
  color-scheme: light;
  --background: #f5f6f2;
  --paper: #fff;
  --soft: #f3f5f0;
  --ink: #1c2821;
  --muted: #5c685f;
  --subtle: #707a71;
  --line: #e3e7e0;
  --line-strong: #d8dfd6;
  --forest: #17251f;
  --forest-active: #2c4135;
  --brand: #dec58a;
  --green: #2e654e;
  --green-strong: #26563f;
  --green-light: #e7f0e9;
  --gold-light: #f6eddb;
  --gold-dark: #795d25;
  --red: #a34d44;
  --red-light: #faeeeb;
  --focus: #3a805c;
  --sidebar-width: 216px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--background); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .51; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { display: block; }
h1, h2, h3, p, dl, ul { margin: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, canvas:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: 0; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.sr-only { position: absolute; clip-path: inset(50%); inline-size: 1px; block-size: 1px; overflow: hidden; white-space: nowrap; }
.skip-link { position: fixed; z-index: 30; inset: 10px auto auto 10px; padding: 10px 16px; border-radius: 8px; background: var(--paper); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100dvh; z-index: 12; min-height: 0;
  display: flex; flex-direction: column; overflow-y: auto;
  background: var(--forest); color: #e6eee6; padding: 27px 17px 19px;
}
.brand { display: flex; align-items: center; gap: 11px; margin: 0 4px 34px; min-height: 45px; }
.brand img { width: 66px; height: auto; object-fit: contain; }
.brand > span { border-left: 1px solid #475448; padding-left: 11px; color: #f4f5ed; font-size: .925rem; font-weight: 700; line-height: 1.28; white-space: nowrap; }
.brand-subtitle { display: block; font-size: .72rem; font-weight: 500; color: #adb9a9; margin-top: 3px; }
.nav-group { margin-bottom: 24px; }
.nav-caption { color: #9aab9d; font-size: .75rem; font-weight: 560; padding: 0 11px; margin: 0 0 8px; letter-spacing: .035em; }
.nav-link { position: relative; min-height: 45px; padding: 9px 11px; display: flex; align-items: center; gap: 11px; color: #cad6ca; border-radius: 8px; font-weight: 560; font-size: .94rem; margin: 2px 0; }
.nav-link .icon, .reset-button .icon { width: 17px; height: 17px; }
.nav-link:hover, .reset-button:hover { background: #26382e; color: white; }
.nav-link[aria-current] { background: var(--forest-active); color: #fbf8ee; }
.nav-link[aria-current] .icon { color: var(--brand); }
.nav-link[aria-current]::after { content: ""; position: absolute; inset: 12px 0 12px auto; width: 2px; border-radius: 2px; background: var(--brand); }

.main-shell { min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 64px;
  padding: 9px clamp(20px, 3vw, 44px); border-bottom: 1px solid var(--line);
  background: #fbfcf9; position: sticky; top: 0; z-index: 7;
}
.top-start, .top-tools, .breadcrumb { display: flex; align-items: center; gap: 11px; min-width: 0; }
.breadcrumb { font-size: .87rem; color: var(--muted); gap: 9px; }
.breadcrumb .icon { width: 13px; height: 13px; color: var(--subtle); }
.breadcrumb strong { color: var(--ink); font-weight: 650; white-space: nowrap; }
.top-tools { flex: 0 0 auto; gap: 13px; }
.icon-button:hover, .button:hover { background: var(--soft); }
.logout { color: var(--muted); min-height: 35px; padding-inline: 10px; font-size: .83rem; }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); flex: 0 0 auto; }
.menu-button, .mobile-nav, .nav-scrim, .mobile-brand { display: none; }

main { margin: 0 auto; padding: 30px clamp(20px, 3vw, 44px) 43px; max-width: 1670px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 25px; }
.page-heading h1 { font-size: clamp(1.95rem, 2.8vw, 2.5rem); font-weight: 740; line-height: 1.18; letter-spacing: -.035em; }
.page-heading p { color: var(--muted); font-size: .9rem; line-height: 1.5; margin-top: 8px; }
.period-control { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; }
.period-date { color: var(--subtle); font-size: .78rem; font-variant-numeric: tabular-nums; padding-right: 2px; }
.segment { display: inline-flex; align-items: stretch; gap: 2px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 9px; background: #eef1eb; }
.segment button { min-height: 34px; background: transparent; border: 1px solid transparent; padding: 4px 11px; color: var(--muted); white-space: nowrap; border-radius: 6px; font-size: .84rem; font-weight: 570; }
.segment button:hover { color: var(--ink); }
.segment button[aria-pressed="true"] { color: var(--green-strong); background: var(--paper); border-color: #dfe5dc; box-shadow: 0 1px 1px #132b1910; font-weight: 700; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; min-width: 0; }
.card-heading { display: flex; gap: 8px; justify-content: space-between; align-items: flex-start; padding: 17px 20px 0; }
.card-heading h2, .section-heading h2 { font-size: 1.05rem; letter-spacing: -.012em; font-weight: 700; line-height: 1.4; }
.card-heading p { margin-top: 3px; font-size: .79rem; color: var(--muted); }
.quiet-button { background: transparent; border: 0; border-radius: 6px; color: var(--green-strong); padding: 4px 7px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: .85rem; font-weight: 650; text-align: center; }
.quiet-button:hover { background: var(--green-light); }
.button { border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 7px 13px; background: var(--paper); border-radius: 8px; color: var(--ink); font-size: .9rem; font-weight: 650; line-height: 1.35; white-space: nowrap; }
.button .icon, .quiet-button .icon { height: 16px; width: 16px; }
.button.primary { color: white; background: var(--green-strong); border-color: var(--green-strong); }
.button.primary:hover { background: #204b37; }
.button.danger { color: #8d3d36; border-color: #f0dcd6; background: #fff; }
.button.danger:hover { background: var(--red-light); }
.button.danger-fill { background: #953d37; color: white; border-color: #953d37; }
.button.danger-fill:hover { background: #81312b; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { padding: 15px 15px 14px; min-height: 116px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; gap: 5px; }
.stat-label { font-size: .88rem; color: var(--muted); font-weight: 590; }
.stat-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; color: var(--green-strong); background: var(--green-light); }
.stat-icon .icon { width: 16px; height: 16px; }
.stat-icon.gold { color: #826533; background: var(--gold-light); }
.stat-value { display: block; font-size: clamp(1.65rem, 2.55vw, 2.08rem); font-weight: 710; font-variant-numeric: tabular-nums; letter-spacing: -.045em; line-height: 1.13; margin: 5px 0 7px; }
.stat-context { color: var(--subtle); font-size: .78rem; display: flex; gap: 7px; align-items: baseline; flex-wrap: wrap; }
.delta { color: var(--green-strong); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.down { color: var(--red); }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.88fr) minmax(302px, 1fr); gap: 17px; align-items: stretch; }
.trend-card { min-width: 0; }
.trend-card .card-heading { align-items: flex-start; }
.chart-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex-wrap: wrap; }
.legend-button { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 5px; min-height: 34px; padding: 4px 6px; background: transparent; color: var(--muted); white-space: nowrap; font-size: .76rem; }
.legend-button:hover { background: var(--soft); }
.legend-button[aria-pressed="false"] { opacity: .52; text-decoration: line-through; }
.legend-sample { display: inline-block; width: 13px; height: 3px; border-radius: 4px; background: #376c54; }
.legend-sample.registrations { background: #91a991; }
.chart-body { position: relative; padding: 8px 17px 13px 10px; }
.chart-wrap { width: 100%; position: relative; height: 247px; min-width: 0; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; border-radius: 4px; outline-offset: 0; }
.chart-tooltip { position: absolute; z-index: 2; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--paper); color: var(--muted); box-shadow: 0 5px 18px #15281c15; font-size: .76rem; pointer-events: none; min-width: 113px; }
.chart-tooltip strong { color: var(--ink); display: block; margin-bottom: 4px; }
.chart-tooltip div { display: flex; justify-content: space-between; gap: 13px; }
.chart-tooltip b { color: var(--ink); font-variant-numeric: tabular-nums; }

.funnel-list { list-style: none; padding: 15px 20px 19px; display: grid; gap: 13px; }
.funnel-label { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 8px; margin-bottom: 5px; font-size: .85rem; }
.funnel-label strong { font-size: .87rem; font-variant-numeric: tabular-nums; }
.funnel-rate { font-size: .77rem; text-align: right; color: var(--subtle); width: 51px; font-variant-numeric: tabular-nums; }
.bar-track { width: 100%; height: 7px; border-radius: 6px; background: #edf1eb; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; display: block; background: #3a6f55; }
.funnel-list li:nth-child(2) .bar-fill { background: #5d8568; }
.funnel-list li:nth-child(3) .bar-fill { background: #83a088; }
.funnel-list li:nth-child(4) .bar-fill { background: #a7bba9; }
.funnel-foot { margin: 0 20px 15px; padding: 8px 10px; border-radius: 7px; background: var(--soft); color: var(--muted); font-size: .8rem; }
.funnel-foot strong { color: var(--green-strong); }

.section-tabs { display: flex; align-items: flex-end; gap: 19px; border-bottom: 1px solid var(--line); padding: 0 18px; }
.section-tabs button { color: var(--muted); border: 0; border-bottom: 2px solid transparent; background: transparent; min-height: 48px; padding: 9px 2px 7px; font-size: .93rem; font-weight: 600; }
.section-tabs button:hover { color: var(--ink); }
.section-tabs button[aria-pressed="true"] { color: var(--green-strong); border-bottom-color: var(--green); font-weight: 700; }
.table-tools { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 13px 17px; }
.table-tools .search-field { flex: 1 1 220px; min-width: min(190px, 100%); max-width: 350px; }
.table-tools .button:last-child { margin-left: auto; }
.search-field { display: flex; align-items: center; gap: 8px; min-height: 41px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 11px; background: var(--paper); color: var(--subtle); min-width: 0; }
.search-field:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.search-field input { min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink); padding: 8px 0; outline: 0; font-size: .9rem; }
.search-field input:focus-visible { outline: none; }
.search-field input::placeholder { color: #69766b; opacity: 1; }
.mini-select, .field select {
  appearance: none; background-color: var(--paper);
  background-image: var(--select-chevron); background-repeat: no-repeat; background-position: right 10px center;
  padding: 8px 28px 8px 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  min-height: 41px; font-size: .88rem; color: var(--ink); max-width: 100%;
}
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 11px 13px; vertical-align: middle; }
th { font-size: .82rem; color: var(--muted); white-space: nowrap; background: var(--soft); font-weight: 620; border-top: 1px solid #e9ede6; border-bottom: 1px solid #e9ede6; }
td { color: var(--ink); font-size: .89rem; line-height: 1.4; height: 55px; border-bottom: 1px solid #edf0eb; }
th:first-child, td:first-child { padding-left: 17px; }
th:last-child, td:last-child { text-align: right; padding-right: 17px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8faf6; }
.cell-primary { font-weight: 650; line-height: 1.32; display: block; }
.cell-meta, .mono { color: var(--subtle); font-size: .76rem; margin-top: 3px; display: block; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.person { display: flex; gap: 9px; align-items: center; }
.person > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.avatar { flex: 0 0 33px; display: grid; place-items: center; height: 33px; width: 33px; border-radius: 50%; background: #e2eee4; color: #3c664c; font-weight: 700; font-size: .85rem; }
.avatar.gold { background: #f6ebd7; color: #795e2d; }
.avatar.rose { background: #f2e6e3; color: #835a54; }
.avatar.blue { background: #e5edf0; color: #4b6671; }
.badge { display: inline-flex; align-items: center; min-height: 23px; max-width: 100%; padding: 2px 7px; border-radius: 5px; background: #edf0eb; color: #526157; white-space: nowrap; font-size: .76rem; font-weight: 630; }
.badge.success { background: var(--green-light); color: var(--green-strong); }
.badge.gold { background: var(--gold-light); color: var(--gold-dark); }
.badge.alert { background: var(--red-light); color: var(--red); }
.badges { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.table-footer { border-top: 1px solid var(--line); color: var(--muted); padding: 11px 17px; font-size: .82rem; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pagination { display: flex; align-items: center; gap: 7px; }
.pagination .button { min-height: 34px; padding: 5px 8px; font-size: .79rem; }
.empty-state { padding: 44px 18px; text-align: center; color: var(--muted); font-size: .91rem; }
.empty-state .icon { display: block; margin: 0 auto 10px; width: 23px; height: 23px; }
.table-top-note { padding: 10px 17px 0; font-size: .83rem; color: var(--muted); }
.insights-grid { margin: 17px 0; }
.retention { width: calc(100% - 28px); margin: 11px 14px 0; }
.retention th { background: transparent; border-top: 0; color: var(--muted); }
.retention th, .retention td { padding: 6px; white-space: nowrap; text-align: center; height: 34px; }
.retention th:first-child, .retention td:first-child { text-align: left; }
.retention td:last-child, .retention th:last-child { padding-right: 5px; text-align: center; }
.retention span { display: block; border-radius: 5px; padding: 3px 2px; min-width: 32px; }
.retention .late { color: var(--subtle); background: #f0f2ee; }
.retention-note { padding: 10px 17px 13px; color: var(--muted); font-size: .8rem; }

dialog { color: var(--ink); border: 1px solid var(--line); background: var(--paper); padding: 0; }
dialog::backdrop { background: rgba(14,27,19,.43); }
.detail-drawer { --drawer-size: min(480px, 100vw); position: fixed; inset: 0 0 0 auto; margin: 0; width: var(--drawer-size); max-width: 100vw; height: 100%; height: 100dvh; max-height: 100dvh; border-radius: 15px 0 0 15px; box-shadow: -16px 0 48px #14251c20; }
.detail-drawer[open] { display: flex; flex-direction: column; }
.detail-drawer .dialog-header, .modal .dialog-header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; padding: 18px 19px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 1.16rem; font-weight: 730; line-height: 1.35; }
.dialog-header p { color: var(--muted); font-size: .82rem; margin-top: 4px; overflow-wrap: anywhere; }
.dialog-header .icon-button { width: 36px; height: 36px; }
.detail-body { flex: 1; overflow: auto; display: grid; align-content: start; padding: 17px 19px; gap: 14px; }
.detail-card { border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; overflow-wrap: anywhere; }
.detail-card h3 { font-size: .97rem; margin-bottom: 8px; font-weight: 680; }
.detail-card p { font-size: .91rem; color: var(--muted); white-space: pre-wrap; }
.detail-card p + h3 { margin-top: 13px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 14px; margin: 0; }
.detail-grid dt { font-size: .79rem; color: var(--muted); }
.detail-grid dd { margin: 3px 0 0; font-size: .9rem; font-weight: 610; overflow-wrap: anywhere; white-space: pre-wrap; }
.release-details .detail-grid { grid-template-columns: 1fr; }
.detail-actions { margin-top: auto; padding: 12px 19px max(13px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 7px; border-top: 1px solid var(--line); background: var(--paper); }
.detail-list { list-style: none; padding: 0; }
.detail-list li { display: flex; align-items: flex-start; gap: 9px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .87rem; }
.detail-list li:last-child { border-bottom: 0; }
.detail-list li > span:last-child { color: var(--muted); text-align: right; }
.modal { width: min(calc(100% - 28px), 520px); max-width: 100%; max-height: min(89dvh, 780px); border-radius: 13px; box-shadow: 0 22px 68px #17251f38; }
.modal.wide { width: min(calc(100% - 28px), 630px); }
.modal .form-content { padding: 15px 19px; }
.modal form { margin: 0; }
.modal .dialog-footer { position: sticky; bottom: 0; padding: 12px 19px; border-top: 1px solid var(--line); background: var(--paper); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.field { display: grid; gap: 5px; margin-bottom: 11px; color: var(--ink); font-size: .87rem; font-weight: 630; min-width: 0; }
.field input, .field textarea, .field select { border: 1px solid var(--line-strong); border-radius: 8px; min-height: 41px; min-width: 0; width: 100%; background-color: var(--paper); color: var(--ink); font-size: .9rem; font-weight: 500; }
.field input, .field textarea { padding: 8px 10px; }
.field textarea { resize: vertical; min-height: 78px; }
.field input[type="date"] { appearance: none; min-height: 41px; max-width: 100%; }
.field:last-child { margin-bottom: 0; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.form-row + .field, .form-row + fieldset { margin-top: 9px; }
.form-note { color: var(--muted); font-size: .84rem; line-height: 1.55; margin-bottom: 10px; }
.form-alert { color: #8d3d36; background: var(--red-light); border-radius: 7px; padding: 8px 10px; font-size: .84rem; margin: 0 19px 10px; }
.gift-recipient-picker { margin-bottom: 11px; }
.gift-recipient-picker .field { margin-bottom: 6px; }
.gift-recipient-results { max-height: 190px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.gift-recipient-option { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 7px 10px; cursor: pointer; font-size: .87rem; }
.gift-recipient-option + .gift-recipient-option { border-top: 1px solid var(--line); }
.gift-recipient-option:hover, .gift-recipient-option:has(input:checked) { background: var(--soft); }
.gift-recipient-option input { flex: none; margin: 0; accent-color: var(--green-strong); }
.gift-recipient-option > span { min-width: 0; overflow-wrap: anywhere; }
.gift-recipient-feedback { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .84rem; }
.gift-recipient-feedback p:not(:empty) { padding-top: 5px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 7px 10px 9px; min-width: 0; }
legend { padding: 0 4px; font-size: .83rem; font-weight: 630; }
.check-list { display: flex; flex-wrap: wrap; column-gap: 13px; }
.check { display: flex; align-items: center; min-height: 34px; gap: 6px; font-size: .86rem; color: var(--muted); }
.check input { accent-color: var(--green-strong); width: 15px; height: 15px; margin: 0; }
.member-entry { display: flex; align-items: center; gap: 5px; min-height: 36px; font-size: .88rem; padding: 4px 0; border-bottom: 1px solid var(--line); }
.member-entry > span { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.member-entry .quiet-button { min-height: 32px; padding: 3px 5px; font-size: .76rem; }
.member-control { display: flex; gap: 7px; padding-top: 8px; min-width: 0; }
.member-control select { flex: 1; min-width: 0; }
.confirm-summary { background: var(--soft); border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; margin: 0 0 12px; overflow-wrap: anywhere; }
.confirm-summary .detail-grid { gap: 9px; }
.toast { position: fixed; z-index: 15; right: max(19px, env(safe-area-inset-right)); bottom: max(19px, env(safe-area-inset-bottom)); padding: 10px 14px; color: #fff; background: #284a37; box-shadow: 0 8px 24px #142c2130; border-radius: 9px; max-width: calc(100vw - 38px); font-size: .9rem; display: flex; gap: 8px; align-items: flex-start; }
.storage-warning { margin: 0 0 14px; color: var(--red); background: var(--red-light); padding: 9px 12px; border-radius: 7px; }

.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px 17px; max-width: none; }
.login-card { width: min(100%, 420px); padding: 27px 26px 24px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 15px; box-shadow: 0 12px 50px #243b2720; }
.login-brand { width: 99px; padding: 8px; background: var(--forest); border-radius: 10px; margin-bottom: 19px; }
.login-brand img { object-fit: contain; }
.login-card h1 { font-size: 1.5rem; letter-spacing: -.025em; }
.login-description { margin: 5px 0 16px; color: var(--muted); font-size: .9rem; }
.login-card > .button, .login-card form .button { display: flex; width: 100%; margin-top: 8px; }
.login-limit, .login-email { color: var(--muted); margin-top: 11px; font-size: .79rem; overflow-wrap: anywhere; }
.login-message { margin-top: 13px; padding: 8px 10px; border-radius: 7px; background: var(--soft); color: var(--muted); font-size: .82rem; }
.login-message.is-error { color: var(--red); background: var(--red-light); }

.pack-shortcut { margin-bottom: 12px; }
.package-workbench {
  width: min(calc(100% - 30px), 960px); max-width: 100%; max-height: min(91dvh, 840px);
  border-radius: 13px; box-shadow: 0 22px 65px #17251f42;
}
.package-workbench[open] { display: flex; flex-direction: column; }
.package-workbench .dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 15px 19px; border-bottom: 1px solid var(--line); }
.package-workbench form { min-height: 0; display: flex; flex-direction: column; }
.pack-content { padding: 13px 19px; min-height: 0; overflow: auto; }
.pack-actions, .pack-file-tools, .pack-pagination, .pack-footer { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pack-actions { margin-bottom: 11px; }
.pack-actions #pack-status { color: var(--muted); align-self: center; font-size: .83rem; }
.pack-overview { margin-bottom: 13px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; }
.pack-overview .detail-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.pack-select { display: inline-flex; align-items: center; min-width: 0; gap: 7px; font-size: .87rem; color: var(--muted); }
.pack-select > label { white-space: nowrap; }
.pack-select select { min-width: 0; }
.pack-file-tools { justify-content: space-between; }
.pack-file-tools .pack-select { max-width: 65%; }
.pack-file-description { margin: 7px 0 10px; font-size: .8rem; color: var(--muted); }
.pack-metadata { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 7px; font-size: .85rem; }
.pack-metadata summary { font-weight: 650; cursor: pointer; }
.pack-metadata dl { margin-top: 8px; }
.pack-data-scroll { margin-top: 7px; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; max-width: 100%; }
.pack-data-scroll th, .pack-data-scroll td { white-space: nowrap; height: auto; min-width: 75px; padding: 5px 8px; font-size: .81rem; text-align: left; }
.pack-data-scroll th:last-child, .pack-data-scroll td:last-child { text-align: left; }
.pack-pagination { justify-content: space-between; margin-block: 7px; font-size: .79rem; color: var(--muted); }
.pack-empty { margin: 6px 0 12px; color: var(--muted); font-size: .91rem; }
.pack-error { background: var(--red-light); border-radius: 8px; color: var(--red); padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 7px 0 10px; font-size: .84rem; }
.pack-footer { padding: 10px 19px; justify-content: flex-end; border-top: 1px solid var(--line); background: var(--paper); }
.field .pack-json { font-family: ui-monospace, "SF Mono", monospace; min-height: min(45dvh,360px); tab-size: 2; }

@media (max-width: 1180px) {
  :root { --sidebar-width: 192px; }
  .overview-grid { grid-template-columns: minmax(0, 1.6fr) minmax(275px, 1fr); gap: 13px; }
  .card-heading { padding-inline: 15px; }
  .funnel-list { padding-inline: 15px; }
  .funnel-foot { margin-inline: 15px; }
  .stat-grid { gap: 11px; }
}
@media (min-width: 861px) and (max-width: 980px) {
  .overview-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: min(245px, calc(100% - 56px)); height: 100dvh; }
  .sidebar.open { display: flex; box-shadow: 8px 0 35px #17251f35; }
  .nav-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 11; border: 0; background: #142b2066; padding: 0; }
  .menu-button { display: inline-grid; }
  .mobile-brand { display: inline; font-weight: 710; font-size: .95rem; white-space: nowrap; }
  .breadcrumb { display: none; }
  .topbar { min-height: 59px; padding-inline: 15px; }
  .top-start { gap: 8px; }
  .mobile-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; inset: auto 0 0; z-index: 6; border-top: 1px solid var(--line-strong); padding: 2px 4px env(safe-area-inset-bottom); background: #fbfcf9; }
  .mobile-nav a { min-height: 51px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; color: var(--muted); font-size: .73rem; font-weight: 560; }
  .mobile-nav a[aria-current] { color: var(--green-strong); font-weight: 740; }
  .mobile-nav a[aria-current] .icon { stroke-width: 2.15; }
  main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { bottom: max(68px, calc(68px + env(safe-area-inset-bottom))); }
}
@media (max-width: 695px) {
  main { padding-top: 21px; padding-inline: 14px; }
  .overview-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 13px; margin-bottom: 16px; }
  .period-control { flex-direction: row-reverse; align-items: center; justify-content: space-between; width: 100%; gap: 6px; }
  .period-date { font-size: .75rem; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 13px; gap: 10px; }
  .stat-card { min-height: 110px; padding: 10px 11px 11px; }
  .stat-value { font-size: 1.72rem; }
  .stat-context { font-size: .74rem; }
  .stat-label { font-size: .84rem; }
  .chart-wrap { height: 222px; }
  .table-wrap:has(.responsive-table) { overflow: visible; }
  .responsive-table, .responsive-table tbody, .responsive-table tr { display: block; }
  .responsive-table thead { position: absolute; clip-path: inset(50%); inline-size: 1px; block-size: 1px; overflow: hidden; }
  .responsive-table tr { position: relative; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 9px; padding: 9px 12px; }
  .responsive-table tr + tr { border-top: 1px solid var(--line); }
  .responsive-table td, .responsive-table td:first-child, .responsive-table td:last-child { display: block; height: auto; border: 0; padding: 1px 0; text-align: left; overflow-wrap: anywhere; }
  .responsive-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .75rem; margin-bottom: 2px; }
  .responsive-table td:first-child { grid-column: 1 / -1; padding-right: 52px; margin-bottom: 2px; }
  .responsive-table td.row-action { padding: 0; position: absolute; right: 9px; top: 7px; }
  .responsive-table td:not([data-label]):last-child:not(.row-action) { grid-column: 1 / -1; }
  .table-tools { padding: 11px 12px; }
  .table-tools .search-field { max-width: none; flex-basis: 100%; }
  .table-tools .button:last-child { margin-left: 0; }
  .table-footer { padding-inline: 12px; }
  .retention th, .retention td { padding-inline: 4px; font-size: .77rem; }
}
@media (max-width: 480px) {
  .top-tools { gap: 8px; }
  .period-date { white-space: normal; text-align: right; line-height: 1.3; }
  .segment button { padding-inline: 8px; }
  .card-heading { padding: 15px 12px 0; }
  .chart-body { padding-inline: 4px 9px; }
  .funnel-list { padding-inline: 12px; }
  .funnel-foot { margin-inline: 12px; }
  .detail-drawer { border-radius: 0; }
  .table-tools .mini-select { max-width: 100%; }
  .member-entry .quiet-button { min-width: 41px; }
  .package-workbench { width: calc(100% - 14px); max-height: 94dvh; }
  .package-workbench .dialog-header, .pack-content, .pack-footer { padding-inline: 12px; }
  .pack-overview .detail-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pack-file-tools .pack-select { max-width: 100%; }
}
@media (pointer: coarse) {
  button, .button, .quiet-button, .mini-select, .search-field, .field input, .field select { min-height: 44px; }
  .icon-button { min-width: 44px; }
  input, select, textarea, .mini-select, .field input, .field textarea, .field select, .search-field input { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }

.environment-control #environment-select { color: #5b471d; border-color: #bea46b; background-color: var(--gold-light); min-width: 80px; font-weight: 650; }
.environment-control #environment-select:has(option[value="ppe"]:checked) { color: var(--text); border-color: var(--line); background-color: #fff; }
