/* ===== Design Tokens ===== */
:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.3);
  --success: #22c55e;
  --success-bg: #dcfce7;
  --danger: #ef4444;
  --danger-light: #fecaca;
  --warning: #f59e0b;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --card-border: rgba(226, 232, 240, 0.8);
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== Layout ===== */
.app-header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.app-header .logo {
  font-weight: 700;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-header .nav { display: flex; align-items: center; gap: 10px; }
.app-header .user-info { font-size: 0.9rem; color: var(--text-secondary); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.container-sm { max-width: 480px; margin: 0 auto; padding: 16px; }

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
  padding: 24px;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.card-header h2 { font-size: 1.05rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header h2 .icon { font-size: 1.2rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover { box-shadow: 0 4px 16px var(--primary-glow); transform: translateY(-1px); color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); border-color: #cbd5e1; color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 6px 14px; font-size: 0.85rem; border-radius: var(--radius-xs); }
.btn-xs { padding: 4px 10px; font-size: 0.8rem; border-radius: 4px; }

.btn-logout {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
}
.btn-logout:hover { color: var(--danger); border-color: var(--danger); background: #fef2f2; }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
  background: var(--card-bg);
  color: var(--text);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }

/* ===== Login Page ===== */
.login-page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  background: #0f172a;
}

/* Animated background */
.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
.login-bg .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: orbFloat 20s ease-in-out infinite;
}
.login-bg .orb:nth-child(1) {
  width: 500px; height: 500px;
  background: var(--primary);
  top: -10%; left: -10%;
  animation-delay: 0s;
}
.login-bg .orb:nth-child(2) {
  width: 400px; height: 400px;
  background: #a855f7;
  bottom: -15%; right: -10%;
  animation-delay: -7s;
}
.login-bg .orb:nth-child(3) {
  width: 300px; height: 300px;
  background: #06b6d4;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(60px, -40px) scale(1.1); }
  50% { transform: translate(-30px, 60px) scale(0.9); }
  75% { transform: translate(40px, 30px) scale(1.05); }
}

/* Grid overlay */
.login-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 44px 36px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  animation: cardAppear 0.6s ease-out;
}

@keyframes cardAppear {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card .logo-section {
  text-align: center;
  margin-bottom: 32px;
}
.login-card .logo-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
  animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(99,102,241,0.35); }
  50% { box-shadow: 0 8px 32px rgba(99,102,241,0.55); }
}
.login-card h1 {
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.login-card .subtitle {
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
}

.login-card .form-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 0.85rem;
  display: none;
  animation: shake 0.3s ease;
}
.login-card .form-error.show { display: block; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.login-card .form-group label {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
}
.login-card .form-input {
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.12);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.95rem;
  transition: var(--transition);
}
.login-card .form-input::placeholder { color: rgba(255,255,255,0.35); }
.login-card .form-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(129,140,248,0.2);
  background: rgba(255,255,255,0.12);
}
.login-card .form-input:-webkit-autofill,
.login-card .form-input:-webkit-autofill:hover,
.login-card .form-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0px 1000px rgba(99,102,241,0.15) inset;
  transition: background-color 5000s ease-in-out 0s;
}

.login-card .btn {
  width: 100%;
  padding: 13px;
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
  position: relative;
  overflow: hidden;
}
.login-card .btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.1));
  opacity: 0;
  transition: opacity 0.3s;
}
.login-card .btn:hover::after { opacity: 1; }
.login-card .btn:hover { box-shadow: 0 6px 24px rgba(99,102,241,0.5); transform: translateY(-1px); }
.login-card .btn:disabled { opacity: 0.6; }

.login-card .btn .btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.login-card .btn .btn-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ===== Stat Cards ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #a855f7);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card .stat-icon { font-size: 1.5rem; margin-bottom: 8px; }
.stat-card .number {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-card .label { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; }

/* ===== Tables ===== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg);
  white-space: nowrap;
}
.admin-table tbody tr {
  transition: background 0.15s;
}
.admin-table tbody tr:hover { background: var(--bg); }
.admin-table tbody tr:last-child td { border-bottom: none; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  gap: 4px;
}
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-user { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-fail { background: #fef2f2; color: #dc2626; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination .page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
  min-width: 34px;
  text-align: center;
}
.pagination .page-btn:hover { background: var(--bg); border-color: #cbd5e1; }
.pagination .page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { font-size: 0.85rem; color: var(--text-secondary); margin-left: 8px; }

/* ===== File List ===== */
.file-list { list-style: none; }
.file-list li {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  gap: 12px;
}
.file-list li:hover { background: var(--bg); }
.file-list li:active { transform: scale(0.99); }
.file-list .file-icon { font-size: 1.3rem; flex-shrink: 0; }
.file-list .file-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .file-meta { color: var(--text-muted); font-size: 0.82rem; flex-shrink: 0; }

.breadcrumb {
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text); font-weight: 500; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.9rem;
  z-index: 9999;
  animation: toastIn 0.35s ease;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  pointer-events: none;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Loading ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
  gap: 10px;
}
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Refresh Bar ===== */
.refresh-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== Admin Section ===== */
.admin-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
  padding: 24px;
  margin-bottom: 24px;
  transition: var(--transition);
}
.admin-section:hover { box-shadow: var(--shadow-md); }
.admin-section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Mobile Card List (for mobile admin) ===== */
.mobile-log-list {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.mobile-log-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: var(--transition);
}
.mobile-log-card:hover { box-shadow: var(--shadow-sm); }
.mobile-log-card .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.mobile-log-card .row:last-child { margin-bottom: 0; }
.mobile-log-card .label { font-size: 0.78rem; color: var(--text-muted); }
.mobile-log-card .value { font-size: 0.9rem; font-weight: 500; }

/* ===== Navigate Link ===== */
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  transition: var(--transition);
  border: 1px solid transparent;
}
.nav-link:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
  text-decoration: none;
}

/* ===== Blacklist ===== */
.blacklist-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.blacklist-form .form-input {
  flex: 1;
  min-width: 140px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container { padding: 16px 12px; }
  .container-sm { padding: 12px; }
  .card { padding: 16px; }
  .admin-section { padding: 16px; }

  .app-header { padding: 0 12px; height: 54px; }
  .app-header .logo { font-size: 1rem; }
  .app-header .user-info { display: none; }
  .app-header .nav .nav-link span { display: none; }

  .login-card { padding: 32px 24px 28px; margin: 12px; border-radius: 16px; }
  .login-card .logo-icon { width: 48px; height: 48px; font-size: 1.4rem; }
  .login-card h1 { font-size: 1.2rem; }

  .stat-cards { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stat-card { padding: 14px 10px; }
  .stat-card .number { font-size: 1.4rem; }
  .stat-card .label { font-size: 0.75rem; }

  .admin-table { font-size: 0.82rem; }
  .admin-table th, .admin-table td { padding: 8px 10px; }

  .file-list li { padding: 10px 12px; }
  .file-list .file-meta { font-size: 0.78rem; }

  .pagination { gap: 2px; }
  .pagination .page-btn { padding: 5px 9px; font-size: 0.8rem; min-width: 30px; }

  .toast { left: 12px; right: 12px; max-width: none; }

  .blacklist-form .form-input { min-width: 100px; }
}

/* Mobile: switch tables to card layout */
@media (max-width: 640px) {
  .admin-table thead { display: none; }
  .admin-table tbody tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .admin-table tbody tr:last-child { border-bottom: none; }
  .admin-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
    font-size: 0.85rem;
  }
  .admin-table tbody td::before {
    content: attr(data-label);
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.78rem;
    flex-shrink: 0;
    margin-right: 12px;
  }
  .admin-table tbody td.no-data { display: block; text-align: center; }
  .admin-table tbody td.no-data::before { display: none; }
  .admin-table tbody tr:hover { background: none; }

  .stat-cards { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-card { padding: 12px 8px; }
  .stat-card .number { font-size: 1.2rem; }
  .stat-card .stat-icon { font-size: 1.2rem; margin-bottom: 4px; }
  .stat-card .label { font-size: 0.7rem; }

  .admin-section { padding: 14px; margin-bottom: 16px; }
  .admin-section h2 { font-size: 0.95rem; }

  .btn-sm { padding: 5px 10px; font-size: 0.8rem; }
  .btn-xs { padding: 3px 8px; font-size: 0.75rem; }

  .login-card { padding: 28px 20px 24px; }
  .login-card .form-input { padding: 10px 14px; }
  .login-card .btn { padding: 11px; }

  .nav-link { padding: 4px 8px; font-size: 0.8rem; }
}

/* ===== Navigation Page ===== */
.nav-group { margin-bottom: 28px; }
.nav-group-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.nav-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  transition: var(--transition);
  overflow: hidden;
}
.nav-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.nav-item-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  color: var(--text);
  text-decoration: none;
  height: 100%;
}
.nav-item-link:hover { color: var(--text); text-decoration: none; }
.nav-item-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  border-radius: 10px;
}
.nav-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
.nav-item-title {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item-url {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.nav-item:hover .nav-item-actions { opacity: 1; }
.nav-item-actions .btn-ghost {
  background: rgba(255,255,255,0.9);
  box-shadow: var(--shadow-sm);
  padding: 3px 6px;
  font-size: 0.75rem;
  border-radius: 4px;
}
.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== Dialog ===== */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: dialogSlide 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes dialogSlide {
  from { transform: translateY(-20px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.dialog-header h3 { font-size: 1.05rem; font-weight: 600; }
.dialog form { padding: 20px; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .nav-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
  .nav-item-link { padding: 10px; }
  .nav-item-icon { width: 32px; height: 32px; font-size: 1.3rem; }
  .nav-item-actions { opacity: 1; }
  .form-row { flex-direction: column; }
  .form-row .form-group { width: 100% !important; }
}

/* ===== Utility ===== */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.ip-addr { font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace; font-size: 0.85rem; }
.device-info { font-size: 0.82rem; color: var(--text-secondary); }
.success-badge { color: #16a34a; font-weight: 600; }
.fail-badge { color: #dc2626; font-weight: 600; }