:root {
  --teal: #138f99;
  --teal-bright: #3fbcc4;
  --teal-pale: #eaf8f8;
  --green: #6f9414;
  --green-pale: #f2f8df;
  --yellow: #a86d00;
  --yellow-pale: #fff5d5;
  --red: #b4232e;
  --red-pale: #fff0f1;
  --peach: #fbd3c6;
  --grey: #6b6d69;
  --line: #d9e2e2;
  --surface: #fff;
  --background: #f7faf9;
  --text: #172326;
  --shadow: 0 10px 30px rgba(24, 64, 69, .08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.demo-banner {
  padding: 7px 16px;
  color: #543b00;
  background: var(--yellow-pale);
  border-bottom: 1px solid #efd686;
  text-align: center;
  font-size: .82rem;
  font-weight: 650;
}

.app-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px clamp(18px, 4vw, 58px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; }
.brand img { width: 102px; height: 56px; object-fit: cover; object-position: 50% 78%; border-radius: 4px; }
.brand span { display: grid; }
.brand strong { color: var(--teal); font-size: 1.2rem; }
.brand small { color: var(--grey); }
.header-tools { display: flex; align-items: center; gap: 18px; }
.context-picker { display: grid; gap: 3px; color: var(--grey); font-size: .75rem; font-weight: 600; }
.context-picker select { min-width: 190px; }
.session-user { font-size: .88rem; color: var(--grey); }

.main-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 3px;
  padding: 0 clamp(18px, 4vw, 58px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.main-nav button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 17px 12px;
  color: #475657;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.main-nav button:hover, .main-nav button.active { color: var(--teal); border-bottom-color: var(--teal); }

main { max-width: 1460px; margin: 0 auto; padding: 34px clamp(18px, 4vw, 58px) 70px; }
.view { display: none; }
.view.active { display: block; animation: enter .2s ease-out; }
@keyframes enter { from { opacity: .4; transform: translateY(4px); } }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 28px; }
.page-heading h1 { margin: 2px 0 0; color: var(--teal); font-size: clamp(1.75rem, 3vw, 2.65rem); line-height: 1.1; }
.page-heading > p { max-width: 520px; margin: 0; color: var(--grey); font-size: 1.02rem; }
.eyebrow { margin: 0; color: var(--grey); font-size: .78rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
h2 { font-size: 1.15rem; }

.puls-layout { display: grid; grid-template-columns: minmax(250px, 350px) minmax(550px, 1fr); gap: 28px; align-items: start; }
.reflection-panel, .signal-panel, .settings-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.reflection-panel { position: sticky; top: 70px; padding: 24px; border-top: 4px solid var(--peach); }
.reflection-panel h2 { margin: 8px 0 20px; }
.privacy-label { padding: 4px 8px; background: #fff0eb; color: #7f4638; border-radius: 999px; font-size: .73rem; font-weight: 700; }
.reflection-panel label { margin-bottom: 16px; }
.hint { color: var(--grey); font-size: .8rem; line-height: 1.45; }
.signal-panel { padding: clamp(18px, 3vw, 32px); box-shadow: var(--shadow); }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 0 0 16px; }
.section-title > div { display: flex; align-items: center; gap: 10px; }
.section-title h2 { margin: 0; }
.step { width: 28px; height: 28px; display: grid; place-items: center; color: white; background: var(--teal); border-radius: 50%; font-weight: 750; }
.required-note { color: var(--grey); font-size: .75rem; }

.status-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 25px; }
.status-choice { position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 9px; min-height: 94px; padding: 14px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.status-choice input { position: absolute; opacity: 0; pointer-events: none; }
.status-choice .status-symbol { grid-row: 1 / 3; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; }
.status-choice small { color: var(--grey); line-height: 1.25; }
.status-choice:has(input:focus-visible) { outline: 3px solid rgba(19, 143, 153, .3); }
.status-choice.green .status-symbol { color: var(--green); background: var(--green-pale); }
.status-choice.yellow .status-symbol { color: var(--yellow); background: var(--yellow-pale); }
.status-choice.red .status-symbol { color: var(--red); background: var(--red-pale); }
.status-choice.green:has(input:checked) { border-color: var(--green); background: var(--green-pale); }
.status-choice.yellow:has(input:checked) { border-color: var(--yellow); background: var(--yellow-pale); }
.status-choice.red:has(input:checked) { border-color: var(--red); background: var(--red-pale); }

.voice-box { margin: 0 0 28px; padding: 17px; border: 1px solid #a9dadd; border-left: 4px solid var(--teal-bright); border-radius: 10px; background: var(--teal-pale); }
.voice-box > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.voice-box p { margin: 3px 0 10px; color: #526667; font-size: .84rem; }
.voice-actions, .button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.voice-status { min-height: 20px; margin-top: 8px; color: var(--teal); font-size: .84rem; font-weight: 650; }
.recording { animation: pulse 1.2s infinite; color: var(--red) !important; border-color: var(--red) !important; }
@keyframes pulse { 50% { opacity: .55; } }
.transcript-wrap { margin-top: 12px; padding-top: 12px; border-top: 1px solid #b9dddd; }
.hidden { display: none !important; }

label { display: grid; gap: 6px; color: #37484a; font-size: .84rem; font-weight: 650; }
input, textarea, select {
  width: 100%;
  padding: 10px 11px;
  color: var(--text);
  background: white;
  border: 1px solid #b9c7c7;
  border-radius: 7px;
  outline: none;
}
textarea { resize: vertical; line-height: 1.42; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(63, 188, 196, .16); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-grid .wide { grid-column: 1 / -1; }
.red-required { display: none; color: var(--red); }
.signal-panel[data-status="red"] .red-required { display: inline; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-footer span { color: var(--grey); font-size: .82rem; }
.form-message { min-height: 20px; margin-top: 12px; color: var(--red); font-weight: 650; }

.primary-button, .secondary-button, .danger-button, .file-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}
.primary-button { color: white; background: var(--teal); border: 1px solid var(--teal); }
.primary-button:hover { background: #0a7780; }
.secondary-button, .file-button { color: var(--teal); background: white; border: 1px solid #8fc8cb; }
.secondary-button:hover, .file-button:hover { background: var(--teal-pale); }
.danger-button { color: var(--red); background: white; border: 1px solid #e6a7ad; }
button:disabled { cursor: wait; opacity: .55; }

.toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 14px; margin-bottom: 15px; padding: 13px 16px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.toolbar label { min-width: 170px; }
.toolbar select, .toolbar input { padding: 7px 10px; }
.toolbar .result-count { margin-left: auto; color: var(--grey); font-size: .85rem; }
.board-list { display: grid; background: white; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.board-item { display: grid; grid-template-columns: 105px minmax(240px, 1.5fr) minmax(160px, .8fr) minmax(160px, .8fr) auto; align-items: center; gap: 16px; padding: 17px 19px; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; }
.board-item:last-child { border-bottom: 0; }
.board-item:hover { background: #f8fcfb; }
.board-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.response-count, .review-marker { display: inline-flex; align-items: center; justify-content: center; height: 24px; line-height: 24px; white-space: nowrap; font-size: .76rem; }
.response-count { color: var(--grey); }
.review-marker { color: var(--teal); font-weight: 800; }
.board-title strong { display: block; margin-bottom: 5px; font-size: 1rem; }
.board-title small, .board-meta small { color: var(--grey); }
.board-meta { display: grid; gap: 4px; }
.chevron { color: var(--teal); font-size: 1.4rem; }
.status-pill, .workflow-pill { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 5px 9px; border-radius: 999px; font-size: .78rem; font-weight: 750; }
.status-pill.green { color: var(--green); background: var(--green-pale); }
.status-pill.yellow { color: var(--yellow); background: var(--yellow-pale); }
.status-pill.red { color: var(--red); background: var(--red-pale); }
.workflow-pill { color: #436062; background: #edf2f2; }
.empty-state { padding: 50px 20px; text-align: center; color: var(--grey); }

.calendar-list { display: grid; gap: 13px; }
.calendar-day { display: grid; grid-template-columns: 130px 1fr; gap: 20px; }
.calendar-date { padding: 14px 0; color: var(--teal); font-weight: 750; }
.calendar-events { display: grid; background: white; border: 1px solid var(--line); border-radius: 10px; }
.calendar-event { display: grid; grid-template-columns: 85px 100px 1fr auto; align-items: center; gap: 15px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.calendar-event:last-child { border-bottom: 0; }
.calendar-event:hover { background: #f8fcfb; }
.event-kind { color: var(--teal); font-size: .8rem; font-weight: 750; }

.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.settings-grid article { padding: 24px; }
.settings-grid h2 { margin-top: 0; color: var(--teal); }
.settings-grid p { color: var(--grey); line-height: 1.5; }
#health-status { margin: 0; }
#health-status div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
#health-status dt { text-transform: capitalize; }
#health-status dd { margin: 0; font-weight: 700; }

dialog { width: min(780px, calc(100% - 26px)); max-height: calc(100vh - 30px); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 24px 80px rgba(0,0,0,.25); overflow: auto; }
dialog::backdrop { background: rgba(19, 35, 38, .52); backdrop-filter: blur(2px); }
.dialog-close { position: sticky; float: right; top: 12px; right: 14px; z-index: 3; width: 38px; height: 38px; color: var(--grey); background: white; border: 1px solid var(--line); border-radius: 50%; font-size: 1.5rem; }
#topic-detail { padding: 32px; }
.detail-head { padding-right: 40px; }
.detail-head h2 { margin: 8px 0; color: var(--teal); font-size: 1.65rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 22px; margin: 24px 0; }
.detail-field { padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.detail-field.wide { grid-column: 1 / -1; }
.detail-field dt { margin-bottom: 4px; color: var(--grey); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.detail-field dd { margin: 0; white-space: pre-wrap; line-height: 1.42; }
.dialog-tabs { display: flex; gap: 6px; margin: 20px 0 14px; border-bottom: 1px solid var(--line); }
.dialog-tabs button { padding: 10px 13px; color: var(--grey); background: transparent; border: 0; border-bottom: 3px solid transparent; }
.dialog-tabs button.active { color: var(--teal); border-bottom-color: var(--teal); }
.response-entry { padding: 12px; margin-bottom: 8px; background: #f6f9f8; border-left: 3px solid var(--teal-bright); border-radius: 4px; }
.response-entry small { color: var(--grey); }
.dialog-form { display: grid; gap: 13px; padding: 16px; background: var(--teal-pale); border-radius: 10px; }
.dialog-form .form-grid { gap: 12px; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 390px; padding: 13px 17px; color: white; background: #24494c; border-radius: 9px; box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .puls-layout { grid-template-columns: 1fr; }
  .reflection-panel { position: static; }
  .board-item { grid-template-columns: 90px 1fr auto; }
  .board-item .board-meta:nth-of-type(n+2) { display: none; }
}

@media (max-width: 650px) {
  .demo-banner { font-size: .7rem; }
  .app-header { align-items: flex-start; padding: 10px 14px; }
  .brand img { width: 74px; height: 44px; }
  .brand small, .session-user { display: none; }
  .context-picker { max-width: 155px; }
  .context-picker select { min-width: 0; font-size: .79rem; }
  .main-nav { padding: 0 8px; }
  .main-nav button { padding: 12px 11px 10px; font-size: .8rem; }
  main { padding: 25px 13px 60px; }
  .page-heading { display: block; }
  .page-heading > p { margin-top: 10px; }
  .status-options { grid-template-columns: 1fr; }
  .status-choice { min-height: 72px; }
  .form-grid, .settings-grid, .detail-grid { grid-template-columns: 1fr; }
  .form-grid .wide, .detail-field.wide { grid-column: auto; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-footer .primary-button { width: 100%; }
  .voice-box > div:first-child { display: block; }
  .board-item { grid-template-columns: 75px 1fr auto; gap: 9px; padding: 14px 11px; }
  .board-item .board-meta { display: none; }
  .calendar-day { grid-template-columns: 1fr; gap: 4px; }
  .calendar-date { padding: 10px 2px 2px; }
  .calendar-event { grid-template-columns: 60px 70px 1fr; gap: 8px; padding: 12px 10px; }
  .calendar-event .workflow-pill { display: none; }
  #topic-detail { padding: 25px 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
