:root {
  --navy: #0b2545;
  --navy-2: #123a6b;
  --gold: #c9a227;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1c2b3a;
  --muted: #63758a;
  --border: #dde4ee;
  --ok: #1c8a4c;
  --warn: #b8860b;
  --danger: #c0392b;
  --console-bg: #0d1117;
  --console-text: #c9d1d9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: linear-gradient(90deg, var(--navy), var(--navy-2));
  color: white;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--gold);
  color: var(--navy);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-title { font-weight: 600; font-size: 16px; }
.brand-sub { font-size: 12px; opacity: 0.85; }

.env-badge {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.12);
  padding: 6px 10px;
  border-radius: 6px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr;
  gap: 20px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(20,30,50,0.06);
}

.auth-panel { padding: 24px 28px 28px; min-height: 480px; }

.steps { display: flex; gap: 8px; margin-bottom: 20px; }
.step {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.step.active { background: var(--navy); color: white; border-color: var(--navy); }

h2 { margin: 0 0 8px; font-size: 20px; color: var(--navy); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 18px; }

form { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 12px; font-weight: 600; color: var(--navy-2); margin-top: 8px; }
input[type="text"], input[type="password"] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
input:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(18,58,107,0.12); }

.btn {
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 14px;
}
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-2); }
.btn-link { background: transparent; color: var(--navy-2); text-decoration: underline; padding: 8px 0; margin-top: 10px; }
.btn-ghost { background: transparent; color: var(--console-text); border: 1px solid #30363d; padding: 4px 10px; font-size: 12px; margin-top: 0; }

.spinner-row { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-top: 10px; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--navy-2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.factor-list { display: flex; flex-direction: column; gap: 10px; }
.factor-btn {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.factor-btn-row { display: flex; align-items: center; justify-content: space-between; }
.factor-btn-detail { font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 4px; }
.factor-btn:hover { border-color: var(--navy-2); }
.factor-btn .badge { font-size: 11px; font-weight: 500; color: var(--muted); }
.factor-btn.disabled { opacity: 0.5; cursor: not-allowed; }

.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 6px; margin-bottom: 12px; }
.tag-warning { background: #fdf2d5; color: var(--warn); }
.tag-danger { background: #fbe4e1; color: var(--danger); }

.user-chip {
  display: inline-flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}
.user-chip b { color: var(--navy); font-size: 14px; }

.log-panel { background: var(--console-bg); color: var(--console-text); padding: 16px; height: calc(100vh - 140px); display: flex; flex-direction: column; position: sticky; top: 24px; }
.log-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.log-header h3 { margin: 0; font-size: 14px; color: var(--console-text); font-family: Consolas, monospace; }

.log-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; font-family: Consolas, 'Courier New', monospace; font-size: 12px; }

.log-entry { border: 1px solid #30363d; border-radius: 8px; padding: 8px 10px; background: #161b22; }
.log-entry-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.log-method { font-weight: 700; color: #79c0ff; }
.log-url { color: #8b949e; word-break: break-all; }
.log-status { margin-left: auto; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.status-2xx { background: rgba(46,160,67,0.2); color: #3fb950; }
.status-4xx { background: rgba(210,153,34,0.2); color: #d29922; }
.status-5xx, .status-0 { background: rgba(248,81,73,0.2); color: #f85149; }
.log-time { color: #6e7681; font-size: 11px; margin-left: 6px; }
.log-body { margin-top: 6px; white-space: pre-wrap; color: #c9d1d9; max-height: 160px; overflow-y: auto; }
.log-note { color: #8b949e; font-style: italic; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .log-panel { height: 420px; position: static; }
}
