:root {
  --finance: #315e77;
  --finance-soft: #e8f1f5;
  --violet: #69578d;
  --violet-soft: #f0edf7;
}

body {
  font-variant-numeric: tabular-nums;
  word-break: keep-all;
  overflow-wrap: normal;
}

.brand {
  display: block;
}

.brand-logo {
  display: block;
  width: 122px;
  height: auto;
}

.brand > small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.page-head h1,
.hero-copy h2,
.executive-summary h2,
.executive-signal strong,
.card h2,
.card h3,
.metric-card strong {
  word-break: keep-all;
  overflow-wrap: normal;
}

.sidebar {
  overflow-y: auto;
  scrollbar-width: thin;
}

.sim-clock {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
}

.sim-toggle {
  min-height: 34px;
  border: 1px solid #b9d8ca;
  border-radius: 999px;
  background: #fff;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.sim-toggle-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1c9d70;
  box-shadow: 0 0 0 4px rgba(28, 157, 112, .12);
}

.sim-toggle.running .sim-toggle-dot {
  animation: live-pulse 1.5s ease-in-out infinite;
}

.sim-toggle:not(.running) {
  border-color: var(--line);
  color: var(--muted);
}

.sim-toggle:not(.running) .sim-toggle-dot {
  background: #9aa39e;
  box-shadow: none;
}

.sim-speed {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 0 7px;
  font-size: 10px;
  outline: 0;
}

.live-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf8;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
}

.source-tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.live-flow-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfa 0%, #f3f7f3 100%);
}

.live-flow-svg {
  display: block;
  width: 100%;
  min-width: 860px;
  height: 190px;
}

.flow-base {
  fill: none;
  stroke: #cbd7d0;
  stroke-width: 5;
  stroke-linecap: round;
}

.flow-active {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 4 9;
  animation: rail-dash 1.5s linear infinite;
}

.flow-node circle {
  fill: #fff;
  stroke: #9eb7aa;
  stroke-width: 2;
}

.flow-node.active circle {
  fill: var(--green-soft);
  stroke: var(--green);
}

.flow-node.warn circle {
  fill: var(--yellow-soft);
  stroke: var(--yellow);
}

.flow-node text {
  fill: var(--ink);
  stroke: none;
  text-anchor: middle;
  font-family: Pretendard, sans-serif;
}

.flow-node .node-label {
  font-size: 12px;
  font-weight: 700;
}

.flow-node .node-value {
  fill: var(--muted);
  font-size: 10px;
}

.egg-packet {
  fill: #f6c85f;
  stroke: #a97917;
  stroke-width: 1;
  transform-origin: center;
}

body.simulation-paused .flow-active,
body.simulation-paused .sim-toggle-dot,
body.simulation-paused .live-glow::after {
  animation-play-state: paused;
}

.event-ticker {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: #fffdf5;
  min-height: 43px;
}

.event-ticker b {
  color: #7b5a0e;
  font-size: 9px;
}

.event-ticker span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

.event-ticker time {
  color: var(--muted);
  font-size: 9px;
}

.metric-card.live-glow {
  position: relative;
  overflow: hidden;
}

.metric-card.live-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(31, 130, 95, .08), transparent 80%);
  transform: translateX(-100%);
  animation: data-scan 4s ease-in-out infinite;
  pointer-events: none;
}

.live-number.changed {
  color: var(--green);
  animation: number-pop .34s ease-out;
}

.executive-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(290px, .5fr);
  gap: 1px;
  padding: 1px;
  background: #d6e0da;
  border: 1px solid #d6e0da;
  border-radius: 17px;
  overflow: hidden;
  margin-bottom: 15px;
}

.executive-summary,
.executive-signal {
  background: #fff;
  padding: 24px;
}

.executive-summary h2 {
  margin: 7px 0 4px;
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: -.045em;
  line-height: 1;
}

.executive-summary p,
.executive-signal p {
  color: var(--muted);
  font-size: 11px;
  margin: 6px 0 0;
}

.executive-kicker {
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
}

.executive-signal {
  background: var(--green-deep);
  color: #fff;
}

.executive-signal .executive-kicker {
  color: #f4cf58;
}

.executive-signal strong {
  display: block;
  font-size: 24px;
  line-height: 1.25;
  margin-top: 12px;
}

.executive-signal p {
  color: rgba(255,255,255,.72);
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 13px;
}

.board-span-8 { grid-column: span 8; }
.board-span-7 { grid-column: span 7; }
.board-span-5 { grid-column: span 5; }
.board-span-4 { grid-column: span 4; }

.money-value {
  display: block;
  margin-top: 7px;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -.035em;
}

.money-unit {
  color: var(--muted);
  font-size: 10px;
}

.finance-card {
  border-color: #cfdae0;
}

.finance-card .metric-badge {
  background: var(--finance-soft);
  color: var(--finance);
}

.finance-chart {
  width: 100%;
  height: 250px;
}

.finance-chart .area {
  fill: url(#cashFill);
  stroke: none;
}

.finance-chart .line {
  fill: none;
  stroke: var(--finance);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw-line 1.6s ease-out forwards;
}

.finance-chart .forecast-line {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 2;
  stroke-dasharray: 5 6;
}

.finance-chart text {
  fill: var(--muted);
  stroke: none;
  font-family: Pretendard, sans-serif;
  font-size: 10px;
}

.aging-bars {
  display: grid;
  gap: 13px;
}

.aging-row {
  display: grid;
  grid-template-columns: 70px 1fr 86px;
  align-items: center;
  gap: 10px;
  font-size: 10px;
}

.aging-track {
  height: 9px;
  border-radius: 99px;
  background: #eef1ef;
  overflow: hidden;
}

.aging-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  animation: grow-bar .8s ease-out both;
}

.aging-row.warn .aging-track i { background: var(--yellow); }
.aging-row.alert .aging-track i { background: var(--red); }

.automation-flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
}

.automation-step {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fafbf9;
  position: relative;
}

.automation-step:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -11px;
  top: 34px;
  z-index: 2;
  color: var(--green);
  font-weight: 700;
}

.automation-step i {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  margin-bottom: 8px;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
}

.automation-step b {
  display: block;
  font-size: 11px;
}

.automation-step span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.automation-step.processing {
  border-color: var(--yellow);
  background: var(--yellow-soft);
  animation: step-pulse 1s ease-in-out infinite;
}

.automation-step.done {
  border-color: #afd3c1;
  background: var(--green-soft);
}

.inquiry-layout {
  display: grid;
  grid-template-columns: minmax(280px, .75fr) minmax(0, 1.25fr);
  gap: 14px;
}

.inquiry-list {
  display: grid;
  gap: 7px;
}

.inquiry-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  padding: 12px;
  text-align: left;
}

.inquiry-item:hover,
.inquiry-item.active {
  border-color: #9ec6b4;
  background: var(--green-soft);
}

.inquiry-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inquiry-item strong {
  font-size: 11px;
}

.inquiry-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-thread {
  min-height: 390px;
  display: flex;
  flex-direction: column;
}

.chat-message {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 14px 14px 14px 3px;
  background: #f2f4f1;
  font-size: 12px;
  line-height: 1.55;
}

.chat-message.ai {
  align-self: flex-end;
  margin-top: 12px;
  border-radius: 14px 14px 3px 14px;
  background: var(--yellow-soft);
}

.classification-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid #c5dfd2;
  border-radius: 12px;
  background: var(--green-soft);
}

.classification-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.classification-grid div {
  padding: 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.78);
}

.classification-grid span,
.classification-grid b {
  display: block;
  font-size: 9px;
}

.classification-grid span { color: var(--muted); }
.classification-grid b { margin-top: 2px; font-size: 11px; }

.material-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
}

.material-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.material-item span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.material-item strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.material-item small {
  display: block;
  margin-top: 6px;
  color: var(--green);
  font-size: 8px;
  font-weight: 700;
}

.material-item.warn {
  background: var(--yellow-soft);
  border-color: #efd989;
}

.material-item.warn small { color: #855f09; }

.pulse-row {
  animation: row-highlight 1.2s ease-out;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(.82); }
}

@keyframes rail-dash {
  to { stroke-dashoffset: -26; }
}

@keyframes data-scan {
  0%, 25% { transform: translateX(-110%); }
  70%, 100% { transform: translateX(110%); }
}

@keyframes number-pop {
  0% { transform: translateY(3px); opacity: .55; }
  100% { transform: none; opacity: 1; }
}

@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}

@keyframes grow-bar {
  from { width: 0 !important; }
}

@keyframes step-pulse {
  50% { box-shadow: 0 0 0 4px rgba(239, 182, 37, .13); }
}

@keyframes row-highlight {
  from { background: var(--yellow-soft); }
  to { background: transparent; }
}

@media (max-width: 1260px) {
  .sim-clock,
  .live-pill { display: none; }
  .board-span-8,
  .board-span-7 { grid-column: span 12; }
  .board-span-4,
  .board-span-5 { grid-column: span 6; }
}

@media (max-width: 900px) {
  .sim-speed { display: none; }
  .executive-hero { grid-template-columns: 1fr; }
  .inquiry-layout { grid-template-columns: 1fr; }
  .automation-flow { grid-template-columns: 1fr 1fr; }
  .automation-step:not(:last-child)::after { display: none; }
  .material-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .sim-toggle { width: 39px; padding: 0; justify-content: center; }
  .sim-toggle span:last-child { display: none; }
  .event-ticker { grid-template-columns: auto 1fr; }
  .event-ticker time { display: none; }
  .board-span-8,
  .board-span-7,
  .board-span-5,
  .board-span-4 { grid-column: span 12; }
  .material-grid { grid-template-columns: repeat(2, 1fr); }
  .classification-grid { grid-template-columns: repeat(2, 1fr); }
  .automation-flow { grid-template-columns: 1fr; }
  .executive-summary,
  .executive-signal { padding: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .flow-active,
  .sim-toggle-dot,
  .metric-card.live-glow::after,
  .finance-chart .line,
  .automation-step.processing,
  .pulse-row { animation: none !important; }
}
