/* ── Reset ─────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design tokens ──────────────────────────────────────────── */

:root {
  color-scheme: light;
  --accent: #ff3e00;
  --accent-dim: rgba(255, 62, 0, 0.12);
  --accent-hover: #ff5a26;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #f0f0f0;
  --border: #e0e0e0;
  --border-focus: #ff3e00;
  --text: #0c0c0c;
  --muted: #6b7280;
  --success: #22c55e;
  --danger: #ef4444;
  --method-get: #2563eb;
  --method-post: #16a34a;
  --method-delete: #dc2626;
  --method-put: #ea580c;
  --method-patch: #9333ea;
  --sidebar-width: 280px;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
  --transition: 0.18s ease;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
}

/* Light only: the app is designed for the light theme. */

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Admin layout shell ─────────────────────────────────────── */

#app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */

#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* ── Form controls — APPLIES TO BOTH ADMIN & USER VIEW ─────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* Shared baseline for every interactive control inside .field */
.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="url"],
.field input[type="search"],
.field select,
.field textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 9px 11px;
  width: 100%;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.65;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--surface);
}

.field input:hover:not(:focus),
.field select:hover:not(:focus),
.field textarea:hover:not(:focus) {
  border-color: #bbb;
}

/* Textarea extras */
.field textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.55;
}

.field .hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.field .hint a {
  color: var(--accent);
  text-decoration: none;
}
.field .hint a:hover {
  text-decoration: underline;
}

/* ── Main content ───────────────────────────────────────────── */

#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 32px 36px;
  gap: 28px;
  overflow-y: auto;
}

/* ── Spec overview card ─────────────────────────────────────── */

.base-url {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
}

/* Tag group */

.tag-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--border);
  padding: 1px 7px;
  border-radius: 20px;
}

/* Endpoint row */

.method-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

/* MCP-transport tools (no HTTP verb — the tool name is the operation). */
.method-MCP { background: rgba(59, 61, 157, 0.12); color: #3b3d9d; }

.method-GET {
  color: var(--method-get);
}
.method-POST {
  color: var(--method-post);
}
.method-DELETE {
  color: var(--method-delete);
}
.method-PUT {
  color: var(--method-put);
}
.method-PATCH {
  color: var(--method-patch);
}

.ep-path {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.ep-summary {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Orange fetch button */
.btn-fetch {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.02em;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(255, 62, 0, 0.35);
  transition:
    background var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.btn-fetch:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 10px rgba(255, 62, 0, 0.35);
  transform: translateY(-1px);
}

.btn-fetch:active:not(:disabled) {
  transform: translateY(0);
}

.btn-fetch:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Ghost / secondary button */
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition:
    border-color var(--transition),
    background var(--transition),
    color var(--transition);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Toast ──────────────────────────────────────────────────── */

#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  font-size: 13px;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  pointer-events: none;
  z-index: 1000;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}
#toast.success {
  border-left: 4px solid var(--success);
}
#toast.error {
  border-left: 4px solid var(--danger);
}

/* ── Loading spinner ────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Scrollbar ──────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ── Utility ────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 820px) {
  #sidebar {
    display: none;
  }
  #main {
    padding: 20px 16px;
  }

  

  

  

  
  
  
  
  

  

  
}

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE  —  /login.html
   ══════════════════════════════════════════════════════════════ */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* ── Brand ─────────────────────────────────────────────────── */

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

/* Icon badge — orange accent circle */
.login-brand-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(255, 62, 0, 0.35);
}

.login-brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
}

.login-brand-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

/* ── Card ──────────────────────────────────────────────────── */

.login-card {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.08);
  padding: 36px 32px 32px;
}

.login-card-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.login-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

.login-highlight {
  color: var(--text);
  font-weight: 600;
}

/* Extends .btn-fetch — only overrides width / margin / display */
.login-btn {
  display: block;
  width: 100%;
  margin-top: 18px;
  text-align: center;
}

/* ── Error strip ───────────────────────────────────────────── */

.login-error {
  margin-top: 12px;
  padding: 10px 13px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: var(--radius);
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.55;
}

/* ── State icons (step-sent / step-completing) ─────────────── */

.login-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.login-state-icon--sent {
  background: rgba(34, 197, 94, 0.12);
  border: 1.5px solid rgba(34, 197, 94, 0.35);
  color: #15803d;
}

/* ── Spinner (completing step) ─────────────────────────────── */

.login-spinner-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.login-spinner-svg {
  width: 48px;
  height: 48px;
  color: var(--accent);
  animation: login-spin 0.9s linear infinite;
}

@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Footer note ───────────────────────────────────────────── */

.login-footer-note {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* ── Modal overlay ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 640px;
  max-width: 100%;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Modal header */
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.modal-head-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.modal-head-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.modal-close-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Endpoint list in modal */
.modal-ep-list {
  overflow-y: auto;
  max-height: 260px;
  flex-shrink: 0;
}
.modal-ep-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  border-left: 3px solid transparent;
}
.modal-ep-row:last-child {
  border-bottom: none;
}
.modal-ep-row:hover {
  background: var(--surface-2);
}
.modal-ep-row.selected {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.modal-ep-cb {
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Manage Endpoints modal — extra breathing room ───────────────────────── */
.modal-ep-list {
  padding: 4px 0;
}
.modal-ep-row {
  padding: 10px 18px;
}

/* ── Labelled action buttons (header) ─────────────────────────── */

.um-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition),
    color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.um-action-btn svg { flex-shrink: 0; }

.um-action-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(255,62,0,.3);
}
.um-action-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 3px 10px rgba(255,62,0,.35);
  transform: translateY(-1px);
}
.um-action-btn--primary:active { transform: translateY(0); }

/* A short list of facts inside a dialog — the operations an app asks for
   (apps.html), and the setup steps and warnings for a source (sources.html).
   Shared because both are the same shape: a tight list somebody reads before
   agreeing to something. */
.grant-list { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 6px; }
.grant-list li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
ol.grant-list { list-style: decimal; padding-left: 20px; }
ol.grant-list li { display: list-item; }
.grant-op { font-family: "JetBrains Mono", monospace; font-size: 12.5px; }
