/* AMTI Hub — 통합 금융 OS 허브 스타일 */

/* ── KPI 띠 ──────────────────────────────────────────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 0 0 28px;
}
.kpi-cell {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px 16px 14px;
  position: relative;
  overflow: hidden;
}
.kpi-cell::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--kpi-accent, var(--gold));
}
.kpi-cell .kpi-lbl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-mute);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.kpi-cell .kpi-val {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.kpi-cell .kpi-sub {
  font-size: 11px;
  color: var(--text-mute);
}
.kpi-cell.band-fit    { --kpi-accent: #4DA86E; }
.kpi-cell.band-fit .kpi-val { color: #4DA86E; }
.kpi-cell.band-caution { --kpi-accent: #C9A227; }
.kpi-cell.band-caution .kpi-val { color: #C9A227; }
.kpi-cell.band-risk   { --kpi-accent: #E45858; }
.kpi-cell.band-risk .kpi-val { color: #E45858; }
.kpi-cell.band-critical { --kpi-accent: #E45858; border-color: #E45858; }
.kpi-cell.band-critical .kpi-val { color: #E45858; }
.kpi-cell.kpi-gold .kpi-val { color: var(--gold); }

/* ── 6서비스 카드 그리드 ──────────────────────────────────────── */
.svc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.svc-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
}
.svc-card::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--svc-color, var(--line));
}
.svc-card:hover {
  border-color: var(--svc-color, var(--gold-dim));
  background: var(--bg-card);
}
.svc-card .svc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.svc-card .svc-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--svc-color, var(--text));
}
.svc-card .svc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-mute);
  flex-shrink: 0;
}
.svc-card .svc-dot.online { background: #4DA86E; box-shadow: 0 0 6px #4DA86E66; }
.svc-card .svc-dot.offline { background: var(--risk); }
.svc-card .svc-kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12px;
}
.svc-card .svc-kv:last-child { border-bottom: none; }
.svc-card .svc-kv .k { color: var(--text-mute); }
.svc-card .svc-kv .v {
  font-family: var(--mono);
  color: var(--text);
  font-size: 13px;
}

/* ── 인과 미니맵 ──────────────────────────────────────────────── */
.minimap-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 28px;
  display: flex;
  gap: 28px;
  align-items: center;
}
.minimap-svg-wrap {
  flex-shrink: 0;
}
.minimap-legend {
  flex: 1;
  min-width: 0;
}
.minimap-legend h3 { margin: 0 0 10px; font-size: 15px; }
.minimap-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 12px;
}
.minimap-edges {
  list-style: none;
  padding: 0;
  margin: 0;
}
.minimap-edges li {
  font-size: 12px;
  color: var(--text-mute);
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
  display: flex;
  gap: 8px;
  align-items: center;
}
.minimap-edges li:last-child { border-bottom: none; }
.minimap-edges .edge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── 통합 타임라인 ────────────────────────────────────────────── */
.timeline-unified {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 28px;
}
.timeline-unified h3 { margin: 0 0 18px; }
.tl-list {
  position: relative;
  padding-left: 20px;
}
.tl-list::before {
  content: '';
  position: absolute;
  left: 6px; top: 0; bottom: 0;
  width: 1px;
  background: var(--line);
}
.tl-item {
  position: relative;
  padding: 0 0 18px 20px;
  font-size: 13px;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tl-color, var(--text-mute));
  border: 1px solid var(--bg-elev);
}
.tl-item.tl-measure { --tl-color: var(--gold); }
.tl-item.tl-feedback { --tl-color: var(--info); }
.tl-item.tl-anchor { --tl-color: var(--safe); }
.tl-item .tl-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 1px;
  margin-bottom: 3px;
}
.tl-item .tl-title {
  color: var(--text);
  font-weight: 500;
}
.tl-item .tl-detail {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 2px;
}
.tl-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
  text-transform: uppercase;
}
.tl-tag.measure { background: rgba(201,162,39,.15); color: var(--gold); }
.tl-tag.feedback { background: rgba(79,163,214,.15); color: var(--info); }
.tl-tag.anchor { background: rgba(77,168,110,.15); color: var(--safe); }

/* ── 빠른 액션 ────────────────────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.quick-actions .btn {
  flex-shrink: 0;
}

/* ── Hub 조회 입력 ────────────────────────────────────────────── */
.hub-lookup {
  max-width: 520px;
  margin: 0 0 32px;
}
.hub-lookup .lookup-row {
  margin-top: 16px;
}

/* ── Hub 섹션 헤더 ────────────────────────────────────────────── */
.hub-section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}
.hub-section-hdr h3 {
  margin: 0;
}
.hub-section-hdr .hdr-link {
  font-size: 12px;
  color: var(--text-mute);
  text-decoration: none;
  font-family: var(--mono);
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
}
.hub-section-hdr .hdr-link:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
}

/* ── 로딩 스피너 ──────────────────────────────────────────────── */
.hub-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
  padding: 40px 0;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 에러/빈 박스 ─────────────────────────────────────────────── */
.hub-empty {
  padding: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-mute);
  font-size: 13px;
  font-family: var(--mono);
  text-align: center;
  margin-bottom: 28px;
}

/* ── 허브 헤드 ────────────────────────────────────────────────── */
.hub-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.hub-head .who { font-size: 13px; color: var(--text-mute); }
.hub-head .who strong { color: var(--text); font-size: 16px; font-weight: 500; display: block; margin-bottom: 4px; }
.hub-head .who .badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  color: var(--gold);
  margin-right: 6px;
}
.hub-nav-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hub-nav-pills a {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--mono);
  letter-spacing: 0.5px;
  transition: all .15s;
}
.hub-nav-pills a:hover, .hub-nav-pills a.active {
  color: var(--gold);
  border-color: var(--gold-dim);
}

/* ── 반응형 ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .svc-grid { grid-template-columns: repeat(2, 1fr); }
  .minimap-card { flex-direction: column; }
}
@media (max-width: 600px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .svc-grid { grid-template-columns: 1fr; }
  .hub-head { flex-direction: column; align-items: flex-start; }
}

/* ── 세제계좌 카드 ───────────────────────────────────────────── */
.tax-section { margin: 20px 0; }
.hub-tax-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 12px 0;
}
.hub-tax-box {
  background: var(--bg-elev, #161B22);
  border: 1px solid var(--line, #2A323C);
  border-radius: 6px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.hub-tax-box.hub-tax-isa     { border-left: 3px solid var(--gold, #C9A227); }
.hub-tax-box.hub-tax-pension { border-left: 3px solid #4F8FE0; }
.hub-tax-box.hub-tax-irp     { border-left: 3px solid #4DA86E; }
.hub-tax-box.hub-tax-taxable { border-left: 3px solid var(--text-mute, #6E7686); }
.hub-tax-box.pri { box-shadow: 0 0 0 1px var(--gold-dim, #8C6E1B) inset; }
.hub-tax-label {
  font-size: 11px; letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.hub-tax-tag {
  background: var(--gold, #C9A227); color: #1A1F26;
  font-size: 9px; padding: 1px 5px; border-radius: 3px;
  margin-left: 4px;
}
.hub-tax-amount {
  font-family: var(--mono);
  font-size: 18px; font-weight: 600;
  color: var(--text);
}
.hub-tax-saving {
  font-family: var(--mono);
  font-size: 12px;
  color: #4DA86E;
}
.hub-tax-saving.muted { color: var(--text-mute); }
.hub-tax-total {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.hub-tax-total strong {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--gold, #C9A227);
}

/* ── 인과 시계열 미니카드 ─────────────────────────────────────── */
.ct-section { margin: 20px 0; }
.hub-ct-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.hub-ct-cell {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 8px;
  text-align: center;
}
.hub-ct-name {
  font-size: 10px; letter-spacing: 1.5px;
  color: var(--text-mute);
}
.hub-ct-last {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  margin: 4px 0 2px;
}
.hub-ct-delta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
}
.hub-ct-cell.up   { border-color: rgba(77, 168, 110, 0.4); }
.hub-ct-cell.up   .hub-ct-delta { color: #4DA86E; }
.hub-ct-cell.down { border-color: rgba(228, 88, 88, 0.4); }
.hub-ct-cell.down .hub-ct-delta { color: #E45858; }

@media (max-width: 900px) {
  .hub-tax-grid { grid-template-columns: repeat(2, 1fr); }
  .hub-ct-grid  { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .hub-ct-grid  { grid-template-columns: repeat(2, 1fr); }
}
