/* ===== Design System (Shared between login & app) ===== */
:root {
  --bg: #f8f9fa;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f1f3f5;
  --border: #e9ecef;
  --border-light: #dee2e6;
  --text: #1a1d21;
  --text-secondary: #495057;
  --text-muted: #868e96;
  --accent: #4263eb;
  --accent-hover: #3b5bdb;
  --accent-bg: #edf2ff;
  --accent-light: #748ffc;
  --success: #2f9e44;
  --success-bg: #ebfbee;
  --warning: #f08c00;
  --warning-bg: #fff9db;
  --danger: #e03131;
  --danger-bg: #fff5f5;
  --info: #0c8599;
  --info-bg: #e3fafc;
  --radius: 10px;
  --radius-sm: 6px;
  --font-display: 'SF Pro Display', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.03);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);

  /* Touch targets */
  --touch-min: 44px;
}

/* ===== Dark color-scheme (scrollbar etc) ===== */
html { color-scheme: light dark; }

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

/* ===== Device Toggle ===== */
.device-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 3px;
}
.device-toggle button {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  line-height: 1;
}
.device-toggle button.active {
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow);
}
.device-toggle button:hover:not(.active) { color: var(--text-secondary); }

/* ===== Layout ===== */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  z-index: 50;
}

.sidebar-header {
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.sidebar-header .subtitle {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 2px;
  font-weight: 500;
  min-height: var(--touch-min);
}

.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); }
.nav-item .icon { font-size: 16px; }
.nav-item .badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--border);
  color: var(--text-secondary);
  font-weight: 600;
}
.nav-item.active .badge { background: var(--accent); color: #fff; }

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.topbar .spacer { flex: 1; }

.search-box { position: relative; width: 280px; }

.search-box input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  font-family: var(--font-body);
}

.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-bg); }
.search-box .search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px;
}

.content-area { flex: 1; overflow-y: auto; padding: 24px; overscroll-behavior: contain; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), opacity var(--transition);
  white-space: nowrap;
  font-family: var(--font-body);
  min-height: 32px;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.88; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-outline { background: #fff; border: 1px solid var(--border-light); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 4px 10px; font-size: 12px; min-height: auto; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow var(--transition), transform var(--transition);
  box-shadow: var(--shadow);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

.stat-icon.accent { background: var(--accent-bg); }
.stat-icon.green { background: var(--success-bg); }
.stat-icon.orange { background: var(--warning-bg); }
.stat-icon.blue { background: var(--info-bg); }

.stat-info h3 { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-info p { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ===== Card ===== */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

.card-header h3 { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text); }
.card-body { padding: 18px; }

/* ===== Parent List ===== */
.parent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.parent-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  box-shadow: var(--shadow);
}

.parent-card:hover { border-color: var(--accent-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.parent-card.active { border-color: var(--accent); background: var(--accent-bg); }

.parent-card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px; }

.parent-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}

.parent-info { flex: 1; min-width: 0; }
.parent-name { font-size: 14px; font-weight: 700; color: var(--text); }
.parent-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.parent-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: var(--bg-hover); color: var(--text-secondary); font-weight: 500;
}

.parent-stats {
  display: flex; gap: 12px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
  flex-wrap: wrap;
}

.parent-stats span { display: flex; align-items: center; gap: 3px; }

/* ===== Detail ===== */
.parent-detail-header { display: flex; align-items: flex-start; gap: 16px; }
.parent-detail-header .parent-avatar { width: 48px; height: 48px; font-size: 20px; }
.parent-detail-header .info { flex: 1; min-width: 0; }
.parent-detail-header .name { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--text); }
.parent-detail-header .meta { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.parent-detail-header .actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===== Timeline ===== */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}

.timeline-item {
  position: relative; margin-bottom: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.timeline-item:hover { border-color: var(--border-light); box-shadow: var(--shadow); }

.timeline-item::before {
  content: ''; position: absolute; left: -19px; top: 18px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2px solid var(--text-muted);
}

.timeline-item.status-open::before { border-color: var(--warning); }
.timeline-item.status-in_progress::before { border-color: var(--info); }
.timeline-item.status-done::before { border-color: var(--success); }

.timeline-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }

.timeline-type {
  font-size: 10px; padding: 2px 8px; border-radius: 4px;
  font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
}

.type-interview { background: var(--info-bg); color: var(--info); }
.type-visit { background: var(--success-bg); color: var(--success); }
.type-call { background: var(--warning-bg); color: var(--warning); }
.type-note { background: var(--bg-hover); color: var(--text-secondary); }
.type-follow_up { background: var(--accent-bg); color: var(--accent); }
.type-ai { background: #f8f0fc; color: #ae3ec9; }

.status-badge { font-size: 10px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.status-open { background: var(--warning-bg); color: var(--warning); }
.status-in_progress { background: var(--info-bg); color: var(--info); }
.status-done { background: var(--success-bg); color: var(--success); }

.timeline-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 3px; text-wrap: pretty; }
.timeline-content { font-size: 13px; color: var(--text-secondary); white-space: pre-wrap; line-height: 1.7; }
.timeline-meta { font-size: 11px; color: var(--text-muted); margin-top: 10px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== Forms ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 4px;
}

.form-group label .req { color: var(--danger); }

input[type="text"], input[type="date"], input[type="tel"], textarea, select {
  width: 100%; padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px;
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font-body);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
textarea { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; min-width: 0; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s;
  overscroll-behavior: contain;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 480px; max-width: 90vw; max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: scale(1); }

.modal-header { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; overscroll-behavior: contain; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ===== Audio ===== */
.audio-player {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 8px 0;
}

.audio-player audio { width: 100%; height: 32px; }

.recording-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); animation: rec-pulse 1.5s infinite;
}

@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

/* ===== Attachments ===== */
.attachment-list { display: flex; flex-direction: column; gap: 4px; }

.attachment-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: border-color var(--transition);
}

.attachment-item:hover { border-color: var(--border-light); }
.attachment-item .file-icon { font-size: 16px; }
.attachment-item .file-info { flex: 1; min-width: 0; }
.attachment-item .file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.attachment-item .file-size { font-size: 11px; color: var(--text-muted); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .icon { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-family: var(--font-display); font-size: 15px; font-weight: 700; margin-bottom: 4px; color: var(--text-secondary); text-wrap: pretty; }
.empty-state p { font-size: 12px; }

/* ===== Loading ===== */
.loading { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }

/* ===== Table ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.data-table th {
  text-align: left; padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted); font-weight: 600;
  font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase;
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.data-table tr:hover td { background: var(--bg-hover); cursor: pointer; }
.data-table tr:last-child td { border-bottom: none; }

/* ===== Mobile Sidebar Overlay ===== */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 40;
  opacity: 0;
  transition: opacity 0.25s;
}
.sidebar-overlay.show { display: block; opacity: 1; }

.sidebar-close {
  display: none;
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  border: none; background: var(--bg-hover);
  border-radius: 50%; font-size: 18px;
  cursor: pointer; color: var(--text-muted);
  align-items: center; justify-content: center;
  z-index: 51;
}

/* ===== Mobile Bottom Nav ===== */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 4px 0 env(safe-area-inset-bottom, 0);
  z-index: 100;
}
.mobile-nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  padding: 6px 0;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
  background: none; border: none;
  min-height: var(--touch-min);
}
.mobile-nav-item .icon { font-size: 20px; }
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item:hover { color: var(--text-secondary); }

/* ===== Responsive — Mobile ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.show { transform: translateX(0); }
  .sidebar-close { display: flex; }

  .mobile-nav { display: flex; }

  .topbar { padding: 10px 16px; gap: 8px; }
  .topbar h2 { font-size: 15px; }
  .search-box { width: auto; flex: 1; min-width: 0; }

  .content-area { padding: 12px; padding-bottom: 64px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px 10px; gap: 8px; }
  .stat-icon { width: 32px; height: 32px; font-size: 16px; }
  .stat-info h3 { font-size: 20px; }

  .parent-grid { grid-template-columns: 1fr; gap: 10px; }

  .parent-detail-header { flex-direction: column; }
  .parent-detail-header .actions { width: 100%; }
  .parent-detail-header .actions .btn { flex: 1; }

  .timeline { padding-left: 18px; }
  .timeline-item { padding: 12px 14px; }
  .timeline-meta { gap: 8px; }
  .timeline-meta span:last-child { margin-left: 0 !important; width: 100%; justify-content: flex-end; }

  .modal { width: 100%; max-width: 100vw; border-radius: 0; max-height: 100vh; }
  .modal-overlay { align-items: stretch; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 10px 16px; }

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

  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .data-table th:nth-child(4), .data-table td:nth-child(4) { display: none; }

  .topbar .btn span { display: none; }
  .topbar .btn { padding: 7px 10px; }
}

/* ===== Responsive — Desktop (force desktop mode) ===== */
body.force-desktop .sidebar { transform: none; position: relative; }
body.force-desktop .mobile-nav { display: none; }
body.force-desktop .sidebar-close { display: none; }
body.force-desktop .sidebar-overlay { display: none !important; }

/* ===== Responsive — Mobile (force mobile mode on small screen) ===== */
body.force-mobile .sidebar { position: fixed; transform: translateX(-100%); }
body.force-mobile .sidebar.show { transform: translateX(0); }
body.force-mobile .mobile-nav { display: flex; }
body.force-mobile .content-area { padding-bottom: 64px; }

/* ===== Login Page (Shared Styles) ===== */
.login-page { display: flex; min-height: 100vh; }
.login-brand {
  flex: 0 0 380px;
  background: var(--text);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-brand::before {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(-45deg, transparent, transparent 40px, rgba(255,255,255,0.02) 40px, rgba(255,255,255,0.02) 41px);
}
.login-brand-inner { position: relative; z-index: 1; padding: 40px 32px; max-width: 320px; }
.login-brand-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 48px; }
.login-brand-icon {
  width: 32px; height: 32px; border-radius: 6px;
  background: #fff; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.login-brand-name { font-size: 16px; font-weight: 600; }
.login-brand-title { font-size: 22px; font-weight: 700; line-height: 1.4; margin-bottom: 12px; text-wrap: balance; }
.login-brand-desc { font-size: 14px; line-height: 1.7; color: rgba(255,255,255,0.55); }
.login-brand-footer { position: absolute; bottom: 32px; left: 32px; display: flex; align-items: center; gap: 8px; }
.login-brand-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); animation: brand-pulse 2s infinite;
}
@keyframes brand-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(47,158,68,0.5); }
  50% { box-shadow: 0 0 0 5px rgba(47,158,68,0); }
}
.login-brand-footer-text { font-size: 11px; color: rgba(255,255,255,0.35); }

.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: 100%; max-width: 400px; }
.login-card-title { font-size: 22px; font-weight: 700; color: var(--text); text-wrap: balance; }
.login-card-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 6px; margin-bottom: 24px; }

.login-search-wrap { position: relative; margin-bottom: 12px; }
.login-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.login-search {
  width: 100%; padding: 10px 12px 10px 36px;
  font-size: 14px; border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); box-sizing: border-box;
  background: #fff; color: var(--text);
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
.login-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.login-search:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.login-user-list {
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 20px; background: #fff;
  overscroll-behavior: contain;
}

.login-user-item {
  display: flex; align-items: center;
  padding: 10px 14px; cursor: pointer;
  gap: 10px; border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  min-height: var(--touch-min);
}
.login-user-item:last-child { border-bottom: none; }
.login-user-item:hover { background: var(--bg-hover); }
.login-user-item.selected { background: var(--accent-bg); border-left: 3px solid var(--accent); padding-left: 11px; }
.login-user-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.login-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--text); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.login-name { flex: 1; font-size: 14px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-role { font-size: 11px; color: var(--text-muted); background: var(--bg-hover); padding: 1px 6px; border-radius: 4px; flex-shrink: 0; }

.login-btn {
  width: 100%; padding: 11px 16px;
  font-size: 14px; font-weight: 500;
  border-radius: var(--radius-sm); border: none;
  cursor: pointer; transition: background var(--transition), opacity var(--transition);
  min-height: var(--touch-min);
}
.login-btn-primary { background: var(--accent); color: #fff; }
.login-btn-primary:hover { background: var(--accent-hover); }
.login-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.login-status { margin-top: 14px; text-align: center; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.login-status.success { color: var(--success); font-weight: 600; }
.login-status.error { color: var(--danger); }

.login-spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-card-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); text-align: center; }
.login-dev-toggle { color: var(--text-secondary); cursor: pointer; background: none; border: none; font-size: 12px; transition: color var(--transition); }
.login-dev-toggle:hover { color: var(--accent); }
.login-dev-form { display: none; margin-top: 12px; }
.login-dev-form.show { display: block; }
.login-dev-form input {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  font-size: 14px; box-sizing: border-box; margin-bottom: 8px;
  background: #fff; color: var(--text);
}

/* ===== Login Responsive ===== */
@media (max-width: 768px) {
  .login-brand { display: none; }
  .login-main { padding: 20px 16px; }
  .login-card { max-width: 100%; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
