:root {
  color-scheme: light dark;
  --bg: #0f172a;
  --bg-alt: #111827;
  --card: #020617;
  --border: #1f2937;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.1);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --danger: #f97373;
  --danger-soft: rgba(248, 113, 113, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1d283a 0, #020617 45%, #000 100%);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.page {
  width: 100%;
  max-width: 1200px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
}

.title-block h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-pill {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--muted);
}

.title-block p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.meta {
  text-align: right;
  font-size: 11px;
  color: var(--muted);
}

.meta strong {
  color: var(--text);
  font-weight: 500;
}

.chips {
  display: none;
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (max-width: 960px) {
  .meta {
    text-align: left;
  }
  .chips {
    justify-content: flex-start;
  }
}

.card {
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.75));
  border-radius: 16px;
  border: 1px solid rgba(31, 41, 55, 0.8);
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(15, 23, 42, 0.8);
  padding: 16px 16px 14px;
  backdrop-filter: blur(26px);
}

.card--secondary {
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.7));
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #e5e7eb;
}

.card-caption {
  font-size: 11px;
  color: var(--muted);
}

.badge {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(75, 85, 99, 0.9);
  color: var(--muted);
}

.badge--green {
  border-color: rgba(34, 197, 94, 0.6);
  background: var(--accent-soft);
  color: #bbf7d0;
}

.badge--red {
  border-color: rgba(248, 113, 113, 0.6);
  background: var(--danger-soft);
  color: #fecaca;
}

.badge--cyan {
  border-color: rgba(6, 182, 212, 0.6);
  background: rgba(6, 182, 212, 0.08);
  color: #a5f3fc;
}

.tabs {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 2px;
  background: rgba(15, 23, 42, 0.9);
  gap: 2px;
  font-size: 11px;
}

.tab {
  border-radius: 999px;
  padding: 3px 10px;
  cursor: default;
  color: var(--muted);
  white-space: nowrap;
}

.tab--active {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #022c22;
  font-weight: 600;
}

.table-wrapper {
  border-radius: 10px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background:
    linear-gradient(to bottom right, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.92)),
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.05), transparent 48%);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

thead {
  background: linear-gradient(to right, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.96));
}

th, td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(31, 41, 55, 0.85);
  vertical-align: top;
}

th {
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.3);
}

tbody tr:last-child td {
  border-bottom: none;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(31, 41, 55, 0.9);
  color: #e5e7eb;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 10px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  color: var(--muted);
  white-space: nowrap;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.9);
}

.pill--ok .pill-dot {
  background: #22c55e;
}

.pill--warn .pill-dot {
  background: #f97373;
}

.pill--hard {
  border-color: rgba(248, 113, 113, 0.6);
  color: #fecaca;
}

.k {
  color: #bfdbfe;
  font-weight: 500;
  font-size: 11px;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 6px;
  color: #e5e7eb;
}

.section-desc {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 10px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.list-item {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.list-item strong {
  color: var(--text);
  font-weight: 500;
}

.list-item span {
  text-align: right;
  white-space: nowrap;
}

/* ─── 일반지갑 결산 시뮬레이터 ─── */
.sim-section {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(6, 182, 212, 0.25);
  background: rgba(6, 182, 212, 0.03);
}

.sim-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sim-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #a5f3fc;
}

.sim-controls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.sim-control-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sim-control-group label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sim-control-group select,
.sim-control-group input {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
  font-size: 11px;
  font-family: inherit;
}

.sim-control-group select:focus,
.sim-control-group input:focus {
  outline: none;
  border-color: rgba(6, 182, 212, 0.5);
}

.sim-matches {
  margin-bottom: 12px;
}

.sim-match-row {
  display: grid;
  grid-template-columns: 60px 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(31, 41, 55, 0.5);
  font-size: 11px;
}

.sim-match-row:last-child {
  border-bottom: none;
}

.sim-match-label {
  color: var(--muted);
  font-weight: 500;
}

.sim-match-row select,
.sim-match-row input {
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
  font-size: 11px;
  font-family: inherit;
  width: 100%;
}

.sim-match-remove {
  background: none;
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #f97373;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 10px;
}

.sim-match-remove:hover {
  background: rgba(248, 113, 113, 0.1);
}

.sim-add-match {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px dashed rgba(6, 182, 212, 0.4);
  background: transparent;
  color: #67e8f9;
  font-size: 10px;
  cursor: pointer;
  margin-top: 6px;
}

.sim-add-match:hover {
  background: rgba(6, 182, 212, 0.08);
}

.sim-run-btn {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid rgba(6, 182, 212, 0.7);
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #042f2e;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-transform: uppercase;
}

.sim-run-btn:hover {
  filter: brightness(1.1);
}

.sim-result {
  margin-top: 14px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(15, 23, 42, 0.95);
  display: none;
}

.sim-result.active {
  display: block;
}

.sim-result-title {
  font-size: 11px;
  font-weight: 600;
  color: #a5f3fc;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sim-step {
  padding: 6px 0;
  border-bottom: 1px solid rgba(31, 41, 55, 0.5);
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sim-step:last-child {
  border-bottom: none;
}

.sim-step-label {
  color: var(--muted);
}

.sim-step-value {
  font-weight: 500;
}

.sim-step-value.positive {
  color: #22c55e;
}

.sim-step-value.negative {
  color: #f97373;
}

.sim-step-value.neutral {
  color: #fbbf24;
}

.sim-wallet-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.sim-wallet-box {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(15, 23, 42, 0.8);
}

.sim-wallet-box-title {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.sim-wallet-box-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.sim-wallet-box-value.highlight-balance {
  color: #67e8f9;
}

.sim-wallet-box-value.highlight-cash {
  color: #22c55e;
}

.sim-flow-steps {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(31, 41, 55, 0.6);
  background: rgba(15, 23, 42, 0.6);
}

.sim-flow-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 11px;
}

.sim-flow-arrow {
  color: var(--muted);
  font-size: 10px;
}

.sim-flow-desc {
  color: var(--text);
}

.sim-flow-amount {
  margin-left: auto;
  font-weight: 500;
  white-space: nowrap;
}
