:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e334d;
  --accent: #6366f1;
  --accent-hover: #4f52d8;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #38bdf8;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* LOGIN */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem 2rem; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-logo { font-size: 1.6rem; font-weight: 700; color: var(--accent); text-align: center; margin-bottom: .25rem; }
.login-sub { text-align: center; color: var(--text-muted); font-size: .85rem; margin-bottom: 1.75rem; }

/* HEADER */
.header { display: flex; align-items: center; justify-content: space-between; padding: .9rem 2rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-brand { font-weight: 700; font-size: 1.1rem; color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.base-url-badge { font-size: .75rem; background: var(--surface2); border: 1px solid var(--border); padding: .25rem .6rem; border-radius: 20px; color: var(--text-muted); }

/* MAIN */
.main { max-width: 980px; margin: 2rem auto; padding: 0 1rem; display: flex; flex-direction: column; gap: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }

/* SYNTAX TIP */
.syntax-tip {
  background: rgba(99,102,241,.07);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 8px;
  padding: .65rem 1rem;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
}
.syntax-tip strong { color: var(--text); margin-right: .25rem; }
.tag-required { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.25); padding: .1rem .4rem; border-radius: 4px; font-family: monospace; font-size: .8rem; }
.tag-optional { background: rgba(34,197,94,.1); color: #4ade80; border: 1px solid rgba(34,197,94,.25); padding: .1rem .4rem; border-radius: 4px; font-family: monospace; font-size: .8rem; }
.tag-block { background: rgba(56,189,248,.1); color: #38bdf8; border: 1px solid rgba(56,189,248,.25); padding: .1rem .4rem; border-radius: 4px; font-family: monospace; font-size: .8rem; }

/* FORM */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 180px; }
.flex-2 { flex: 2; min-width: 220px; }
input[type=text], input[type=password], textarea { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: .6rem .8rem; font-size: .9rem; transition: border-color .2s; resize: vertical; font-family: inherit; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { font-family: 'Courier New', monospace; font-size: .85rem; }
.input-with-btn { display: flex; gap: .5rem; }
.input-with-btn input { flex: 1; }
.form-actions { align-items: center; justify-content: space-between; }
.form-card h2 { margin-bottom: .75rem; font-size: 1rem; }

/* PARAMS PREVIEW */
.params-preview { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: .85rem 1rem; margin-top: .5rem; font-size: .82rem; }
.params-preview .preview-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; margin-bottom: .5rem; }
.params-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.params-row:last-child { margin-bottom: 0; }
.param-tag { display: inline-flex; align-items: center; gap: .3rem; border-radius: 20px; padding: .18rem .6rem; font-family: monospace; font-size: .78rem; font-weight: 600; }
.param-tag.required { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.25); }
.param-tag.optional { background: rgba(34,197,94,.1); color: #4ade80; border: 1px solid rgba(34,197,94,.25); }
.param-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.param-dot.r { background: #f87171; }
.param-dot.o { background: #4ade80; }
.preview-url { font-family: monospace; font-size: .78rem; color: var(--text-muted); margin-top: .55rem; word-break: break-all; }
.preview-url span { color: var(--accent); }

/* SLUG PREVIEW */
.slug-preview { font-size: .82rem; color: var(--text-muted); background: var(--surface); border: 1px dashed var(--border); border-radius: 6px; padding: .5rem .9rem; }
.slug-preview strong { color: var(--success); word-break: break-all; }

/* BUTTONS */
.btn { cursor: pointer; border: none; border-radius: 6px; padding: .55rem 1.1rem; font-size: .875rem; font-weight: 600; transition: background .2s, opacity .2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--surface2); }
.btn-outline-sm { background: transparent; color: var(--text-muted); border: 1px solid var(--border); padding: .35rem .8rem; font-size: .8rem; border-radius: 6px; cursor: pointer; }
.btn-outline-sm:hover { background: var(--surface2); }
.btn-sm { padding: .4rem .75rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .85; }

/* TOGGLE */
.toggle-group { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 22px; transition: .3s; }
.slider:before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
input:checked + .slider { background: var(--accent); }
input:checked + .slider:before { transform: translateX(18px); }

/* LIST */
.list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem; }
.list-header h2 { font-size: 1rem; }
.search-input { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: .45rem .75rem; font-size: .85rem; width: 200px; }
.search-input:focus { outline: none; border-color: var(--accent); }
.empty-state { color: var(--text-muted); text-align: center; padding: 2rem 0; }
.endpoint-item { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; transition: border-color .2s; margin-bottom: .75rem; }
.endpoint-item:last-child { margin-bottom: 0; }
.endpoint-item:hover { border-color: var(--accent); }
.endpoint-item.inactive { opacity: .55; }
.ep-left { display: flex; flex-direction: column; gap: .25rem; flex: 1; min-width: 0; }
.ep-label { font-weight: 600; font-size: .95rem; }
.ep-slug { font-size: .78rem; color: var(--accent); word-break: break-all; }
.ep-params { font-size: .75rem; margin-top: .1rem; display: flex; flex-wrap: wrap; gap: .25rem; }
.ep-badges { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .3rem; }
.badge { font-size: .7rem; padding: .2rem .55rem; border-radius: 20px; font-weight: 600; }
.badge-active { background: rgba(34,197,94,.15); color: #22c55e; border: 1px solid rgba(34,197,94,.3); }
.badge-inactive { background: rgba(239,68,68,.12); color: #ef4444; border: 1px solid rgba(239,68,68,.25); }
.badge-protected { background: rgba(245,158,11,.12); color: #f59e0b; border: 1px solid rgba(245,158,11,.25); }
.badge-public { background: rgba(99,102,241,.12); color: #6366f1; border: 1px solid rgba(99,102,241,.25); }
.ep-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 90%; max-width: 620px; z-index: 51; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal-content { position: relative; }
.modal-close { position: absolute; top: -1rem; right: -1rem; background: transparent; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal h3 { margin-bottom: 1rem; }
.modal-row { display: flex; flex-direction: column; gap: .2rem; margin-bottom: .9rem; }
.modal-row label { font-size: .72rem; text-transform: uppercase; color: var(--text-muted); font-weight: 700; letter-spacing: .05em; }
.modal-row code { background: var(--surface2); padding: .5rem .75rem; border-radius: 6px; font-size: .82rem; word-break: break-all; display: block; white-space: pre-wrap; font-family: 'Courier New', monospace; }
.modal-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.modal-section h4 { font-size: .82rem; margin-bottom: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.modal-param-row { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .6rem; padding: .55rem .75rem; background: var(--surface2); border-radius: 6px; }
.modal-param-name { font-family: monospace; font-size: .82rem; font-weight: 700; min-width: 130px; }
.modal-param-name.required { color: #f87171; }
.modal-param-name.optional { color: #4ade80; }
.modal-param-badge { font-size: .65rem; padding: .15rem .45rem; border-radius: 20px; font-weight: 700; white-space: nowrap; }
.modal-param-badge.r { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.modal-param-badge.o { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.28); }
.modal-param-desc { font-size: .78rem; color: var(--text-muted); }

/* ALERT */
.alert-error { background: rgba(239,68,68,.12); color: #ef4444; border: 1px solid rgba(239,68,68,.3); border-radius: 6px; padding: .5rem .75rem; font-size: .85rem; }
.hidden { display: none !important; }

@media (max-width: 600px) {
  .form-row { flex-direction: column; }
  .main { padding: 0 .5rem; }
  .modal { width: 95%; padding: 1.25rem; }
  .ep-actions { width: 100%; justify-content: flex-end; }
  .syntax-tip { font-size: .75rem; }
}
