:root {
  color-scheme: light;
  --ink: #17232d;
  --muted: #64727c;
  --line: #e3e9eb;
  --paper: #f5f8f8;
  --teal: #087f78;
  --teal-dark: #06655f;
  --white: #fff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; }
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--teal);
  color: white;
  font-weight: 800;
}
.logout {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.topnav { display: flex; gap: 20px; margin-left: auto; margin-right: 24px; color: var(--muted); font-size: 14px; font-weight: 650; }
.topnav a:hover, .text-link:hover, .more-link a:hover { color: var(--teal-dark); }
.page { width: min(1080px, calc(100% - 40px)); margin: 56px auto; }
.welcome { max-width: 760px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 10px; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(30px, 5vw, 46px); line-height: 1.12; letter-spacing: -.035em; }
.intro { max-width: 700px; margin: 18px 0 0; color: var(--muted); font-size: 18px; }
.status-card, .step-card, .login-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 8px 28px rgba(23, 35, 45, .035);
}
.status-card { display: flex; gap: 15px; align-items: flex-start; padding: 22px 24px; margin-bottom: 24px; }
.status-card p, .step-card p { margin: 5px 0 0; color: var(--muted); }
.status-dot { flex: 0 0 10px; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: #25a58e; }
.next-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.step-card { padding: 22px; }
.step-card > span { color: var(--teal); font-size: 13px; font-weight: 800; }
.step-card h2 { margin: 9px 0 0; font-size: 19px; }
.login-card { width: min(440px, 100%); margin: 8vh auto; padding: 30px; }
.login-card h1 { font-size: 32px; }
.muted { color: var(--muted); }
.login-card form { display: grid; gap: 10px; margin-top: 24px; }
.login-card label { margin-top: 8px; font-weight: 650; }
.login-card input[type="text"], .login-card input[type="password"] {
  width: 100%; padding: 12px 14px; border: 1px solid #cad4d8; border-radius: 10px; font: inherit;
}
.button { display: inline-flex; justify-content: center; padding: 12px 16px; border: 0; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; }
.button.primary { margin-top: 12px; background: var(--teal); color: white; }
.button.primary:hover { background: var(--teal-dark); }
.messages { margin-bottom: 20px; }
.message { padding: 12px 16px; border-radius: 10px; background: white; border: 1px solid var(--line); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading .intro { margin-top: 12px; }
.form-heading { font-size: clamp(30px, 5vw, 42px); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 18px; color: var(--muted); }
.toolbar strong { color: var(--ink); font-size: 22px; }
.client-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.client-card, .detail-card, .form-card, .empty-card, .action-card, .notice-card, .library-card, .prompt-card, .text-panel, .reason-card {
  border: 1px solid var(--line); border-radius: 16px; background: var(--white); box-shadow: 0 8px 28px rgba(23, 35, 45, .025);
}
.client-card { display: flex; align-items: center; gap: 15px; padding: 19px; transition: border-color .15s, transform .15s; }
.client-card:hover { border-color: #a8d4ce; transform: translateY(-1px); }
.client-initial, .empty-icon { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: #e4f4f1; color: var(--teal-dark); font-weight: 800; }
.client-card h2 { margin: 0; font-size: 16px; }
.client-card p { margin: 3px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.arrow { margin-left: auto; color: var(--teal); font-size: 22px; }
.empty-card { padding: 40px 24px; text-align: center; }
.empty-card h2 { margin: 14px 0 4px; font-size: 20px; }
.empty-card p { margin: 0 auto 20px; max-width: 520px; color: var(--muted); }
.empty-icon { margin: 0 auto; font-size: 24px; }
.more-link { text-align: right; color: var(--teal); font-weight: 650; }
.button.secondary { border: 1px solid #cbd7d9; background: white; color: var(--ink); }
.button.secondary:hover { background: #f3f8f8; }
.form-card { max-width: 820px; margin-top: 28px; padding: clamp(20px, 4vw, 34px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.wide, .form-actions.wide { grid-column: 1 / -1; }
.field label { font-weight: 700; }
.field label span { padding-left: 4px; color: #a64237; }
.field small, .field .helptext { color: var(--muted); font-size: 13px; }
.field input, .field textarea, .field select { width: 100%; padding: 11px 13px; border: 1px solid #cad4d8; border-radius: 10px; background: white; color: var(--ink); font: inherit; }
.field textarea { min-height: 100px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 3px solid #d6eeea; border-color: var(--teal); }
.errorlist { margin: 0; padding-left: 19px; color: #a64237; font-size: 13px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 28px 0 16px; }
.detail-card { padding: 23px; min-width: 0; }
.card-heading, .library-heading, .panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.card-heading h2 { margin: 0; font-size: 20px; }
.card-heading .eyebrow { margin-bottom: 6px; }
.text-link { color: var(--teal-dark); font-weight: 650; overflow-wrap: anywhere; }
.data-list { margin: 18px 0 0; }
.data-list div { padding: 13px 0; border-top: 1px solid var(--line); }
.data-list dt { margin-bottom: 4px; color: var(--muted); font-size: 13px; }
.data-list dd { margin: 0; overflow-wrap: anywhere; }
.note, .notice-card { background: #f1f8f7; }
.note { margin: 15px 0 0; padding: 12px; border-radius: 10px; color: #3c6662; font-size: 13px; }
.briefing-preview { min-height: 80px; margin: 18px 0; white-space: pre-line; }
.briefing-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.action-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; margin-top: 16px; }
.action-card h2 { margin: 0; font-size: 21px; }
.action-card p:not(.eyebrow) { max-width: 680px; margin: 8px 0 0; color: var(--muted); }
.notice-card { padding: 20px 22px; margin: 20px 0; border: 1px solid #d7e9e5; border-radius: 14px; color: #214844; }
.notice-card p { margin: 5px 0 0; color: #4e6d69; }
.library-list, .prompt-list { display: grid; gap: 14px; margin-top: 20px; }
.section-block { margin-top: 30px; }
.section-block > h2 { margin: 0 0 14px; font-size: 22px; }
.prompt-library-details { margin-top: 28px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.prompt-library-details summary { color: var(--teal-dark); font-weight: 700; cursor: pointer; }
.prompt-library-details .prompt-list { margin-top: 16px; }
.prompt-library-details .prompt-card { box-shadow: none; }
.library-card, .prompt-card { padding: 21px; }
.library-heading h2, .prompt-card h2 { margin: 0; font-size: 18px; }
.prompt-card h3 { margin: 3px 0 0; font-size: 17px; }
.library-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.template-list { margin: 18px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.template-list li { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(0, 1.2fr); gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.template-list span { color: var(--muted); }
code { padding: 2px 5px; border-radius: 5px; background: #eef3f3; color: #26423f; font-size: .9em; overflow-wrap: anywhere; }
.prompt-card { display: flex; justify-content: space-between; gap: 24px; }
.prompt-card h2 { margin-top: 3px; }
.prompt-card .eyebrow { margin-bottom: 6px; }
.prompt-preview { margin: 10px 0 0; color: var(--muted); font-size: 14px; white-space: pre-line; }
.prompt-actions { display: flex; min-width: 205px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; }
.prompt-actions form { margin: 0; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; background: #fff5da; color: #805e10; font-size: 12px; font-weight: 750; }
.badge.neutral { background: #eef2f3; color: #53636a; }
.badge.pending { background: #fff5da; color: #805e10; }
.badge.approved { background: #e2f5ec; color: #176441; }
.badge.rejected { background: #fbe9e7; color: #913d32; }
.badge.no_change { background: #edf1f2; color: #53636a; }
.reason-card { padding: 22px; margin: 20px 0; }
.reason-card p:not(.eyebrow) { margin: 4px 0 12px; }
.reason-card small { color: var(--muted); }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.text-panel { min-width: 0; overflow: hidden; }
.panel-heading { align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-size: 17px; }
.text-panel pre { max-height: 580px; overflow: auto; margin: 0; padding: 18px; background: #fbfcfc; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.context-panel { margin-top: 24px; }
.context-panel .panel-heading { flex-wrap: wrap; gap: 12px; }
.context-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.context-actions .button.primary { margin-top: 0; }
.context-warning { color: #913d32; font-weight: 600; }
.context-history-entry { padding: 18px; border-bottom: 1px solid #dbe5e6; }
.context-history-entry pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.review-box { display: flex; justify-content: space-between; align-items: center; gap: 22px; margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.review-box p { margin: 5px 0 0; color: var(--muted); }
.review-box form { display: flex; flex: 0 0 auto; gap: 9px; }
@media (max-width: 640px) {
  .page { margin: 36px auto; }
  .next-grid { grid-template-columns: 1fr; }
  .topbar { min-height: 64px; flex-wrap: wrap; gap: 8px 16px; padding-top: 12px; padding-bottom: 12px; }
  .brand { flex: 1 1 auto; min-width: 0; font-size: 15px; }
  .brand-mark { flex: 0 0 34px; }
  .topbar > form { order: 1; }
  .topnav { order: 2; flex-basis: 100%; flex-wrap: wrap; gap: 20px; margin: 0; font-size: 13px; }
  .page-heading, .action-card, .review-box { align-items: flex-start; flex-direction: column; }
  .client-grid, .detail-grid, .comparison-grid, .form-grid { grid-template-columns: 1fr; }
  .field.wide, .form-actions.wide { grid-column: auto; }
  .prompt-card { flex-direction: column; }
  .prompt-actions { min-width: 0; }
  .template-list li { grid-template-columns: 1fr; gap: 4px; }
  .review-box form { width: 100%; flex-wrap: wrap; }
}
