/* ══════════════════════════════════════════════
   KIWOOM API TESTER  ·  Premium Developer UI
   ══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

:root {
  --canvas:        #070b0f;
  --surface-0:     #0b1017;
  --surface-1:     #101820;
  --surface-2:     #162030;
  --surface-3:     #1c2838;
  --line-0:        rgba(255,255,255,0.04);
  --line-1:        rgba(255,255,255,0.08);
  --line-2:        rgba(255,255,255,0.14);
  --line-focus:    rgba(245,166,35,0.55);
  --accent:        #f5a623;
  --accent-2:      #e07d06;
  --accent-glow:   rgba(245,166,35,0.2);
  --accent-dim:    rgba(245,166,35,0.07);
  --t0:            #eef2f7;
  --t1:            #8fa0b5;
  --t2:            #4d6278;
  --t3:            #2b3a4a;
  --ok:            #4ade80;
  --ok-bg:         rgba(74,222,128,0.08);
  --ok-line:       rgba(74,222,128,0.25);
  --err:           #f87171;
  --err-bg:        rgba(248,113,113,0.08);
  --err-line:      rgba(248,113,113,0.25);
  --warn:          #fbbf24;
  --warn-bg:       rgba(251,191,36,0.08);
  --warn-line:     rgba(251,191,36,0.3);
  --info:          #60a5fa;
  --info-bg:       rgba(96,165,250,0.08);
  --info-line:     rgba(96,165,250,0.25);
  --purple:        #a78bfa;
  --mono: 'IBM Plex Mono', 'Fira Code', Consolas, monospace;
  --sans: 'Noto Sans KR', -apple-system, sans-serif;
  --r-xs: 3px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --ease: cubic-bezier(.22,.68,0,1.2);
  --ease-out: cubic-bezier(0,0,.3,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--canvas);
  color: var(--t0);
  font-size: 13px;
  line-height: 1.6;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* grain overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.022;
  pointer-events: none;
  z-index: 9998;
}

/* ─── HEADER ─── */
.app-header {
  height: 52px;
  background: var(--surface-0);
  border-bottom: 1px solid var(--line-1);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 100;
  position: relative;
}
.app-header::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 40%, transparent 100%);
  opacity: 0.5;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  box-shadow: 0 0 14px var(--accent-glow), 0 2px 6px rgba(0,0,0,0.5);
  flex-shrink: 0;
}
.logo-text {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--t0);
  letter-spacing: 0.02em;
}
.logo-text em { font-style: normal; color: var(--accent); }
.logo-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t2);
  background: var(--surface-2);
  border: 1px solid var(--line-1);
  border-radius: 3px;
  padding: 1px 6px;
  letter-spacing: 0.04em;
}

.header-right { display: flex; align-items: center; gap: 10px; }

.env-toggle {
  display: flex;
  background: var(--surface-1);
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.env-toggle button {
  border: none; background: none;
  color: var(--t2);
  padding: 4px 12px;
  font-size: 11px; font-family: var(--mono); font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s var(--ease-out);
}
.env-toggle button.active {
  background: var(--accent);
  color: #07090c;
  box-shadow: 0 0 10px var(--accent-glow);
}
.env-toggle button:not(.active):hover { color: var(--t1); background: var(--surface-2); }

.auth-status {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-1);
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  padding: 5px 12px 5px 9px;
  font-size: 11px; font-family: var(--mono);
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  overflow: hidden;
}
.auth-status:hover { border-color: var(--line-2); background: var(--surface-2); }

.auth-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--t3);
  flex-shrink: 0;
  transition: all 0.25s;
}
.auth-status.authenticated .dot {
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--ok-bg), 0 0 8px var(--ok);
  animation: pulse-dot 2.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 2px var(--ok-bg), 0 0 8px var(--ok); }
  50%      { box-shadow: 0 0 0 4px var(--ok-bg), 0 0 14px var(--ok); }
}
.auth-status.authenticated { border-color: var(--ok-line); }
#auth-status-text { color: var(--t1); }
.auth-status.authenticated #auth-status-text { color: var(--ok); }
.token-preview {
  color: var(--t2); max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10px;
  border-left: 1px solid var(--line-1);
  padding-left: 7px;
}

/* ─── LAYOUT ─── */
.app-body { display: flex; flex: 1; overflow: hidden; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: 266px; min-width: 266px;
  background: var(--surface-0);
  border-right: 1px solid var(--line-1);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.sidebar-search {
  padding: 10px;
  border-bottom: 1px solid var(--line-0);
  flex-shrink: 0;
}
.search-wrap { position: relative; }
.search-icon {
  position: absolute; left: 9px; top: 50%;
  transform: translateY(-50%);
  color: var(--t2); pointer-events: none; font-size: 12px;
}
.search-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  color: var(--t0);
  padding: 7px 9px 7px 30px;
  font-size: 12px; font-family: var(--mono);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search-input:focus { border-color: var(--line-focus); background: var(--surface-3); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-input::placeholder { color: var(--t3); }

.sidebar-meta {
  padding: 5px 12px;
  font-size: 10px; font-family: var(--mono);
  color: var(--t3);
  border-bottom: 1px solid var(--line-0);
  display: flex; justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-meta .count-num { color: var(--accent); font-weight: 600; }

.api-list { flex: 1; overflow-y: auto; padding: 5px 0; }
.api-list::-webkit-scrollbar { width: 3px; }
.api-list::-webkit-scrollbar-thumb { background: var(--line-1); border-radius: 2px; }

.category-group { margin-bottom: 2px; }
.category-header {
  padding: 7px 12px 3px;
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  color: var(--t3); letter-spacing: 0.12em; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none;
  transition: color 0.15s;
}
.category-header:hover { color: var(--t2); }
.category-header .cat-count {
  background: var(--surface-2); border: 1px solid var(--line-0);
  border-radius: 3px; padding: 0 4px;
  font-size: 9px; color: var(--t3);
}
.category-header .arrow {
  margin-left: auto;
  transition: transform 0.2s var(--ease-out);
  font-size: 9px; color: var(--t3);
}
.category-header.collapsed .arrow { transform: rotate(-90deg); }
.category-items.hidden { display: none; }

.api-item {
  padding: 5px 12px 5px 14px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  border-left: 2px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  position: relative;
}
.api-item:hover { background: rgba(255,255,255,0.03); }
.api-item.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.api-item.active::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--accent-glow), transparent 60%);
  pointer-events: none;
}
.api-id-badge {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line-1);
  border-radius: 3px; padding: 1px 5px;
  color: var(--t1); flex-shrink: 0; white-space: nowrap;
  transition: all 0.12s;
}
.api-item.active .api-id-badge {
  background: var(--accent); border-color: var(--accent);
  color: #07090c; font-weight: 700;
}
.api-item .api-name {
  font-size: 12px; color: var(--t1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color 0.12s;
}
.api-item.active .api-name { color: var(--t0); font-weight: 500; }
.api-item:hover .api-name { color: var(--t0); }

/* ─── MAIN CONTENT ─── */
.main-content {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--canvas);
}

/* ─── WELCOME ─── */
.welcome-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0; position: relative; overflow: hidden;
}
.welcome-screen::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line-0) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-0) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 65% 65% at 50% 50%, black 0%, transparent 100%);
}
.welcome-glow {
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  position: absolute; pointer-events: none;
  animation: glow-drift 8s ease-in-out infinite alternate;
}
@keyframes glow-drift {
  from { transform: translate(-40px,-30px); opacity:0.5; }
  to   { transform: translate(40px,30px); opacity:1; }
}
.welcome-content { position: relative; text-align: center; }
.welcome-icon { font-size: 42px; margin-bottom: 18px; opacity: 0.15; filter: grayscale(1); }
.welcome-title {
  font-family: var(--mono); font-size: 20px; font-weight: 600;
  color: var(--t0); letter-spacing: -0.01em; margin-bottom: 8px;
}
.welcome-title em { font-style: normal; color: var(--accent); }
.welcome-sub { font-size: 13px; color: var(--t2); margin-bottom: 24px; }
.welcome-chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.welcome-chip {
  font-family: var(--mono); font-size: 10px; color: var(--t2);
  background: var(--surface-1); border: 1px solid var(--line-1);
  border-radius: 4px; padding: 3px 10px; letter-spacing: 0.04em;
}

/* ─── API PANEL ─── */
.api-panel {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  animation: panel-in 0.22s var(--ease-out);
}
@keyframes panel-in {
  from { opacity:0; transform:translateY(5px); }
  to   { opacity:1; transform:none; }
}

.api-panel-header {
  background: var(--surface-0);
  border-bottom: 1px solid var(--line-1);
  padding: 11px 20px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.method-badge {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em;
  background: var(--info-bg); color: var(--info); border: 1px solid var(--info-line);
  border-radius: var(--r-xs); padding: 3px 8px;
}
.panel-api-name { font-size: 15px; font-weight: 600; color: var(--t0); }
.api-id-chip {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  background: var(--accent-dim); border: 1px solid rgba(245,166,35,0.2);
  border-radius: var(--r-xs); padding: 2px 8px; font-weight: 600;
}
.api-breadcrumb {
  margin-left: auto;
  font-family: var(--mono); font-size: 10px; color: var(--t2);
  display: flex; align-items: center; gap: 4px;
}
.api-breadcrumb span { color: var(--t3); }

.api-panel-body { flex: 1; display: flex; overflow: hidden; }

.request-panel, .response-panel {
  display: flex; flex-direction: column; overflow: hidden;
}
.request-panel { width: 46%; border-right: 1px solid var(--line-1); }
.response-panel { flex: 1; }

.panel-title {
  padding: 8px 15px;
  background: var(--surface-0);
  border-bottom: 1px solid var(--line-0);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.panel-title-text {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.1em; color: var(--t2); text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.panel-title-text::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--t3);
}
.request-panel .panel-title-text::before { background: var(--info); box-shadow: 0 0 6px var(--info); }
.response-panel .panel-title-text::before { background: var(--ok); box-shadow: 0 0 6px var(--ok); }

.panel-scroll { flex: 1; overflow-y: auto; padding: 13px 15px; }
.panel-scroll::-webkit-scrollbar { width: 3px; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--line-1); border-radius: 2px; }

/* ─── FORM FIELDS ─── */
.field-section { margin-bottom: 16px; }
.field-section-label {
  display: flex; align-items: center; gap: 8px; margin-bottom: 9px;
}
.field-section-label-text {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  color: var(--t2); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap;
}
.field-section-label-line { flex: 1; height: 1px; background: var(--line-0); }

.field-row { margin-bottom: 8px; }
.field-label { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.field-name { font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--t0); }
.field-korean { font-size: 11px; color: var(--t2); }
.required-badge {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  background: var(--err-bg); color: var(--err); border: 1px solid var(--err-line);
  border-radius: 3px; padding: 0 4px; letter-spacing: 0.04em;
}
.optional-badge { font-family: var(--mono); font-size: 9px; color: var(--t3); }
.length-badge { font-family: var(--mono); font-size: 9px; color: var(--t3); margin-left: auto; }

.field-desc {
  font-size: 10.5px; color: var(--t2); margin-bottom: 4px;
  white-space: pre-wrap; line-height: 1.5;
  padding-left: 6px; border-left: 2px solid var(--line-1);
}
.field-input {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  color: var(--t0);
  padding: 7px 10px;
  font-size: 12px; font-family: var(--mono);
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  letter-spacing: 0.01em;
}
.field-input:focus {
  border-color: var(--line-focus);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field-input::placeholder { color: var(--t3); }
.field-input[readonly] {
  color: var(--t2); background: var(--surface-0);
  cursor: default; border-style: dashed;
}

/* ─── SEND BAR ─── */
.send-section {
  padding: 9px 14px;
  border-top: 1px solid var(--line-1);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; background: var(--surface-0);
}
.btn-send {
  display: flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #07090c;
  border: none; border-radius: var(--r-sm);
  padding: 7px 18px;
  font-size: 12px; font-family: var(--mono); font-weight: 700; letter-spacing: 0.06em;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: all 0.15s var(--ease-out);
  position: relative; overflow: hidden;
}
.btn-send::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent);
  pointer-events: none;
}
.btn-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px var(--accent-glow), 0 0 0 1px rgba(245,166,35,0.4);
}
.btn-send:active:not(:disabled) { transform: translateY(0); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-send .btn-icon, .btn-send .btn-label { position: relative; z-index: 1; }
.btn-send .spinner {
  width: 12px; height: 12px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #07090c;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  position: relative; z-index: 1;
}
@keyframes spin { to { transform: rotate(360deg); } }

.url-preview { font-family: var(--mono); font-size: 10px; color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.url-preview .url-domain { color: var(--t1); }
.url-preview .url-path { color: var(--accent); }

/* ─── RESPONSE ─── */
.response-status { display: flex; align-items: center; gap: 8px; }
.status-badge {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 3px; letter-spacing: 0.05em;
}
.status-badge.success { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.status-badge.error   { background: var(--err-bg); color: var(--err); border: 1px solid var(--err-line); }
.status-badge.pending { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }

.resp-time { font-family: var(--mono); font-size: 10px; color: var(--t2); }
.resp-headers-toggle {
  font-family: var(--mono); font-size: 10px; color: var(--info);
  cursor: pointer; background: none; border: none; padding: 0;
  opacity: 0.8; transition: opacity 0.15s;
}
.resp-headers-toggle:hover { opacity: 1; text-decoration: underline; }

.response-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 10px;
  color: var(--t2); font-size: 12px; font-family: var(--mono);
}
.response-empty-icon { font-size: 26px; opacity: 0.12; }
.response-empty-line {
  display: flex; align-items: center; gap: 6px; color: var(--t3); font-size: 10px;
}
.response-empty-line::before, .response-empty-line::after { content: '─────'; opacity: 0.3; }

.resp-headers-box {
  background: var(--surface-1); border: 1px solid var(--line-1);
  border-radius: var(--r-sm); padding: 10px 14px;
  font-family: var(--mono); font-size: 10.5px; line-height: 1.8;
  margin-bottom: 10px;
  animation: fade-in 0.2s var(--ease-out);
}
@keyframes fade-in { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }
.resp-headers-box .h-key { color: var(--info); }
.resp-headers-box .h-sep { color: var(--t3); margin: 0 2px; }
.resp-headers-box .h-val { color: var(--t1); }

pre.json-output {
  background: var(--surface-1); border: 1px solid var(--line-1);
  border-radius: var(--r-sm); padding: 14px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.65;
  overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  animation: fade-in 0.2s var(--ease-out);
}
.json-key    { color: #7dd3fc; }
.json-string { color: #86efac; }
.json-number { color: #d8b4fe; }
.json-bool   { color: var(--warn); }
.json-null   { color: var(--t3); font-style: italic; }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface-0);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  width: 460px; max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0,0,0,0.75), 0 0 0 1px var(--line-0);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.25s var(--ease);
  overflow: hidden;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-1);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-1);
}
.modal-header-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--t0);
}
.modal-header-title .icon {
  width: 26px; height: 26px;
  background: var(--accent-dim); border: 1px solid rgba(245,166,35,0.25);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.modal-close {
  background: none; border: none; color: var(--t2); font-size: 16px; cursor: pointer;
  width: 26px; height: 26px; border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--surface-3); color: var(--t0); }

.modal-body { padding: 18px; }
.modal-body .field-row { margin-bottom: 12px; }

.info-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 11px; color: var(--t2); line-height: 1.5;
  background: var(--info-bg); border: 1px solid var(--info-line);
  border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 14px;
}
.info-row .info-icon { font-size: 12px; flex-shrink: 0; margin-top: 1px; }

.token-display {
  background: var(--surface-2); border: 1px solid var(--ok-line);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-family: var(--mono); font-size: 10px; color: var(--ok);
  word-break: break-all; line-height: 1.6; max-height: 72px; overflow-y: auto;
}
.modal-footer {
  padding: 12px 18px; border-top: 1px solid var(--line-1);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  background: var(--surface-1);
}
.btn-secondary {
  background: var(--surface-2); color: var(--t1);
  border: 1px solid var(--line-1); border-radius: var(--r-sm);
  padding: 7px 14px; font-size: 12px; font-family: var(--mono);
  cursor: pointer; transition: all 0.15s;
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--line-2); color: var(--t0); }
.btn-danger {
  background: var(--err-bg); color: var(--err); border: 1px solid var(--err-line);
  border-radius: var(--r-sm); padding: 7px 14px;
  font-size: 12px; font-family: var(--mono); cursor: pointer; transition: all 0.15s;
}
.btn-danger:hover { background: rgba(248,113,113,0.15); }
.copy-btn {
  background: none; border: 1px solid var(--line-1); color: var(--t1);
  border-radius: 4px; padding: 3px 8px; font-size: 10px; font-family: var(--mono);
  cursor: pointer; transition: all 0.15s;
}
.copy-btn:hover { background: var(--surface-2); color: var(--t0); }

/* ─── NOTIFICATION ─── */
.notification {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--surface-1); border: 1px solid var(--line-2);
  border-radius: var(--r-md); padding: 10px 16px;
  font-family: var(--mono); font-size: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5); z-index: 9999;
  transform: translateY(20px) scale(0.96); opacity: 0;
  transition: all 0.22s var(--ease);
  display: flex; align-items: center; gap: 8px; max-width: 320px;
}
.notification.show { transform: translateY(0) scale(1); opacity: 1; }
.notification.success { border-color: var(--ok-line); color: var(--ok); }
.notification.error   { border-color: var(--err-line); color: var(--err); }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-2); }

/* ══════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════ */
body.is-login {
  align-items: center;
  justify-content: center;
  background: var(--canvas);
}

.login-page {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
}

.login-bg {
  position: fixed; inset: 0; pointer-events: none;
}
.login-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line-0) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-0) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 0%, transparent 100%);
}
.login-glow {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, var(--accent-glow) 0%, transparent 70%);
  animation: glow-drift 8s ease-in-out infinite alternate;
}

.login-card {
  background: var(--surface-0);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  width: 380px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 0 1px var(--line-0);
  position: relative;
  overflow: hidden;
  animation: card-in 0.4s var(--ease);
}
@keyframes card-in {
  from { opacity:0; transform: translateY(20px) scale(0.97); }
  to   { opacity:1; transform: none; }
}
/* top glow line */
.login-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}

.login-logo {
  padding: 28px 28px 20px;
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid var(--line-0);
}
.login-logo-mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 20px var(--accent-glow), 0 4px 10px rgba(0,0,0,0.5);
  flex-shrink: 0;
}
.login-logo-title {
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  color: var(--t0); letter-spacing: 0.02em;
}
.login-logo-title em { font-style: normal; color: var(--accent); }
.login-logo-sub {
  font-family: var(--mono); font-size: 10px; color: var(--t2);
  letter-spacing: 0.08em; margin-top: 2px;
}

.login-alert {
  margin: 0 28px;
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--err-bg);
  border: 1px solid var(--err-line);
  border-radius: var(--r-sm);
  font-family: var(--mono); font-size: 12px; color: var(--err);
  animation: fade-in 0.2s var(--ease-out);
}
.login-alert.success {
  background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok);
}

.login-form { padding: 20px 28px 24px; }

.lf-row { margin-bottom: 14px; }
.lf-label {
  display: block; margin-bottom: 5px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: var(--t2); letter-spacing: 0.1em; text-transform: uppercase;
}
.lf-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  color: var(--t0);
  padding: 10px 12px;
  font-size: 13px; font-family: var(--sans);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lf-input:focus {
  border-color: var(--line-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.lf-input::placeholder { color: var(--t3); }

.lf-btn {
  width: 100%; margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07090c;
  border: none; border-radius: var(--r-sm);
  padding: 11px;
  font-size: 13px; font-family: var(--mono); font-weight: 700; letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  position: relative; overflow: hidden;
}
.lf-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent);
  pointer-events: none;
}
.lf-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}
.lf-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.lf-btn .lf-btn-icon, .lf-btn .lf-btn-label { position: relative; z-index: 1; }
.lf-btn .spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.2); border-top-color: #07090c;
  border-radius: 50%; animation: spin 0.6s linear infinite;
  position: relative; z-index: 1;
}

.login-footer {
  padding: 14px 28px;
  border-top: 1px solid var(--line-0);
  font-family: var(--mono); font-size: 10px; color: var(--t3);
  text-align: center;
}

/* ══════════════════════════════════════════════
   HEADER — TOKEN STATUS + USER BADGE
══════════════════════════════════════════════ */
.token-status-badge {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-1); border: 1px solid var(--line-1);
  border-radius: var(--r-sm); padding: 5px 6px 5px 9px;
  font-size: 11px; font-family: var(--mono);
  transition: all 0.15s;
}
.token-status-badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--t3); flex-shrink: 0; transition: all 0.25s;
}
.token-status-badge.has-token { border-color: var(--ok-line); }
.token-status-badge.has-token .dot {
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--ok-bg), 0 0 8px var(--ok);
  animation: pulse-dot 2.5s ease-in-out infinite;
}
.token-status-badge.expired .dot { background: var(--err); box-shadow: 0 0 6px var(--err); }
.token-status-badge.expired { border-color: var(--err-line); }
#token-status-text { color: var(--t1); }
.token-status-badge.has-token #token-status-text { color: var(--ok); }
.token-status-badge.expired #token-status-text { color: var(--err); }

.tsb-action {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  background: var(--surface-2); color: var(--t1);
  border: 1px solid var(--line-1);
  border-radius: 4px; padding: 2px 8px;
  cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.tsb-action:hover { background: var(--accent-dim); color: var(--accent); border-color: rgba(245,166,35,0.3); }
.tsb-action:disabled { opacity: 0.4; cursor: not-allowed; }

.user-badge {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-1); border: 1px solid var(--line-1);
  border-radius: var(--r-sm); padding: 5px 6px 5px 9px;
  font-size: 11px; font-family: var(--mono);
}
.user-icon { font-size: 12px; }
.user-name { color: var(--t0); font-weight: 500; }
.user-role {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  background: var(--surface-2); border: 1px solid var(--line-1);
  border-radius: 3px; padding: 1px 5px; color: var(--t2);
}
.user-role.admin { background: var(--accent-dim); border-color: rgba(245,166,35,0.25); color: var(--accent); }

.logout-btn {
  font-family: var(--mono); font-size: 10px;
  background: none; color: var(--t2);
  border: 1px solid var(--line-1); border-radius: 4px;
  padding: 2px 8px; cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.logout-btn:hover { border-color: var(--err-line); color: var(--err); background: var(--err-bg); }

/* 요청 폼 — authorization 필드를 자동주입 상태로 표시 */
.field-input.auto-inject {
  border-style: dashed;
  color: var(--ok);
  border-color: var(--ok-line);
  background: var(--ok-bg);
  cursor: default;
}

/* ══════════════════════════════════════════════
   RESPONSE TOOLBAR — 복사 버튼 + 뷰 탭
══════════════════════════════════════════════ */
.resp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line-0);
}

/* ── 뷰 탭 (JSON / 표) ── */
.resp-view-tabs {
  display: flex;
  background: var(--surface-1);
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.resp-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  color: var(--t2);
  padding: 4px 12px;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s var(--ease-out);
  white-space: nowrap;
}
.resp-tab span { font-size: 12px; }
.resp-tab:hover:not(:disabled):not(.active) {
  color: var(--t1);
  background: var(--surface-2);
}
.resp-tab.active {
  background: var(--accent);
  color: #07090c;
  font-weight: 700;
  box-shadow: 0 0 8px var(--accent-glow);
}
.resp-tab:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── 복사 버튼 ── */
.resp-copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-1);
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  color: var(--t1);
  padding: 5px 12px;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  white-space: nowrap;
}
.resp-copy-btn .copy-icon {
  font-size: 14px;
  line-height: 1;
  transition: transform 0.15s;
}
.resp-copy-btn:hover {
  border-color: var(--line-2);
  background: var(--surface-2);
  color: var(--t0);
}
.resp-copy-btn:hover .copy-icon { transform: scale(1.2); }
.resp-copy-btn.copied {
  border-color: var(--ok-line);
  background: var(--ok-bg);
  color: var(--ok);
}

/* ══════════════════════════════════════════════
   TABLE VIEW
══════════════════════════════════════════════ */
.table-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--t2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
  margin-top: 4px;
}
.table-section-icon {
  color: var(--accent);
  font-size: 13px;
}
.table-row-count {
  font-size: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line-1);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--t2);
  margin-left: auto;
  font-weight: 400;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-1);
  margin-bottom: 4px;
  animation: fade-in 0.2s var(--ease-out);
}
.table-wrap::-webkit-scrollbar { height: 4px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line-1); border-radius: 2px; }

.resp-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}
.resp-table thead tr {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.resp-table th {
  padding: 7px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--t1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-right: 1px solid var(--line-1);
  white-space: nowrap;
}
.resp-table th:last-child { border-right: none; }

.resp-table tbody tr {
  border-bottom: 1px solid var(--line-0);
  transition: background 0.1s;
}
.resp-table tbody tr:last-child { border-bottom: none; }
.resp-table tbody tr:hover { background: var(--surface-2); }
.resp-table tbody tr.even { background: rgba(255,255,255,0.015); }
.resp-table tbody tr.even:hover { background: var(--surface-2); }

.resp-table td {
  padding: 6px 14px;
  color: var(--t0);
  border-right: 1px solid var(--line-0);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.resp-table td:last-child { border-right: none; }

/* 값 타입별 색상 */
.tv-null { color: var(--t3); font-style: italic; }
.tv-bool { color: var(--warn); }
.tv-obj  {
  color: var(--t2);
  background: var(--surface-2);
  border: 1px solid var(--line-0);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  cursor: default;
}

.table-divider {
  height: 16px;
}
.table-empty {
  text-align: center;
  color: var(--t3);
  font-family: var(--mono);
  font-size: 11px;
  padding: 24px;
}

/* ══════════════════════════════════════════════
   SIDEBAR TABS — 전체 / 최근 사용
══════════════════════════════════════════════ */
.sidebar-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line-1);
  flex-shrink: 0;
  background: var(--surface-0);
}

.sidebar-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  background: none;
  color: var(--t2);
  padding: 9px 6px;
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  position: relative;
  transition: color 0.15s, background 0.15s;
}
.sidebar-tab:hover:not(.active) {
  color: var(--t1);
  background: rgba(255,255,255,0.02);
}
.sidebar-tab.active {
  color: var(--t0);
  font-weight: 600;
}
/* 활성 탭 하단 인디케이터 */
.sidebar-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 10%; right: 10%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 6px var(--accent-glow);
}

/* 최근 사용 개수 뱃지 */
.recent-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  background: var(--accent);
  color: #07090c;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 4px;
  line-height: 1;
  animation: badge-pop 0.25s var(--ease);
}
@keyframes badge-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* 패널 컨테이너 */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── 최근 사용 목록 ── */
.recent-item {
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  padding: 6px 12px 6px 14px;
}
.recent-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.recent-item-main .api-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.recent-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 2px;
}
.recent-time {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--t3);
  letter-spacing: 0.02em;
}
.recent-remove-btn {
  background: none;
  border: none;
  color: var(--t3);
  font-size: 10px;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1;
  opacity: 0;
  transition: all 0.12s;
}
.recent-item:hover .recent-remove-btn { opacity: 1; }
.recent-remove-btn:hover {
  background: var(--err-bg);
  color: var(--err);
}

/* ── 초기화 버튼 ── */
.recent-clear-btn {
  background: none;
  border: 1px solid var(--line-1);
  color: var(--t2);
  font-family: var(--mono);
  font-size: 10px;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.recent-clear-btn:hover {
  border-color: var(--err-line);
  color: var(--err);
  background: var(--err-bg);
}

/* ── 최근 사용 비어있음 ── */
.recent-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px;
  padding: 40px 16px;
  text-align: center;
}
.recent-empty-icon {
  font-size: 28px;
  opacity: 0.15;
}
.recent-empty-text {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--t2);
}
.recent-empty-sub {
  font-size: 11px;
  color: var(--t3);
  line-height: 1.5;
}

/* no-toggle 카테고리 헤더 (최근 날짜 그룹) */
.category-header.no-toggle {
  cursor: default;
}
.category-header.no-toggle .arrow { display: none; }
