* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', 'Segoe UI', sans-serif; background: #f8fafc; color: #0f172a; min-height: 100vh; }

header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
header h1 { font-size: 16px; font-weight: 700; color: #1e40af; letter-spacing: 0.5px; }
header span { font-size: 12px; color: #94a3b8; }

.layout { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 49px); }

/* ── SIDEBAR ── */
.sidebar {
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.section { border-bottom: 1px solid #e2e8f0; padding: 14px 16px; }
.section h2 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #2563eb;
  font-weight: 700;
  margin-bottom: 10px;
}

label { font-size: 12px; color: #64748b; display: block; margin-bottom: 4px; margin-top: 10px; }
input[type=text], input[type=password], input[type=email] {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #0f172a;
  padding: 7px 10px;
  font-size: 12px;
  font-family: monospace;
}
input:focus { outline: none; border-color: #2563eb; background: #ffffff; }

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  transition: opacity 0.15s;
}
button:hover    { opacity: 0.85; }
button:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary   { background: #2563eb; color: #fff; width: 100%; margin-top: 12px; }
.btn-secondary { background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; width: 100%; margin-top: 8px; }
.btn-danger    { background: #ef4444; color: #fff; width: 100%; margin-top: 8px; }
.btn-success   { background: #10b981; color: #fff; width: 100%; margin-top: 8px; }

.token-label { font-size: 11px; color: #64748b; margin-top: 10px; }
.token-box {
  background: #1e293b;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 11px;
  font-family: monospace;
  color: #a5f3fc;
  word-break: break-all;
  min-height: 34px;
  margin-top: 6px;
  position: relative;
}
.token-box .copy-btn {
  position: absolute;
  top: 4px; right: 4px;
  background: #1e293b; color: #94a3b8;
  border: none; border-radius: 4px;
  padding: 2px 6px; font-size: 10px;
  cursor: pointer; width: auto; margin: 0;
}

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.dot-idle       { background: #cbd5e1; }
.dot-connecting { background: #f59e0b; animation: pulse 1s infinite; }
.dot-connected  { background: #10b981; }
.dot-error      { background: #ef4444; }

@keyframes pulse    { 0%,100%{opacity:1} 50%{opacity:0.4} }
@keyframes shimmer  { 0%{background-position:0% center} 100%{background-position:200% center} }
@keyframes cardPop  { 0%{transform:scale(0.85);opacity:0} 100%{transform:scale(1);opacity:1} }

/* ── MAIN PANEL ── */
.main { display: flex; flex-direction: column; overflow: hidden; }

.tabs { display: flex; background: #ffffff; border-bottom: 1px solid #e2e8f0; }
.tab {
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
  white-space: nowrap;
}
.tab.active { color: #2563eb; border-bottom-color: #2563eb; }
.tab:hover  { color: #3b82f6; }

.tab-content        { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.tab-content.active { display: flex; }

.split-view {
  display: grid;
  grid-template-rows: 1fr 1fr;
  flex: 1;
  overflow: hidden;
}
.pane {
  display: flex; flex-direction: column;
  overflow: hidden;
  border-bottom: 1px solid #e2e8f0;
}
.pane-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px;
  background: #f8fafc;
  font-size: 11px; color: #64748b; letter-spacing: 0.5px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.pane-header span { color: #475569; font-weight: 600; }
.curl-copy-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  color: #64748b;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  cursor: pointer;
  width: auto;
  transition: border-color 0.15s, color 0.15s;
}
.curl-copy-btn:hover { border-color: #2563eb; color: #2563eb; opacity: 1; }
pre {
  flex: 1; overflow: auto;
  padding: 14px; font-size: 12px; line-height: 1.6;
  color: #e2e8f0; margin: 0; background: #1e293b;
}

/* ── STREAM PANEL ── */
.stream-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.stream-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0; flex-wrap: wrap;
}
.stream-toolbar input[type=text] {
  flex: 1; min-width: 120px;
}
.stream-count { font-size: 11px; color: #64748b; margin-left: auto; }

#sse-log {
  flex: 1; overflow-y: auto;
  padding: 10px 14px;
  font-size: 12px; font-family: monospace;
  background: #1e293b;
}

.empty-state { color: #94a3b8; font-size: 13px; padding: 40px; text-align: center; }

.badge { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 4px; font-weight: 700; margin-right: 6px; }
.badge-post { background: #7c3aed; color: #fff; }
.badge-get  { background: #0891b2; color: #fff; }
.badge-del  { background: #dc2626; color: #fff; }

/* ── Pane layout utilities ── */
.pane--fixed    { flex: 0 0 auto; }
.pane-header-actions { display: flex; align-items: center; gap: 10px; }
pre.pre-sm       { max-height: 50px;  flex: none; }
pre.pre-md       { max-height: 80px;  flex: none; }
pre.pre-lg       { max-height: 100px; flex: none; }
pre.pre-response { min-height: 120px; max-height: none; flex: none; overflow: auto; }
.body-fill  { flex: 0 0 auto; height: 180px; overflow: auto; padding: 10px 12px; background: #1e293b; border-bottom: 2px solid #334155; }
.tab-content--scroll { overflow-y: auto !important; }

/* ── Permissions section ── */
.perm-group-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #94a3b8;
  font-weight: 700;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  display: block;
}
.role-select {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #0f172a;
  padding: 7px 10px;
  font-size: 12px;
  font-family: monospace;
  cursor: pointer;
  margin-top: 4px;
}
.role-select:focus { outline: none; border-color: #2563eb; }

/* Role chips */
.role-chip           { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; font-family: monospace; }
.role-owner          { background: #450a0a; color: #fca5a5; }
.role-buyer          { background: #1e3a5f; color: #93c5fd; }
.role-monitor        { background: #164e63; color: #67e8f9; }
.role-integration    { background: #3b0764; color: #e9d5ff; }
.role-lead_creator   { background: #451a03; color: #fcd34d; }
.role-storekeeper    { background: #14532d; color: #86efac; }
.role-sales          { background: #1e1b4b; color: #a5b4fc; }

/* Member cards */
.member-card {
  border-radius: 6px;
  padding: 9px 12px;
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.member-card-info { min-width: 0; flex: 1; }
.member-card-row  { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.member-card-email { font-size: 11px; color: #60a5fa; font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-card-meta  { font-size: 10px; color: #64748b; font-family: monospace; }

/* ── Resize handle ── */
.resize-handle {
  flex-shrink: 0;
  height: 5px;
  background: #e2e8f0;
  cursor: row-resize;
  position: relative;
  z-index: 10;
  transition: background 0.12s;
}
.resize-handle::before {
  content: '';
  position: absolute;
  inset: -6px 0; /* larger click area */
}
.resize-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 2px;
  background: #94a3b8;
  border-radius: 2px;
  box-shadow: 0 -3px 0 #94a3b8, 0 3px 0 #94a3b8;
  pointer-events: none;
}
.resize-handle:hover,
.resize-handle.is-dragging { background: #bfdbfe; }
.resize-handle--single {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  flex-shrink: 0;
}
.is-resizing,
.is-resizing * { cursor: row-resize !important; user-select: none !important; }

::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ── Header nav links ── */
.header-nav-link {
  font-size: 12px;
  color: #64748b;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
}
.header-title {
  margin: 0 auto 0 16px;
}
.header-subtitle {
  font-size: 11px;
  color: #94a3b8;
}
.header-docs-link {
  font-size: 12px;
  color: #64748b;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 4px 10px;
  margin-left: 16px;
}
.header-docs-link:hover { border-color: #cbd5e1; color: #475569; }
.header-api-link {
  font-size: 12px;
  color: #2563eb;
  text-decoration: none;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 4px 10px;
}
.header-api-link:hover { background: #eff6ff; }

/* ── Auth spinner ── */
.login-spinner {
  display: none;
  font-size: 11px;
  color: #64748b;
  margin-top: 8px;
  text-align: center;
}

/* ── SSE token badge ── */
.sse-tok-badge {
  color: #64748b;
  font-size: 10px;
}

/* ── User card ── */
.user-card {
  display: none;
  margin-top: 14px;
  text-align: center;
}
.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 8px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 2px;
}
.user-email-disp {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 10px;
}
.user-profile-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  position: relative;
}
.user-id-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #2563eb;
  margin-bottom: 4px;
}
.user-id-display {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #1e40af;
  font-family: monospace;
  word-break: break-all;
}
.btn-copy-userid {
  margin-top: 6px;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 10px;
  cursor: pointer;
  width: auto;
}

/* ── Tags section ── */
.tags-uid-display {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 8px;
  font-family: monospace;
}

/* ── SSE curl bar ── */
.sse-curl-bar {
  display: none;
  flex-direction: column;
  background: #1e293b;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}
.sse-curl-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px 4px;
  border-bottom: 1px solid #1e293b;
}
.curl-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
}
.sse-curl-pre {
  padding: 10px 14px;
  font-size: 12px;
  color: #a5f3fc;
  background: transparent;
  line-height: 1.6;
  max-height: 72px;
  overflow: auto;
  margin: 0;
}
