/* ==========================================================================
   urlLink - Design System & Modern UI (Cloudflare Edge Suite)
   ========================================================================== */

:root {
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace, Consolas, Courier New;

  /* Theme: Dark (Default) */
  --bg-app: #0d1117;
  --bg-surface: #161b22;
  --bg-surface-elevated: #21262d;
  --bg-surface-hover: #2b313a;
  --bg-input: #0d1117;
  
  --border-subtle: #30363d;
  --border-focus: #58a6ff;
  --border-strong: #484f58;

  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --text-inverse: #0d1117;

  /* Primary Accent: Cloudflare Orange / Electric Indigo */
  --primary: #f6821f;
  --primary-hover: #fa953c;
  --primary-glow: rgba(246, 130, 31, 0.25);
  
  --accent-blue: #388bfd;
  --accent-blue-hover: #58a6ff;

  /* HTTP Verb Colors */
  --http-get: #2ea043;
  --http-get-bg: rgba(46, 160, 67, 0.15);
  --http-post: #388bfd;
  --http-post-bg: rgba(56, 139, 253, 0.15);
  --http-put: #d29922;
  --http-put-bg: rgba(210, 153, 34, 0.15);
  --http-delete: #f85149;
  --http-delete-bg: rgba(248, 81, 73, 0.15);
  --http-patch: #a371f7;
  --http-patch-bg: rgba(163, 113, 247, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--primary-glow);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Light Theme Variables */
body.light-theme {
  --bg-app: #f6f8fa;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f0f3f6;
  --bg-surface-hover: #e8ecf0;
  --bg-input: #ffffff;
  
  --border-subtle: #d0d7de;
  --border-focus: #0969da;
  --border-strong: #afb8c1;

  --text-primary: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #8c959f;
  --text-inverse: #ffffff;

  --primary: #e66a00;
  --primary-hover: #f6821f;
  --primary-glow: rgba(230, 106, 0, 0.2);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

.code-font {
  font-family: var(--font-mono);
}

/* App Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top App Header */
.app-header {
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

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

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #e65100);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow-glow);
}

.brand-icon.small {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1.1;
  margin: 0;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  background: var(--bg-surface-elevated);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 3px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.tab-pill {
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 12px;
}

.nav-tab.active .tab-pill {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.tab-pill-highlight {
  background: var(--primary-glow);
  color: var(--primary);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-status-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(246, 130, 31, 0.12);
  border: 1px solid rgba(246, 130, 31, 0.3);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 14px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--primary);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.user-profile-menu {
  position: relative;
}

.user-badge-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-badge-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 210px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 5px;
  z-index: 200;
}

.dropdown-header {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.dropdown-email {
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--bg-surface-hover);
}

.dropdown-item.danger:hover {
  background: rgba(248, 81, 73, 0.15);
  color: var(--http-delete);
}

.theme-toggle-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
}

/* Main Content Area */
.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 20px;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* View Header */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.view-title-area h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.view-title-area p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.badge-accent {
  display: inline-block;
  background: var(--primary-glow);
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.active-project-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-blue);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  font-family: var(--font-main);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11.5px;
  border-radius: var(--radius-sm);
}

.btn-icon-only {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
}

.btn-icon-only:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--accent-blue);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-text:hover {
  text-decoration: underline;
}

/* Filter Toolbar */
.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 4px 10px;
  flex: 1;
  min-width: 220px;
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
  width: 100%;
}

.search-icon {
  font-size: 13px;
  opacity: 0.6;
}

.filter-group {
  display: flex;
  gap: 8px;
}

.toolbar-stats {
  display: flex;
  gap: 8px;
}

.stat-tag {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.stat-tag strong {
  color: var(--text-primary);
}

/* Custom Select & Inputs */
.custom-select, .custom-input {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 5px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
  font-family: var(--font-main);
}

.custom-select:focus, .custom-input:focus {
  border-color: var(--border-focus);
}

.custom-select.compact {
  padding: 4px 8px;
  font-size: 11.5px;
}

.custom-select.highlight-select {
  background: var(--bg-input);
  border-color: var(--primary);
  font-weight: 700;
  color: var(--text-primary);
}

/* Master Catalog Toolbar */
.master-catalog-toolbar {
  margin-bottom: 14px;
}

.catalog-selector-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
}

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

.selector-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.catalog-metrics-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
}

.metric-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.metric-lbl {
  font-size: 10.5px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--project-color, var(--primary));
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 6px;
}

.project-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.project-color-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--project-color, var(--primary));
  flex-shrink: 0;
}

.project-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.project-card-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.project-card-actions .btn-icon-only {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.project-card-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-links-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  flex: 1;
}

.link-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 3px 6px;
  gap: 6px;
}

.link-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  flex: 1;
}

.link-cat-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  white-space: nowrap;
}

.link-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-title:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

.link-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.link-actions .btn-icon-only {
  width: 20px;
  height: 20px;
  font-size: 10px;
  border: none;
  background: transparent;
}

.link-actions .btn-icon-only:hover {
  background: var(--bg-surface-hover);
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 7px;
  margin-top: auto;
}

.project-footer-stats {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.project-footer-btns {
  display: flex;
  gap: 4px;
}

.project-footer-btns .btn {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
}

/* APIs Grid */
.apis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

.api-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

.api-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.api-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.api-badges-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.http-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.http-badge.get { color: var(--http-get); background: var(--http-get-bg); border: 1px solid var(--http-get); }
.http-badge.post { color: var(--http-post); background: var(--http-post-bg); border: 1px solid var(--http-post); }
.http-badge.put { color: var(--http-put); background: var(--http-put-bg); border: 1px solid var(--http-put); }
.http-badge.delete { color: var(--http-delete); background: var(--http-delete-bg); border: 1px solid var(--http-delete); }
.http-badge.patch { color: var(--http-patch); background: var(--http-patch-bg); border: 1px solid var(--http-patch); }
.http-badge.head, .http-badge.options { color: var(--text-secondary); background: var(--bg-surface-elevated); }

.project-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.env-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
}

.auth-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(246, 130, 31, 0.15);
  color: var(--primary);
}

.api-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.api-endpoint-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.endpoint-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.35;
  flex: 1;
}

.api-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 7px;
  margin-top: auto;
}

.api-actions-left {
  display: flex;
  gap: 4px;
}

.api-actions-right {
  display: flex;
  gap: 3px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.medium { max-width: 600px; }
.modal-card.large { max-width: 780px; }
.modal-card.compact-card { 
  max-width: 480px; 
  border-radius: var(--radius-lg);
}

.modal-card.compact-card .modal-header,
.modal-header.compact-header {
  padding: 12px 18px;
}

.modal-card.compact-card .modal-body,
.modal-body.compact-body {
  padding: 14px 18px;
  gap: 12px;
}

.modal-card.compact-card .modal-footer,
.modal-footer.compact-footer {
  padding: 10px 18px;
}

.modal-card.compact-card .form-group,
.compact-body .form-group {
  gap: 4px;
}

.modal-card.compact-card .form-group label,
.compact-body .form-group label {
  font-size: 11.5px;
  font-weight: 700;
}

.modal-card.compact-card .form-group input,
.modal-card.compact-card .form-group select,
.compact-body .form-group input,
.compact-body .form-group select {
  padding: 7px 10px;
  font-size: 13px;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
}

.modal-title-with-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-surface-elevated);
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: flex;
  gap: 14px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }
.full-width { width: 100%; }

.form-group label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-label-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-group input, .form-group textarea, .form-group select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13.5px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  outline: none;
  font-family: var(--font-main);
  transition: border-color var(--transition-fast);
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--border-focus);
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker-row input[type="color"] {
  width: 40px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
}

.modal-urls-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.url-input-card {
  display: grid;
  grid-template-columns: 1.5fr 2fr 1fr;
  gap: 6px;
}

/* Detail Modal Sections */
.detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.url-display-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.url-text {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--accent-blue);
  word-break: break-all;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-section h4 {
  font-size: 12.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-title-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.desc-text {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.5;
}

.curl-box, .code-box {
  background: #090d13;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 12px;
  color: #7ee787;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Drag & Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.drop-zone:hover {
  border-color: var(--primary);
  background: var(--bg-surface-elevated);
}

.drop-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.file-support-text {
  font-size: 11px;
  color: var(--text-muted);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.2s ease;
}

.toast.success { border-color: var(--http-get); }
.toast.error { border-color: var(--http-delete); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Empty Placeholder */
.empty-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.placeholder-icon {
  font-size: 40px;
  opacity: 0.6;
}

.empty-placeholder h3 {
  font-size: 18px;
  font-weight: 700;
}

.empty-placeholder p {
  font-size: 13.5px;
  color: var(--text-secondary);
  max-width: 400px;
  margin-bottom: 10px;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Mobile & Responsive Enhancements (Phones & Tablets)
   ========================================================================== */

@media (max-width: 860px) {
  .app-header {
    height: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-actions {
    gap: 8px;
    justify-content: space-between;
    width: 100%;
  }

  .nav-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 3px;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tab {
    padding: 7px 12px;
    font-size: 12.5px;
    flex-shrink: 0;
  }

  .main-content {
    padding: 10px 12px;
  }

  .view-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }

  .view-actions {
    display: flex;
    flex-direction: row;
    width: 100%;
    gap: 6px;
  }

  .view-actions .btn {
    flex: 1;
  }

  .project-selector-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 4px;
  }

  .project-selector-wrapper select {
    width: 100%;
  }

  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 10px;
  }

  .search-box {
    min-width: 0;
    width: 100%;
  }

  .filter-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }

  .filter-group select {
    width: 100%;
  }

  .toolbar-stats {
    justify-content: space-between;
  }

  .catalog-selector-card {
    grid-template-columns: 1fr;
    padding: 10px;
    gap: 8px;
  }

  .catalog-metrics-ribbon {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .metric-card {
    padding: 6px 10px;
  }

  .metric-num {
    font-size: 16px;
  }

  .projects-grid, .apis-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .project-card, .api-card {
    padding: 10px 12px;
  }

  .link-item-row {
    padding: 4px 6px;
  }

  .project-card-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
  }

  .project-footer-stats {
    justify-content: flex-start;
  }

  .project-footer-btns {
    display: flex;
    gap: 4px;
  }

  .project-footer-btns .btn {
    padding: 4px 8px;
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .url-input-card {
    grid-template-columns: 1fr;
  }

  .modal-card {
    max-width: 100%;
    max-height: 94vh;
    border-radius: var(--radius-lg);
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px;
    gap: 12px;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-direction: column;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
  }

  .auth-footer-buttons {
    flex-direction: column;
  }

  .api-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .api-actions-left, .api-actions-right {
    width: 100%;
    justify-content: space-between;
  }

  .api-actions-left .btn {
    width: 100%;
  }

  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .toast {
    width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .brand-text h1 {
    font-size: 16px;
  }

  .brand-subtitle {
    display: none;
  }

  .db-status-badge {
    font-size: 11px;
    padding: 4px 8px;
  }

  .user-badge-btn {
    padding: 4px 8px;
    font-size: 12px;
  }

  .catalog-metrics-ribbon {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   Landing Page & Integrated Login Experience
   ========================================================================== */

.landing-view {
  min-height: 100vh;
  background: var(--bg-app);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

.landing-header {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.landing-edge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(246, 130, 31, 0.12);
  border: 1px solid rgba(246, 130, 31, 0.3);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

/* Landing Hero Section */
.landing-hero-section {
  padding: 48px 24px 36px 24px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.landing-hero-content {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 36px;
  align-items: center;
}

.landing-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-glow);
  border: 1px solid rgba(246, 130, 31, 0.4);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.landing-title {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.8px;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, #fa953c 50%, #58a6ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-subtitle-hero {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 580px;
}

.landing-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.landing-stat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.landing-stat-icon {
  font-size: 20px;
}

.landing-stat-card strong {
  display: block;
  font-size: 12.5px;
  color: var(--text-primary);
}

.landing-stat-card small {
  font-size: 10.5px;
  color: var(--text-secondary);
}

/* Landing Integrated Auth Card */
.landing-auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.landing-auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent-blue));
}

.auth-tabs-nav {
  display: flex;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
  margin-bottom: 16px;
}

.auth-tab-btn {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  font-family: var(--font-main);
}

.auth-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.auth-tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
}

.landing-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.landing-card-header h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.landing-card-header p {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin: 2px 0 0 0;
}

.landing-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.landing-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.auth-switch-helper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.landing-card-footer {
  margin-top: 14px;
  text-align: center;
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Features Grid Showcase */
.landing-features-section {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 24px 48px 24px;
}

.landing-section-header {
  text-align: center;
  margin-bottom: 28px;
}

.landing-section-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.landing-section-header p {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.feature-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: all var(--transition-fast);
}

.feature-item-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  font-size: 24px;
  margin-bottom: 10px;
}

.feature-item-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.feature-item-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Landing Footer */
.landing-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 20px 28px;
}

.landing-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.landing-copyright {
  font-size: 11.5px;
  color: var(--text-secondary);
}

@media (max-width: 860px) {
  .landing-hero-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .landing-title {
    font-size: 26px;
  }

  .landing-stats-grid {
    grid-template-columns: 1fr;
  }

  .landing-header {
    padding: 0 16px;
  }

  .landing-footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* ==========================================================================
   3-Step Login Transition Animations (Cinematic, Ultra-Fluid & Hardware Accelerated)
   ========================================================================== */

/* Step 1: Left content slides to the left */
.anim-slide-out-left {
  animation: stepSlideOutLeft 0.65s cubic-bezier(0.25, 1, 0.4, 1) forwards !important;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

@keyframes stepSlideOutLeft {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
  100% {
    transform: translate3d(-120%, 0, 0);
    opacity: 0;
  }
}

/* Step 2: Right auth card slides to the right */
.anim-slide-out-right {
  animation: stepSlideOutRight 0.65s cubic-bezier(0.25, 1, 0.4, 1) forwards !important;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

@keyframes stepSlideOutRight {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
  100% {
    transform: translate3d(120%, 0, 0);
    opacity: 0;
  }
}

/* Step 3: Entire landing view slides upward as a smooth fixed overlay */
.anim-slide-up-screen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 500 !important;
  overflow: hidden !important;
  animation: stepSlideUpScreen 0.8s cubic-bezier(0.25, 1, 0.4, 1) forwards !important;
  will-change: transform, opacity;
  backface-visibility: hidden;
  pointer-events: none;
}

@keyframes stepSlideUpScreen {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, -100%, 0);
    opacity: 0;
  }
}

/* Dashboard Entrance Animation: Revelado 100% continuo, sin saltos ni etapas cortadas */
.anim-dashboard-reveal {
  animation: dashboardSmoothContinuousReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  will-change: opacity, transform, filter;
  transform-origin: center top;
  backface-visibility: hidden;
}

@keyframes dashboardSmoothContinuousReveal {
  0% {
    opacity: 0;
    filter: blur(12px) brightness(0.25);
    transform: scale(0.98) translate3d(0, 14px, 0);
  }
  100% {
    opacity: 1;
    filter: blur(0px) brightness(1);
    transform: scale(1) translate3d(0, 0, 0);
  }
}

/* ==========================================================================
   Reverse Logout Transition Animations (Cierre de Sesión Inverso)
   ========================================================================== */

/* Step 1 (Logout): Entire landing view slides DOWN into view from top */
.anim-slide-down-screen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 500 !important;
  overflow: hidden !important;
  animation: stepSlideDownScreen 0.75s cubic-bezier(0.25, 1, 0.4, 1) forwards !important;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

@keyframes stepSlideDownScreen {
  0% {
    transform: translate3d(0, -100%, 0);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

/* Dashboard Exit Animation on logout: Desvanecimiento continuo hacia borroso y negro */
.anim-dashboard-exit {
  animation: dashboardSmoothContinuousExit 0.65s cubic-bezier(0.25, 1, 0.4, 1) forwards !important;
  will-change: opacity, transform, filter;
  backface-visibility: hidden;
}

@keyframes dashboardSmoothContinuousExit {
  0% {
    opacity: 1;
    filter: blur(0px) brightness(1);
    transform: scale(1) translate3d(0, 0, 0);
  }
  100% {
    opacity: 0;
    filter: blur(10px) brightness(0.25);
    transform: scale(0.98) translate3d(0, 14px, 0);
  }
}

/* Step 2 (Logout): Left content returns from left into view */
.anim-slide-in-left {
  animation: stepSlideInLeft 0.7s cubic-bezier(0.25, 1, 0.4, 1) forwards !important;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

@keyframes stepSlideInLeft {
  0% {
    transform: translate3d(-120%, 0, 0);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

/* Step 2 (Logout): Right auth card returns from right into view */
.anim-slide-in-right {
  animation: stepSlideInRight 0.7s cubic-bezier(0.25, 1, 0.4, 1) forwards !important;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

@keyframes stepSlideInRight {
  0% {
    transform: translate3d(120%, 0, 0);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

/* ==========================================================================
   Header / Menu Bar Drop-Down Animation (Baja suavemente de arriba hacia abajo y queda fija)
   ========================================================================== */

.anim-header-drop {
  animation: headerSmoothDrop 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

@keyframes headerSmoothDrop {
  0% {
    transform: translate3d(0, -100%, 0);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

/* Menu Bar Slide Up Animation on Logout */
.anim-header-lift {
  animation: headerSmoothLift 0.5s cubic-bezier(0.25, 1, 0.4, 1) forwards !important;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

@keyframes headerSmoothLift {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
  100% {
    transform: translate3d(0, -100%, 0);
    opacity: 0;
  }
}
