:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #5d6b7a;
  --line: #dde3ea;
  --brand: #0f5f8c;
  --brand-ink: #ffffff;
  --warn-bg: #fff4dc;
  --warn-line: #f0c36d;
  --warn-ink: #6b4a00;
  --info-bg: #e8f2fb;
  --info-ink: #124a6e;
  --danger: #b3261e;
  --ok: #1f7a3a;
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--brand); color: var(--brand-ink);
}
.brand { font-weight: 700; font-size: 17px; }
.brand span { font-weight: 400; opacity: .85; margin-left: 4px; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .ghost { color: var(--brand-ink); border-color: rgba(255,255,255,.5); }
.env-banner { background: #fde7e9; color: #7a1c24; text-align: center; font-size: 13px; padding: 4px 16px; }

main { max-width: 1080px; margin: 0 auto; padding: 16px; }
.login { display: flex; justify-content: center; padding-top: 10vh; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.card.narrow { max-width: 420px; width: 100%; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
small { color: var(--muted); font-weight: 400; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: none; padding: 10px 14px; font: inherit; color: var(--muted); cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; margin-bottom: 12px; min-width: 0; }
label.inline { margin: 0; }
input, select {
  font: inherit; font-weight: 400; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); width: 100%; min-width: 0;
}
input:focus, select:focus { outline: 2px solid #9cc7e4; border-color: var(--brand); }
input:disabled { background: #f0f2f4; color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 12px 0; margin: 0 0 12px; min-width: 0; }
legend { font-weight: 700; font-size: 14px; padding: 0 6px; }

.grid2, .grid3 { display: grid; gap: 0 14px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.boosters { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 12px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > input { flex: 1 1 240px; }
.seg { display: flex; gap: 16px; margin-bottom: 10px; }
.seg label { flex-direction: row; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.seg input { width: auto; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.head-row h2 { margin: 0; }

button { font: inherit; cursor: pointer; border-radius: 8px; padding: 9px 16px; border: 1px solid transparent; }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.ghost { background: transparent; border-color: var(--line); color: var(--text); padding: 6px 12px; }
.danger { background: var(--danger); color: #fff; font-weight: 600; }
.wide { width: 100%; margin-top: 8px; padding: 12px; }
.link { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; }
.small-btn { padding: 3px 9px; font-size: 12px; }

.notice { border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; font-size: 14px; }
.notice.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.notice.info { background: var(--info-bg); color: var(--info-ink); }
.error { color: var(--danger); font-size: 14px; margin: 8px 0; }
.ok { color: var(--ok); font-size: 14px; margin: 8px 0; }

.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #0d2233; color: #fff; border-radius: 8px; padding: 14px 16px; margin-bottom: 12px;
}
.code-box code { font: 700 26px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 2px; word-break: break-all; }
.code-box .ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.result { border-color: var(--brand); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.nowrap { white-space: nowrap; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef1f4; color: var(--muted); white-space: nowrap; }
.tag.good { background: #e3f4e8; color: var(--ok); }
.tag.bad { background: #fde7e9; color: var(--danger); }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); }

.summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.stat { background: #f7f9fb; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 110px; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); }

.danger-zone { border-color: #efb8b4; }
.status { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 2px 24px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: #1d2733; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: calc(100% - 32px);
}

/* no awkward wrapping of short controls / ids; long tables scroll inside .table-wrap */
button, .brand, .tabs button { white-space: nowrap; }
.table td.mono { white-space: nowrap; word-break: normal; }

@media (max-width: 720px) {
  .brand span { display: none; }
  .table { min-width: 720px; } /* scroll sideways inside .table-wrap instead of squeezing */
  .who { font-size: 12px; gap: 8px; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .code-box code { font-size: 20px; }
  .top { padding: 10px 16px; }
  .who #whoEmail { max-width: 46vw; }
  .card { padding: 14px; }
}
