:root {
  color-scheme: light;
  --ink: #14231e;
  --muted: #78847e;
  --muted-dark: #58665f;
  --line: #e8ece8;
  --line-strong: #dce3dd;
  --paper: #ffffff;
  --canvas: #f3f6f3;
  --canvas-dark: #edf2ee;
  --green: #18332a;
  --green-deep: #11251e;
  --green-soft: #eaf4ed;
  --lime: #c8f169;
  --lime-deep: #a6d63d;
  --blue: #5277e8;
  --blue-soft: #edf1ff;
  --amber: #e7a840;
  --amber-soft: #fff5e6;
  --red: #d8685c;
  --red-soft: #fff0ed;
  --shadow-xs: 0 2px 8px rgba(22, 43, 33, .035);
  --shadow-sm: 0 10px 32px rgba(22, 43, 33, .06);
  --shadow-lg: 0 25px 90px rgba(15, 30, 24, .22);
  --radius: 18px;
  --sidebar-width: 252px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(132, 183, 59, .48); outline-offset: 2px; }
button:disabled { cursor: not-allowed !important; opacity: .55; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.boot-screen p { margin: 0; font-size: 13px; }
.boot-mark, .brand-mark { display: grid; place-items: center; background: var(--lime); color: var(--green-deep); font-weight: 900; }
.boot-mark { width: 54px; height: 54px; border-radius: 17px; font-size: 23px; box-shadow: 0 10px 30px rgba(154, 200, 63, .25); }
.boot-spinner { width: 20px; height: 20px; border: 2px solid #dce4dc; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Auth / first-run setup */
.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, .92fr) minmax(400px, 1.08fr); background: #f6f8f5; }
.auth-aside { position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 40px clamp(28px, 5vw, 72px); color: #f5f8f4; background: var(--green-deep); }
.auth-aside::before, .auth-aside::after { content: ""; position: absolute; border: 1px solid rgba(207, 243, 138, .13); border-radius: 50%; pointer-events: none; }
.auth-aside::before { width: 520px; height: 520px; right: -270px; top: 12%; }
.auth-aside::after { width: 370px; height: 370px; right: -196px; top: 22%; }
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 750; letter-spacing: -.3px; }
.brand-mark { width: 39px; height: 39px; border-radius: 12px; font-size: 17px; flex: 0 0 auto; }
.auth-copy { position: relative; z-index: 1; max-width: 470px; padding: 54px 0 66px; }
.auth-kicker { color: var(--lime); font-size: 10px; font-weight: 800; letter-spacing: 2.1px; text-transform: uppercase; }
.auth-copy h1 { margin: 17px 0 15px; max-width: 450px; font-size: clamp(36px, 4.3vw, 57px); line-height: 1.04; letter-spacing: -2.4px; }
.auth-copy p { max-width: 420px; color: rgba(243, 248, 241, .67); font-size: 15px; line-height: 1.75; }
.auth-feature-list { display: grid; gap: 14px; margin-top: 32px; }
.auth-feature { display: flex; gap: 11px; align-items: center; color: rgba(247, 250, 246, .88); font-size: 12px; }
.auth-feature span:first-child { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: rgba(200, 241, 105, .13); color: var(--lime); }
.auth-footer { position: relative; z-index: 1; color: rgba(238, 245, 237, .4); font-size: 11px; }
.auth-panel { min-height: 100vh; display: grid; place-items: center; padding: 38px 26px; }
.auth-card { width: min(100%, 470px); padding: clamp(25px, 4vw, 42px); border: 1px solid #e8ede8; border-radius: 22px; background: var(--paper); box-shadow: var(--shadow-sm); }
.auth-card-top { margin-bottom: 27px; }
.auth-card-top .eyebrow { margin: 0 0 8px; color: #82a843; font-size: 10px; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase; }
.auth-card h2 { margin: 0 0 8px; font-size: 27px; letter-spacing: -1px; }
.auth-card-top p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 13px; }
.auth-card .form-grid { gap: 16px; }
.setup-split { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.security-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 17px; padding: 13px; border-radius: 12px; background: #f3f7f3; color: var(--muted-dark); font-size: 11px; line-height: 1.55; }
.security-note svg { color: #629044; flex: 0 0 auto; margin-top: 1px; }

/* Application frame */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; flex-direction: column; width: var(--sidebar-width); padding: 24px 16px 17px; color: #eef4ec; background: var(--green-deep); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 3px 10px 26px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; max-width: 150px; overflow: hidden; color: #fff; font-size: 14px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy small { display: block; margin-top: 3px; color: rgba(238,244,236,.45); font-size: 9px; font-weight: 700; letter-spacing: 1.35px; text-transform: uppercase; }
.sidebar-label { margin: 27px 11px 10px; color: rgba(236,243,235,.35); font-size: 9px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 45px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: rgba(236,243,235,.65); text-align: left; font-size: 12px; font-weight: 620; transition: background .18s ease, color .18s ease, transform .18s ease; cursor: pointer; }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .8; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(200,241,105,.13); color: var(--lime); box-shadow: inset 2px 0 var(--lime); }
.nav-item.active svg { opacity: 1; }
.nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: auto; padding: 0 5px; border-radius: 8px; background: rgba(231,168,64,.2); color: #ffd181; font-size: 10px; }
.sidebar-spacer { flex: 1; }
.sidebar-plan-card { margin: 14px 3px 15px; padding: 15px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.045); }
.sidebar-plan-icon { display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: 10px; border-radius: 9px; background: rgba(200,241,105,.14); color: var(--lime); }
.sidebar-plan-card strong { display: block; margin-bottom: 5px; color: #f0f5ed; font-size: 11px; }
.sidebar-plan-card p { margin: 0; color: rgba(235,243,234,.48); font-size: 10px; line-height: 1.5; }
.sidebar-profile { display: flex; align-items: center; gap: 10px; padding: 15px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.profile-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; background: #314c3e; color: var(--lime); font-size: 12px; font-weight: 800; }
.profile-name { min-width: 0; flex: 1; }
.profile-name strong { display: block; overflow: hidden; color: #fff; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.profile-name small { display: block; margin-top: 3px; color: rgba(236,243,235,.42); font-size: 9px; }
.profile-menu { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: rgba(238,244,236,.62); cursor: pointer; }
.profile-menu:hover { background: rgba(255,255,255,.08); color: white; }

.app-main { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; justify-content: space-between; min-height: 82px; padding: 0 clamp(20px, 3.3vw, 48px); border-bottom: 1px solid rgba(225,232,226,.82); background: rgba(248,250,248,.93); backdrop-filter: blur(14px); }
.topbar-left { display: flex; align-items: center; gap: 13px; min-width: 0; }
.mobile-menu { display: none; place-items: center; width: 37px; height: 37px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--green); cursor: pointer; }
.mobile-menu svg { width: 18px; height: 18px; }
.breadcrumb { color: var(--muted); font-size: 10px; font-weight: 600; }
.topbar-heading { margin: 4px 0 0; font-size: 17px; line-height: 1.25; letter-spacing: -.4px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { position: relative; display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--muted-dark); cursor: pointer; transition: border .18s, transform .18s; }
.icon-button:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.icon-button svg { width: 17px; height: 17px; }
.notify-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border: 1.5px solid white; border-radius: 50%; background: #e77b58; }
.header-separator { width: 1px; height: 30px; margin: 0 4px; background: var(--line-strong); }
.header-date { color: var(--muted-dark); font-size: 10px; font-weight: 600; white-space: nowrap; }
.content-wrap { width: min(100%, 1580px); margin: 0 auto; padding: 29px clamp(20px, 3.3vw, 48px) 48px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 25px; }
.page-heading h1 { margin: 0; font-size: clamp(22px, 2.4vw, 29px); line-height: 1.2; letter-spacing: -1.1px; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.page-heading-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }

.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 39px; padding: 0 14px; border: 1px solid transparent; border-radius: 11px; background: var(--green); color: white; font-size: 11px; font-weight: 750; cursor: pointer; transition: transform .18s, background .18s, box-shadow .18s; white-space: nowrap; }
.button svg { width: 15px; height: 15px; }
.button:hover { transform: translateY(-1px); background: #214737; box-shadow: 0 7px 16px rgba(24,51,42,.13); }
.button-primary { background: var(--green); }
.button-accent { background: var(--lime); color: #203220; }
.button-accent:hover { background: #d5f78a; }
.button-secondary { border-color: var(--line); background: white; color: var(--ink); }
.button-secondary:hover { background: #f8faf8; box-shadow: var(--shadow-xs); }
.button-quiet { background: transparent; color: var(--muted-dark); }
.button-quiet:hover { background: var(--canvas); box-shadow: none; }
.button-danger { background: var(--red-soft); color: #bb4c40; }
.button-danger:hover { background: #ffe4df; box-shadow: none; }
.button-sm { min-height: 32px; padding: 0 10px; font-size: 10px; border-radius: 9px; }
.button-full { width: 100%; }
.button[aria-busy="true"] { pointer-events: none; }
.button-icon { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted-dark); cursor: pointer; }
.button-icon svg { width: 15px; height: 15px; }
.button-icon:hover { color: var(--green); border-color: #cad8cd; }
.button-icon.danger:hover { color: var(--red); border-color: #f1c8c0; }

/* Overview cards and charts */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { min-width: 0; padding: 18px 19px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-xs); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { color: var(--muted); font-size: 10px; font-weight: 650; }
.stat-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--green); background: #eff5ed; }
.stat-icon svg { width: 16px; height: 16px; }
.stat-icon.amber { background: var(--amber-soft); color: #b87b24; }
.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.rose { background: var(--red-soft); color: var(--red); }
.stat-value { margin: 11px 0 7px; font-size: clamp(23px, 2.5vw, 31px); font-weight: 780; letter-spacing: -1.2px; line-height: 1; white-space: nowrap; }
.stat-foot { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.stat-foot strong { color: #5d8a38; font-weight: 750; }
.stat-foot .warn { color: #be842e; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(270px, .88fr); gap: 16px; margin-bottom: 16px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-xs); }
.panel-pad { padding: 19px 20px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-title { margin: 0; font-size: 13px; font-weight: 770; letter-spacing: -.2px; }
.panel-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.panel-link { display: inline-flex; align-items: center; gap: 5px; padding: 4px 0; border: 0; background: transparent; color: #668b3d; font-size: 10px; font-weight: 760; cursor: pointer; }
.panel-link:hover { color: var(--green); }
.chart-summary { display: flex; align-items: baseline; gap: 8px; margin: 0 0 15px; }
.chart-summary strong { font-size: 23px; letter-spacing: -.8px; }
.chart-summary span { color: var(--muted); font-size: 10px; }
.bar-chart { display: flex; align-items: stretch; gap: 13px; height: 152px; padding: 10px 5px 0; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent, transparent 37px, #f1f4f1 38px, transparent 39px); }
.bar-column { display: flex; align-items: center; justify-content: flex-end; flex: 1; min-width: 0; flex-direction: column; gap: 8px; }
.bar-track { display: flex; align-items: flex-end; justify-content: center; width: min(100%, 31px); height: 118px; }
.bar-fill { width: 100%; min-height: 4px; border-radius: 7px 7px 3px 3px; background: #d6e0d6; transition: height .45s cubic-bezier(.2,.8,.2,1), background .18s; }
.bar-column.today .bar-fill { background: var(--green); }
.bar-column:hover .bar-fill { background: var(--lime-deep); }
.bar-label { color: #909a93; font-size: 9px; font-weight: 600; }
.chart-empty { display: grid; place-items: center; width: 100%; height: 120px; color: var(--muted); font-size: 11px; }
.plan-mix-list { display: grid; gap: 15px; }
.plan-mix-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; }
.plan-mix-title { overflow: hidden; color: var(--muted-dark); font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.plan-mix-count { color: var(--ink); font-size: 10px; font-weight: 800; }
.plan-mix-track { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 99px; background: #eff2ef; }
.plan-mix-bar { height: 100%; border-radius: inherit; background: var(--green); }
.plan-mix-row:nth-child(2) .plan-mix-bar { background: #91b965; }
.plan-mix-row:nth-child(3) .plan-mix-bar { background: #e3ba68; }
.plan-mix-row:nth-child(4) .plan-mix-bar { background: #829ddd; }
.plan-mix-row:nth-child(5) .plan-mix-bar { background: #c191bc; }
.plan-mix-empty { padding: 17px 13px; border-radius: 12px; background: #f7f9f7; color: var(--muted); font-size: 10px; line-height: 1.6; }
.lower-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 16px; }
.due-list { display: grid; }
.due-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid #f0f2f0; }
.due-row:first-child { padding-top: 0; border-top: 0; }
.member-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: #edf3e9; color: #577838; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.member-avatar.avatar-blue { background: #edf1ff; color: #5a72be; }
.member-avatar.avatar-amber { background: #fff4e6; color: #a97124; }
.member-avatar.avatar-rose { background: #fff0ed; color: #b96356; }
.member-avatar.avatar-lilac { background: #f4edfa; color: #8a69a7; }
.member-main { min-width: 0; }
.member-main strong { display: block; overflow: hidden; color: #23332c; font-size: 10px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.member-main small { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.due-count { text-align: right; white-space: nowrap; }
.due-count strong { display: block; color: #bd8229; font-size: 10px; }
.due-count small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.empty-mini { padding: 22px 10px; color: var(--muted); font-size: 11px; text-align: center; }
.activity-list { display: grid; }
.activity-row { display: grid; grid-template-columns: 33px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid #f0f2f0; }
.activity-row:first-child { padding-top: 0; border-top: 0; }
.cash-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; background: #edf5eb; color: #5c8b40; }
.cash-icon svg { width: 15px; height: 15px; }
.activity-amount { color: #275437; font-size: 10px; font-weight: 800; text-align: right; white-space: nowrap; }
.activity-amount small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; font-weight: 550; }

/* Notices and empty states */
.notice-banner { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 17px; padding: 13px 15px; border: 1px solid #f1dfbb; border-radius: 14px; background: #fff8e9; color: #7e6335; }
.notice-banner svg { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px; }
.notice-banner strong { display: block; margin-bottom: 3px; color: #705525; font-size: 11px; }
.notice-banner p { margin: 0; font-size: 10px; line-height: 1.55; }
.notice-banner .notice-action { margin-left: auto; border: 0; background: transparent; color: #765e33; font-size: 10px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.onboarding-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; padding: 18px 20px; border: 1px solid #dce9ce; border-radius: 17px; background: linear-gradient(110deg, #f5faed, #fff 74%); }
.onboarding-card h3 { margin: 0 0 4px; font-size: 13px; }
.onboarding-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.onboarding-mark { display: grid; place-items: center; width: 38px; height: 38px; margin-right: 13px; border-radius: 12px; background: var(--lime); color: var(--green); flex: 0 0 auto; }
.onboarding-copy { display: flex; align-items: center; min-width: 0; }
.blank-state { display: grid; justify-items: center; padding: 45px 20px; color: var(--muted); text-align: center; }
.blank-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 14px; border-radius: 17px; background: #edf4e8; color: #53763c; }
.blank-icon svg { width: 23px; height: 23px; }
.blank-state h3 { margin: 0 0 7px; color: var(--ink); font-size: 15px; }
.blank-state p { max-width: 360px; margin: 0 0 16px; font-size: 11px; line-height: 1.65; }

/* Members and payment pages */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.toolbar-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.search-field { position: relative; min-width: 200px; width: min(300px, 34vw); }
.search-field svg { position: absolute; top: 50%; left: 12px; width: 15px; height: 15px; color: #9aa49d; transform: translateY(-50%); pointer-events: none; }
.search-field input { width: 100%; min-height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: white; color: var(--ink); font-size: 10px; }
.search-field input:focus { border-color: #a8c184; box-shadow: 0 0 0 3px rgba(168,193,132,.14); }
.filter-pills { display: flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.filter-pill { min-height: 29px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 720; cursor: pointer; white-space: nowrap; }
.filter-pill.active { background: #edf3ea; color: #426332; }
.table-card { overflow: hidden; }
.table-scroll { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
.data-table thead th { height: 43px; padding: 0 15px; border-bottom: 1px solid var(--line); background: #fbfcfb; color: #909a93; font-size: 8px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.data-table tbody td { height: 62px; padding: 8px 15px; border-bottom: 1px solid #f0f2f0; color: #536159; font-size: 10px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fcfdfc; }
.table-member { display: flex; align-items: center; gap: 9px; min-width: 175px; }
.table-member .member-avatar { width: 32px; height: 32px; border-radius: 10px; }
.table-member-name { min-width: 0; }
.table-member-name button { max-width: 205px; overflow: hidden; padding: 0; border: 0; background: transparent; color: #25372d; font-size: 10px; font-weight: 750; text-overflow: ellipsis; cursor: pointer; white-space: nowrap; }
.table-member-name button:hover { color: #638e3c; }
.table-member-name small { display: block; max-width: 180px; overflow: hidden; margin-top: 4px; color: #9aa39d; font-size: 8px; text-overflow: ellipsis; }
.plan-cell strong { display: block; color: #45544b; font-size: 9px; font-weight: 700; }
.plan-cell small { display: block; margin-top: 4px; color: #9aa39d; font-size: 8px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 0 8px; border-radius: 7px; font-size: 8px; font-weight: 780; text-transform: capitalize; }
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-active, .status-paid, .status-sent { background: #edf6eb; color: #4b8a43; }
.status-expiring, .status-partial, .status-queued { background: #fff4e2; color: #b47a25; }
.status-expired, .status-due, .status-failed, .status-cancelled { background: #fff0ed; color: #bd5b50; }
.status-upcoming, .status-no-plan, .status-paused { background: #eef1f7; color: #74819b; }
.status-none { background: #f1f3f2; color: #87918a; }
.money-cell { color: #3c5144 !important; font-weight: 750 !important; }
.money-cell.muted { color: #9aa39d !important; font-weight: 600 !important; }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 5px; }
.table-meta { display: flex; align-items: center; justify-content: space-between; padding: 11px 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.table-meta strong { color: var(--muted-dark); }
.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 15px; }
.summary-tile { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.summary-tile span { display: block; color: var(--muted); font-size: 9px; font-weight: 650; }
.summary-tile strong { display: block; margin-top: 8px; font-size: 19px; letter-spacing: -.6px; }

/* Insights */
.insight-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr); gap: 15px; margin-bottom: 15px; }
.insight-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 18px; }
.insight-mini { padding: 13px; border-radius: 12px; background: #f6f8f6; }
.insight-mini span { display: block; color: var(--muted); font-size: 8px; }
.insight-mini strong { display: block; margin-top: 7px; font-size: 16px; }
.progress-list { display: grid; gap: 15px; }
.progress-line { display: grid; grid-template-columns: minmax(75px, 1fr) 2fr auto; align-items: center; gap: 9px; }
.progress-line span { color: var(--muted-dark); font-size: 9px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: #eff2ef; }
.progress-value { height: 100%; border-radius: 99px; background: #82ad5b; }
.progress-line strong { min-width: 18px; color: var(--ink); font-size: 9px; text-align: right; }
.insights-note { padding: 14px 16px; border: 1px solid #e7eadf; border-radius: 14px; background: #f8faf5; color: #667261; font-size: 10px; line-height: 1.6; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 15px; align-items: start; }
.settings-stack { display: grid; gap: 15px; }
.settings-card { padding: 20px; }
.settings-heading { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 18px; }
.settings-icon { display: grid; place-items: center; width: 35px; height: 35px; flex: 0 0 auto; border-radius: 11px; background: #eef4e9; color: #577b3a; }
.settings-icon svg { width: 17px; height: 17px; }
.settings-heading h3 { margin: 1px 0 4px; font-size: 12px; }
.settings-heading p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.form-grid { display: grid; gap: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.field { min-width: 0; }
.field label { display: flex; align-items: center; gap: 5px; margin: 0 0 6px; color: #526057; font-size: 9px; font-weight: 740; }
.field label .optional { color: #9da69f; font-size: 8px; font-weight: 500; }
.control { display: block; width: 100%; min-height: 39px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 10px; outline: none; background: white; color: var(--ink); font-size: 10px; transition: border .16s, box-shadow .16s; }
.control:focus { border-color: #a9c685; box-shadow: 0 0 0 3px rgba(169,198,133,.14); }
.control::placeholder { color: #abb3ad; }
textarea.control { min-height: 84px; resize: vertical; line-height: 1.5; }
.form-hint { margin: 6px 0 0; color: #939d96; font-size: 8px; line-height: 1.5; }
.check-row { display: flex; align-items: flex-start; gap: 9px; color: #59665e; font-size: 9px; line-height: 1.5; cursor: pointer; }
.check-row input { margin: 2px 0 0; accent-color: #578240; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.locked-note { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; padding: 10px 11px; border-radius: 10px; background: #f6f8f6; color: var(--muted); font-size: 8px; line-height: 1.55; }
.locked-note svg { width: 13px; height: 13px; flex: 0 0 auto; margin-top: 1px; color: #7a8c73; }
.plan-setting-list { display: grid; }
.plan-setting-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 9px; padding: 11px 0; border-top: 1px solid #f0f2f0; }
.plan-setting-row:first-child { border-top: 0; }
.plan-setting-main strong { display: block; color: #394a3f; font-size: 10px; }
.plan-setting-main small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.plan-setting-price { color: #33493a; font-size: 10px; font-weight: 800; white-space: nowrap; }
.plan-setting-actions { display: flex; align-items: center; gap: 5px; }
.plan-archived { opacity: .58; }
.email-status { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 8px; background: #fff4e3; color: #a9782b; font-size: 8px; font-weight: 800; }
.email-status.ready { background: #edf6eb; color: #4b8a43; }
.email-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.code-snippet { overflow: auto; margin: 12px 0; padding: 12px; border: 1px solid #263a30; border-radius: 11px; background: #172a22; color: #d7e2d5; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 8px; line-height: 1.75; white-space: pre; }
.email-step { margin: 0 0 0 15px; padding-left: 3px; color: #69766e; font-size: 9px; line-height: 1.7; }
.reminder-list { display: grid; }
.reminder-row { display: grid; grid-template-columns: 33px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 10px 0; border-top: 1px solid #f0f2f0; }
.reminder-row:first-child { border-top: 0; }
.reminder-date { color: var(--muted); font-size: 8px; text-align: right; }
.reminder-date strong { display: block; color: var(--muted-dark); font-size: 9px; }
.data-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.account-line { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: #f7f9f7; }
.account-line .profile-avatar { background: #dcead5; color: #466437; }
.account-line div:last-child { min-width: 0; }
.account-line strong { display: block; color: #35473b; font-size: 10px; }
.account-line small { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 8px; text-overflow: ellipsis; }

/* Modal and toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: auto; padding: 22px; background: rgba(13,28,21,.45); backdrop-filter: blur(4px); animation: fade-in .15s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card { width: min(100%, 540px); max-height: min(90vh, 880px); overflow: auto; border: 1px solid rgba(255,255,255,.7); border-radius: 20px; background: white; box-shadow: var(--shadow-lg); animation: modal-in .2s cubic-bezier(.2,.8,.25,1); }
@keyframes modal-in { from { opacity: .65; transform: translateY(9px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-card.modal-wide { width: min(100%, 700px); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 20px 22px 15px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); backdrop-filter: blur(8px); }
.modal-head h2 { margin: 0; font-size: 17px; letter-spacing: -.5px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.modal-close { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #667269; cursor: pointer; }
.modal-close svg { width: 14px; height: 14px; }
.modal-body { padding: 18px 22px 21px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; }
.detail-hero { display: flex; align-items: center; gap: 13px; margin-bottom: 17px; padding: 14px; border-radius: 14px; background: #f6f8f5; }
.detail-hero .member-avatar { width: 43px; height: 43px; border-radius: 14px; font-size: 12px; }
.detail-hero h3 { margin: 0; font-size: 13px; }
.detail-hero p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.detail-action-row { display: flex; gap: 7px; flex-wrap: wrap; margin-left: auto; }
.detail-section { margin-top: 17px; }
.detail-section h4 { margin: 0 0 9px; color: #849087; font-size: 8px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; }
.detail-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.detail-fact { padding: 10px; border: 1px solid #eef1ed; border-radius: 10px; }
.detail-fact span { display: block; color: var(--muted); font-size: 8px; }
.detail-fact strong { display: block; overflow: hidden; margin-top: 5px; color: #34443a; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.history-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px 0; border-top: 1px solid #f0f2f0; }
.history-item:first-of-type { border-top: 0; }
.history-item strong { display: block; color: #3e5045; font-size: 9px; }
.history-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.history-side { text-align: right; }
.history-side strong { font-size: 9px; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 9px; max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid #deeadb; border-radius: 13px; background: white; color: #314639; box-shadow: 0 14px 45px rgba(20,43,29,.15); font-size: 10px; line-height: 1.5; pointer-events: auto; animation: toast-in .2s ease; }
.toast svg { width: 16px; height: 16px; flex: 0 0 auto; color: #639548; }
.toast.error { border-color: #f0d0c8; color: #793e37; }
.toast.error svg { color: #c56758; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.loading-inline { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 160px; color: var(--muted); font-size: 10px; }
.loading-inline .boot-spinner { width: 16px; height: 16px; }
.screen-overlay { display: none; }
.mobile-sidebar-close { display: none; }

@media (max-width: 1180px) {
  :root { --sidebar-width: 226px; }
  .content-wrap { padding-right: 26px; padding-left: 26px; }
  .topbar { padding-right: 26px; padding-left: 26px; }
  .stat-grid { gap: 10px; }
  .stat-card { padding-right: 15px; padding-left: 15px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.4fr) minmax(250px, .85fr); }
}
@media (max-width: 950px) {
  :root { --sidebar-width: 0px; }
  .sidebar { width: 250px; transform: translateX(-105%); transition: transform .25s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow-lg); }
  .app-shell.mobile-nav-open .sidebar { transform: translateX(0); }
  .app-shell.mobile-nav-open .screen-overlay { position: fixed; inset: 0; z-index: 35; display: block; background: rgba(13,28,21,.42); }
  .mobile-menu { display: grid; }
  .mobile-sidebar-close { display: grid; place-items: center; margin-left: auto; width: 29px; height: 29px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: transparent; color: white; cursor: pointer; }
  .sidebar-brand { padding-right: 5px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.35fr) minmax(240px, .9fr); }
}
@media (max-width: 760px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-panel { min-height: 100vh; padding: 22px 15px; }
  .auth-card { max-width: 470px; padding: 27px 23px; }
  .topbar { min-height: 70px; padding: 0 17px; }
  .content-wrap { padding: 22px 17px 36px; }
  .topbar-heading { font-size: 15px; }
  .breadcrumb { font-size: 9px; }
  .header-date, .header-separator { display: none; }
  .topbar-actions { gap: 7px; }
  .icon-button { width: 35px; height: 35px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 20px; }
  .page-heading-actions { width: 100%; }
  .page-heading-actions .button { flex: 1; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px; border-radius: 15px; }
  .stat-value { font-size: 24px; }
  .dashboard-grid, .lower-grid, .insight-grid, .settings-grid { grid-template-columns: 1fr; }
  .bar-chart { gap: 8px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-left { flex-wrap: wrap; }
  .search-field { width: 100%; min-width: 100%; }
  .filter-pills { width: max-content; max-width: 100%; overflow-x: auto; }
  .summary-strip { gap: 8px; }
  .summary-tile { padding: 12px; }
  .summary-tile strong { font-size: 16px; }
  .settings-card { padding: 16px; }
  .notice-banner { align-items: flex-start; }
  .notice-banner .notice-action { display: none; }
  .onboarding-card { align-items: flex-start; flex-direction: column; }
  .onboarding-copy { align-items: flex-start; }
  .onboarding-card > .button { width: 100%; }
  .detail-hero { align-items: flex-start; flex-wrap: wrap; }
  .detail-action-row { width: 100%; margin-left: 56px; }
  .modal-backdrop { align-items: end; padding: 9px; }
  .modal-card { max-height: 92vh; border-radius: 18px 18px 12px 12px; }
  .modal-head { padding: 16px 17px 12px; }
  .modal-body { padding: 15px 17px 18px; }
}
@media (max-width: 520px) {
  .setup-split, .form-row { grid-template-columns: 1fr; gap: 12px; }
  .filter-pills { width: 100%; }
  .filter-pill { flex: 1; padding: 0 7px; }
  .data-table thead th, .data-table tbody td { padding-right: 10px; padding-left: 10px; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-tile:first-child { grid-column: 1 / -1; }
  .plan-setting-row { grid-template-columns: minmax(0, 1fr) auto; }
  .plan-setting-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .insight-summary { grid-template-columns: 1fr 1fr; }
  .insight-mini:last-child { grid-column: 1 / -1; }
  .page-heading h1 { font-size: 23px; }
  .stat-label { font-size: 9px; }
  .stat-icon { width: 30px; height: 30px; }
  .stat-value { font-size: 22px; }
  .panel-pad { padding: 16px; }
  .detail-facts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 520px) { .topbar-actions .button[data-action="new-member"] { width: 37px; min-width: 37px; padding: 0; } .topbar-actions .button[data-action="new-member"] span { display: none; } }

/* ---- Security: sign-in activity ---- */
.activity-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.activity-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.activity-dot.ok { background: #16a34a; }
.activity-dot.bad { background: #dc2626; }
.activity-main { display: flex; flex-direction: column; min-width: 0; }
.activity-main small { color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-row time { margin-left: auto; font-size: 12px; color: #64748b; flex: none; }

/* =====================================================================
   LUXURY PASS — shared identity with the public /live page
   (dark pre-login phase, gold accents, Cormorant Garamond + Jost)
   ===================================================================== */
:root {
  --gold: #c9a25e;
  --gold-bright: #d4b06a;
  --gold-soft: #f0e2c4;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
}

body { font-family: var(--sans); letter-spacing: .01em; }
.detail-section h4, .auth-card h2, .auth-aside h1, .auth-aside h2 { font-family: var(--serif); font-weight: 600; letter-spacing: .015em; }

.button { transition: transform .18s ease, box-shadow .18s ease, filter .18s ease, background .18s ease; }
.button:active { transform: translateY(1px); }

/* ---- Preloader (matches /live curtain + gold ring) ---- */
body.is-loading { overflow: hidden; }
.boot-loader { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.boot-loader.gone { display: none; }
.boot-curtain { position: absolute; left: 0; right: 0; height: 50.5%; background: #0a0c0b;
  transition: transform 1s cubic-bezier(.77,0,.18,1); }
.boot-curtain.top { top: 0; }
.boot-curtain.bottom { bottom: 0; }
.boot-curtain.top::after, .boot-curtain.bottom::after { content: ""; position: absolute; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .85; }
.boot-curtain.top::after { bottom: 0; }
.boot-curtain.bottom::after { top: 0; }
.boot-loader.done .boot-curtain.top { transform: translateY(-101%); }
.boot-loader.done .boot-curtain.bottom { transform: translateY(101%); }
.boot-core { position: relative; z-index: 2; width: 168px; height: 168px; display: grid; place-items: center;
  transition: opacity .45s ease, transform .8s cubic-bezier(.22,.8,.2,1); }
.boot-loader.done .boot-core { opacity: 0; transform: scale(1.22); }
.boot-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.boot-ring circle { fill: none; stroke-width: 1.2; }
.boot-ring .track { stroke: rgba(243,239,230,.12); }
.boot-ring .bar { stroke: var(--gold); stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(201,162,94,.8)); }
.boot-num { font: 500 54px/1 var(--serif); color: #f3efe6; font-variant-numeric: lining-nums; }
.boot-label { position: absolute; bottom: -46px; margin: 0; font-size: 11px; letter-spacing: .38em; text-transform: uppercase;
  color: #8e9297; animation: bootBreathe 1.8s ease-in-out infinite; white-space: nowrap; }
@keyframes bootBreathe { 50% { opacity: .35; } }

/* ---- Dark luxury sign-in phase ---- */
.auth-screen { background: radial-gradient(1100px 520px at 82% -10%, #18211a 0%, transparent 60%), #0a0c0b; }
.auth-aside { background: linear-gradient(165deg, #121a13 0%, #0a0c0b 75%); }
.auth-card { background: #12160f; border: 1px solid rgba(201,162,94,.28); color: #edf2ec;
  box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.auth-card-top .eyebrow { color: var(--gold); }
.auth-card h2 { color: #f5f2e9; }
.auth-card .field label { color: #97a297; }
.auth-card .control { background: #0c100c; border-color: rgba(243,239,230,.14); color: #f2f6f0; }
.auth-card .control::placeholder { color: #5c665d; }
.auth-card .control:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,94,.18); }
.auth-card .button-primary { background: linear-gradient(135deg, var(--gold-bright), #a9853f); color: #1c1507;
  font-weight: 600; letter-spacing: .07em; text-transform: uppercase; font-size: 12px; }
.auth-card .button-primary:hover { filter: brightness(1.08); box-shadow: 0 10px 26px rgba(201,162,94,.25); }
.auth-card .security-note { color: #8a958a; }
.auth-card .notice-banner { background: rgba(201,162,94,.08); border-color: rgba(201,162,94,.25); }

/* ======================= AI ASSISTANT (Atlas) ======================= */
.ai-fab { position: fixed; right: 22px; bottom: 22px; z-index: 150; display: flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: none; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, var(--gold-bright), #a9853f); color: #1c1507;
  font: 600 13px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  box-shadow: 0 12px 32px rgba(201,162,94,.4); transition: transform .2s cubic-bezier(.22,.8,.2,1), box-shadow .2s ease; }
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(201,162,94,.5); }
.ai-fab svg { width: 16px; height: 16px; }
.ai-drawer { position: fixed; right: 22px; bottom: 84px; z-index: 150; width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 130px));
  display: flex; flex-direction: column; background: #0e120e; color: #e9efe9;
  border: 1px solid rgba(201,162,94,.3); border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(14px) scale(.98); pointer-events: none;
  transition: opacity .25s ease, transform .3s cubic-bezier(.22,.8,.2,1); }
.ai-drawer.open { opacity: 1; transform: none; pointer-events: auto; }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid rgba(243,239,230,.1); background: linear-gradient(160deg, #131a12, #0e120e); }
.ai-head strong { font-family: var(--serif); font-size: 20px; color: var(--gold-soft); letter-spacing: .04em; }
.ai-head small { display: block; color: #93a192; font-size: 11.5px; margin-top: 2px; }
.ai-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 86%; padding: 10px 13px; border-radius: 13px; font-size: 13.5px; line-height: 1.55; white-space: normal; }
.ai-msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--gold-bright), #a9853f); color: #1c1507; border-bottom-right-radius: 4px; }
.ai-msg.assistant { align-self: flex-start; background: #171d16; border: 1px solid rgba(243,239,230,.09); color: #dfe7de; border-bottom-left-radius: 4px; }
.ai-msg.typing { display: flex; gap: 5px; align-items: center; }
.ai-msg.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); opacity: .4; animation: aiBlink 1.1s infinite; }
.ai-msg.typing span:nth-child(2) { animation-delay: .18s; }
.ai-msg.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes aiBlink { 40% { opacity: 1; } }
.ai-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(243,239,230,.1); }
.ai-form .control { flex: 1; background: #0a0e0a; border-color: rgba(243,239,230,.14); color: #f0f4ef; }
.ai-form .control:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,94,.18); }

/* ---- AI Studio (letter generator) ---- */
.ai-studio-card + .ai-studio-card { margin-top: 16px; }
.letter-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.letter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.letter-preview { width: 100%; height: 520px; margin-top: 14px; border: 1px solid rgba(201,162,94,.25); border-radius: 14px; background: #fff; }
.ai-studio-card > h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 22px; }

/* ======================= LIVE CONTROL PANEL ======================= */
.live-panel { max-width: 720px; }
.live-ctrl { display: flex; align-items: center; justify-content: center; gap: 28px; padding: 28px 0 8px; }
.live-btn { width: 84px; height: 84px; border-radius: 50%; border: none; cursor: pointer; font-size: 40px; line-height: 1;
  display: grid; place-items: center; transition: transform .16s cubic-bezier(.22,.8,.2,1), box-shadow .2s ease, filter .2s ease; }
.live-btn.plus { background: linear-gradient(135deg, var(--gold-bright), #a9853f); color: #1c1507; box-shadow: 0 12px 30px rgba(201,162,94,.35); }
.live-btn.minus { background: #1a1f1a; color: #e8b4b4; border: 1px solid rgba(220,120,120,.4); }
.live-btn:hover { transform: translateY(-2px); filter: brightness(1.07); }
.live-btn:active { transform: translateY(1px) scale(.97); }
.live-count { text-align: center; min-width: 180px; }
.live-count strong { display: block; font-family: var(--serif); font-size: 72px; line-height: 1; color: var(--ink); }
.live-count small { display: block; margin-top: 8px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #6b7a6d; }
.live-hint { text-align: center; margin: 6px auto 16px; max-width: 520px; }
.live-panel .activity-list { max-width: 520px; margin: 0 auto; }
.live-panel .form-actions { justify-content: center; margin-top: 18px; }

/* ===== Marketing ===== */
.mkt-panel + .mkt-panel { margin-top: 16px; }
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 4px; }
.toggle-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
.toggle-line strong { display: block; }
.toggle-line small { color: #64748b; }
.switch { width: 46px; height: 26px; border-radius: 999px; border: none; background: #cbd5cf; position: relative; cursor: pointer; transition: background .2s ease; flex: none; }
.switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch.on { background: #1f7a55; }
.switch.on span { transform: translateX(20px); }
.mkt-sub { margin: 18px 0 6px; }
.chip-box { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; min-height: 44px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: #123c2b; color: #e8f0e8; font-size: 12.5px; }
.chip button { border: none; background: rgba(255,255,255,.15); color: inherit; width: 18px; height: 18px; border-radius: 50%; cursor: pointer; line-height: 1; }
.chip-add { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mkt-html { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

/* ===== Responsive pass ===== */
@media (max-width: 1024px) {
  .form-grid { grid-template-columns: 1fr !important; }
  .toggle-row { grid-template-columns: 1fr; }
  .letter-head { flex-direction: column; }
}
@media (max-width: 720px) {
  .live-ctrl { gap: 16px; }
  .live-btn { width: 64px; height: 64px; font-size: 30px; }
  .live-count strong { font-size: 52px; }
  .ai-drawer { right: 10px; left: 10px; width: auto; bottom: 76px; }
  .ai-fab { right: 12px; bottom: 12px; }
  .letter-preview { height: 380px; }
  .chip-add { flex-direction: column; align-items: stretch; }
}

/* ===== v1.5.1 polish ===== */
.ai-fab { left: 22px; right: auto; }
.ai-drawer { left: 22px; right: auto; }
@media (max-width: 720px) { .ai-fab { left: 12px; } .ai-drawer { left: 10px; right: 10px; } }
.mkt-tabs { display: flex; gap: 8px; margin: 14px 0 10px; }
.mkt-tab { padding: 8px 16px; border-radius: 999px; border: 1px solid #cbd5cf; background: #fff; color: #40514a; cursor: pointer; font-size: 13px; }
.mkt-tab.active { background: #123c2b; border-color: #123c2b; color: #f0e2c4; }
.boot-emblem { position: absolute; top: -58px; left: 50%; transform: translateX(-50%); }
.boot-emblem svg { width: 42px; height: 42px; stroke: #c9a25e; fill: none; stroke-width: 1.6; stroke-linecap: round; filter: drop-shadow(0 0 8px rgba(201,162,94,.5)); }
.boot-word { position: absolute; bottom: -74px; margin: 0; width: 280px; text-align: center; font-family: var(--serif); font-style: italic; font-size: 15px; color: #b9b29e; opacity: 0; transition: opacity .4s ease; }
.boot-word.show { opacity: 1; }
.live-bg { position: fixed; inset: 0; z-index: -1; background: radial-gradient(900px 500px at 15% 0%, rgba(201,162,94,.10), transparent 60%), radial-gradient(700px 500px at 85% 100%, rgba(95,214,164,.07), transparent 60%), #07080a; animation: liveBg 14s ease-in-out infinite alternate; }
@keyframes liveBg { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(-14deg); } }
@media (prefers-reduced-motion: reduce) { .live-bg { animation: none; } }

/* ===== v1.6.0: Atlas side tab + marketing editor ===== */
.ai-fab { left: auto; right: 0; top: 50%; bottom: auto; transform: translateY(-50%); border-radius: 12px 0 0 12px; padding: 16px 9px; writing-mode: vertical-rl; letter-spacing: .28em; box-shadow: -8px 0 24px rgba(201,162,94,.3); }
.ai-fab:hover { transform: translateY(-50%) translateX(-2px); }
.ai-drawer { left: auto; right: 12px; bottom: 16px; top: auto; }
@media (max-width: 720px) { .ai-fab { right: 0; } .ai-drawer { left: 10px; right: 10px; width: auto; } }
.mkt-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mkt-split .mkt-html { width: 100%; resize: vertical; }
.mkt-preview { width: 100%; height: 320px; border: 1px solid rgba(201,162,94,.25); border-radius: 12px; background: #fff; }
.schedule-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.schedule-row .control { max-width: 260px; }
@media (max-width: 900px) { .mkt-split { grid-template-columns: 1fr; } .mkt-preview { height: 260px; } }

/* ===== WhatsApp marketing ===== */
.wa-btn { background: #123c2b; border-color: #1f7a55; color: #d8f5e4; }
.wa-btn:hover { filter: brightness(1.15); }
.wa-btn-grey { background: #eef2ee; border-color: #cbd5cf; color: #40514a; }
.wa-days { font-weight: 600; color: #1f7a55; }
.wa-days.due { color: #c2410c; }

/* ===== RESPONSIVE AUDIT PASS (phones) ===== */
@media (max-width: 900px) {
  .auth-aside { display: none; }
  .auth-panel { width: 100%; padding: 20px; }
  .auth-screen { padding: 0; }
}
@media (max-width: 720px) {
  /* global spacing */
  .content-wrap, .panel { padding-left: 12px; padding-right: 12px; }
  .panel { padding-top: 14px; padding-bottom: 14px; }
  h2, .panel-title { font-size: 20px; }
  .panel-subtitle { font-size: 11px; }
  /* actions wrap, never overflow */
  .form-actions, .page-heading-actions, .letter-actions { flex-wrap: wrap; }
  .form-actions .button, .page-heading-actions .button { flex: 1 1 auto; }
  /* schedule + chips */
  .schedule-row { flex-direction: column; align-items: stretch; }
  .schedule-row .control { max-width: none; }
  .chip-add { flex-direction: column; align-items: stretch; }
  /* activity rows keep time visible */
  .activity-row time { font-size: 11px; }
  /* boot loader smaller */
  .boot-core { width: 128px; height: 128px; }
  .boot-num { font-size: 42px; }
  .boot-label { font-size: 9px; letter-spacing: .28em; }
  .boot-word { width: 220px; font-size: 13px; bottom: -64px; }
  /* tables: force scroll container to be safe */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 560px; }
  /* misc */
  .mkt-html { font-size: 12px; }
  .toggle-line { padding: 12px; }
  .ai-head small { display: none; }
  .letter-preview { height: 300px; }
}
@media (max-width: 480px) {
  .data-table { min-width: 520px; }
  .live-ctrl { gap: 12px; }
  .live-btn { width: 56px; height: 56px; font-size: 26px; }
  .live-count strong { font-size: 42px; }
  .ai-form { flex-wrap: nowrap; }
  .ai-form .button { padding: 8px 12px; }
  .boot-core { width: 108px; height: 108px; }
  .boot-num { font-size: 34px; }
}

/* ===== Phone polish (v1.9.1) ===== */
/* A wide table must never widen the page itself */
.app-shell, .app-main, .content-wrap, .panel, .table-card { min-width: 0; max-width: 100%; }
.table-scroll { max-width: 100%; }

/* Members: rows become tappable cards on phones instead of a clipped table */
@media (max-width: 640px) {
  .data-table.is-stacked { min-width: 0; white-space: normal; }
  .data-table.is-stacked thead { display: none; }
  .data-table.is-stacked, .data-table.is-stacked tbody { display: block; width: 100%; }
  .data-table.is-stacked tbody tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
    padding: 14px 4px; border-bottom: 1px solid #f0f2f0;
  }
  .data-table.is-stacked tbody tr:last-child { border-bottom: 0; }
  .data-table.is-stacked tbody td { display: block; height: auto; padding: 0; border: 0; min-width: 0; font-size: 12px; }
  .data-table.is-stacked tbody td:first-child,
  .data-table.is-stacked tbody td:last-child { grid-column: 1 / -1; }
  .data-table.is-stacked tbody td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 4px;
    color: #909a93; font-size: 9px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase;
  }
  .data-table.is-stacked .row-actions { flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding-top: 4px; }
  .data-table.is-stacked .table-member-name small { overflow-wrap: anywhere; }
  .data-table.is-stacked tbody tr:hover td { background: transparent; }
}

/* Comfortable touch targets */
@media (max-width: 760px) {
  .button, .icon-button, .button-icon, .nav-item, .filter-pill { min-height: 40px; }
  .button-sm { min-height: 36px; }
  input, select, textarea { font-size: 16px; } /* stops iOS zooming into fields */
}

/* Atlas tab: sit near the bottom edge on phones so it never covers stat cards */
@media (max-width: 720px) {
  .ai-fab { top: auto; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: none; padding: 12px 7px; font-size: 11px; }
  .ai-fab:hover { transform: translateX(-2px); }
  .content-wrap { padding-bottom: 96px; }
}

/* Very small phones (320px, e.g. iPhone SE 1st gen) */
.stat-card, .insight-mini { min-width: 0; }
.stat-value, .insight-mini strong { overflow-wrap: anywhere; }
@media (max-width: 360px) {
  .content-wrap { padding-left: 12px; padding-right: 12px; }
  .stat-grid { gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 19px; }
  .insight-summary { grid-template-columns: 1fr; }
  .insight-mini:last-child { grid-column: auto; }
}

/* Never let the Atlas tab sit on top of an open form/modal */
body:has(.modal-backdrop) .ai-fab { display: none; }

/* Activity rows are bordered cards: the first one must not lose its top padding/border */
.activity-row:first-child { padding-top: 8px; border-top: 1px solid #e2e8f0; }
.live-panel .activity-list { margin-top: 14px; }

/* ===== Opening hours editor ===== */
.hours-grid { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.hours-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hours-day { width: 90px; font-size: 13px; color: #40514a; font-weight: 500; }
.hours-num { width: 74px; padding: 8px 10px; }
.hours-sep { color: #9aa79d; }
.hours-closed { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #64748b; cursor: pointer; margin-left: auto; }
@media (max-width: 720px) { .hours-day { width: 76px; } .hours-closed { margin-left: 0; width: 100%; } }

/* ===== View transitions ===== */
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#content-view.view-anim { animation: viewIn .28s cubic-bezier(.22,.8,.2,1); }
@media (prefers-reduced-motion: reduce) { #content-view.view-anim { animation: none; } }

/* ===== Live pro stats + luxury refinements ===== */
.statbars { display: flex; align-items: flex-end; gap: 6px; min-height: 150px; padding: 12px 4px 0; overflow-x: auto; }
.statbar { flex: 1 0 26px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 150px; }
.statbar-fill { width: 100%; max-width: 30px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--gold-bright, #d4b06a), #123c2b); min-height: 3px; transition: height .5s cubic-bezier(.22,.8,.2,1); box-shadow: 0 4px 14px rgba(201,162,94,.25); }
.statbar-lab { font-size: 10.5px; color: #6b7a6d; white-space: nowrap; }
.statbar-val { font-size: 11px; font-weight: 600; color: #123c2b; }
.detail-section h4, .panel-title { letter-spacing: .02em; }
.side-nav .nav-item.active, .nav-item.active { box-shadow: inset 3px 0 0 var(--gold, #c9a25e); }
