:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --dark: #111827;
  --dark-2: #1f2937;
  --accent: #c8a96b;
  --accent-soft: #f4ecdb;
  --danger: #b42318;
  --success: #157f3f;
  --work: #2563eb;
  --health: #16a34a;
  --family: #9333ea;
  --learning: #ea580c;
  --spiritual: #b58900;
  --community: #0f766e;
  --other: #6b7280;
  --shadow: 0 8px 30px rgba(17, 24, 39, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--dark); color: white; padding: 24px 18px; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #4b5563 transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 999px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--dark); background: var(--accent); font-weight: 900; letter-spacing: -.04em; }
.brand-title { font-weight: 800; letter-spacing: -.02em; }
.brand-subtitle { font-size: 11px; color: #9ca3af; margin-top: 2px; }
.nav { display: grid; gap: 5px; padding-top: 22px; }
.nav button { border: 0; background: transparent; color: #cbd5e1; text-align: left; padding: 11px 12px; border-radius: 11px; display: flex; align-items: center; gap: 11px; font-weight: 650; }
.nav button:hover { background: rgba(255,255,255,.06); color: white; }
.nav button.active { background: rgba(200,169,107,.16); color: #f6e7c3; }
.nav button span { width: 18px; opacity: .9; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.09); padding-top: 18px; }
.role-box { display: grid; gap: 6px; }
.role-box select { width: 100%; border-radius: 10px; background: var(--dark-2); color: white; border: 1px solid #374151; padding: 10px; }
.privacy-note { color: #9ca3af; font-size: 11px; line-height: 1.45; margin-top: 10px; }

.main { min-width: 0; }
.topbar { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 28px; background: rgba(244,246,248,.92); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 15; border-bottom: 1px solid rgba(229,231,235,.8); }
.topbar h1 { margin: 3px 0 0; font-size: 29px; letter-spacing: -.035em; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .11em; font-weight: 800; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content { padding: 24px 28px 60px; max-width: 1500px; margin: 0 auto; }

.primary, .secondary, .danger, .ghost { border-radius: 10px; padding: 10px 14px; font-weight: 750; border: 1px solid transparent; }
.primary { background: var(--dark); color: white; }
.primary:hover { background: #0b1220; }
.secondary { background: white; border-color: var(--line); color: var(--text); }
.secondary:hover { background: var(--panel-2); }
.ghost { background: transparent; border-color: var(--line); }
.danger { background: #fff1f0; border-color: #ffd1cc; color: var(--danger); }
.icon-button { position: relative; width: 40px; height: 40px; display: grid; place-items: center; background: white; border: 1px solid var(--line); border-radius: 10px; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; display: grid; place-items: center; background: var(--danger); color: white; font-size: 10px; font-weight: 800; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(17,24,39,.02); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card h2, .card h3 { margin-top: 0; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 15px; }
.card-title-row h2, .card-title-row h3 { margin: 0; }
.subtle { color: var(--muted); }
.small { font-size: 12px; }
.stat { padding: 18px; }
.stat-value { font-size: 31px; font-weight: 850; letter-spacing: -.04em; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; }

.hero { background: linear-gradient(130deg, #111827, #263248); color: white; border: 0; overflow: hidden; position: relative; }
.hero::after { content: ""; width: 280px; height: 280px; border-radius: 50%; position: absolute; right: -80px; top: -110px; background: rgba(200,169,107,.13); }
.hero .eyebrow { color: #d8c49b; }
.hero h2 { font-size: 30px; margin: 6px 0 8px; letter-spacing: -.04em; max-width: 720px; }
.hero p { color: #cbd5e1; max-width: 780px; line-height: 1.55; }

.focus-list { display: grid; gap: 10px; counter-reset: focus; }
.focus-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: var(--panel-2); border-radius: 12px; }
.focus-item::before { counter-increment: focus; content: counter(focus); min-width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--dark); color: white; font-weight: 800; font-size: 12px; }

.timeline { display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 72px 8px 1fr; gap: 12px; min-height: 66px; }
.timeline-time { font-size: 12px; font-weight: 800; padding-top: 3px; }
.timeline-line { width: 2px; background: var(--line); position: relative; margin-left: 3px; }
.timeline-line::before { content:""; width: 8px; height: 8px; background: var(--area-color, var(--other)); border-radius: 50%; position: absolute; left: -3px; top: 5px; }
.timeline-content { padding-bottom: 16px; }
.timeline-title { font-weight: 800; }
.timeline-meta { margin-top: 4px; font-size: 12px; color: var(--muted); }

.area-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; border-radius: 999px; background: color-mix(in srgb, var(--area-color) 12%, white); color: var(--area-color); }
.area-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--area-color); }

.balance-row { display: grid; grid-template-columns: 92px 1fr 48px; gap: 10px; align-items: center; margin-bottom: 12px; }
.balance-name { font-weight: 750; font-size: 12px; text-transform: capitalize; }
.progress-track { background: #eef1f4; border-radius: 999px; height: 9px; overflow: hidden; }
.progress-fill { background: var(--area-color, var(--dark)); height: 100%; border-radius: inherit; }
.balance-value { font-size: 12px; font-weight: 800; text-align: right; }
.target-marker { color: var(--muted); font-weight: 600; }

.section-header { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin: 4px 0 18px; }
.section-header h2 { margin: 0 0 4px; letter-spacing: -.03em; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

.goal-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.goal-card { border-top: 4px solid var(--area-color); }
.goal-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.goal-card h3 { margin: 10px 0 12px; font-size: 18px; letter-spacing: -.025em; }
.goal-progress { display: grid; gap: 7px; }
.goal-progress-header { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; background: #eef8f1; color: var(--success); font-size: 10px; font-weight: 800; }
.status.behind { background: #fff4e8; color: #b54708; }
.status.attention { background: #fff1f0; color: var(--danger); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; background: var(--panel-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
.task-title { font-weight: 750; }
.task-done { text-decoration: line-through; color: var(--muted); }
.checkbox { width: 18px; height: 18px; }

.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); gap: 10px; overflow: auto; padding-bottom: 8px; }
.day-column { min-height: 560px; border: 1px solid var(--line); border-radius: 14px; background: white; overflow: hidden; }
.day-head { padding: 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.day-name { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; }
.day-date { font-size: 23px; font-weight: 850; margin-top: 3px; }
.day-column.today .day-head { background: var(--dark); color: white; }
.day-column.today .day-name { color: #d1d5db; }
.day-body { padding: 8px; display: grid; gap: 7px; }
.cal-event { border-left: 4px solid var(--area-color); padding: 9px; border-radius: 8px; background: color-mix(in srgb, var(--area-color) 7%, white); font-size: 12px; }
.cal-time { font-size: 10px; font-weight: 850; color: var(--muted); }
.cal-title { font-weight: 800; margin-top: 3px; line-height: 1.3; }
.cal-source { margin-top: 4px; color: var(--muted); font-size: 10px; }

.radar-wrap { display: grid; place-items: center; min-height: 350px; }
.radar { width: min(360px, 90%); overflow: visible; }
.radar-grid { fill: none; stroke: #d7dce2; stroke-width: 1; }
.radar-axis { stroke: #e6e9ed; stroke-width: 1; }
.radar-shape { fill: rgba(17,24,39,.12); stroke: #111827; stroke-width: 2.5; }
.radar-label { font-size: 10px; font-weight: 800; fill: #4b5563; text-transform: uppercase; }

.meeting-card { display: grid; grid-template-columns: 170px 1fr; gap: 20px; }
.meeting-time { padding: 15px; background: var(--dark); color: white; border-radius: 13px; align-self: start; }
.meeting-time strong { display: block; font-size: 21px; margin: 4px 0; }
.check-list { display: grid; gap: 8px; margin-top: 8px; }
.check-line { display: flex; gap: 9px; align-items: center; color: var(--muted); }

.booking-card { border-top: 4px solid var(--accent); }
.booking-url { display: flex; gap: 8px; margin-top: 12px; }
.booking-url input { flex: 1; min-width: 0; }

.integration-card { display: grid; grid-template-columns: 56px 1fr auto; gap: 15px; align-items: center; }
.integration-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 14px; background: var(--panel-2); font-size: 25px; }
.integration-status { font-size: 11px; font-weight: 800; padding: 5px 8px; border-radius: 999px; }
.integration-status.on { background: #eaf7ee; color: var(--success); }
.integration-status.off { background: #fff4e8; color: #b54708; }
.code-note { background: #0b1220; color: #dbe4ef; padding: 14px; border-radius: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow: auto; }


.user-name { font-weight: 800; }
.user-email { color: var(--muted); font-size: 11px; margin-top: 3px; }
.role-badge, .access-chip { display: inline-flex; align-items: center; border-radius: 999px; font-size: 10px; font-weight: 800; }
.role-badge { padding: 5px 8px; background: #eef2ff; color: #3730a3; text-transform: uppercase; letter-spacing: .05em; }
.access-list { display: flex; flex-wrap: wrap; gap: 5px; max-width: 460px; }
.access-chip { padding: 4px 7px; background: var(--panel-2); color: #4b5563; border: 1px solid var(--line); }
.user-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; }
.user-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.user-status.inactive { color: var(--muted); }
.user-status.inactive::before { background: #9ca3af; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 8px; }
.permission-option { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); text-transform: none; letter-spacing: 0; font-size: 12px; }
.permission-option input { width: auto; margin: 0; }
.permission-tools { display: flex; gap: 8px; margin-top: 8px; }
.owner-note { display: inline-flex; align-items: center; gap: 5px; color: #8a641b; font-size: 10px; font-weight: 800; margin-left: 6px; }

.review-callout { border-left: 4px solid var(--accent); background: #fffaf0; }
.insight { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.insight strong { display: block; margin-bottom: 4px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-field { display: grid; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
input, select, textarea { width: 100%; border: 1px solid #d5dae0; border-radius: 10px; background: white; padding: 10px 11px; outline: none; color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: #8c96a3; box-shadow: 0 0 0 3px rgba(17,24,39,.06); }
textarea { min-height: 90px; resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.48); z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal { width: min(650px, 100%); max-height: 90vh; overflow: auto; background: white; border-radius: 18px; box-shadow: var(--shadow); padding: 22px; }
.modal h2 { margin: 0 0 6px; }
.hidden { display: none !important; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(420px, 100%); background: white; z-index: 45; border-left: 1px solid var(--line); box-shadow: -12px 0 35px rgba(17,24,39,.12); padding: 22px; overflow: auto; }
.drawer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.drawer-header h2 { margin: 4px 0 0; }
.notification { padding: 13px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.notification.unread { border-left: 4px solid var(--accent); }
.notification-title { font-weight: 780; }
.notification-when { color: var(--muted); font-size: 11px; margin-top: 5px; }
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 70; display: grid; gap: 8px; }
.toast { background: var(--dark); color: white; padding: 12px 15px; border-radius: 10px; box-shadow: var(--shadow); max-width: 340px; font-size: 13px; animation: toast-in .2s ease-out; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.empty { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed #cfd4da; border-radius: 14px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-12 { margin-top: 12px; }
.mt-18 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; }

@media (max-width: 1100px) {
  .goal-columns, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meeting-card { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; overflow: visible; }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav button { justify-content: center; font-size: 11px; padding: 9px 5px; }
  .nav button span { width: auto; }
  .sidebar-footer { margin-top: 16px; }
  .topbar { position: relative; padding: 16px; }
  .content { padding: 16px; }
  .grid-2, .grid-3, .grid-4, .goal-columns { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .permission-grid { grid-template-columns: 1fr; }
  .calendar-grid { grid-template-columns: repeat(7, 160px); }
  .topbar h1 { font-size: 24px; }
}

/* Authentication, settings and action controls */
.signed-in-user { display:grid; gap:4px; }
.signed-in-user .eyebrow { color:#9ca3af; }
.signed-in-user strong { color:white; font-size:14px; }
.signed-in-user span:last-child { color:#9ca3af; font-size:11px; }
.compact { padding:6px 9px; font-size:11px; }
.tiny { padding:4px 7px; font-size:10px; border-radius:7px; }
.goal-entry { position:relative; }
.goal-entry-actions { display:flex; justify-content:flex-end; gap:6px; margin-bottom:5px; }
.cal-actions { display:flex; gap:5px; align-items:center; margin-top:8px; }
.meeting-card > div:last-child { position:relative; }
.meeting-actions { display:flex; justify-content:flex-end; gap:7px; margin-bottom:8px; }
.settings-person > strong { font-size:14px; }
.toggle-row { display:flex; gap:11px; align-items:flex-start; padding:12px; border:1px solid var(--line); border-radius:12px; background:var(--panel-2); text-transform:none; letter-spacing:0; color:var(--text); }
.toggle-row input { width:auto; margin-top:3px; }
.toggle-row span { display:grid; gap:3px; }
.toggle-row small { color:var(--muted); line-height:1.4; font-weight:500; }
.quick-choice-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.quick-choice { display:grid; gap:4px; text-align:left; padding:15px; border:1px solid var(--line); border-radius:12px; background:var(--panel-2); color:var(--text); }
.quick-choice:hover { border-color:#b8c0ca; background:white; }
.quick-choice span { color:var(--muted); font-size:11px; line-height:1.35; }

.auth-body { min-height:100vh; background:radial-gradient(circle at top right, rgba(200,169,107,.16), transparent 34%), #eef1f5; }
.auth-shell { min-height:100vh; display:grid; place-items:center; padding:24px; }
.auth-card { width:min(460px,100%); background:white; border:1px solid var(--line); border-radius:22px; box-shadow:var(--shadow); padding:28px; }
.auth-card h1 { margin:5px 0 7px; font-size:34px; letter-spacing:-.045em; }
.auth-brand { padding:0 0 20px; color:var(--text); }
.auth-brand .brand-subtitle { color:var(--muted); }
.auth-submit { width:100%; margin-top:18px; }
.auth-error { margin-top:12px; padding:10px 12px; border-radius:10px; background:#fff1f0; color:var(--danger); font-size:12px; font-weight:700; }
.login-help { margin-top:18px; padding-top:16px; border-top:1px solid var(--line); color:var(--muted); font-size:11px; line-height:1.5; }

@media (max-width:780px) {
  .quick-choice-grid { grid-template-columns:1fr; }
  .topbar-actions { flex-wrap:wrap; justify-content:flex-end; }
}
.notification-diagnostic { display:grid; gap:4px; padding:10px 12px; border-radius:10px; border:1px solid var(--line); font-size:11px; line-height:1.45; background:var(--panel-2); }
.notification-diagnostic strong { font-size:12px; }
.notification-diagnostic span { color:var(--muted); }
.notification-diagnostic.ok { border-color:#b8dfc4; background:#f0faf3; }
.notification-diagnostic.ok strong { color:var(--success); }
.notification-diagnostic.warn { border-color:#f2d39b; background:#fff8eb; }
.notification-diagnostic.warn strong { color:#9a6700; }
.notification-diagnostic.bad { border-color:#f2b8b5; background:#fff2f1; }
.notification-diagnostic.bad strong { color:var(--danger); }
