:root {
  --ink: #17201e;
  --muted: #64716d;
  --line: #dfe6e2;
  --paper: #fbfcfa;
  --panel: #ffffff;
  --green: #12312f;
  --green-soft: #dcece7;
  --blue: #244f7b;
  --gold: #b8872f;
  --red: #a13f35;
  --shadow: 0 14px 42px rgba(18, 49, 47, 0.12);
}

body[data-theme="dark"] {
  --ink: #e6edf3;
  --muted: #8b949e;
  --line: #30363d;
  --paper: #0d1117;
  --panel: #161b22;
  --green: #58a6ff;
  --green-soft: #102a43;
  --blue: #79c0ff;
  --gold: #d29922;
  --red: #ff7b72;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.is-auth-hidden {
  display: none !important;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(18, 49, 47, 0.92), rgba(36, 79, 123, 0.76)),
    var(--green);
}

.auth-card {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  border-radius: 8px;
  padding: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-card .brand-mark {
  background: var(--green);
  color: #fff;
}

.auth-card h1,
.auth-card h2,
.auth-card p {
  margin: 0;
}

.auth-card h2 {
  font-size: 1.6rem;
}

.auth-copy {
  color: var(--muted);
}

.auth-mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f5;
}

.auth-mode {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-mode.is-active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 4px 14px rgba(18, 49, 47, 0.1);
}

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

.auth-actions.is-single {
  grid-template-columns: 1fr;
}

.auth-actions .secondary-button.is-ready {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
  box-shadow: 0 0 0 3px rgba(18, 49, 47, 0.08);
}

.auth-help,
.auth-footnote {
  color: var(--muted);
  font-size: 0.88rem;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 70px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 6px;
  min-height: 30px;
  width: 56px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f8f5;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
}

.app-header {
  grid-column: 1 / -1;
  background: var(--green);
  color: #f8fbf8;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar {
  background: var(--green);
  color: #f8fbf8;
  padding: 18px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
}

.app-brand {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.header-user-name {
  max-width: 180px;
  overflow: hidden;
  color: #f8fbf8;
  font-size: 0.9rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fbf8;
  padding: 0;
}

.profile-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.profile-face {
  position: relative;
  width: 22px;
  height: 22px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.profile-eye {
  position: absolute;
  top: 7px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
}

.profile-eye:first-child {
  left: 6px;
}

.profile-eye:nth-child(2) {
  right: 6px;
}

.profile-smile {
  position: absolute;
  left: 6px;
  bottom: 5px;
  width: 8px;
  height: 5px;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 10px 10px;
}

.profile-face.has-photo {
  border: 0;
  background-position: center;
  background-size: cover;
}

.profile-face.has-photo .profile-eye,
.profile-face.has-photo .profile-smile {
  display: none;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #f8fbf8;
  color: var(--green);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand h1,
.app-brand h1,
.topbar h2,
.panel h3 {
  margin: 0;
  line-height: 1.1;
}

.app-brand h1 {
  color: #f8fbf8;
  font-size: 1.35rem;
  font-weight: 900;
  white-space: nowrap;
}

.eyebrow,
.label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #a7c7bd;
}

.tabs {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
}

.tabs-main,
.tabs-secondary {
  display: grid;
  gap: 8px;
}

.tabs-secondary {
  margin-top: auto;
}

.tab {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: transparent;
  color: #f8fbf8;
  text-align: left;
  padding: 0 14px;
}

.tab.is-active {
  background: #f8fbf8;
  color: var(--green);
  font-weight: 800;
}

.main {
  padding: 28px;
  min-width: 0;
  overflow-y: auto;
}

.topbar {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--paper);
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: -28px -28px 20px;
  padding: 16px 28px 10px;
  border-bottom: 1px solid rgba(223, 230, 226, 0.7);
}

.auth-status {
  display: block;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f6f8f5;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.auth-status-info {
  background: #eef5f3;
  color: var(--green);
}

.auth-status-success {
  background: var(--green-soft);
  color: var(--green);
}

.auth-status-error {
  background: #fee2dc;
  color: #7a1f16;
}

.topbar h2 {
  color: var(--green);
  font-size: clamp(1.45rem, 2.3vw, 2rem);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar:not(.has-date) .title-separator,
.topbar:not(.has-date) .date-title-button,
.topbar:not(.has-date) .date-icon-button {
  display: none;
}

.title-separator {
  color: var(--muted);
  font-size: clamp(1.45rem, 2.3vw, 2rem);
  font-weight: 900;
}

.date-title-button {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: clamp(1.45rem, 2.3vw, 2rem);
  font-weight: 900;
  padding: 0 2px;
}

.date-icon-button {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  font-size: 1rem;
}

.date-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.date-icon-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  min-height: 0;
  padding: 0;
}

.top-actions,
.inline-actions,
.action-pair {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.icon-action span[aria-hidden="true"] {
  font-size: 1.1rem;
  line-height: 1;
}

.sync-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.sync-status-saving {
  border-color: var(--gold);
  color: var(--gold);
}

.sync-status-synced {
  border-color: var(--green);
  color: var(--green);
}

.sync-status-error {
  border-color: var(--red);
  color: var(--red);
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 15px;
  font-weight: 800;
}

.primary-button {
  background: var(--green);
  color: #fff;
}

.secondary-button {
  background: #fff;
  color: var(--green);
  border-color: var(--line);
}

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

.icon-button {
  width: 44px;
  padding: 0;
  background: var(--green-soft);
  color: var(--green);
}

.full {
  width: 100%;
}

.notice {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

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

.panel.compact {
  align-self: start;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.status-pill {
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.session-form,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.settings-accordion {
  display: grid;
  gap: 10px;
}

.app-version-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 0 14px;
  background: var(--green-soft);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

.app-version-row span {
  color: var(--ink);
}

.app-version-row strong {
  min-width: 64px;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--green);
  color: #fff;
  text-align: center;
}

body[data-theme="dark"] .app-version-row {
  border-color: #58a6ff;
  background: #102a43;
}

body[data-theme="dark"] .app-version-row span {
  color: #f0f6fc;
}

body[data-theme="dark"] .app-version-row strong {
  background: #58a6ff;
  color: #0d1117;
}

.settings-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.settings-section-header {
  min-height: 46px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  background: #fff;
  color: var(--green);
  padding: 0 14px;
  font-weight: 900;
}

.settings-section-header span:last-child {
  transition: transform 0.16s ease;
}

.settings-section.is-open .settings-section-header span:last-child {
  transform: rotate(45deg);
}

.settings-section-body {
  display: none;
  padding: 0 14px 14px;
}

.settings-section.is-open .settings-section-body {
  display: block;
}

.settings-section-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

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

.date-shortcut {
  justify-self: start;
}

.hidden-field {
  display: none !important;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select,
textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  padding: 9px 11px;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .auth-mode.is-active,
body[data-theme="dark"] .profile-menu-item,
body[data-theme="dark"] .member-picker-option,
body[data-theme="dark"] .member-picker-details,
body[data-theme="dark"] .settings-section,
body[data-theme="dark"] .settings-section-header,
body[data-theme="dark"] .schedule-card,
body[data-theme="dark"] .profile-data-section {
  background: #0d1117;
  color: var(--ink);
}

body[data-theme="dark"] .panel,
body[data-theme="dark"] .auth-card,
body[data-theme="dark"] dialog {
  background: var(--panel);
}

body[data-theme="dark"] .app-header,
body[data-theme="dark"] .sidebar {
  background: #010409;
}

body[data-theme="dark"] .auth-screen {
  background:
    linear-gradient(135deg, rgba(1, 4, 9, 0.96), rgba(13, 17, 23, 0.92)),
    #010409;
}

body[data-theme="dark"] .auth-mode-row,
body[data-theme="dark"] .password-toggle {
  background: #0d1117;
}

body[data-theme="dark"] .primary-button {
  background: #238636;
  color: #fff;
}

body[data-theme="dark"] .secondary-button,
body[data-theme="dark"] .date-icon-button,
body[data-theme="dark"] .sync-status {
  background: #21262d;
  color: var(--ink);
}

body[data-theme="dark"] .sync-status-saving {
  color: var(--gold);
}

body[data-theme="dark"] .sync-status-synced {
  color: #3fb950;
}

body[data-theme="dark"] .sync-status-error {
  color: var(--red);
}

textarea {
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.attendance-list,
.activity,
.player-grid,
.membership-list {
  display: grid;
  gap: 10px;
}

.schedule-list {
  gap: 8px;
}

.schedule-list.calendar-grid {
  gap: 10px;
}

.schedule-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.schedule-card.is-expanded {
  border-color: var(--green);
  box-shadow: 0 8px 22px rgba(18, 49, 47, 0.1);
  z-index: 6;
}

.schedule-card.is-cancelled {
  opacity: 0.72;
}

.schedule-card.has-overlap {
  border-color: #f0c7be;
}

.schedule-summary {
  width: 100%;
  min-height: 58px;
  border: 0;
  background: #fff;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  text-align: left;
}

.schedule-card.is-expanded .schedule-summary {
  background: var(--green-soft);
}

.schedule-time {
  display: grid;
  gap: 2px;
  color: var(--green);
  font-weight: 900;
}

.schedule-time small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.schedule-card.is-expanded .schedule-time small {
  color: var(--green);
}

.schedule-name {
  color: var(--ink);
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-status {
  border-radius: 999px;
  background: #f3f7f5;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  padding: 7px 9px;
  white-space: nowrap;
}

.schedule-details {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.sub-heading {
  margin-top: 20px;
}

.day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.day-chip,
.group-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  font-weight: 900;
}

.day-chip {
  min-height: 40px;
}

.day-chip.is-active,
.group-row.is-active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.group-list {
  margin-bottom: 18px;
  position: relative;
}

.calendar-grid {
  min-height: var(--calendar-height);
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  background:
    linear-gradient(to bottom, transparent calc(100% - 1px), var(--line) calc(100% - 1px));
  background-size: 100% 96px;
}

.group-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  margin: 6px 0;
  position: relative;
}

.group-card.is-expanded {
  border-color: var(--green);
  box-shadow: 0 8px 22px rgba(18, 49, 47, 0.1);
}

.group-card.has-overlap {
  border-color: #f0c7be;
}

.calendar-events {
  position: relative;
  min-height: var(--calendar-height);
}

.calendar-event {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0;
  z-index: 1;
}

.calendar-event.is-expanded {
  z-index: 5;
}

.empty-calendar {
  grid-column: 1 / -1;
}

.calendar-hours {
  position: relative;
  min-height: var(--calendar-height);
}

.calendar-hour {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.calendar-hour span {
  position: relative;
  top: -0.7em;
  background: var(--panel);
  padding-right: 5px;
}

.group-row {
  width: 100%;
  border: 0;
  min-height: 52px;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.group-time {
  display: grid;
  gap: 2px;
  font-weight: 900;
}

.group-time small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.group-row.is-active .group-time small {
  color: #dcece7;
}

.group-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-count {
  color: var(--muted);
  font-size: 0.82rem;
}

.group-row.is-active .group-count {
  color: #dcece7;
}

.group-editor {
  border-top: 1px solid var(--line);
  padding: 12px;
  background: #fbfdfb;
}

.group-edit-grid {
  margin-bottom: 12px;
}

.editor-section {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  padding-bottom: 14px;
}

.group-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.member-block {
  display: grid;
  gap: 10px;
}

.quick-add-player {
  display: grid;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
}

.billing-editor {
  border-top: 0;
  margin: 4px 0 14px;
  padding: 12px 0;
}

.billing-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.term-list {
  display: grid;
  gap: 8px;
}

.term-item {
  border-radius: 8px;
  background: #f3f7f5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  padding: 10px;
}

.term-item-main {
  display: grid;
  gap: 4px;
}

.term-item span {
  color: var(--muted);
  font-size: 0.84rem;
}

body[data-theme="dark"] .term-item {
  background: #0d1117;
  border: 1px solid var(--line);
}

body[data-theme="dark"] .term-item strong {
  color: #f0f6fc;
}

.visible-members {
  display: grid;
  gap: 8px;
}

.add-member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.member-picker-open {
  justify-self: start;
}

.attendance-item,
.activity-item,
.player-card {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.attendance-item strong,
.player-card strong {
  display: block;
}

.attendance-item span,
.activity-item span,
.player-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.toggle {
  min-width: 96px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  min-height: 38px;
  font-weight: 800;
}

.toggle.is-on {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.metric {
  border-radius: 8px;
  background: #f3f7f5;
  padding: 13px;
  display: grid;
  gap: 8px;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.metric strong {
  color: var(--green);
  font-size: 1.25rem;
}

.invoice-table-wrap {
  overflow-x: auto;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.invoice-table th,
.invoice-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
}

.invoice-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.invoice-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.invoice-message-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.status-select {
  min-width: 112px;
}

.player-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.people-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.player-actions {
  display: flex;
  gap: 8px;
}

.mini-button {
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green);
  font-weight: 800;
}

dialog {
  border: 0;
  padding: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(18, 49, 47, 0.36);
}

.dialog-card {
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
  display: grid;
  gap: 14px;
}

.profile-card {
  width: min(560px, calc(100vw - 32px));
}

.member-picker-card {
  width: min(720px, calc(100vw - 24px));
}

.member-picker-layout {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.member-picker-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: min(52vh, 420px);
  overflow: auto;
}

.member-picker-option {
  display: grid;
  gap: 4px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.member-picker-option span,
.member-picker-summary span {
  color: var(--muted);
  font-size: 0.86rem;
}

.member-picker-option.is-active {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(18, 111, 91, 0.14);
}

.member-picker-details {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.member-picker-summary {
  display: grid;
  gap: 8px;
}

.profile-menu {
  display: grid;
  gap: 8px;
}

.profile-menu-item {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  padding: 0 14px;
  font-weight: 900;
}

.profile-menu-item.is-expanded span:last-child {
  transform: rotate(45deg);
}

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

.profile-details {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.profile-photo-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-photo-preview {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  background-position: center;
  background-size: cover;
  font-size: 0.72rem;
  font-weight: 900;
}

.profile-photo-preview.has-photo {
  color: transparent;
}

.profile-photo-button {
  width: auto;
  min-width: 118px;
  justify-content: center;
}

.profile-password-button {
  width: 100%;
  justify-content: center;
}

.profile-signout-button {
  justify-self: start;
  min-width: 118px;
}

.profile-data-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.profile-data-section h4 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.profile-data-section .auth-help {
  margin: 0;
}

.profile-data-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.profile-data-actions .secondary-button {
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 0 10px;
}

.profile-data-actions .secondary-button span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-setup-section {
  background: #f8faf8;
}

.payment-settings-grid {
  gap: 10px;
}

.payment-setup-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.payment-setup-actions .secondary-button {
  min-width: 0;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.admin-user-list {
  display: grid;
  gap: 10px;
}

.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.admin-user-row > div:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.admin-user-row span,
.admin-user-row small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.payment-setup-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.dialog-card h3 {
  margin: 0;
}

menu {
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: 100dvh;
  }

  .app-header {
    padding: 10px 12px;
  }

  .app-brand {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .app-brand h1 {
    font-size: 1.12rem;
  }

  .header-account {
    gap: 6px;
  }

  .header-user-name {
    max-width: 92px;
    font-size: 0.78rem;
  }

  .app-brand .sync-status {
    display: none;
  }

  .sidebar {
    position: relative;
    z-index: 2;
    padding: 10px 12px;
    gap: 10px;
  }

  .brand {
    align-items: center;
    gap: 10px;
  }

  .profile-button {
    width: 36px;
    height: 36px;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    flex: initial;
  }

  .tabs-main,
  .tabs-secondary {
    display: contents;
  }

  .tabs-secondary {
    margin-top: 0;
  }

  .tab {
    text-align: center;
    padding: 0 8px;
  }

  .main {
    padding: 12px;
    overflow-y: auto;
  }

  .topbar {
    margin: -12px -12px 12px;
    padding: 8px 12px;
    gap: 8px;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
  }

  .topbar h2 {
    font-size: 1.28rem;
  }

  .topbar .eyebrow {
    display: none;
  }

  .split-grid,
  .session-form,
  .settings-grid {
    grid-template-columns: 1fr;
  }

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

  .top-actions,
  .inline-actions {
    justify-content: stretch;
  }

  .inline-actions > * {
    flex: 1 1 auto;
  }

  .top-actions {
    flex-wrap: nowrap;
    margin-left: auto;
  }

}

@media (max-width: 520px) {
  .brand h1 {
    font-size: 1rem;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 0.78rem;
  }

  .profile-button {
    width: 32px;
    height: 32px;
  }

  .header-user-name {
    max-width: 74px;
  }

  .profile-face {
    width: 18px;
    height: 18px;
  }

  .profile-eye {
    top: 5px;
  }

  .profile-eye:first-child {
    left: 4px;
  }

  .profile-eye:nth-child(2) {
    right: 4px;
  }

  .profile-smile {
    left: 4px;
    bottom: 4px;
  }

  .sidebar .eyebrow {
    display: none;
  }

  .tabs {
    gap: 6px;
  }

  .tab {
    min-height: 34px;
    font-size: 0.72rem;
    padding: 0 4px;
  }

  .main {
    padding: 10px;
  }

  .topbar {
    margin: -10px -10px 10px;
    padding: 7px 10px;
  }

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

  .topbar-title {
    gap: 5px;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .topbar h2 {
    font-size: 1.08rem;
  }

  .title-separator {
    font-size: 1.08rem;
  }

  .date-title-button {
    min-height: 34px;
    max-width: 112px;
    font-size: 1.08rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .date-icon-button,
  .icon-action {
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
  }

  .action-text {
    display: none;
  }

  .top-actions > * {
    font-size: 0.82rem;
  }

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

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

  .admin-user-row,
  .admin-user-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .panel {
    padding: 14px;
  }

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

  .schedule-summary {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .schedule-status {
    grid-column: 2;
    justify-self: start;
  }

  .day-strip {
    gap: 5px;
  }

  .day-chip {
    min-height: 34px;
    font-size: 0.75rem;
  }

  .group-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .group-count {
    grid-column: 2;
  }

  .calendar-grid {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 7px;
  }

  .calendar-hour {
    font-size: 0.7rem;
  }

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

  .member-picker-layout {
    grid-template-columns: 1fr;
  }

  .member-picker-details {
    min-height: 0;
  }

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

  .people-tools {
    grid-template-columns: 1fr;
  }
}
