:root {
  --bg: #f4f8fb;
  --surface: #ffffff;
  --surface-soft: #f8fbfd;
  --ink: #12243a;
  --muted: #617389;
  --line: #dbe6ef;
  --navy: #06243d;
  --navy-2: #0b3558;
  --cyan: #0a85c8;
  --cyan-soft: #e8f6fd;
  --green: #169b63;
  --green-soft: #e8f7ef;
  --amber: #e89a22;
  --amber-soft: #fff5e4;
  --red: #db4d45;
  --red-soft: #fdeceb;
  --shadow: 0 18px 42px rgba(18, 36, 58, 0.08);
  --radius: 8px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  background:
    linear-gradient(180deg, rgba(232, 246, 253, 0.72), rgba(244, 248, 251, 0) 320px),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  min-width: 0;
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 28px;
  padding: 22px 14px;
  background:
    linear-gradient(180deg, rgba(10, 133, 200, 0.2), rgba(22, 155, 99, 0.08)),
    var(--navy);
  color: #f7fcff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.brand-mark svg {
  width: 28px;
  height: 28px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand span {
  margin-top: 4px;
  color: rgba(247, 252, 255, 0.66);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: rgba(247, 252, 255, 0.84);
  font-size: 14px;
  font-weight: 680;
  text-decoration: none;
}

.side-nav a:hover,
.side-nav a.active {
  border-color: rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, #0a85c8, #0f6a9e);
  color: #ffffff;
}

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

.side-status {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

.side-status span {
  color: rgba(247, 252, 255, 0.65);
  font-size: 12px;
}

.side-status strong {
  display: block;
  margin: 8px 0;
  font-size: 17px;
}

.side-status p {
  margin: 0;
  color: rgba(247, 252, 255, 0.72);
  font-size: 12px;
  line-height: 1.55;
}

.workspace {
  min-width: 0;
  padding: 0 24px 36px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 248, 251, 0.92);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.top-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 720;
  white-space: nowrap;
}

.primary-button {
  border: 1px solid #0877b4;
  background: linear-gradient(135deg, #0986c8, #086da3);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(10, 133, 200, 0.2);
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.ghost-button.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.section {
  margin-top: 22px;
}

.generator-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
  align-items: start;
}

.matrix-grid,
.meeting-grid,
.coach-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.profile-panel,
.output-panel,
.cadence-panel,
.meeting-grid .panel,
.coach-grid .panel,
.matrix-grid .panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
}

.panel-head h2 {
  margin: 5px 0 0;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
}

#saveState,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: #076aa2;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.warn {
  background: var(--amber-soft);
  color: #9a5f08;
}

.form-grid,
.split-fields,
.data-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label,
fieldset {
  display: grid;
  gap: 7px;
  margin: 0;
}

label span,
legend {
  color: #31455c;
  font-size: 12px;
  font-weight: 780;
}

fieldset {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

legend {
  padding: 0 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 40px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(10, 133, 200, 0.55);
  box-shadow: 0 0 0 3px rgba(10, 133, 200, 0.12);
}

.wide-field,
.choice-block,
.split-fields,
fieldset,
.button-row {
  margin-top: 14px;
}

.data-field-grid .wide-field {
  grid-column: 1 / -1;
  margin-top: 0;
}

.choice-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.choice-head h3,
.subhead h3 {
  margin: 0;
  font-size: 15px;
}

.choice-head span,
.subhead span {
  color: var(--muted);
  font-size: 12px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.product-tile {
  position: relative;
  display: grid;
  min-height: 86px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(232, 246, 253, 0.8), rgba(255, 255, 255, 0) 62%),
    #ffffff;
  color: var(--ink);
}

.product-tile input {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 16px;
  height: 16px;
  accent-color: var(--cyan);
}

.product-tile strong {
  align-self: end;
  margin-left: 22px;
  font-size: 13px;
  line-height: 1.2;
}

.product-tile small {
  margin: 6px 0 0 22px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
}

.product-tile::after {
  content: attr(data-short);
  position: absolute;
  right: 9px;
  bottom: 8px;
  color: rgba(10, 133, 200, 0.16);
  font-size: 26px;
  font-weight: 900;
}

.product-tile:has(input:checked) {
  border-color: rgba(10, 133, 200, 0.6);
  background:
    linear-gradient(160deg, rgba(232, 246, 253, 1), rgba(255, 255, 255, 0.35) 62%),
    #ffffff;
  box-shadow: 0 0 0 2px rgba(10, 133, 200, 0.09);
}

.check-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.check-grid label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
}

.check-grid input {
  width: 14px;
  height: 14px;
  accent-color: var(--cyan);
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-item,
.focus-card,
.logic-item,
.battle-card,
.meeting-section,
.cadence-card,
.check-row,
.diagnosis-column section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.summary-item {
  padding: 11px;
}

.summary-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.summary-item strong {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.35;
}

.focus-products {
  margin-bottom: 14px;
  padding: 13px;
  border: 1px solid rgba(10, 133, 200, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(232, 246, 253, 0.88), #ffffff);
}

.focus-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.focus-head h3,
.focus-card h4 {
  margin: 0;
  font-size: 14px;
}

.focus-head span {
  color: var(--muted);
  font-size: 12px;
}

.focus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.focus-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  padding: 10px;
  background: #ffffff;
}

.focus-card strong {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  font-size: 13px;
}

.focus-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.diagnosis-block {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(22, 155, 99, 0.24);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(232, 247, 239, 0.88), #ffffff);
}

.diagnosis-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.diagnosis-head span {
  color: var(--green);
  font-size: 12px;
  font-weight: 820;
}

.diagnosis-head h3 {
  margin: 5px 0 0;
  font-size: 15px;
  line-height: 1.45;
}

.diagnosis-head strong {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 26px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #0d7349;
  font-size: 12px;
  font-weight: 820;
}

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

.diagnosis-column {
  min-width: 0;
}

.diagnosis-column h4 {
  margin: 0 0 8px;
  color: #31455c;
  font-size: 13px;
}

.diagnosis-column > div {
  display: grid;
  gap: 8px;
}

.diagnosis-column section {
  padding: 10px;
  background: #ffffff;
}

.diagnosis-column strong {
  display: block;
  font-size: 12px;
  line-height: 1.4;
}

.diagnosis-column p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.52;
}

.data-gap-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.data-gap-list span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #9a5f08;
  font-size: 11px;
  font-weight: 760;
}

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

.kpi-card {
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.kpi-card span {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #0d7349;
  font-size: 11px;
  font-weight: 800;
}

.kpi-card h3 {
  margin: 10px 0 7px;
  font-size: 15px;
  line-height: 1.25;
}

.kpi-card p,
.logic-item p,
.battle-card p,
.meeting-section li,
.cadence-card p,
.check-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.logic-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.logic-item {
  padding: 12px;
}

.logic-item h3,
.battle-card h3,
.meeting-section h3,
.cadence-card h3 {
  margin: 0 0 7px;
  font-size: 15px;
  line-height: 1.25;
}

.logic-item code {
  display: block;
  margin-top: 8px;
  padding: 9px;
  border-radius: var(--radius);
  background: #ffffff;
  color: #0b4f78;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.45;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.45;
}

th {
  background: #eef5fa;
  color: #31455c;
  font-size: 12px;
  font-weight: 830;
}

td:first-child {
  font-weight: 780;
}

tr:last-child td {
  border-bottom: 0;
}

.tag {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: #076aa2;
  font-size: 12px;
  font-weight: 780;
}

.cadence-layout {
  display: grid;
  grid-template-columns: 0.72fr 1fr;
  gap: 16px;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.segmented button {
  min-width: 58px;
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-weight: 760;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--cyan-soft);
  color: #076aa2;
}

.cadence-card {
  padding: 16px;
  background: linear-gradient(160deg, var(--cyan-soft), #ffffff 70%);
}

.cadence-card strong {
  display: block;
  margin-top: 14px;
  color: #0b4f78;
  font-size: 30px;
  line-height: 1;
}

.cadence-table {
  min-width: 0;
}

.subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 86px;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.check-row strong {
  font-size: 13px;
  line-height: 1.4;
}

.check-row span {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

#meetingTemplate,
.battle-list {
  display: grid;
  gap: 10px;
}

.meeting-section,
.battle-card {
  padding: 13px;
}

.meeting-section ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
}

.meeting-section .duration {
  display: inline-flex;
  margin-bottom: 9px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
}

.battle-card {
  position: relative;
  background: #ffffff;
}

.battle-card::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 0;
  width: 3px;
  height: calc(100% - 26px);
  border-radius: 999px;
  background: var(--amber);
}

.battle-card h3,
.battle-card p {
  padding-left: 8px;
}

.battle-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 0 8px;
}

.battle-meta span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #9a5f08;
  font-size: 11px;
  font-weight: 780;
}

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

.course-skill-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.course-skill-card h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
}

.course-skill-card p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.course-skill-card span {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
}

.chat-panel {
  display: grid;
  gap: 12px;
}

.chat-messages {
  display: grid;
  max-height: 430px;
  min-height: 260px;
  gap: 10px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.chat-message {
  display: grid;
  max-width: 86%;
  gap: 5px;
}

.chat-message span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.chat-message p {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.chat-message.user {
  justify-self: end;
}

.chat-message.user span {
  justify-self: end;
}

.chat-message.user p {
  border-color: rgba(10, 133, 200, 0.35);
  background: var(--cyan-soft);
}

.quick-prompts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-prompts button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #0b4f78;
  font-size: 12px;
  font-weight: 760;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
  align-items: end;
}

.chat-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .side-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .side-status {
    display: none;
  }

  .generator-grid,
  .matrix-grid,
  .meeting-grid,
  .coach-grid,
  .cadence-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 0 14px 26px;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 0;
  }

  .top-actions,
  .button-row {
    width: 100%;
  }

  .primary-button,
  .ghost-button {
    flex: 1 1 150px;
  }

  .ghost-button.small {
    flex: 0 0 auto;
  }

  .side-nav {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid,
  .split-fields,
  .data-field-grid,
  .profile-summary,
  .focus-grid,
  .diagnosis-grid,
  .course-skill-list,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .chat-message {
    max-width: 96%;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-head,
  .subhead {
    align-items: flex-start;
    flex-direction: column;
  }

  .check-row {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .check-row span {
    grid-column: 2;
    justify-self: start;
  }
}
