:root {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --text: #191f28;
  --sub: #6b7684;
  --muted: #8b95a1;
  --line: #e5e8eb;
  --accent: #2f6bff;
  --accent-soft: #edf3ff;
  --success: #00a878;
  --success-soft: #e8faf4;
  --warning: #ff8a00;
  --warning-soft: #fff5e6;
  --danger: #e5484d;
  --danger-soft: #fff0f0;
  --purple: #7f5af0;
  --shadow: 0 12px 36px rgba(15, 23, 42, 0.07);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html { background: var(--bg); color-scheme: light; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, "Apple SD Gothic Neo", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(47, 107, 255, 0.25);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; }

.side-nav {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  padding: 26px 20px;
  background: rgba(255,255,255,.88);
  border-right: 1px solid rgba(229,232,235,.9);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.brand {
  border: 0;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  background: linear-gradient(145deg, #2f6bff, #7c4dff);
  display: grid;
  grid-template-columns: repeat(3, 4px);
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 7px;
  box-shadow: 0 8px 18px rgba(47,107,255,.25);
}
.brand-mark i { display: block; width: 4px; border-radius: 3px; background: #fff; }
.brand-mark i:nth-child(1) { height: 7px; opacity: .65; }
.brand-mark i:nth-child(2) { height: 12px; }
.brand-mark i:nth-child(3) { height: 17px; }

.side-nav nav { display: grid; gap: 8px; margin-top: 40px; }
.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  color: var(--sub);
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
}
.nav-item:hover { background: var(--surface-soft); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item svg, .icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.side-profile {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 10px;
  border-top: 1px solid var(--line);
}
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #202632; color: #fff; font-size: 12px; font-weight: 800; }
.side-profile strong, .side-profile small { display: block; }
.side-profile strong { font-size: 14px; }
.side-profile small { margin-top: 3px; color: var(--muted); font-size: 12px; }

.mobile-topbar, .bottom-nav { display: none; }

main {
  width: min(1120px, calc(100% - 248px));
  min-height: 100vh;
  margin-left: 248px;
  padding: 52px 54px 80px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}
.eyebrow { margin: 0 0 8px; color: var(--accent); font-weight: 800; font-size: 14px; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 42px); line-height: 1.22; letter-spacing: -1.5px; }
.page-description { margin: 10px 0 0; color: var(--sub); font-size: 16px; line-height: 1.6; }

.primary-button, .secondary-button, .ghost-button, .chip-button {
  border: 0;
  cursor: pointer;
  border-radius: 15px;
  font-weight: 750;
  transition: transform .16s ease, background .16s ease, opacity .16s ease;
}
.primary-button:hover, .secondary-button:hover, .ghost-button:hover, .chip-button:hover { transform: translateY(-1px); }
.primary-button { padding: 14px 19px; background: var(--accent); color: #fff; box-shadow: 0 9px 20px rgba(47,107,255,.22); }
.secondary-button { padding: 13px 18px; background: var(--accent-soft); color: var(--accent); }
.ghost-button { padding: 11px 13px; background: transparent; color: var(--sub); }
.chip-button { padding: 8px 12px; background: var(--surface-soft); color: var(--sub); font-size: 13px; }
.full { width: 100%; }

.grid { display: grid; gap: 18px; }
.grid > *, .card { min-width: 0; }
.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)); }
.span-two { grid-column: span 2; }

.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(229,232,235,.55);
}
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.accent-card { background: linear-gradient(145deg, #2362ff 0%, #7357ed 100%); color: #fff; overflow: hidden; position: relative; }
.accent-card::after { content: ""; position: absolute; width: 210px; height: 210px; border-radius: 50%; right: -80px; bottom: -110px; background: rgba(255,255,255,.12); }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.card-title { margin: 0; font-size: 19px; letter-spacing: -.4px; }
.card-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.accent-card .card-subtitle { color: rgba(255,255,255,.72); }

.hero-balance { margin-top: 26px; font-size: clamp(34px, 6vw, 48px); font-weight: 850; letter-spacing: -2px; }
.hero-meta { margin-top: 10px; display: flex; gap: 9px; flex-wrap: wrap; }
.hero-meta span { padding: 8px 11px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 13px; font-weight: 700; }

.metric { min-height: 140px; }
.metric-label { color: var(--muted); font-size: 14px; font-weight: 700; }
.metric-value { margin-top: 18px; font-size: 30px; font-weight: 850; letter-spacing: -1px; }
.metric-delta { margin-top: 10px; color: var(--success); font-size: 13px; font-weight: 750; }
.metric-delta.down { color: var(--danger); }

.action-list { display: grid; gap: 4px; }
.action-row {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.action-row:last-child { border-bottom: 0; }
.action-row:hover strong { color: var(--accent); }
.action-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 15px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 850; }
.action-icon.green { background: var(--success-soft); color: var(--success); }
.action-icon.orange { background: var(--warning-soft); color: var(--warning); }
.action-icon.purple { background: #f1edff; color: var(--purple); }
.action-copy { min-width: 0; flex: 1; }
.action-copy strong, .action-copy small { display: block; }
.action-copy strong { font-size: 16px; }
.action-copy small { margin-top: 5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: #b0b8c1; font-size: 22px; }

.section { margin-top: 34px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.7px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); }

.progress-track { height: 10px; border-radius: 99px; background: #e9edf2; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #7a5cff); }
.progress-labels { display: flex; justify-content: space-between; margin-top: 9px; color: var(--muted); font-size: 13px; }

.pipeline { display: grid; grid-template-columns: repeat(5, minmax(190px, 1fr)); gap: 14px; overflow-x: auto; padding: 2px 2px 16px; }
.pipeline-column { background: #e9edf1; border-radius: 22px; padding: 14px; min-height: 400px; }
.pipeline-title { display: flex; justify-content: space-between; align-items: center; padding: 4px 5px 12px; font-weight: 800; }
.count-badge { padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.78); color: var(--sub); font-size: 12px; }
.project-card { width: 100%; text-align: left; border: 0; background: #fff; border-radius: 18px; padding: 16px; margin-bottom: 10px; box-shadow: 0 4px 14px rgba(15,23,42,.05); cursor: pointer; }
.project-card:hover { box-shadow: 0 8px 22px rgba(15,23,42,.09); }
.project-card .tag { margin-bottom: 12px; }
.project-card strong { display: block; line-height: 1.42; }
.project-card small { display: block; margin-top: 10px; color: var(--muted); }

.tag { display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
.tag.green { background: var(--success-soft); color: var(--success); }
.tag.orange { background: var(--warning-soft); color: var(--warning); }
.tag.gray { background: #eef1f4; color: var(--sub); }
.tag.red { background: var(--danger-soft); color: var(--danger); }

.bar-chart { display: flex; align-items: end; gap: 10px; min-height: 190px; padding-top: 18px; }
.bar-item { flex: 1; min-width: 32px; text-align: center; }
.bar { width: 100%; min-height: 5px; background: linear-gradient(180deg, #4e7cff, #7b5cff); border-radius: 10px 10px 5px 5px; transform-origin: bottom; animation: rise .55s ease both; }
.bar-item strong { display: block; margin-top: 10px; color: var(--muted); font-size: 12px; }
@keyframes rise { from { transform: scaleY(.05); } }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 15px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; }
td { font-size: 14px; }
tr:last-child td { border-bottom: 0; }
.amount { font-weight: 800; }

.brand-list { display: grid; gap: 12px; }
.brand-row { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface-soft); border-radius: 19px; }
.brand-avatar { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; border-radius: 15px; background: #fff; box-shadow: 0 3px 10px rgba(15,23,42,.06); font-weight: 850; color: var(--accent); }
.brand-copy { flex: 1; min-width: 0; }
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy small { margin-top: 5px; color: var(--muted); }
.brand-actions { display: flex; align-items: center; gap: 8px; }

.switch { position: relative; width: 50px; height: 30px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #c9d0d8; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 2px 5px rgba(0,0,0,.15); transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }

.automation-card { display: flex; align-items: flex-start; gap: 14px; }
.automation-card .action-icon { margin-top: 2px; }
.automation-card .copy { flex: 1; }
.automation-card h3 { margin: 0 0 7px; font-size: 17px; }
.automation-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.automation-card .switch { flex: 0 0 50px; }
.automation-meta { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.payment-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(250px, .7fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 22px;
  padding: 30px;
  border-radius: var(--radius-xl);
  color: #fff;
  background:
    radial-gradient(circle at 85% 15%, rgba(255,255,255,.2), transparent 24%),
    linear-gradient(135deg, #2362ff 0%, #6948df 100%);
  box-shadow: 0 20px 50px rgba(47,107,255,.2);
}
.payment-labels { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.payment-labels .tag { background: rgba(255,255,255,.16); color: #fff; }
.payment-copy .eyebrow { margin-bottom: 6px; color: rgba(255,255,255,.72); }
.payment-copy h2 { margin: 0; font-size: clamp(27px, 4vw, 38px); letter-spacing: -1.2px; }
.payment-copy > p:not(.eyebrow) { max-width: 620px; margin: 12px 0 0; color: rgba(255,255,255,.76); line-height: 1.65; }
.payment-benefits { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 22px; font-size: 13px; font-weight: 750; color: rgba(255,255,255,.9); }
.payment-checkout { display: flex; flex-direction: column; justify-content: center; padding: 24px; border: 1px solid rgba(255,255,255,.18); border-radius: 22px; background: rgba(255,255,255,.12); backdrop-filter: blur(12px); }
.payment-caption { color: rgba(255,255,255,.68); font-size: 13px; font-weight: 700; }
.payment-checkout > strong { margin: 8px 0 18px; font-size: 30px; letter-spacing: -1px; }
.payment-checkout .primary-button { background: #fff; color: #245fe9; box-shadow: none; }
.payment-checkout .primary-button:disabled { opacity: .65; cursor: wait; }
.payment-checkout small { margin-top: 12px; color: rgba(255,255,255,.68); line-height: 1.45; }
.payment-result { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 22px; padding: 17px 18px; border-radius: 18px; }
.payment-result > span { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 50%; font-weight: 900; }
.payment-result strong, .payment-result small { display: block; }
.payment-result small { margin-top: 4px; line-height: 1.45; opacity: .76; }
.payment-result.success { background: var(--success-soft); color: #08795a; }
.payment-result.pending { background: var(--accent-soft); color: var(--accent); }
.payment-result.error { background: var(--danger-soft); color: var(--danger); }
.payment-result.success > span, .payment-result.pending > span, .payment-result.error > span { background: rgba(255,255,255,.72); }

.timeline { position: relative; padding-left: 24px; display: grid; gap: 20px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline-item { position: relative; }
.timeline-item::before { content: ""; position: absolute; left: -23px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.timeline-item strong, .timeline-item span { display: block; }
.timeline-item span { margin-top: 5px; color: var(--muted); font-size: 13px; }

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 14px; font-weight: 800; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 15px;
  padding: 14px 15px;
  color: var(--text);
}
.field textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); background: #fff; }
.help { color: var(--muted); font-size: 12px; }

.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choice { border: 1px solid var(--line); border-radius: 18px; background: #fff; padding: 16px; text-align: left; cursor: pointer; }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(47,107,255,.08); }
.choice strong, .choice small { display: block; }
.choice small { margin-top: 6px; color: var(--muted); line-height: 1.45; }

.sheet-tabs { display: flex; gap: 6px; padding: 4px; margin-bottom: 20px; background: var(--surface-soft); border-radius: 14px; overflow-x: auto; }
.sheet-tab { flex: 1; border: 0; border-radius: 11px; background: transparent; padding: 10px; color: var(--muted); font-weight: 750; white-space: nowrap; cursor: pointer; }
.sheet-tab.active { background: #fff; color: var(--text); box-shadow: 0 3px 10px rgba(15,23,42,.07); }

.output-box { position: relative; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 18px; padding: 18px; min-height: 130px; white-space: pre-wrap; line-height: 1.65; font-size: 14px; }
.output-box .chip-button { position: absolute; top: 10px; right: 10px; background: #fff; }

.check-result { border-radius: 18px; padding: 16px; margin-top: 14px; display: flex; gap: 12px; align-items: flex-start; }
.check-result.ok { background: var(--success-soft); color: #08795a; }
.check-result.warn { background: var(--warning-soft); color: #9a5900; }
.check-result strong, .check-result small { display: block; }
.check-result small { margin-top: 4px; opacity: .78; line-height: 1.5; }

.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(11,15,20,.45); backdrop-filter: blur(6px); display: grid; place-items: end center; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.sheet { width: min(680px, 100%); max-height: min(86vh, 860px); overflow-y: auto; background: #fff; border-radius: 28px; padding: 26px; box-shadow: 0 28px 80px rgba(0,0,0,.22); animation: sheetIn .24s ease both; }
@keyframes sheetIn { from { transform: translateY(30px); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 22px; }
.sheet-head h2 { margin: 0; font-size: 25px; letter-spacing: -.7px; }
.sheet-head p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.close-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--surface-soft); color: var(--sub); font-size: 24px; cursor: pointer; }
.sheet-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translate(-50%, 18px); padding: 13px 17px; border-radius: 14px; background: #202632; color: #fff; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .22s ease; font-size: 14px; font-weight: 700; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 8px; }

@media (max-width: 1000px) {
  .side-nav { display: none; }
  .mobile-topbar { position: sticky; top: 0; z-index: 30; height: 64px; display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; background: rgba(242,244,246,.9); backdrop-filter: blur(16px); }
  .mobile-topbar .brand { font-size: 18px; }
  .mobile-topbar .brand-mark { width: 28px; height: 28px; }
  .icon-button { position: relative; border: 0; background: transparent; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; }
  .notification-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: #ff4d57; border: 2px solid var(--bg); }
  main { width: 100%; margin: 0; padding: 28px 18px 108px; }
  .bottom-nav { position: fixed; z-index: 40; left: 12px; right: 12px; bottom: 12px; height: 68px; display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px; border: 1px solid rgba(229,232,235,.9); border-radius: 23px; background: rgba(255,255,255,.93); box-shadow: 0 14px 40px rgba(15,23,42,.15); backdrop-filter: blur(18px); }
  .bottom-nav .nav-item { flex-direction: column; justify-content: center; gap: 3px; padding: 5px; border-radius: 16px; font-size: 10px; }
  .bottom-nav .nav-item svg { width: 21px; height: 21px; }
  .page-header { margin-bottom: 22px; }
  .page-header .primary-button { display: none; }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  h1 { font-size: 31px; }
  .page-description { font-size: 14px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
  .span-two { grid-column: auto; }
  .card { padding: 20px; border-radius: 23px; }
  .metric { min-height: 126px; }
  .metric-value { font-size: 25px; }
  .choice-grid { grid-template-columns: 1fr; }
  .sheet { border-radius: 27px 27px 18px 18px; padding: 22px 18px; max-height: 90vh; }
  .modal-backdrop { padding: 0; }
  .brand-actions .chip-button { display: none; }
  .hero-balance { font-size: 40px; }
  .hero-meta span { font-size: 12px; }
  .payment-hero { grid-template-columns: 1fr; padding: 22px; }
  .payment-checkout { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
