/* AI-Native Return on AI Exercise — stylesheet
   Refined layout & typography pass. Class names and structure are unchanged
   from the original so the app's markup keeps working; this pass tightens the
   type scale, spacing, depth and interactive states. */

:root {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: #121a33;
  background: #eef1f7;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;

  --ink: #121a33;          /* primary text / dark surfaces */
  --ink-2: #26304f;        /* gradient partner for dark panels */
  --coral: #e2503a;        /* single signal colour */
  --coral-soft: #fdeeea;   /* coral tint for selected/pill states */
  --coral-ink: #b63a28;    /* readable coral text on light */
  --muted: #647089;
  --line: #dde2ec;
  --line-2: #e8ecf3;
  --field-bg: #fbfcfe;
  --paper: #ffffff;
  --wash: #f5f7fb;

  /* Quadrant identity colours — kept distinct and meaningful */
  --q1: #e2503a;           /* build products & services */
  --q2: #2f4a86;           /* scale growth */
  --q3: #10a07a;           /* operational efficiency */
  --q4: #e0962a;           /* quality & risk */

  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(18, 26, 51, .05);
  --shadow: 0 10px 30px -14px rgba(18, 26, 51, .28);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; }

h1, h2, h3, h4, p { margin-top: 0; }
h1 { letter-spacing: -.03em; line-height: 1.08; font-weight: 800; }
h2 { letter-spacing: -.02em; line-height: 1.2; font-weight: 750; font-size: 20px; }
h3 { margin-bottom: .5rem; line-height: 1.25; }
p { line-height: 1.55; }
ul { padding-left: 1.3rem; }
li { margin: .3rem 0; line-height: 1.55; }
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .92em; }

.container { max-width: 1160px; margin: auto; padding: 0 22px; }
.shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Top bar ---- */
.topbar { background: var(--ink); color: #fff; padding: 15px 0; }
.top-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.logo {
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--coral); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 19px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.brand b { display: block; font-size: 14.5px; letter-spacing: -.01em; }
.brand small { display: block; color: #9aa4bd; font-size: 11px; margin-top: 2px; letter-spacing: .01em; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.top-actions .chip { background: rgba(255,255,255,.1); color: #fff; }

.content { padding: 34px 0 72px; flex: 1; }

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, var(--ink), var(--ink-2));
  color: #fff; padding: 40px; border-radius: var(--radius-lg);
  margin-bottom: 24px; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; width: 320px; height: 320px; border-radius: 50%;
  right: -90px; top: -150px; background: radial-gradient(circle, rgba(226,80,58,.4), transparent 70%);
  pointer-events: none;
}
.eyebrow { font-size: 12px; font-weight: 700; color: var(--coral-ink); margin-bottom: 9px; }
.hero .eyebrow { color: #f3a493; }
.hero h1 { font-size: clamp(26px, 4vw, 42px); margin-bottom: 13px; max-width: 18ch; }
.hero p { max-width: 62ch; color: #c6cde0; margin-bottom: 0; font-size: 15px; }

/* ---- Panels & layout ---- */
.panel {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.panel .title { font-weight: 800; margin-bottom: 4px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

/* ---- Form controls ---- */
.label {
  font-size: 12px; font-weight: 700; display: block; margin-bottom: 7px;
  color: #45506b; letter-spacing: 0;
}
.field {
  display: block; width: 100%; border: 1.5px solid var(--line);
  border-radius: 11px; padding: 12px 13px; color: var(--ink);
  background: var(--field-bg); outline: 0; transition: border-color .12s, box-shadow .12s;
}
.field:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(226,80,58,.14); }
textarea.field { min-height: 104px; resize: vertical; line-height: 1.5; }

/* ---- Buttons ---- */
.btn {
  border: 0; border-radius: 12px; background: var(--ink); color: #fff;
  padding: 11px 18px; font-weight: 700; font-size: 13.5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  text-decoration: none; min-height: 43px;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn.coral { background: var(--coral); }
.btn.ghost { background: var(--wash); color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: #eceff5; }
.btn.outline { background: #fff; border: 1.5px solid var(--line); color: var(--ink); }
.btn.light { background: rgba(255,255,255,.14); color: #fff; }
.btn.sm { padding: 8px 12px; min-height: 35px; font-size: 12.5px; }
.btn.block { width: 100%; }

.chip {
  background: var(--wash); border-radius: 100px; padding: 6px 11px;
  font-size: 11px; font-weight: 700; color: #55627c;
}
.pill {
  border: 1.5px solid var(--line); padding: 7px 13px; background: #fff;
  color: #58647e; border-radius: 100px; font-size: 12.5px; font-weight: 700;
  transition: .12s;
}
.pill.active { border-color: var(--coral); background: var(--coral-soft); color: var(--coral-ink); }

.tabs { display: flex; gap: 7px; flex-wrap: wrap; margin: 18px 0; }
.tab {
  border: 1.5px solid var(--line); background: #fff; border-radius: 11px;
  padding: 10px 16px; font-size: 13px; font-weight: 700; color: var(--muted);
  transition: .12s;
}
.tab:hover { border-color: #c3cbda; }
.tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.casebox {
  border-left: 3px solid var(--coral); padding: 15px 18px;
  background: var(--wash); border-radius: 0 12px 12px 0;
}

/* ---- Quadrant cards ---- */
.rulelist { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.qcard {
  border: 1.5px solid var(--line); border-radius: 14px; background: #fff;
  text-align: left; padding: 16px; min-height: 116px;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.qcard:hover { border-color: #b7c0d2; transform: translateY(-1px); }
.qcard .qnum { display: block; font-weight: 800; font-size: 22px; margin-bottom: 6px; letter-spacing: -.02em; }
.qcard .qdesc { font-weight: 700; font-size: 12.5px; line-height: 1.35; }
.qcard .qsub { font-size: 10.5px; color: #8893a6; line-height: 1.45; margin-top: 7px; display: block; }
.qcard.selected {
  background: var(--qcolor); border-color: var(--qcolor); color: #fff;
  box-shadow: 0 10px 24px -10px var(--qcolor);
}
.qcard.selected .qsub { color: rgba(255,255,255,.85); }

/* ---- Metrics ---- */
.metric { padding: 16px 18px; background: var(--wash); border-radius: 14px; border: 1px solid var(--line-2); }
.metric strong { display: block; font-size: 25px; letter-spacing: -.03em; }
.metric span { color: var(--muted); font-size: 11px; font-weight: 600; }

/* ---- Group / progress rows ---- */
.group-row {
  border: 1px solid var(--line); padding: 15px 17px; border-radius: 14px;
  margin: 10px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.group-row .grow { min-width: 150px; }
.group-row h3 { font-size: 15px; margin: 0; }
.group-row small { color: var(--muted); }
.progress { height: 8px; background: #e6eaf1; border-radius: 100px; overflow: hidden; }
.progress > div { height: 100%; background: var(--coral); border-radius: 100px; transition: width .25s ease; }

.caseheading { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.caseheading h2 { margin-bottom: 3px; }

/* ---- Voting ---- */
.vote { margin: 0 0 24px; }
.vote-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 13px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step {
  width: 34px; height: 34px; border-radius: 10px; border: 1.5px solid var(--line);
  color: #6d7a93; background: #fff; font-size: 12.5px; font-weight: 800; transition: .12s;
}
.step.done { background: #e4f6ed; color: #0a7050; border-color: #cdeede; }
.step.current { background: var(--coral); color: #fff; border-color: var(--coral); }
.note { border: 1px solid var(--line); background: var(--wash); padding: 11px 14px; border-radius: 10px; }
.selectrow { display: flex; gap: 8px; flex-wrap: wrap; }
.selectrow .pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---- Result bars ---- */
.stacked { display: flex; height: 13px; overflow: hidden; border-radius: 100px; background: #e8ecf2; min-width: 70px; }
.stacked > span { display: block; min-width: 0; }
.legend { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.legend b { font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 5px; }

.result-card { padding: 20px; border: 1px solid var(--line); border-radius: 15px; margin-bottom: 14px; background: #fff; }
.result-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.result-header h3 { font-size: 17px; margin-bottom: 5px; }
.result-details { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bar-labels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 9px; font-size: 12px; }

.vote-detail { border: 1px solid var(--line-2); background: var(--wash); border-radius: 10px; padding: 11px 13px; margin: 7px 0; }
.vote-detail strong { font-size: 12px; }
.vote-detail small { font-size: 11px; color: #68728d; }
.vote-detail p { font-size: 12.5px; white-space: pre-wrap; margin: 5px 0 0; line-height: 1.5; }

/* ---- Notices ---- */
.notice { background: var(--coral-soft); border-left: 3px solid var(--coral); border-radius: 10px; padding: 13px 15px; font-size: 13px; color: #8a3d2e; margin-bottom: 16px; }
.success { background: #e4f6ed; color: #0b6b49; border-left-color: var(--q3); }
.empty { padding: 36px 16px; text-align: center; color: #8893a6; }
.hidden { display: none !important; }

/* ---- Modal ---- */
.modalback { position: fixed; inset: 0; background: rgba(18,26,51,.62); display: flex; justify-content: center; align-items: center; z-index: 50; padding: 22px; }
.modalbox { width: min(560px, 100%); background: #fff; border-radius: var(--radius-lg); padding: 28px; max-height: 95vh; overflow: auto; box-shadow: var(--shadow); }

.error { color: #b23130; font-size: 13px; font-weight: 600; }
.sticky-summary { position: sticky; top: 0; z-index: 4; background: rgba(238,241,247,.92); backdrop-filter: blur(8px); padding: 10px 0; }
.data-muted { font-size: 11px; color: #818ea4; }

/* ---- Projector mode ---- */
.projector .container { max-width: 1660px; }
.projector .result-card { padding: 24px; }
.projector .result-header h3 { font-size: 22px; }
.projector .metric strong { font-size: 32px; }

.foot { margin: 44px auto 22px; text-align: center; font-size: 11px; color: #9aa4b6; }
.notice-inline { font-size: 12px; background: var(--wash); border: 1px dashed var(--line); padding: 11px; border-radius: 10px; }

.loader { display: inline-block; width: 17px; height: 17px; border: 3px solid #ccd4e0; border-top-color: var(--coral); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive ---- */
@media (max-width: 850px) {
  .rulelist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three, .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-details { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .hero { padding: 28px 22px; }
  .content { padding-top: 20px; }
  .rulelist { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .qcard { padding: 12px; min-height: 98px; }
  .qcard .qnum { font-size: 19px; }
  .qcard .qdesc { font-size: 10.5px; }
  .panel { padding: 18px; }
  .caseheading { display: block; }
  .top-actions { margin-left: 0; width: 100%; }
  .result-header { display: block; }
  .bar-labels { font-size: 10px; }
  .vote-top { display: block; }
  .steps { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .01ms !important; }
}
@media print {
  .topbar, .tabs, .no-print, .btn { display: none !important; }
  .content { padding: 5px; }
  .panel, .result-card { break-inside: avoid; box-shadow: none; }
  .projector .container { max-width: 100%; }
  body { background: #fff; }
}
