:root {
  --green: #6ea44f;
  --green-dark: #315f2b;
  --green-soft: #edf6e7;
  --warm: #df9f59;
  --warm-soft: #fff3e4;
  --coral: #e26d5c;
  --ink: #20251f;
  --muted: #6c7468;
  --line: #dfe7db;
  --paper: #f7f8f4;
  --white: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: #dfe8d8; color: var(--ink); min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.app-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  position: relative;
  overflow: hidden;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  box-shadow: none;
}
.view { display: none; min-height: 100vh; }
.view.active { display: block; }
.brand-panel { padding: 56px 24px 24px; background: linear-gradient(145deg, var(--green), var(--warm)); color: white; }
.brand-mark { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.35); font-weight: 900; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 18px 0 8px; font-size: 34px; letter-spacing: 0; }
h2 { font-size: 25px; line-height: 1.25; letter-spacing: 0; }
h3 { letter-spacing: 0; }
.auth-card, .content { padding: 22px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.segmented button, .bottom-nav button { border: 1px solid var(--line); background: white; color: var(--muted); border-radius: 10px; padding: 10px; font-weight: 800; }
.segmented button.active, .bottom-nav button.active { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
label { display: block; color: var(--muted); font-size: 12px; font-weight: 800; margin: 0 0 12px; }
input, textarea, select { width: 100%; min-height: 48px; margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; background: white; padding: 12px 14px; color: var(--ink); }
textarea { min-height: 108px; resize: vertical; }
.signup-fields { display: none; }
.signup-fields.open { display: block; }
.primary-btn, .secondary-btn, .danger-btn { width: 100%; min-height: 50px; border-radius: 14px; font-weight: 900; margin: 8px 0 0; }
.primary-btn { border: 0; background: linear-gradient(135deg, var(--green), var(--warm)); color: white; }
.secondary-btn { background: white; color: var(--green-dark); border: 1px solid var(--line); }
.danger-btn { background: #fff1ef; color: #a73426; border: 1px solid #ffd3cc; }
.hint, .muted { color: var(--muted); font-size: 13px; line-height: 1.5; }
.hint { margin: 12px 0 0; }
.topbar { height: 58px; display: flex; align-items: center; gap: 8px; padding: 0 16px; background: rgba(247,248,244,.92); border-bottom: 1px solid var(--line); }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line); background: white; font-size: 28px; line-height: 1; }
.role-grid, .interest-grid { display: grid; gap: 10px; }
.role-card, .interest-chip { border: 1px solid var(--line); background: white; border-radius: 14px; padding: 16px; text-align: left; }
.role-card span { display: block; font-size: 17px; font-weight: 900; margin-bottom: 6px; }
.role-card small { color: var(--muted); line-height: 1.45; }
.role-card.active, .interest-chip.active { border-color: var(--green); background: var(--green-soft); }
.interest-grid { grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.interest-chip { text-align: center; font-weight: 800; padding: 13px 8px; }
.screen { height: calc(100vh - 72px - env(safe-area-inset-bottom)); overflow: hidden; }
.tab { display: none; height: 100%; overflow-y: auto; padding: 18px 18px 28px; }
.tab.active { display: block; }
.bottom-nav { height: calc(72px + env(safe-area-inset-bottom)); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; background: white; border-top: 1px solid var(--line); }
.bottom-nav button { padding: 8px 2px; font-size: 11px; border-radius: 12px; }
.hero-card { background: linear-gradient(135deg, var(--green), var(--warm)); color: white; border-radius: 20px; padding: 18px; margin-bottom: 14px; }
.hero-card h2 { margin-bottom: 8px; color: white; }
.status-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; min-height: 28px; border-radius: 999px; padding: 5px 10px; background: rgba(255,255,255,.2); color: inherit; font-size: 12px; font-weight: 800; }
.card, .notice-card, .course-card, .chat-card { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.card h3, .course-card h3, .chat-card h3 { font-size: 17px; margin-bottom: 8px; }
.course-card h3 { font-size: 16px; margin-bottom: 6px; }
.course-meta { color: var(--muted); font-size: 12px; line-height: 1.45; }
.course-actions, .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.tiny-btn { min-height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--green-soft); color: var(--green-dark); font-weight: 900; }
.tiny-btn.secondary { background: white; color: var(--muted); }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; }
.toolbar button { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; background: white; padding: 8px 12px; color: var(--muted); font-weight: 800; }
.toolbar button.active { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.profile-row { display: flex; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.profile-row span { color: var(--muted); }
.profile-row strong { text-align: right; overflow-wrap: anywhere; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.metric-card { background: #ffffff; border: 1px solid #e3e8ef; border-radius: 8px; padding: 14px; }
.metric-card span { display: block; color: #64748b; font-size: 13px; margin-bottom: 6px; }
.metric-card strong { display: block; color: #162033; font-size: 24px; }
.metric-card em { display: block; margin-top: 6px; color: #64748b; font-size: 12px; font-style: normal; }
.warning-text { color: #b45309; font-size: 13px; line-height: 1.5; }
.dashboard-status { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: #f1f5f9; border: 1px solid #d8e0ea; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; color: #334155; }
.radar-wrap { display: grid; place-items: center; margin: 12px 0; }
.radar { width: min(280px, 100%); height: auto; }
.progress-row { margin-top: 12px; }
.progress-row > div:first-child { display: flex; justify-content: space-between; margin-bottom: 6px; color: #475569; font-size: 13px; }
.progress-track { height: 9px; background: #e6edf5; border-radius: 999px; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: linear-gradient(90deg, #2f80ed, #26a69a); border-radius: inherit; }
.chat-list { display: grid; gap: 10px; }
.chat-message { border-radius: 12px; padding: 10px 12px; margin: 8px 0; background: #fff; border: 1px solid var(--line); }
.chat-message.mine { background: var(--green-soft); border-color: #c7ddbd; }
.chat-message strong { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.safe-box { background: var(--warm-soft); border: 1px solid #f3d7b7; border-radius: 12px; padding: 12px; margin: 10px 0; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.32); display: grid; align-items: end; justify-items: center; z-index: 20; }
.modal[hidden] { display: none; }
.modal-sheet { width: min(430px, 100vw); max-height: 86vh; overflow-y: auto; background: var(--paper); border-radius: 22px 22px 0 0; padding: 22px; position: relative; }
.modal-close { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border: 0; background: white; border-radius: 50%; font-size: 24px; }
.toast-area { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(390px, calc(100vw - 28px)); z-index: 30; pointer-events: none; }
.toast { background: rgba(32,37,31,.94); color: white; border-radius: 14px; padding: 12px 14px; margin-top: 8px; box-shadow: 0 10px 24px rgba(0,0,0,.2); }
.loading-panel { display: grid; justify-items: center; gap: 12px; padding: 28px 8px; text-align: center; }
.loading-spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 420px) { .metric-grid, .course-actions, .two-col { grid-template-columns: 1fr; } }
@media (min-width: 700px) {
  body { padding: 0; }
  .app-shell { min-height: 100vh; border-radius: 0; }
  .view { min-height: 100vh; }
  .screen { height: calc(100vh - 72px - env(safe-area-inset-bottom)); }
}

/* Design reference alignment: brand palette, softer mobile cards, clearer app chrome. */
:root {
  --green: #93BE6F;
  --green-dark: #6FA050;
  --green-soft: #EEF6E0;
  --warm: #E8A668;
  --warm-soft: #FBEED9;
  --coral: #E07A4D;
  --ink: #2D3D24;
  --muted: #5F6E54;
  --line: #E5E7DA;
  --paper: #FAF7F0;
  --brand-grad: linear-gradient(135deg, #E8A668 0%, #93BE6F 100%);
  --brand-grad-soft: linear-gradient(135deg, #FBEED9 0%, #EEF6E0 100%);
  --shadow-sm: 0 4px 16px rgba(60,80,40,0.06);
  --shadow-md: 0 8px 32px rgba(60,80,40,0.10);
  --shadow-lg: 0 20px 60px rgba(60,80,40,0.18);
}

html, body {
  background:
    radial-gradient(circle at 15% 0%, rgba(232,166,104,0.12), transparent 50%),
    radial-gradient(circle at 85% 100%, rgba(147,190,111,0.18), transparent 50%),
    #F5F1E6;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  background: var(--paper);
  box-shadow: none;
}

.brand-panel {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 52px 28px 32px;
  background: linear-gradient(180deg, #fff 0%, var(--warm-soft) 48%, var(--green-soft) 100%);
  color: var(--ink);
  position: relative;
  overflow: hidden;
}

.brand-panel::before {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -70px;
  top: -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(147,190,111,.26), transparent 68%);
}

.brand-panel::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  left: -76px;
  bottom: -70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,166,104,.22), transparent 70%);
}

.brand-mark {
  width: 78px;
  height: 78px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid rgba(207,211,192,.9);
  box-shadow: var(--shadow-md);
  display: block;
  object-fit: contain;
  padding: 8px;
  position: relative;
  z-index: 1;
}

.brand-mark::before {
  content: none;
}

.brand-panel h1 {
  position: relative;
  z-index: 1;
  margin: 26px 0 10px;
  color: #1A2614;
  font-size: 38px;
  line-height: 1.15;
  font-weight: 900;
}

.brand-panel p {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 310px;
}

.auth-card, .content {
  padding: 24px 22px 28px;
}

.segmented {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.segmented button {
  border: 0;
  border-radius: 14px;
  min-height: 42px;
}

.segmented button.active {
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 6px 18px rgba(200,133,74,0.22);
}

label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .02em;
}

input, textarea, select {
  min-height: 56px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: #1A2614;
  font-weight: 700;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(147,190,111,.18);
}

.primary-btn, .secondary-btn, .danger-btn {
  min-height: 58px;
  border-radius: 18px;
  font-size: 16px;
  margin-top: 12px;
  transition: transform .15s, box-shadow .15s, background .15s;
}

.primary-btn {
  background: var(--brand-grad);
  box-shadow: 0 8px 22px rgba(200,133,74,.24);
}

.primary-btn:hover, .secondary-btn:hover, .danger-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn {
  border: 2px solid #CFD3C0;
  color: var(--green-dark);
  box-shadow: var(--shadow-sm);
}

.topbar {
  height: 64px;
  padding: 8px 18px 0;
  background: rgba(250,247,240,.94);
  border-bottom: 0;
}

.topbar strong {
  color: #1A2614;
  font-size: 18px;
}

.icon-btn {
  border-radius: 14px;
  border: 0;
  background: #fff;
  box-shadow: var(--shadow-sm);
  color: #1A2614;
}

.role-card {
  border: 2.5px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.role-card.active {
  border-color: var(--green);
  background: var(--green-soft);
}

.role-card[data-role="child"].active {
  border-color: var(--warm);
  background: var(--warm-soft);
}

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

.interest-chip {
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  min-height: 52px;
  box-shadow: var(--shadow-sm);
}

.interest-chip.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.screen {
  background: var(--paper);
}

.tab {
  padding: 18px 20px 32px;
}

.bottom-nav {
  height: calc(78px + env(safe-area-inset-bottom));
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  gap: 8px;
  box-shadow: 0 -4px 16px rgba(60,80,40,0.04);
}

.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  border-radius: 16px;
}

.bottom-nav button::before {
  font-size: 20px;
  line-height: 1;
}

.bottom-nav button[data-tab="homeTab"]::before { content: "🏠"; }
.bottom-nav button[data-tab="coursesTab"]::before { content: "📚"; }
.bottom-nav button[data-tab="chatTab"]::before { content: "💬"; }
.bottom-nav button[data-tab="scheduleTab"]::before { content: "📅"; }
.bottom-nav button[data-tab="reportTab"]::before { content: "📊"; }
.bottom-nav button[data-tab="profileTab"]::before { content: "👤"; }

.bottom-nav button.active {
  background: var(--green-soft);
  color: var(--green-dark);
}

.hero-card {
  background: var(--brand-grad);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(200,133,74,0.20);
}

.hero-card h2 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 900;
}

.pill {
  background: rgba(255,255,255,.25);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 12px;
}

.card, .notice-card, .course-card, .chat-card {
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.course-card {
  padding: 18px;
  border: 2px solid transparent;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.course-actions, .two-col {
  gap: 12px;
}

.card > button + button,
.notice-card > button + button,
.modal-sheet button + button,
.auth-card > button + p,
.profile-row + .primary-btn,
.profile-row + .secondary-btn {
  margin-top: 12px;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #C5DDA5;
}

.course-card:has(.safe-box) {
  background: linear-gradient(135deg, #fff 0%, var(--warm-soft) 100%);
  border-color: var(--warm);
}

.course-card h3 {
  color: #1A2614;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.35;
}

.course-meta {
  color: var(--muted);
  font-size: 13px;
}

.tiny-btn {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 14px rgba(147,190,111,.24);
}

.tiny-btn.secondary {
  background: #fff;
  color: var(--green-dark);
  border: 2px solid var(--line);
  box-shadow: none;
}

.toolbar button {
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.toolbar button.active {
  background: var(--brand-grad);
  color: #fff;
}

.metric-grid {
  gap: 9px;
}

.metric-card {
  border: 0;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.metric-card strong {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.dashboard-status {
  border: 0;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.radar-wrap {
  background: linear-gradient(180deg, #fff 0%, var(--green-soft) 100%);
  border-radius: 18px;
  padding: 12px;
}

.safe-box {
  background: var(--warm-soft);
  border: 1px solid #F4C99C;
  border-radius: 14px;
}

.chat-card {
  text-align: left;
  width: 100%;
}

.chat-message {
  border: 0;
  box-shadow: var(--shadow-sm);
}

.chat-message.mine {
  background: var(--green-soft);
}

.profile-row {
  border-bottom-color: var(--line);
  align-items: flex-start;
  padding: 16px 0;
}

.profile-row strong {
  color: #1A2614;
  line-height: 1.35;
  max-width: 58%;
}

#profileTab .card,
#profileTab .notice-card {
  margin-bottom: 18px;
}

#profileTab .card h3,
#profileTab .notice-card h3 {
  margin-bottom: 12px;
}

#profileTab > .secondary-btn,
#profileTab > .danger-btn {
  margin: 16px 0 18px;
}

#profileTab input {
  margin-top: 14px;
}

#profileTab .primary-btn {
  margin-top: 16px;
}

#profileTab input:disabled,
#profileTab button:disabled {
  cursor: default;
  opacity: .68;
}

.family-linked-card input:disabled {
  background: #f8faf5;
  color: var(--muted);
}

.modal-sheet {
  background: var(--paper);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.toast {
  border-radius: 16px;
  background: rgba(26,38,20,.94);
}

@media (min-width: 700px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    border: 0;
    overflow: hidden;
  }

  .view,
  .screen {
    border-radius: 0;
  }
}

@media (min-width: 760px) {
  .tab {
    padding: 28px clamp(24px, 4vw, 56px) 34px;
  }

  .auth-card,
  .content {
    padding: 32px clamp(28px, 5vw, 72px);
  }

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

  #coursesTab #courseList,
  #chatTab .chat-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
  }

  .course-card,
  .chat-card,
  .card,
  .notice-card {
    margin-bottom: 16px;
  }

  .bottom-nav {
    gap: 10px;
    padding-inline: clamp(16px, 4vw, 56px);
  }

  .bottom-nav button {
    font-size: 13px;
  }

  .modal-sheet {
    width: min(760px, calc(100vw - 48px));
    border-radius: 26px;
    margin-bottom: 24px;
  }

  .toast-area {
    width: min(520px, calc(100vw - 48px));
  }
}

@media (min-width: 1120px) {
  .course-actions,
  .two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #profileTab .card,
  #profileTab .notice-card,
  #reportTab .card,
  #reportTab .notice-card {
    max-width: none;
  }
}

/* Touch spacing refinements for course and chat tabs. */
#coursesTab .toolbar {
  gap: 12px;
  margin: 14px 0 18px;
  padding-bottom: 2px;
}

#coursesTab .toolbar button {
  min-height: 40px;
  padding-inline: 14px;
}

#createP2PBtn,
#refreshChatBtn {
  margin: 14px 0 18px;
}

#chatTab > .hint {
  margin-bottom: 14px;
}

#chatTab .chat-list,
#coursesTab #courseList {
  margin-top: 14px;
}
/* DOCX UX refresh: larger text, 4-item navigation, full-width responsive web app. */
:root {
  --doc-ink: #172413;
  --doc-green: #5f9344;
  --doc-green-strong: #315f2b;
  --doc-mint: #edf7e7;
  --doc-honey: #e8a668;
  --doc-cream: #fffaf0;
  --doc-danger: #c94732;
}

body {
  font-size: 18px;
  line-height: 1.55;
  color: var(--doc-ink);
}

h1 { font-size: clamp(34px, 5vw, 56px); }
h2 { font-size: clamp(26px, 3.5vw, 38px); }
h3 { font-size: clamp(20px, 2.4vw, 26px); }

.hint,
.muted,
.course-meta,
.warning-text,
.metric-card em,
.progress-row > div:first-child {
  font-size: 16px;
  line-height: 1.6;
}

label {
  font-size: 16px;
  margin-bottom: 16px;
}

button,
.primary-btn,
.secondary-btn,
.danger-btn,
.tiny-btn,
.segmented button,
.toolbar button,
.bottom-nav button,
input,
textarea,
select {
  min-height: 56px;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.tiny-btn,
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  gap: 8px;
}

.app-shell,
.view,
.screen {
  width: 100%;
  max-width: none;
}

.screen {
  height: calc(100vh - 84px - env(safe-area-inset-bottom));
}

.tab {
  padding: clamp(20px, 3vw, 44px) clamp(18px, 5vw, 72px) clamp(112px, 12vh, 150px);
}

.brand-panel {
  min-height: clamp(280px, 36vh, 420px);
  padding-inline: clamp(26px, 7vw, 96px);
  background:
    linear-gradient(110deg, rgba(255,250,240,.96), rgba(237,247,231,.92)),
    var(--brand-grad);
}

.brand-panel p {
  max-width: 680px;
  font-size: clamp(18px, 2vw, 22px);
}

.brand-mark {
  width: clamp(84px, 10vw, 118px);
  height: clamp(84px, 10vw, 118px);
}

.auth-card,
.content {
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}

.bottom-nav {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: calc(84px + env(safe-area-inset-bottom));
  padding: 10px clamp(10px, 4vw, 72px) calc(10px + env(safe-area-inset-bottom));
  gap: clamp(8px, 2vw, 18px);
}

.bottom-nav button {
  font-size: clamp(13px, 1.8vw, 16px);
  border-radius: 20px;
}

.bottom-nav button::before {
  font-size: 24px;
}

.hero-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 4vw, 42px);
  border-radius: 24px;
}

.hero-card h2 {
  font-size: clamp(28px, 4vw, 44px);
}

.status-row {
  gap: 10px;
}

.pill {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 15px;
}

.card,
.notice-card,
.course-card,
.chat-card,
.metric-card {
  border-radius: 22px;
  padding: clamp(18px, 2.5vw, 28px);
}

.quick-card {
  border: 2px solid rgba(95,147,68,.18);
  background: linear-gradient(180deg, #fff 0%, var(--doc-mint) 100%);
}

.home-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

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

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: clamp(12px, 2vw, 20px);
}

.metric-card strong {
  font-size: clamp(28px, 4vw, 42px);
}

.course-actions,
.two-col {
  gap: 12px;
}

.toolbar {
  gap: 12px;
  padding: 4px 0 8px;
}

.toolbar button {
  padding-inline: 18px;
}

.radar {
  width: min(440px, 100%);
}

.radar-wrap {
  min-height: 320px;
}

.sos-floating {
  position: fixed;
  right: clamp(16px, 4vw, 42px);
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 19;
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #f05f43, #c73527);
  color: #fff;
  font-weight: 950;
  letter-spacing: 0;
  box-shadow: 0 16px 36px rgba(199,53,39,.32);
}

#authView .sos-floating,
#roleView .sos-floating,
#onboardingView .sos-floating {
  display: none;
}

.profile-row {
  gap: 20px;
  font-size: 18px;
}

.profile-row strong {
  max-width: 64%;
}

@media (max-width: 520px) {
  .home-action-grid,
  .metric-grid,
  .course-actions,
  .two-col {
    grid-template-columns: 1fr;
  }

  .home-action-grid .wide-action {
    grid-column: auto;
  }

  .tab {
    padding-inline: 18px;
  }

  .bottom-nav {
    gap: 7px;
  }

  .bottom-nav button {
    font-size: 12px;
  }

  .sos-floating {
    width: 62px;
    height: 62px;
    right: 14px;
  }
}

@media (min-width: 980px) {
  #homeTab,
  #reportTab,
  #profileTab {
    display: none;
  }

  #homeTab.active,
  #reportTab.active,
  #profileTab.active {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
    align-content: start;
    gap: 22px;
  }

  #homeTab.active .hero-card,
  #homeTab.active .metric-grid,
  #reportTab.active > h2,
  #reportTab.active .dashboard-status,
  #profileTab.active > h2 {
    grid-column: 1 / -1;
  }

  #coursesTab #courseList,
  #chatTab .chat-list {
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  }
}
/* Interest editor restored as large tap chips in profile edit. */
.interest-editor {
  margin: 18px 0 22px;
}

.interest-editor > strong {
  display: block;
  margin-bottom: 4px;
  color: var(--doc-ink);
  font-size: 18px;
}

.interest-editor .interest-grid {
  margin-top: 12px;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.interest-editor .interest-chip {
  min-height: 56px;
  font-size: 17px;
}
/* Senior-friendly avatar picker: preset emoji selection only. */
.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 0 18px;
  box-shadow: var(--shadow-md);
}

.preset-avatar {
  display: grid;
  place-items: center;
  background: var(--brand-grad-soft);
  border: 3px solid #fff;
  color: var(--doc-green-strong);
  font-size: 40px;
  font-weight: 950;
}

.avatar-editor {
  margin: 18px 0 22px;
}

.avatar-editor > strong {
  display: block;
  margin-bottom: 4px;
  color: var(--doc-ink);
  font-size: 18px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.avatar-choice {
  min-height: 96px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: #fff;
  color: var(--doc-ink);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.avatar-choice span {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-grad-soft);
  color: var(--doc-green-strong);
  font-size: 30px;
  font-weight: 950;
}

.avatar-choice small {
  font-size: 15px;
  font-weight: 900;
}

.avatar-choice.active {
  border-color: var(--green);
  background: var(--green-soft);
}
/* Profile tab button sizing: keep all direct actions visually consistent. */
#profileTab > .secondary-btn,
#profileTab > .danger-btn,
#profileTab .card .primary-btn,
#profileTab .card .secondary-btn,
#profileTab .notice-card .primary-btn,
#profileTab .notice-card .secondary-btn {
  width: 100%;
  min-height: 56px;
  border-radius: 18px;
  margin: 12px 0 0;
  padding: 0 18px;
  font-size: 17px;
  line-height: 1.25;
}

#profileTab > .secondary-btn:first-of-type,
#profileTab > .danger-btn:first-of-type {
  margin-top: 0;
}

#profileTab > .secondary-btn,
#profileTab > .danger-btn {
  margin-bottom: 16px;
}

#profileTab .family-linked-card .secondary-btn:disabled {
  min-height: 56px;
}
/* Profile edit modal selection buttons: avatar and interest use one size system. */
.avatar-grid,
.interest-editor .interest-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.avatar-choice,
.interest-editor .interest-chip {
  min-height: 82px;
  width: 100%;
  border-radius: 18px;
  padding: 10px 12px;
}

.avatar-choice {
  grid-template-columns: auto 1fr;
  justify-items: start;
  align-content: center;
  text-align: left;
}

.avatar-choice span {
  width: 46px;
  height: 46px;
  font-size: 28px;
}

.avatar-choice small,
.interest-editor .interest-chip {
  font-size: 19px;
  font-weight: 900;
}

@media (max-width: 420px) {
  .avatar-grid,
  .interest-editor .interest-grid {
    grid-template-columns: 1fr;
  }
}
/* Interest-based course recommendation markers. */
.course-interest-hint {
  background: linear-gradient(135deg, #fff 0%, var(--green-soft) 100%);
  border: 1px solid rgba(147,190,111,.38);
}

.course-interest-hint strong {
  display: block;
  margin-bottom: 4px;
  color: var(--doc-green-strong);
  font-size: 18px;
}

.match-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--doc-green-strong);
  font-size: 14px;
  font-weight: 950;
}

/* Market safety and trust UI */
.promise-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.55;
}
.promise-list li + li { margin-top: 4px; }
.trust-box {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffef8;
}
.trust-box p { margin: 6px 0 0; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-weight: 800;
}
.checkbox-row input {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}


/* Senior-friendly emoji shortcuts */
.emoji-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.emoji-action span {
  font-size: 1.35em;
  line-height: 1;
}
.quick-message-panel {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--warm-soft);
}
.quick-message-panel strong {
  display: block;
  margin-bottom: 10px;
}
.quick-message-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.quick-message-grid button {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}
@media (max-width: 420px) {
  .quick-message-grid { grid-template-columns: 1fr; }
}


/* Signup interest picker */
.signup-interest-block {
  display: grid;
  gap: 8px;
}
.signup-interest-block > strong {
  font-size: 16px;
  color: var(--text);
}
.signup-interest-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.signup-interest-grid .interest-chip {
  min-height: 52px;
  text-align: center;
  font-size: 15px;
}
@media (min-width: 720px) {
  .signup-interest-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Senior readability pass: larger type and clearer loading feedback. */
html {
  font-size: 20px;
}

body {
  font-size: 20px;
  line-height: 1.68;
}

h1 { font-size: clamp(38px, 5vw, 60px); }
h2 { font-size: clamp(30px, 3.6vw, 42px); }
h3 { font-size: clamp(23px, 2.5vw, 30px); }

.hint,
.muted,
.course-meta,
.warning-text,
.metric-card em,
.progress-row > div:first-child,
.profile-row,
.trust-box,
.safe-box,
.promise-list,
.checkbox-row {
  font-size: clamp(18px, 1.8vw, 21px);
  line-height: 1.7;
}

label,
.signup-interest-block > strong,
.avatar-editor > strong,
.interest-editor > strong,
.course-interest-hint strong {
  font-size: clamp(19px, 2vw, 22px);
}

input,
textarea,
select {
  min-height: 64px;
  font-size: 20px;
  padding: 16px 18px;
  border-radius: 18px;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.tiny-btn,
.link-btn,
.toolbar button,
.segmented button,
.quick-message-grid button,
.interest-chip,
.role-card {
  min-height: 64px;
  font-size: clamp(19px, 2vw, 22px);
  line-height: 1.35;
}

.role-card span,
.card h3,
.course-card h3,
.chat-card h3 {
  font-size: clamp(23px, 2.4vw, 30px);
  line-height: 1.35;
}

.course-card h3 {
  font-size: clamp(22px, 2.2vw, 28px);
}

.card,
.notice-card,
.course-card,
.chat-card,
.metric-card {
  padding: clamp(22px, 3vw, 34px);
}

.pill,
.match-badge {
  min-height: 42px;
  font-size: clamp(17px, 1.8vw, 20px);
  padding: 8px 15px;
}

.metric-card span {
  font-size: clamp(18px, 1.8vw, 21px);
}

.metric-card strong {
  font-size: clamp(34px, 4.2vw, 48px);
}

.bottom-nav button {
  font-size: clamp(14px, 1.7vw, 17px);
  min-height: 66px;
}

.bottom-nav button::before {
  font-size: 28px;
}

.loading-panel {
  border: 1px solid rgba(147,190,111,.35);
  border-radius: 22px;
  background: linear-gradient(180deg, #fff 0%, var(--green-soft) 100%);
  padding: clamp(26px, 4vw, 42px);
}

.loading-panel strong {
  color: var(--doc-green-strong);
  font-size: clamp(22px, 2.5vw, 28px);
  line-height: 1.35;
}

.compact-loading {
  margin-top: 10px;
}

@media (max-width: 520px) {
  body { font-size: 19px; }
  .bottom-nav button { font-size: 13px; }
  .toolbar button { font-size: 18px; }
  .primary-btn,
  .secondary-btn,
  .danger-btn,
  .tiny-btn,
  .link-btn,
  .interest-chip {
    font-size: 18px;
  }
}

.signup-location-box {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.72);
}
.signup-location-box strong {
  font-size: clamp(19px, 2vw, 22px);
  color: var(--text);
}
.signup-location-box .secondary-btn {
  width: 100%;
}
/* Android WebView navigation bar inset fix. */
:root {
  --android-nav-inset: 0px;
  --app-bottom-inset: max(env(safe-area-inset-bottom), var(--android-nav-inset));
}

.app-shell {
  padding-bottom: var(--app-bottom-inset);
}

.screen {
  height: calc(100vh - 84px - var(--app-bottom-inset));
  height: calc(100dvh - 84px - var(--app-bottom-inset));
}

.bottom-nav {
  height: auto;
  min-height: calc(84px + var(--app-bottom-inset));
  padding-bottom: calc(14px + var(--app-bottom-inset));
  box-sizing: border-box;
}

.sos-floating {
  bottom: calc(108px + var(--app-bottom-inset));
}

.toast-area {
  bottom: calc(104px + var(--app-bottom-inset));
}
.primary-btn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: .9;
  cursor: wait;
}
.button-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
  flex: 0 0 auto;
}
.auth-card button:disabled,
.auth-card input:disabled {
  opacity: .72;
}
.secondary-btn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: wait;
}
.secondary-btn.is-loading .button-spinner {
  border-color: rgba(95,147,68,.28);
  border-top-color: var(--green);
}
.profile-location-editor {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}
.profile-location-editor .secondary-btn {
  margin-top: 0;
}