* { box-sizing: border-box; }
:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #173238;
  background: #eef5f4;
}
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px; background: #1f6f78; color: white;
}
.app-header h1 { margin: 0; font-size: 1.7rem; }
.app-header p { margin: 2px 0 0; opacity: .9; }

main { width: min(920px, calc(100% - 24px)); margin: 20px auto 40px; }
.card {
  background: white; border-radius: 18px; padding: 20px;
  box-shadow: 0 8px 28px rgba(31, 70, 75, .10);
}
.hidden { display: none !important; }

.person-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.person-button {
  min-height: 130px; border: 0; border-radius: 18px; font-size: 2rem;
  font-weight: 750; background: #d8eeeb; color: #154d54;
}
.person-button:active { transform: scale(.99); }

.dashboard-top {
  display: flex; align-items: center; gap: 14px; margin-bottom: 12px;
}
.dashboard-top h2 { margin: 0; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tab {
  border: 0; border-radius: 12px; padding: 13px 8px; background: #dbe7e6; color: #27494d;
  font-weight: 700;
}
.tab.active { background: #1f6f78; color: white; }

.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
}
label { display: grid; gap: 6px; font-weight: 700; }
input, select, textarea {
  width: 100%; border: 1px solid #b8ccca; border-radius: 12px; padding: 13px;
  background: #fbfdfd; color: #173238;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(31,111,120,.18); border-color: #1f6f78;
}
.full-width { margin-top: 14px; }

.primary, .secondary {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 750;
}
.primary { background: #1f6f78; color: white; }
.secondary { background: #dbe7e6; color: #27494d; }
.success { min-height: 1.4em; color: #21663f; font-weight: 700; }

.section-heading {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.history-list { display: grid; gap: 12px; margin-top: 14px; }
.history-item {
  border: 1px solid #d7e4e2; border-radius: 14px; padding: 14px;
}
.history-item-header {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.history-item h4 { margin: 0; }
.history-item p { margin: 7px 0 0; line-height: 1.45; }
.delete-btn {
  border: 0; background: #f7dddd; color: #7a2525; border-radius: 10px; padding: 8px 10px;
}

.trend-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chart-wrap { overflow-x: auto; margin-top: 14px; }
canvas { width: 100%; min-width: 640px; background: #fbfdfd; border-radius: 14px; }
.trend-summary { font-weight: 700; }

.privacy-note {
  margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: #fff8d9;
  color: #5d5126;
}

@media (max-width: 620px) {
  main { width: min(100% - 16px, 920px); margin-top: 10px; }
  .card { padding: 16px; border-radius: 15px; }
  .form-grid, .trend-controls { grid-template-columns: 1fr; }
  .person-button { min-height: 115px; font-size: 1.7rem; }
  .tabs { gap: 5px; }
  .tab { padding: 12px 4px; font-size: .92rem; }
}

/* Cloud-connected version additions */
.header-actions { display: flex; gap: 8px; align-items: center; }
.auth-card { max-width: 560px; margin: 0 auto; }
.auth-card form { display: grid; gap: 14px; }
.auth-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.status-message { min-height: 1.4em; color: #21663f; font-weight: 700; }
.status-message.error, .small-status.error { color: #8a2727; }
.small-status { min-height: 1.2em; margin: 4px 0 10px; color: #476368; }
.section-actions { display: flex; gap: 8px; }
button:disabled { opacity: .6; cursor: wait; }

.mom-button { background: #eadcf0; color: #5f3774; }
.dad-button { background: #dceaf6; color: #265b83; }

body.mom-theme { background: #f5eff8; }
body.mom-theme .app-header,
body.mom-theme .tab.active,
body.mom-theme .primary { background: #7a4b94; }
body.mom-theme .secondary { background: #eadcf0; color: #5f3774; }
body.mom-theme input:focus,
body.mom-theme select:focus,
body.mom-theme textarea:focus { border-color: #7a4b94; outline-color: rgba(122,75,148,.18); }

body.dad-theme { background: #eef5fb; }
body.dad-theme .app-header,
body.dad-theme .tab.active,
body.dad-theme .primary { background: #2f6fa3; }
body.dad-theme .secondary { background: #dceaf6; color: #265b83; }
body.dad-theme input:focus,
body.dad-theme select:focus,
body.dad-theme textarea:focus { border-color: #2f6fa3; outline-color: rgba(47,111,163,.18); }

@media (max-width: 620px) {
  .auth-buttons { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .section-actions { flex-wrap: wrap; justify-content: flex-end; }
}

/* Version 1.1 */
.tabs { grid-template-columns: repeat(5, 1fr); }
.edit-banner { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:12px; margin-bottom:16px; border-radius:12px; background:#fff3cd; color:#5e4e13; }
.edit-banner span { flex:1; min-width:220px; }
.item-actions, .form-actions { display:flex; gap:8px; flex-wrap:wrap; }
.edit-btn, .edit-med-btn { border:0; background:#dceaf6; color:#265b83; border-radius:10px; padding:8px 11px; font-weight:700; }
.edited-time { margin-top:3px; color:#68787b; font-size:.88rem; }
.muted { color:#68787b; margin:4px 0 0; }
.medication-form { margin:18px 0; padding:16px; border:1px solid #d7e4e2; border-radius:14px; background:#fbfdfd; }
.checkbox-row { display:flex; grid-template-columns:none; align-items:center; gap:9px; font-weight:700; margin-top:14px; }
.checkbox-row input { width:auto; transform:scale(1.25); }
.medication-list { display:grid; gap:12px; margin-top:18px; }
.medication-item { border:1px solid #d7e4e2; border-radius:14px; padding:14px; }
.medication-item.inactive { opacity:.72; background:#f4f4f4; }
.medication-details p { margin:6px 0; }
.inactive-label { font-size:.75rem; padding:3px 7px; border-radius:10px; background:#e5e5e5; color:#555; white-space:nowrap; }
.report-controls { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin:18px 0; }
.report-includes { padding:14px; border-radius:12px; background:#eef5f4; line-height:1.5; }

@media (max-width: 760px) {
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .report-controls { grid-template-columns:1fr; }
}


/* Version 1.2 */
.tabs { grid-template-columns: repeat(3, 1fr); }
.admin-subtabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0 18px;
}
.admin-subtab {
  border: 0;
  border-radius: 12px;
  padding: 12px;
  background: #dbe7e6;
  color: #27494d;
  font-weight: 750;
}
.admin-subtab.active { background: var(--person-accent, #1f6f78); color: white; }
.admin-section h4 { font-size: 1.2rem; margin-bottom: 12px; }
.settings-fieldset {
  margin: 18px 0;
  border: 1px solid #c8d9d7;
  border-radius: 14px;
  padding: 14px;
}
.settings-fieldset legend { font-weight: 800; padding: 0 6px; }
.threshold-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.theme-purple { --person-accent: #7a4b94; --person-soft: #f1e8f6; background: #f6f0f8; }
.theme-blue { --person-accent: #2f6fa3; --person-soft: #e6f0f8; background: #eef5fa; }
.theme-teal { --person-accent: #167c78; --person-soft: #e3f3f1; background: #edf8f7; }
.theme-rose { --person-accent: #a84f68; --person-soft: #f8e8ed; background: #fcf1f4; }
.theme-green { --person-accent: #4d7d4f; --person-soft: #eaf3e9; background: #f1f7f0; }
.theme-purple .app-header,
.theme-blue .app-header,
.theme-teal .app-header,
.theme-rose .app-header,
.theme-green .app-header { background: var(--person-accent); }
.theme-purple .primary,
.theme-blue .primary,
.theme-teal .primary,
.theme-rose .primary,
.theme-green .primary,
.theme-purple .tab.active,
.theme-blue .tab.active,
.theme-teal .tab.active,
.theme-rose .tab.active,
.theme-green .tab.active { background: var(--person-accent); }
.theme-purple .person-button,
.theme-blue .person-button,
.theme-teal .person-button,
.theme-rose .person-button,
.theme-green .person-button { background: var(--person-soft); }

@media (max-width: 620px) {
  .threshold-grid { grid-template-columns: 1fr; }
}

.build-label { opacity:.7; white-space:nowrap; }

.baseline-card{
  margin-top:12px;
  padding:12px;
  border:1px solid #c8d9d7;
  border-radius:12px;
  background:rgba(255,255,255,.65);
}
.baseline-card > div{ margin:4px 0; }


.personal-temp-toggle-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}
.toggle-button{
  min-width:110px;
  border:0;
  border-radius:999px;
  padding:10px 16px;
  font-weight:800;
  background:#d9e2e3;
  color:#42585d;
}
.toggle-button.enabled{
  background:var(--person-accent,#1f6f78);
  color:#fff;
}
.visually-hidden{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}
