/* ───────────────────────────────────────────────────────────────────────────
   EOSC Slovak Node — Service Catalogue – Stylesheet
   Design system mirrors the portal/ prototype: modern, minimal, EOSC blue
   ─────────────────────────────────────────────────────────────────────────── */

:root {
  --primary:        #1a56db;
  --primary-dark:   #1044b3;
  --primary-light:  #ebf2ff;
  --primary-muted:  #bfdbfe;
  --success:        #057a55;
  --success-bg:     #def7ec;
  --danger:         #c81e1e;
  --danger-bg:      #fde8e8;
  --warning:        #92400e;
  --warning-bg:     #fef3c7;
  --neutral:        #374151;
  --neutral-bg:     #f3f4f6;

  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --border-focus:   #93c5fd;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --text-light:     #94a3b8;

  --topbar-h:       60px;
  --radius:         8px;
  --radius-lg:      12px;
  --radius-xl:      16px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.06);
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --shadow-xl:      0 20px 25px -5px rgba(0,0,0,.10), 0 10px 10px -5px rgba(0,0,0,.04);
  --transition:     0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 0.9rem; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; height: 100%;
  padding: 0 24px;
  display: flex; align-items: center; gap: 32px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.05rem; color: var(--text);
  text-decoration: none; letter-spacing: -0.01em; flex-shrink: 0;
}
.brand-icon { width: 28px; height: 28px; color: var(--primary); }
.topbar-nav { display: flex; gap: 2px; flex: 1; }
.nav-btn {
  padding: 6px 16px; border: none; background: none; border-radius: 6px;
  font-size: 0.9rem; font-weight: 500; color: var(--text-muted);
  transition: all var(--transition);
}
.nav-btn:hover { background: var(--neutral-bg); color: var(--text); }
.nav-btn.active { background: var(--primary-light); color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.auth-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 600;
  color: var(--success); background: var(--success-bg);
  padding: 4px 10px; border-radius: 20px;
}
.auth-indicator svg { width: 14px; height: 14px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border: 1.5px solid transparent; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600; line-height: 1;
  transition: all var(--transition); white-space: nowrap; letter-spacing: 0.01em;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--neutral-bg); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: #fca5a5; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── View container ──────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }
.view-inner { max-width: 1280px; margin: 0 auto; padding: 32px 24px 64px; }

/* ── Search section ──────────────────────────────────────────────────────── */
.search-bar-section { margin-bottom: 28px; }
.search-box { position: relative; max-width: 560px; margin-bottom: 12px; }
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-light); pointer-events: none;
}
#search-input {
  width: 100%; padding: 11px 14px 11px 44px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: 0.95rem; color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
#search-input:focus {
  outline: none; border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-input {
  padding: 7px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 0.85rem; width: 160px;
  transition: border-color var(--transition);
}
.filter-input:focus { outline: none; border-color: var(--border-focus); }
.result-count { font-size: 0.82rem; color: var(--text-muted); margin-left: auto; }

/* ── Service cards grid ──────────────────────────────────────────────────── */
.service-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.service-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  display: flex; flex-direction: column; gap: 12px;
}
.service-card:hover {
  box-shadow: var(--shadow-md); border-color: var(--primary-muted);
  transform: translateY(-1px);
}
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-logo {
  width: 44px; height: 44px; border-radius: 8px; object-fit: contain;
  flex-shrink: 0; background: var(--neutral-bg); padding: 4px;
}
.card-logo-placeholder {
  width: 44px; height: 44px; border-radius: 8px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.card-title { flex: 1; min-width: 0; }
.card-name {
  font-size: 0.95rem; font-weight: 600; color: var(--text); line-height: 1.3;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card-provider {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-tagline {
  font-size: 0.84rem; color: var(--text-muted); line-height: 1.5;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  flex: 1;
}
/* Card chip zones — each chip type sits in a dedicated, predictable spot */
.card-classification {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.card-meta-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; flex-wrap: wrap;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.card-meta-left,
.card-meta-right { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-tags {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  margin-top: 2px;
  line-height: 1;
}

/* Compact chip variant used inside meta-row */
.chip-sm {
  padding: 1px 7px;
  font-size: 0.68rem;
  font-weight: 600;
}
/* TRL number pill — monospace-feel, sits next to the maturity word */
.chip-trl {
  background: var(--neutral-bg);
  color: var(--neutral);
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  letter-spacing: 0.02em;
}
/* Tag chip — text-like, subdued, with leading # */
.chip-tag {
  display: inline-flex; align-items: center;
  background: transparent;
  color: var(--text-light);
  padding: 0;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip-tag::before {
  content: '#';
  opacity: 0.55;
  margin-right: 1px;
}

/* ── Chips / badges ──────────────────────────────────────────────────────── */
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap; letter-spacing: 0.01em;
}
.chip-domain   { background: #ede9fe; color: #5b21b6; }
.chip-category { background: #e0f2fe; color: #0369a1; }
.chip-open     { background: var(--success-bg); color: var(--success); }
.chip-order    { background: var(--warning-bg); color: var(--warning); }
.chip-neutral  { background: var(--neutral-bg); color: var(--neutral); }
.chip-primary  { background: var(--primary-light); color: var(--primary); }
.chip-eosc     { background: #ecfeff; color: #0e7490; }
.chip-maturity { background: #eef2ff; color: #4338ca; }

/* ── Status & loading ────────────────────────────────────────────────────── */
.loading-state {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 60px 20px; color: var(--text-muted); font-size: 0.9rem;
}
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .75s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted); font-size: 0.9rem;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
  display: flex; justify-content: center; align-items: center; gap: 6px;
  padding: 32px 0 0; flex-wrap: wrap;
}
.page-btn {
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.85rem; font-weight: 500; color: var(--text-muted);
  transition: all var(--transition);
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Detail panel (slide-in) ─────────────────────────────────────────────── */
.detail-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.35); backdrop-filter: blur(2px);
  z-index: 80; opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.detail-overlay.open { opacity: 1; pointer-events: auto; }
.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100vw;
  background: var(--surface); box-shadow: var(--shadow-xl);
  z-index: 90; overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.detail-panel.open { transform: translateX(0); }
.detail-close {
  position: sticky; top: 16px; float: right; margin: 16px 16px 0 0;
  width: 32px; height: 32px;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); z-index: 1; flex-shrink: 0;
}
.detail-close svg { width: 16px; height: 16px; }
.detail-close:hover { background: var(--neutral-bg); color: var(--text); }
#detail-content { padding: 24px 28px 40px; }
.detail-header { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.detail-logo {
  width: 64px; height: 64px; border-radius: 10px; object-fit: contain;
  background: var(--neutral-bg); padding: 6px; flex-shrink: 0;
}
.detail-logo-placeholder {
  width: 64px; height: 64px; border-radius: 10px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.4rem; flex-shrink: 0;
}
.detail-header-info { flex: 1; min-width: 0; }
.detail-name {
  font-size: 1.2rem; font-weight: 700; color: var(--text);
  line-height: 1.3; margin-bottom: 4px;
}
.detail-abbr {
  font-size: 0.78rem; font-weight: 600;
  color: var(--primary); background: var(--primary-light);
  padding: 1px 7px; border-radius: 4px; display: inline-block; margin-bottom: 6px;
}
.detail-provider { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-section { border-top: 1px solid var(--border); padding: 18px 0; }
.detail-section-title {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-light); margin-bottom: 10px;
}
.detail-tagline {
  font-size: 0.95rem; font-style: italic; color: var(--text-muted);
  margin-bottom: 10px; line-height: 1.5;
}
.detail-description { font-size: 0.9rem; color: var(--text); line-height: 1.7; }
.detail-description img, .detail-description iframe { max-width: 100%; }
.detail-dl {
  display: grid; grid-template-columns: auto 1fr;
  gap: 6px 16px; font-size: 0.85rem;
}
.detail-dt { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.detail-dd { color: var(--text); }
.detail-links { display: flex; flex-direction: column; gap: 6px; }
.detail-link {
  font-size: 0.85rem; display: flex; align-items: center; gap: 6px; color: var(--primary);
}
.detail-link svg { width: 13px; height: 13px; flex-shrink: 0; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Login section ───────────────────────────────────────────────────────── */
.login-section {
  display: flex; justify-content: center; align-items: center;
  min-height: calc(100vh - var(--topbar-h) - 64px);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 40px 48px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-md); text-align: center;
}
.login-card-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
}
.login-card-icon svg { width: 28px; height: 28px; }
.login-card h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.login-card p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 28px; }
.login-error { color: var(--danger); font-size: 0.85rem; margin-top: 10px; text-align: center; }

/* ── Registry section ────────────────────────────────────────────────────── */
.registry-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.registry-header h2 { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.registry-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }

/* ── Data table ──────────────────────────────────────────────────────────── */
.table-wrapper {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; min-width: 700px; }
.data-table thead tr { background: var(--bg); border-bottom: 1px solid var(--border); }
.data-table th {
  padding: 12px 16px; text-align: left;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); white-space: nowrap;
}
.th-actions { text-align: right; }
.data-table td {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }
.td-name { font-weight: 600; max-width: 260px; }
.td-truncate {
  max-width: 180px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--text-muted);
}
.td-date { color: var(--text-muted); white-space: nowrap; font-size: 0.8rem; }
.td-actions { text-align: right; white-space: nowrap; }
.td-actions .btn { padding: 5px 10px; font-size: 0.78rem; }

/* ── Form elements ───────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.req { color: var(--danger); }
.field-hint { font-size: 0.75rem; color: var(--text-muted); }
.field input, .field select, .field textarea {
  padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,.10);
}
.field input:read-only { background: var(--neutral-bg); color: var(--text-muted); cursor: default; }
.field textarea { resize: vertical; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-full  { grid-column: 1 / -1; }
.field-half  { grid-column: span 1; }

.field-checkbox {
  flex-direction: row; align-items: center; gap: 8px;
}
.field-checkbox input { width: auto; }
.field-checkbox label { font-weight: 500; }

/* ── Form sections ───────────────────────────────────────────────────────── */
.form-section { border: none; padding: 0; margin-bottom: 24px; }
.form-section legend {
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); margin-bottom: 14px;
  padding: 0; border-bottom: 1px solid var(--border);
  width: 100%; padding-bottom: 8px;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5); backdrop-filter: blur(3px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--surface); border-radius: var(--radius-xl);
  width: 700px; max-width: 100%; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl); overflow: hidden;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.modal-close {
  width: 30px; height: 30px;
  border: 1px solid var(--border); border-radius: 50%;
  background: none; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--neutral-bg); color: var(--text); }
.modal-close svg { width: 15px; height: 15px; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0;
}

/* ── Toast notification ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 200;
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px); opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease; max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast.toast-success { background: var(--success); color: #fff; }
.toast.toast-error   { background: var(--danger); color: #fff; }
.toast.toast-info    { background: var(--primary); color: #fff; }

/* ── Confirm dialog ──────────────────────────────────────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45); backdrop-filter: blur(2px);
  z-index: 110;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.confirm-box {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 28px; width: 380px; max-width: 100%;
  box-shadow: var(--shadow-xl); text-align: center;
}
.confirm-box h4 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.confirm-box p  { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 22px; }
.confirm-btns   { display: flex; justify-content: center; gap: 10px; }

/* ── JSON API view (3-card panel grid) ───────────────────────────────────── */
.api-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem; max-width: 680px; margin: 3rem auto 0;
}
.api-panel {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-md);
  padding: 2rem 1.5rem 1.75rem; gap: 0.75rem;
}
.api-panel-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.25rem; flex-shrink: 0;
}
.api-panel-icon svg { width: 26px; height: 26px; stroke: var(--primary); }
.api-label { font-size: 1rem; font-weight: 600; color: var(--text); }
.api-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.55; flex: 1; }
.api-url {
  display: block; width: 100%;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, 'Courier New', monospace;
  font-size: 0.72rem; color: var(--text-muted);
  background: var(--neutral-bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.35rem 0.6rem; word-break: break-all; text-align: left;
}
.api-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 0.5rem; width: 100%; justify-content: center;
}
.api-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* The JSON API tab has 2 panels: List, Get by PID */
.api-grid { grid-template-columns: repeat(2, 1fr); max-width: 680px; }

/* ── MultiSelect / Combobox ───────────────────────────────────────────────── */
.ms { position: relative; }
.ms-control {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 6px 8px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); min-height: 38px;
  cursor: text;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.ms-control.focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,.10);
}
.ms-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-light); color: var(--primary);
  padding: 2px 4px 2px 9px;
  border-radius: 20px; font-size: 0.78rem; font-weight: 600;
  max-width: 100%;
}
.ms-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%; border: none;
  background: rgba(26,86,219,0.15); color: var(--primary);
  font-size: 12px; line-height: 1; cursor: pointer;
}
.ms-chip-x:hover { background: var(--primary); color: #fff; }
.ms-search {
  flex: 1; min-width: 90px;
  border: none; outline: none; background: transparent;
  font-size: 0.875rem; color: var(--text);
  padding: 4px 2px;
}
.ms-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 70;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  max-height: 280px; overflow-y: auto;
}
.ms-option {
  padding: 8px 12px; font-size: 0.85rem;
  cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.ms-option:hover, .ms-option.active { background: var(--primary-light); }
.ms-option-meta { font-size: 0.72rem; color: var(--text-muted); }
.ms-empty { padding: 12px; color: var(--text-muted); font-size: 0.85rem; text-align: center; }

/* ── Login modal role tabs ───────────────────────────────────────────────── */
.role-tabs {
  display: flex; gap: 4px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.role-tab {
  flex: 1; padding: 10px 16px;
  border: none; background: none;
  font-size: 0.9rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.role-tab:hover { color: var(--text); }
.role-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Superadmin tab ──────────────────────────────────────────────────────── */
.super-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.super-header h2 { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.super-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.super-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.super-controls select {
  padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 0.875rem; min-width: 220px;
}
.td-term-id {
  font-family: monospace; font-size: 0.78rem;
  color: var(--text-muted); max-width: 280px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .api-grid { grid-template-columns: 1fr; max-width: 420px; }
}
@media (max-width: 900px) {
  .service-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 640px) {
  .topbar-inner { padding: 0 16px; gap: 16px; }
  .brand span   { display: none; }
  .view-inner   { padding: 20px 16px 48px; }
  .service-grid { grid-template-columns: 1fr; }
  .field-grid   { grid-template-columns: 1fr; }
  .field-half   { grid-column: 1; }
  .detail-panel { width: 100vw; }
  .login-card   { padding: 28px 24px; }
  .registry-header { flex-direction: column; align-items: flex-start; }
}
