:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #3b82f6;
  --brand-dark: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

.shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Login Card */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.narrow {
  max-width: 420px;
  margin: 80px auto;
  padding: 32px;
}

.narrow h1 { font-size: 1.5rem; margin-bottom: 8px; }
.narrow .muted { margin-bottom: 24px; }

/* Form Elements */
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 6px; }
label span { font-weight: 500; font-size: 14px; }

input, button {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input {
  padding: 12px 14px;
  background: #fafbfc;
}

button {
  padding: 12px 16px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 500;
  border-color: var(--brand);
}

button:hover { background: var(--brand-dark); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
button.secondary:hover { background: #f8fafc; }

/* Error */
.error { color: var(--danger); font-size: 14px; }
.hidden { display: none !important; }

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.topbar h1 { font-size: 1.5rem; }
.profile-line { margin-top: 4px; }

/* Tabs Navigation */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--panel);
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.tab-btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn:hover { background: #f1f5f9; color: var(--ink); }
.tab-btn.active {
  background: var(--brand);
  color: #fff;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Grid Layout */
.tab-grid {
  display: grid;
  gap: 20px;
}

@media (min-width: 1024px) {
  .tab-grid { grid-template-columns: repeat(2, 1fr); }
  .tab-grid .card:first-child { grid-column: 1 / -1; }
}

/* Table Styles */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}
.table-header h2 { font-size: 1rem; font-weight: 600; }

.table-container { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 12px 14px;
  background: #f8fafc;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover { background: #f8fafc; }

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 40px !important;
}

/* Badges */
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-active, .badge-online { background: #dcfce7; color: #166534; }
.badge-inactive, .badge-offline { background: #f1f5f9; color: #475569; }
.badge-deleted, .badge-blocked { background: #fef2f2; color: #991b1b; }
.badge-pending { background: #fef9c3; color: #854d0e; }

/* ID Badges */
.id-badge {
  display: inline-flex;
  padding: 2px 8px;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-family: monospace;
}

/* Action Group */
.action-group {
  display: flex;
  gap: 6px;
}

/* Icon Buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon svg { width: 18px; height: 18px; }

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

.btn-success { background: #dcfce7; color: var(--success); }
.btn-success:hover { background: var(--success); color: #fff; }

.btn-warning { background: #fef9c3; color: var(--warning); }
.btn-warning:hover { background: var(--warning); color: #fff; }

/* Small Buttons */
.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-add {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.btn-add:hover { background: #059669; }

/* Header Actions */
.header-actions {
  display: flex;
  gap: 8px;
}

/* Link Info */
.link-info { display: grid; gap: 2px; }
.link-id { font-size: 12px; color: var(--muted); font-family: monospace; }

/* Code Text */
code { background: #f1f5f9; padding: 2px 8px; border-radius: 4px; font-size: 13px; font-family: monospace; }
.uuid-text { font-size: 11px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-code { color: var(--brand); }
.ip-text { font-size: 12px; }
.time-text { font-size: 13px; color: var(--muted); }
.target-text { font-size: 13px; }
.muted { color: var(--muted); }

/* Token Form */
.token-form {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group { display: grid; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--muted); }
.form-group input { margin-top: 0; }

.btn-generate {
  justify-self: start;
  padding: 12px 24px;
}

.token-result {
  display: grid;
  gap: 16px;
  padding: 24px;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  text-align: center;
}

.token-info {
  display: grid;
  gap: 8px;
  text-align: left;
}

.qr-code {
  width: 200px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fff;
}

.text-sm { font-size: 13px; }

/* Audit Form */
.audit-form {
  display: flex;
  gap: 10px;
  align-items: center;
}
.audit-form input { width: 120px; }
.input-sm { padding: 8px 12px; font-size: 13px; margin-top: 0; width: 100px; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-content {
  background: var(--panel);
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: auto;
}

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

.modal-header h3 { font-size: 1.1rem; }

.modal-close {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.modal-close:hover { background: #f1f5f9; color: var(--ink); }

.modal-body { padding: 24px; }

/* Responsive */
@media (max-width: 768px) {
  .shell { padding: 16px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .tabs { overflow-x: auto; }
  .tab-btn { padding: 8px 14px; white-space: nowrap; }
  .form-row { grid-template-columns: 1fr; }
  .table-header { flex-direction: column; align-items: flex-start; }
  th, td { padding: 10px 12px; }
  .audit-form { flex-wrap: wrap; }
  .audit-form input { width: 100%; }
  .audit-form .input-sm { width: 80px; }
}

@media (max-width: 640px) {
  .tab-grid { grid-template-columns: 1fr; }
  table { font-size: 13px; }
  th { display: none; }
  td { display: grid; gap: 4px; }
  td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    font-size: 11px;
  }
}

/* ==================== PARENT DASHBOARD V2 STYLES ==================== */

.dashboard-content {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .dashboard-content {
    grid-template-columns: 1fr;
  }
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
}

.section-header h2 svg {
  width: 20px;
  height: 20px;
}

.badge-count {
  background: var(--brand);
  color: white;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* Members */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.member-card:hover {
  background: #f8fafc;
  border-color: var(--line);
}

.member-card.active {
  background: #eff6ff;
  border-color: var(--brand);
}

.member-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.member-avatar svg {
  width: 22px;
  height: 22px;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-school {
  font-size: 12px;
  color: var(--muted);
}

.member-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.device-badge, .online-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
}

.online-badge.has-online {
  background: #dcfce7;
  color: #166534;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot.online {
  background: var(--success);
  box-shadow: 0 0 4px var(--success);
}

.dot.offline {
  background: var(--muted);
}

.btn-select {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}

.btn-select.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

/* Main Area */
.main-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Device Bar */
.device-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 20px;
  box-shadow: var(--shadow);
}

.device-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-bar-info svg {
  width: 22px;
  height: 22px;
  color: var(--muted);
}

.device-bar-info span {
  font-weight: 600;
}

.device-bar-status {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.device-bar-status.online {
  background: #dcfce7;
  color: #166534;
}

.device-bar-status.offline {
  background: #f1f5f9;
  color: var(--muted);
}

.devices-summary {
  display: flex;
  gap: 12px;
  align-items: center;
}

.online-count, .offline-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--panel);
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow-x: auto;
}

.tab-nav .tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab-nav .tab-btn:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.tab-nav .tab-btn.active {
  background: var(--brand);
  color: white;
}

/* Tab Panels */
.tab-panels {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 400px;
}

.tab-panel {
  display: none;
  padding: 20px;
}

.tab-panel.active {
  display: block;
}

.panel-placeholder {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 14px;
}

.panel-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.btn-sm.btn-primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.btn-sm.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-sm.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}

.btn-sm.btn-danger:hover {
  background: var(--danger);
  color: white;
}

/* Data Lists */
.data-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
}

.data-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  transition: background 0.1s;
}

.data-item:hover {
  background: #f8fafc;
}

.data-item-icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.data-item-body {
  flex: 1;
  min-width: 0;
}

.data-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.data-item-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-item-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.data-item-text {
  font-size: 13px;
  color: var(--ink);
  margin-top: 4px;
  word-break: break-word;
}

.data-item-meta {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.empty-item {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 14px;
}

/* SMS specific */
.sms-incoming {
  border-left: 3px solid var(--brand);
}

.sms-outgoing {
  border-left: 3px solid var(--success);
}

/* Call type badges */
.call-type-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.call-type-badge.incoming {
  background: #dcfce7;
  color: #166534;
}

.call-type-badge.outgoing {
  background: #dbeafe;
  color: #1e40af;
}

.call-type-badge.missed {
  background: #fef2f2;
  color: #991b1b;
}

/* App badge */
.app-badge {
  padding: 2px 8px;
  background: #f1f5f9;
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
}

/* Camera */
.camera-result {
  margin-bottom: 16px;
}

.camera-result img {
  max-height: 400px;
  border-radius: var(--radius-sm);
}

/* Screen */
.screen-result {
  margin-bottom: 16px;
  text-align: center;
}

/* Video */
.video-container {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  min-height: 300px;
  position: relative;
}

.video-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--muted);
  font-size: 14px;
}

/* GPS Info */
.gps-info {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.gps-detail {
  display: flex;
  gap: 6px;
  font-size: 13px;
}

.gps-label {
  color: var(--muted);
  font-weight: 500;
}

/* Loading */
.loading {
  text-align: center;
  padding: 20px;
  color: var(--muted);
}

/* Error */
.error-msg {
  color: var(--danger);
  padding: 12px;
  background: #fef2f2;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* Connection Status */
.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-dot.offline {
  background: var(--muted);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Error Message */
.error-message {
  color: var(--danger);
  text-align: center;
  padding: 12px;
  font-size: 14px;
  margin-top: 12px;
}

/* Topbar for Parent Dashboard */
.dashboard .topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-info h1 {
  font-size: 1.1rem;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #f8fafc;
}

.btn-secondary svg {
  width: 16px;
  height: 16px;
}

/* Responsive dashboard */
@media (max-width: 640px) {
  .dashboard .topbar {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .tab-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .gps-info {
    flex-direction: column;
    gap: 8px;
  }
}

/* ==================== PARENT DASHBOARD STYLES ==================== */

/* Parent App Container */
.app-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Parent Login Card */
.login-card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--line);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.logo-icon svg {
  width: 32px;
  height: 32px;
}

.logo-icon.small {
  width: 40px;
  height: 40px;
}

.logo-icon.small svg {
  width: 20px;
  height: 20px;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--muted);
  font-size: 0.875rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--ink);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary.btn-full {
  width: 100%;
}

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.error-message {
  color: var(--danger);
  font-size: 0.875rem;
  padding: 12px;
  background: #fef2f2;
  border-radius: var(--radius-sm);
  text-align: center;
}

/* Parent Dashboard */
.dashboard {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 1px solid var(--line);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-info h1 {
  font-size: 1.125rem;
  font-weight: 600;
}

.topbar-info p {
  font-size: 0.8125rem;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.status-dot.offline {
  background: var(--muted);
}

/* Dashboard Content */
.dashboard-content {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .dashboard-content {
    grid-template-columns: 1fr;
  }
}

/* Sections */
.section {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  overflow: hidden;
}

.section-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.section-header h2 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header h2 svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.section-header .muted {
  font-size: 0.8125rem;
  font-weight: 400;
  margin-top: 4px;
}

/* Badge Count */
.badge-count {
  background: var(--brand);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 24px;
  text-align: center;
}

/* Members List */
.members-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s;
}

.member-card:hover {
  border-color: var(--brand);
  background: white;
}

.member-card.active {
  border-color: var(--brand);
  background: rgba(59, 130, 246, 0.05);
}

.member-avatar {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.member-avatar svg {
  width: 24px;
  height: 24px;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-school {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-meta {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.device-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  color: var(--muted);
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.device-badge svg {
  width: 12px;
  height: 12px;
}

.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f8fafc;
  color: var(--muted);
}

.online-badge.has-online {
  background: #dcfce7;
  color: #166534;
}

.member-action {
  flex-shrink: 0;
}

.btn-select {
  padding: 8px 16px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 70px;
}

.btn-select:hover {
  background: var(--brand-dark);
}

.btn-select.selected {
  background: var(--success);
}

/* Devices Summary */
.devices-summary {
  display: flex;
  gap: 12px;
}

.online-count, .offline-count {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.devices-summary .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.devices-summary .dot.online { background: var(--success); }
.devices-summary .dot.offline { background: var(--muted); }

/* Devices List */
.devices-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 600px;
  overflow-y: auto;
}

.device-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all 0.2s;
}

.device-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.device-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.device-icon {
  width: 44px;
  height: 44px;
  background: var(--panel);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.device-icon svg {
  width: 24px;
  height: 24px;
}

.device-info {
  flex: 1;
  min-width: 0;
}

.device-name {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 2px;
}

.device-platform {
  font-size: 0.75rem;
  color: var(--muted);
}

.device-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.device-status.online {
  background: #dcfce7;
  color: #166534;
}

.device-status.offline {
  background: #f8fafc;
  color: var(--muted);
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.device-status.online .status-indicator {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.device-status.offline .status-indicator {
  background: var(--muted);
}

.device-details {
  padding: 12px 16px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.detail-item svg {
  width: 14px;
  height: 14px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.875rem;
}

/* Responsive Parent */
@media (max-width: 640px) {
  .app-container { padding: 12px; }
  .login-card { padding: 24px; }
  .topbar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .topbar-right {
    justify-content: space-between;
  }
  .dashboard-content {
    gap: 16px;
  }
  .section-header {
    flex-direction: column;
    gap: 12px;
  }
  .member-card {
    flex-wrap: wrap;
  }
  .member-action {
    width: 100%;
  }
  .btn-select {
    width: 100%;
  }
  .device-header {
    flex-wrap: wrap;
  }
  .device-details {
    flex-direction: column;
    gap: 8px;
  }
}