:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --paper: #f5f1ea;
  --card: #fffaf2;
  --line: #ded7ca;
  --gold: #b88746;
  --gold-dark: #8f642f;
  --green: #1f7a5a;
  --blue: #365c94;
  --amber: #ab6b12;
  --rose: #9c3c3c;
  --shadow: 0 18px 50px rgba(23, 32, 51, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(184, 135, 70, .18), transparent 34rem),
    linear-gradient(135deg, #fbf8f1 0%, var(--paper) 50%, #ece5d7 100%);
  color: var(--ink);
  min-height: 100vh;
}

button, input, textarea { font: inherit; }

.app-header,
main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.app-header {
  padding: 28px 0 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.feedback-toggle[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, var(--gold-dark), var(--gold)); border-color: transparent; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -0.05em; }
h2 { margin-bottom: 10px; font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: -0.035em; }
h3 { margin-bottom: 7px; font-size: 1.1rem; }
.subhead { color: var(--muted); margin-bottom: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; color: var(--gold-dark); font-size: .75rem; font-weight: 800; margin-bottom: 5px; }

.card,
.quadrant {
  background: rgba(255, 250, 242, .88);
  border: 1px solid rgba(222, 215, 202, .9);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.hero {
  padding: clamp(22px, 4vw, 38px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.hero p { max-width: 680px; color: var(--muted); line-height: 1.6; margin-bottom: 0; }

button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

.primary {
  color: white;
  background: linear-gradient(135deg, var(--ink), #34415c);
  padding: 13px 20px;
  box-shadow: 0 12px 26px rgba(23, 32, 51, .22);
}
.ghost {
  color: var(--ink);
  background: rgba(255,255,255,.56);
  border: 1px solid var(--line);
  padding: 11px 15px;
}
.danger {
  color: #fff;
  background: var(--rose);
  padding: 11px 15px;
}
.hidden { display: none !important; }
.account-panel { padding: 20px 22px; margin-bottom: 18px; }
.auth-controls, .calendar-connect { display: grid; gap: 10px; margin-top: 12px; }
.auth-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.auth-row input[type="email"] { flex: 1 1 260px; margin: 0; }
.calendar-connect { grid-template-columns: auto auto minmax(0, 1fr); align-items: center; }
.calendar-connect .note { margin: 0; }

.capture-panel { padding: 24px; margin-bottom: 28px; }
.section-title { margin-bottom: 18px; }
.row-title { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

label, legend { font-weight: 800; }
input[type="text"], input[type="email"], input[type="number"], input[type="datetime-local"], input:not([type]), textarea {
  width: 100%;
  margin: 8px 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 15px;
  background: rgba(255,255,255,.78);
  color: var(--ink);
  outline: none;
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(184, 135, 70, .15); }
textarea { resize: vertical; }

.question-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: rgba(255,255,255,.42);
}
fieldset label {
  display: block;
  font-weight: 650;
  line-height: 1.35;
  color: #313b50;
  padding: 10px 0;
}
fieldset input { margin-right: 8px; }

.coach-box,
.challenge {
  margin: 16px 0;
  border-radius: 18px;
  padding: 14px 16px;
}
.coach-box { background: rgba(54, 92, 148, .08); border: 1px solid rgba(54, 92, 148, .18); }
.coach-box summary { cursor: pointer; font-weight: 850; }
.coach-box ul { margin-bottom: 0; }
.challenge { background: rgba(184, 135, 70, .13); border: 1px solid rgba(184, 135, 70, .32); font-weight: 750; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.matrix-wrap { margin-bottom: 28px; }
.priority-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid rgba(23, 32, 51, .16);
  border-radius: 28px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.map-cell {
  min-height: 156px;
  border-radius: 0;
  text-align: left;
  padding: clamp(13px, 3vw, 22px);
  background: #fff;
  border-right: 1px solid rgba(23, 32, 51, .12);
  border-bottom: 1px solid rgba(23, 32, 51, .12);
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 5px;
  color: var(--ink);
}
.map-cell:nth-child(2n) { border-right: 0; }
.map-cell:nth-child(n+3) { border-bottom: 0; }
.map-cell strong { font-size: clamp(2rem, 8vw, 3.15rem); line-height: .95; letter-spacing: -.07em; }
.map-cell small { color: rgba(23, 32, 51, .72); font-weight: 800; }
.map-cell em {
  color: rgba(23, 32, 51, .78);
  font-size: .86rem;
  line-height: 1.25;
  align-self: end;
  font-style: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.map-label { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 950; }
.map-do { box-shadow: inset 0 7px 0 var(--rose); background: linear-gradient(135deg, rgba(156,60,60,.13), #fff); }
.map-schedule { box-shadow: inset 0 7px 0 var(--green); background: linear-gradient(135deg, rgba(31,122,90,.13), #fff); }
.map-delegate { box-shadow: inset 0 7px 0 var(--amber); background: linear-gradient(135deg, rgba(171,107,18,.13), #fff); }
.map-delete { box-shadow: inset 0 7px 0 var(--blue); background: linear-gradient(135deg, rgba(54,92,148,.13), #fff); }

.focus-panel {
  padding: 22px;
  margin-bottom: 26px;
  display: grid;
  grid-template-columns: minmax(190px, .75fr) 1.5fr;
  gap: 18px;
  align-items: start;
}
.focus-panel h2 { font-size: clamp(1.2rem, 2.5vw, 1.65rem); }
.focus-grid { display: grid; gap: 10px; }
.focus-grid p {
  background: rgba(255,255,255,.58);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 13px 14px;
  margin: 0;
  line-height: 1.35;
}
.health-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--gold-dark);
  font-weight: 850;
  background: rgba(184,135,70,.12);
  border: 1px solid rgba(184,135,70,.25);
  border-radius: 16px;
  padding: 12px 14px;
}
.detail-title { margin-top: 6px; }
.matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.quadrant {
  min-height: 250px;
  padding: 18px;
  box-shadow: 0 13px 34px rgba(23, 32, 51, .09);
  scroll-margin-top: 18px;
}
.quadrant.highlight {
  outline: 4px solid rgba(184,135,70,.32);
  transform: translateY(-2px);
}
.quadrant > p { color: var(--muted); min-height: 44px; }
.q-do { border-top: 6px solid var(--rose); }
.q-schedule { border-top: 6px solid var(--green); }
.q-delegate { border-top: 6px solid var(--amber); }
.q-delete { border-top: 6px solid var(--blue); }
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .02em;
  vertical-align: middle;
}
.task-list { display: grid; gap: 10px; }
.empty-state { color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; padding: 16px; background: rgba(255,255,255,.34); }

.task-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 12px;
}
.task-title { display: block; margin-bottom: 6px; }
.task-why { margin-bottom: 8px; color: #4f5b70; font-size: .92rem; line-height: 1.35; }
.task-meta { color: var(--muted); }
.task-actions { display: flex; align-items: flex-start; gap: 5px; }
.calendar-sync {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 92px auto;
  gap: 8px;
  align-items: end;
  padding-top: 8px;
  border-top: 1px solid rgba(215,203,184,.62);
}
.calendar-sync label { font-size: .72rem; color: var(--muted); font-weight: 850; }
.calendar-sync input { margin-top: 4px; padding: 9px 10px; border-radius: 12px; }
.calendar-status { grid-column: 1 / -1; color: var(--gold-dark); font-weight: 850; line-height: 1.3; }
.calendar-status a { color: var(--blue); }
.tiny { min-width: 31px; height: 31px; padding: 0; background: #f2eee5; color: var(--ink); border-radius: 11px; }
.remove { color: #fff; background: var(--rose); }

.review-panel { padding: 24px; margin: 0 0 38px; }
.review-panel li { margin-bottom: 10px; line-height: 1.45; }
.note { color: var(--muted); margin-bottom: 0; }

.feedback-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 50;
  transform: translateX(-50%);
  background: rgba(23,32,51,.94);
  color: #fff;
  border-radius: 999px;
  padding: 11px 16px;
  box-shadow: var(--shadow);
  font-weight: 850;
  text-align: center;
  width: min(92vw, 520px);
}
body.feedback-mode-active *:not(.feedback-ui):not(.feedback-ui *) { cursor: crosshair; }
.feedback-marker {
  position: fixed;
  z-index: 70;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--gold-dark);
  box-shadow: 0 0 0 8px rgba(184,135,70,.22), var(--shadow);
  pointer-events: none;
  font-weight: 950;
}
.feedback-dialog {
  width: min(92vw, 560px);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 22px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.feedback-dialog::backdrop { background: rgba(23,32,51,.42); backdrop-filter: blur(2px); }
.feedback-target {
  color: var(--muted);
  background: rgba(255,255,255,.68);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  line-height: 1.35;
}
.feedback-status { min-height: 1.3em; color: var(--gold-dark); font-weight: 850; }
.feedback-drawer {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  width: min(360px, calc(100vw - 32px));
  max-height: 58vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,250,242,.96);
  box-shadow: var(--shadow);
  padding: 14px;
}
.feedback-drawer-head,
.feedback-drawer-actions { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.feedback-drawer-actions { margin-top: 10px; flex-wrap: wrap; }
.feedback-list { display: grid; gap: 8px; margin-top: 10px; }
.feedback-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
  font-size: .88rem;
}
.feedback-item strong { display: block; margin-bottom: 4px; }
.feedback-item small { color: var(--muted); display: block; margin-top: 6px; }
.feedback-sent { border-left: 5px solid var(--green); }
.feedback-pending { border-left: 5px solid var(--amber); }
.feedback-failed { border-left: 5px solid var(--rose); }

@media (max-width: 780px) {
  .app-header, .hero, .row-title { align-items: stretch; flex-direction: column; }
  .header-actions { justify-content: stretch; }
  .header-actions button { flex: 1 1 auto; }
  .hero .primary { width: 100%; }
  .calendar-sync { grid-template-columns: 1fr; }
  .calendar-connect { grid-template-columns: 1fr; }
  .task-card { grid-template-columns: 1fr; }
  .question-grid, .detail-buckets, .focus-panel { grid-template-columns: 1fr; }
  .priority-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-cell { min-height: 132px; padding: 13px; }
  .map-label { font-size: .66rem; }
  .map-cell small { font-size: .74rem; }
  .map-cell em { font-size: .76rem; }
  .toolbar { justify-content: stretch; }
  .toolbar button, .actions button { flex: 1 1 auto; }
}
