:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-soft: #f8f9fb;
  --text: #17191c;
  --muted: #737983;
  --line: #e5e8ed;
  --dark: #141619;
  --accent: #6e59ea;
  --accent-soft: #efeafe;
  --green: #1f9d6a;
  --orange: #c57922;
  --red: #c34b4b;
  --shadow: 0 12px 36px rgba(25, 28, 34, .06);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Noto Sans KR", Inter, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 26px 20px;
  background: var(--dark); color: #fff;
  display: flex; flex-direction: column; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font: 700 18px Inter;
  background: linear-gradient(135deg, #8b79ff, #5c46d9);
}
.brand strong { display: block; font: 700 15px Inter; }
.brand span { display: block; margin-top: 3px; color: #8f949d; font-size: 11px; }
.nav { display: grid; gap: 5px; }
.nav-item {
  border: 0; background: transparent; color: #a8adb5; text-align: left;
  border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: 13px;
}
.nav-item:hover, .nav-item.active { background: #23262b; color: #fff; }
.sidebar-card { margin-top: auto; background: #1e2125; border: 1px solid #2c3035; border-radius: 16px; padding: 16px; }
.sidebar-card p { color: #969ba4; font-size: 12px; line-height: 1.65; margin: 9px 0 14px; }
.source-line { display: flex; align-items: center; gap: 7px; margin-top: 5px; font-size: 13px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.sidebar-footer { display: flex; justify-content: space-between; }
.text-button { background: none; border: 0; color: #858b94; padding: 2px; font-size: 11px; }
.text-button:hover { color: #fff; }
.main { padding: 34px 42px 28px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 28px; }
h1 { margin: 4px 0 0; font-size: clamp(24px, 3vw, 36px); letter-spacing: -.035em; line-height: 1.25; }
h2 { margin: 3px 0 0; font-size: 19px; letter-spacing: -.02em; }
.eyebrow { margin: 0; font: 700 10px Inter, sans-serif; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.sync-note { font-size: 11px; color: var(--muted); margin-right: 3px; }
.button { border: 0; border-radius: 11px; padding: 10px 14px; font-weight: 700; font-size: 12px; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--dark); color: #fff; }
.button.secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.sidebar .button.secondary { background: #2a2e33; border-color: #34393f; color: #fff; }
.full { width: 100%; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.metric-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; box-shadow: 0 4px 18px rgba(20, 24, 29, .02); }
.metric-card.accent { background: var(--dark); color: #fff; border-color: var(--dark); }
.metric-card > span { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
.metric-card.accent > span, .metric-card.accent small { color: #9da2aa; }
.metric-card strong { display: block; margin: 11px 0 6px; font: 700 clamp(20px, 2.2vw, 29px) Inter, "Noto Sans KR"; letter-spacing: -.035em; }
.metric-card small { color: var(--muted); font-size: 10px; }
.next-payment-list { margin-top: 13px; display: grid; gap: 10px; }
.next-payment-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.next-payment-date { font: 700 15px Inter, "Noto Sans KR"; letter-spacing: -.02em; }
.next-payment-name { font-size: 11px; color: var(--muted); }
.next-payment-empty { font-size: 11px; color: var(--muted); margin-top: 13px; }
.section-block { margin-top: 28px; }
.section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 13px; }
.muted { color: var(--muted); font-size: 11px; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 13px; }
.service-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-height: 196px; }
.service-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.service-identity { display: flex; gap: 11px; align-items: center; }
.service-logo { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: #fff; font: 700 13px Inter; }
.logo-openai { background: #17191c; }
.logo-anthropic { background: #c56f43; }
.logo-xai { background: #35393f; }
.logo-cursor { background: #26292d; }
.logo-google { background: #4c78dd; }
.service-name strong { font-size: 13px; display: block; }
.service-name span { color: var(--muted); font-size: 10px; }
.status { border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 700; }
.status.active { color: #19744f; background: #e7f6ef; }
.status.cancelled { color: #9b5a17; background: #fff3e2; }
.service-price { margin: 25px 0 17px; }
.service-price strong { font: 700 22px Inter, "Noto Sans KR"; }
.service-price span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.service-meta { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 7px; }
.meta-row { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; }
.meta-row span:first-child { color: var(--muted); }
.service-note { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 10px; line-height: 1.5; color: var(--muted); }
.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; }
.select { border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); padding: 8px 10px; font-size: 10px; outline: none; }
.bar-chart { min-height: 260px; display: flex; align-items: end; gap: 18px; padding: 24px 12px 8px; border-top: 1px solid var(--line); }
.bar-col { flex: 1; min-width: 56px; text-align: center; display: flex; flex-direction: column; justify-content: end; height: 215px; }
.bar-value { font: 700 10px Inter; margin-bottom: 7px; color: #4b5058; }
.bar-track { height: 165px; display: flex; align-items: end; justify-content: center; }
.bar { width: min(54px, 72%); min-height: 3px; border-radius: 8px 8px 3px 3px; background: #1c1f23; transition: height .25s ease; }
.bar.openai { background: #191b1e; }
.bar.anthropic { background: #bd744e; }
.bar.xai { background: #626974; }
.bar.cursor { background: #30343a; }
.bar.google { background: #5076cf; }
.bar-label { margin-top: 9px; color: var(--muted); font-size: 10px; }
.insights { display: grid; gap: 10px; }
.insight { background: var(--panel-soft); border: 1px solid #eceef2; border-radius: 13px; padding: 13px; }
.insight strong { display: block; font-size: 11px; margin-bottom: 4px; }
.insight p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.insight.warning { background: #fff9f0; border-color: #f2e3cd; }
.insight.good { background: #f2faf6; border-color: #d8eee2; }
.transactions-heading { align-items: end; }
.filters { display: flex; gap: 7px; }
.table-wrap { overflow: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { color: var(--muted); font-size: 9px; letter-spacing: .04em; text-align: left; padding: 11px 10px; font-weight: 700; }
td { font-size: 10px; padding: 12px 10px; border-top: 1px solid #eff1f4; white-space: nowrap; }
td.amount { font: 700 10px Inter; }
.provider-cell { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.provider-mini { width: 18px; height: 18px; border-radius: 6px; color: #fff; display: grid; place-items: center; font: 700 7px Inter; }
.type-pill { display: inline-flex; border-radius: 999px; padding: 4px 7px; background: var(--panel-soft); color: #646a73; font-size: 9px; }
.type-pill.refund { color: #1a7d57; background: #e8f6ef; }
footer { margin: 23px 0 4px; color: #989da5; font-size: 9px; text-align: center; }
dialog { border: 0; border-radius: 20px; padding: 0; width: min(620px, calc(100vw - 32px)); box-shadow: 0 28px 90px rgba(0,0,0,.22); }
dialog::backdrop { background: rgba(18, 20, 24, .54); backdrop-filter: blur(3px); }
.dialog-card { padding: 23px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.icon-button { border: 0; width: 32px; height: 32px; border-radius: 10px; background: var(--panel-soft); font-size: 20px; color: #767b83; }
.dialog-card label { display: grid; gap: 7px; margin-bottom: 16px; }
.dialog-card label > span { font-weight: 700; font-size: 11px; }
.dialog-card input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; outline: none; }
.dialog-card input:focus { border-color: #aaa0e9; box-shadow: 0 0 0 3px #f1edff; }
.dialog-card small { color: var(--muted); font-size: 9px; line-height: 1.5; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 11px 14px; background: #191c20; color: #fff; border-radius: 11px; font-size: 10px; opacity: 0; pointer-events: none; transform: translateY(7px); transition: .2s ease; box-shadow: var(--shadow); z-index: 10; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
  .summary-grid, .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 18px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .nav, .sidebar-card, .sidebar-footer { display: none; }
  .main { padding: 24px 18px; }
  .analysis-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
}
@media (max-width: 580px) {
  .summary-grid, .service-grid { grid-template-columns: 1fr; }
  .main { padding: 20px 12px; }
  .top-actions .sync-note { width: 100%; }
  .transactions-heading { align-items: flex-start; flex-direction: column; }
  .two-col { grid-template-columns: 1fr; }
}

.health-pill { display:inline-flex;align-items:center;gap:6px;font-size:10px;font-weight:700;padding:4px 7px;border-radius:999px;background:#f1f3f5;color:#555;white-space:nowrap; }
.health-pill::before { content:'';width:6px;height:6px;border-radius:50%;background:#9aa0a6; }
.health-pill.operational { background:#e7f6ef;color:#19744f; }
.health-pill.operational::before { background:#1f9d6a; }
.health-pill.degraded { background:#fff3e2;color:#9b5a17; }
.health-pill.degraded::before { background:#e58d26; }
.health-pill.outage { background:#fdecec;color:#a33939; }
.health-pill.outage::before { background:#d84b4b; }
.health-pill.loading { background:#f1f3f5;color:#6d737b; }
.portal-line { margin-top: 10px; font-size: 11px; color: #a5aab0; line-height: 1.5; }
.portal-warn { color: #f2b544; font-weight: 700; }
