/* ===== NAV ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bg-border);
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.nav-brand .logo-dot {
  width: 28px;
  height: 28px;
  background: var(--orange-500);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.nav-actions { display: flex; align-items: center; gap: 8px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--orange-500);
  color: #fff;
}
.btn-primary:hover { background: var(--orange-400); color: #fff; }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--bg-border);
}
.btn-secondary:hover { background: var(--bg-border); color: var(--text-primary); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #F87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); color: #F87171; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon {
  padding: 7px;
  width: 34px;
  height: 34px;
  justify-content: center;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1),
              box-shadow 0.25s cubic-bezier(0.4,0,0.2,1),
              border-color 0.25s cubic-bezier(0.4,0,0.2,1);
}
.card:hover {
  transform: translateY(-10px) scale(1.025);
  box-shadow: 0 28px 64px rgba(249,115,22,0.18), 0 8px 24px rgba(0,0,0,0.18);
  border-color: var(--orange-500);
  z-index: 2;
}
[data-theme="light"] .card:hover {
  box-shadow: 0 28px 64px rgba(249,115,22,0.14), 0 8px 24px rgba(0,0,0,0.08);
}
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--bg-border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Clickable project cards */
.project-card { cursor: pointer; }

/* Description expand on hover */
.card-desc {
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: var(--text-secondary);
  overflow: hidden;
  max-height: 4.5rem;
  margin-bottom: 10px;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
}
.project-card:hover .card-desc {
  max-height: 9rem;
}

/* Stat cards */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--orange-500), var(--purple-500));
}
.stat-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  margin: 8px 0 4px;
  color: var(--text-primary);
}
.stat-label { color: var(--text-secondary); font-size: 0.875rem; }
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.status-active .status-dot   { background: var(--status-active); }
.status-progress .status-dot { background: var(--status-progress); }
.status-archived .status-dot { background: var(--status-archived); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-label .required { color: var(--orange-500); margin-left: 2px; }
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px var(--orange-glow);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { appearance: none; cursor: pointer; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.char-count { font-size: 0.75rem; color: var(--text-muted); text-align: right; margin-top: 2px; }

/* Tag input */
.tag-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  padding: 8px;
  min-height: 44px;
  cursor: text;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.tag-input-container:focus-within {
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px var(--orange-glow);
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-border);
  color: var(--text-primary);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
}
.tag-pill .remove-tag {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  transition: color var(--transition);
  background: none; border: none; padding: 0;
}
.tag-pill .remove-tag:hover { color: #ef4444; }
.tag-input {
  flex: 1;
  min-width: 80px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  font-family: var(--font-body);
}

/* Toggle switch */
.toggle-switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 44px; height: 24px;
  background: var(--bg-border);
  border-radius: 12px;
  transition: background var(--transition);
  position: relative;
}
.toggle-switch input:checked ~ .toggle-track { background: var(--orange-500); }
.toggle-thumb {
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform var(--transition);
}
.toggle-switch input:checked ~ .toggle-track .toggle-thumb { transform: translateX(20px); }

/* ===== SEARCH BAR ===== */
.search-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}
.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1.5px solid var(--bg-border);
  border-radius: 50px;
  color: var(--text-primary);
  padding: 14px 52px 14px 52px;
  font-size: 1rem;
  font-family: var(--font-body);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 4px var(--orange-glow);
}
.search-input::placeholder { color: var(--text-muted); }
.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  background: none; border: none; padding: 4px;
  display: none;
  transition: color var(--transition);
}
.search-clear:hover { color: var(--text-primary); }
.search-clear.visible { display: block; }

/* Filter pills */
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--bg-border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
}
.filter-pill:hover { border-color: var(--orange-500); color: var(--orange-500); }
.filter-pill.active {
  background: var(--orange-500);
  border-color: var(--orange-500);
  color: #fff;
  box-shadow: 0 0 0 3px var(--orange-glow);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  position: relative;
}
@media (prefers-reduced-motion: no-preference) {
  .modal-overlay.open .modal { animation: scaleIn 0.2s ease; }
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer; font-size: 20px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

/* ===== TABLE ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--bg-border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.data-table th:hover { color: var(--text-secondary); }
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bg-border);
  font-size: 0.875rem;
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-elevated); }
.data-table tr:last-child td { border-bottom: none; }

/* ===== TOAST CONTAINER ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: all;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  min-width: 280px;
  max-width: 360px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.toast-border {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.toast.success .toast-border { background: var(--status-active); }
.toast.error   .toast-border { background: #EF4444; }
.toast.info    .toast-border { background: var(--orange-500); }
.toast.warning .toast-border { background: var(--status-progress); }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--status-active); }
.toast.error   .toast-icon { color: #EF4444; }
.toast.info    .toast-icon { color: var(--orange-500); }
.toast.warning .toast-icon { color: var(--status-progress); }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 1px; }
.toast-msg   { font-size: 0.8rem; color: var(--text-secondary); }
.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--bg-border);
  width: 100%;
}
.toast-progress-bar {
  height: 100%;
  background: var(--orange-500);
  transition: width linear;
}
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: slideInRight 0.3s ease; }
  .toast.dismiss { animation: slideInRight 0.25s ease reverse; }
}

/* ===== FLOATING ELEMENTS ===== */
.back-to-top {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  color: var(--text-secondary);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  transition: all var(--transition);
}
.back-to-top.visible { display: flex; }
.back-to-top:hover { background: var(--orange-500); color: #fff; border-color: var(--orange-500); }

.search-hint-pill {
  position: fixed;
  bottom: 80px;
  left: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: none;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  z-index: 40;
  transition: all var(--transition);
}
.search-hint-pill.visible { display: flex; }
.search-hint-pill:hover { border-color: var(--orange-500); color: var(--orange-500); }

/* ===== BULK ACTION BAR ===== */
.bulk-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--bg-border);
  padding: 12px 24px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 50;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.bulk-bar.open {
  display: flex;
  transform: translateY(0);
}

/* ===== MARK HIGHLIGHT ===== */
mark {
  background: rgba(249,115,22,0.25);
  color: var(--orange-400);
  border-radius: 3px;
  padding: 0 2px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p  { font-size: 0.875rem; }

/* ===== ORBS (hero background) ===== */
.orb-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .nav { padding: 0 1rem; }
  .stat-value { font-size: 2rem; }
  .modal { padding: 24px 20px; }
  #toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { min-width: unset; max-width: 100%; }
}

/* Password toggle */
.pass-wrap { position: relative; }
.pass-wrap .form-input { padding-right: 44px; }
.pass-toggle {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  transition: color var(--transition);
}
.pass-toggle:hover { color: var(--text-primary); }

/* Credential copy block */
.cred-block {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.cred-row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bg-border);
}
.cred-row:last-child { border-bottom: none; }
.cred-key { width: 90px; font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; }
.cred-val { flex: 1; font-family: monospace; font-size: 0.9rem; }
.cred-copy {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
  border-radius: 4px;
}
.cred-copy:hover { color: var(--orange-500); }
