:root {
  --bg: #0f1115;
  --card: #171a21;
  --card-2: #1e222b;
  --line: #2a2f3a;
  --fg: #eef1f6;
  --muted: #99a1b3;
  --accent: #3b82f6;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 14px;
  --safe: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(24px + var(--safe)); }
.wide { max-width: 980px; }

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 24px 0 8px; color: var(--muted); font-weight: 600; }
p { margin: 6px 0; }
a { color: var(--accent); }

.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrapy { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

button, .btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--fg);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
}
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 36px; padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }

input, textarea, select {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--fg);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 16px;
  font-family: inherit;
}
textarea { min-height: 180px; resize: vertical; line-height: 1.5; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.green { background: rgba(22,163,74,.18); color: #4ade80; }
.pill.amber { background: rgba(217,119,6,.18); color: #fbbf24; }
.pill.red { background: rgba(220,38,38,.18); color: #f87171; }
.pill.gray { background: rgba(153,161,179,.15); color: var(--muted); }

.banner {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}
.banner.warn { border-color: var(--amber); color: #fbbf24; }
.banner.err { border-color: var(--red); color: #f87171; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td input, td select { padding: 6px 8px; font-size: 13px; border-radius: 7px; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--safe)); transform: translateX(-50%);
  background: #fff; color: #111; padding: 10px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
