@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary: #1B4332;
  --primary-dark: #2D6A4F;
  --primary-light: #40916C;
  --secondary: #52B788;
  --accent: #F0F4F0;
  --accent-dark: #05b88a;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --success: #10b981;
  --success-bg: #d1fae5;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
}

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

::selection {
  background: var(--primary);
  color: white;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
}

/* ===== APP SHELL ===== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--secondary);
  color: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.header-icon {
  font-size: 1.5rem;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.08);
  padding: 6px 14px;
  border-radius: 20px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.status-dot.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(6, 214, 160, 0.5); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(6, 214, 160, 0); }
}

.status-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== TAB BAR ===== */
.tab-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 16px;
  gap: 4px;
  position: sticky;
  top: 56px;
  z-index: 90;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-icon {
  font-size: 1rem;
}

.app-main {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ===== STATS ROW ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.5s ease both;
}

.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }

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

.stat-icon {
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.stat-primary .stat-icon { background: var(--primary-light); }
.stat-success .stat-icon { background: var(--success-bg); }
.stat-danger .stat-icon { background: var(--danger-bg); }
.stat-warning .stat-icon { background: var(--warning-bg); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  display: block;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== ALERTS BANNER ===== */
.alerts-banner {
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #92400e;
  animation: fadeInUp 0.4s ease both;
}

.alert-icon {
  font-size: 1.1rem;
}

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.device-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* ===== DEVICE GRID ===== */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.device-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.5s ease both;
}

.device-card:nth-child(1) { animation-delay: 0.05s; }
.device-card:nth-child(2) { animation-delay: 0.1s; }
.device-card:nth-child(3) { animation-delay: 0.15s; }
.device-card:nth-child(4) { animation-delay: 0.2s; }
.device-card:nth-child(5) { animation-delay: 0.25s; }
.device-card:nth-child(6) { animation-delay: 0.3s; }

.device-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.device-card.online {
  border-left: 3px solid var(--success);
}

.device-card.offline {
  border-left: 3px solid var(--text-muted);
}

.device-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.device-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-type-icon {
  font-size: 1.5rem;
}

.device-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
}

.device-location {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== STATUS BADGES ===== */
.device-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-online {
  background: var(--success-bg);
  color: #065f46;
}

.badge-offline {
  background: var(--border-light);
  color: var(--text-muted);
}

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

.badge-online .badge-dot { background: var(--success); }
.badge-offline .badge-dot { background: var(--text-muted); }

.mini-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* ===== DEVICE READINGS ===== */
.device-readings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.reading-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.reading-icon {
  font-size: 0.9rem;
}

.reading-key {
  color: var(--text-muted);
  font-weight: 500;
}

.reading-val {
  font-weight: 600;
  color: var(--text);
}

.no-readings {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 14px;
}

.device-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.last-seen {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.view-detail {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
}

/* ===== DETAIL VIEW ===== */
.detail-view {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  animation: fadeInUp 0.4s ease both;
}

.detail-identity {
  display: flex;
  align-items: center;
  gap: 16px;
}

.detail-icon {
  font-size: 2.5rem;
}

.detail-name {
  font-size: 1.5rem;
  font-weight: 700;
}

.detail-location {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
  animation: fadeInUp 0.4s ease 0.05s both;
}

.meta-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.meta-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.meta-value {
  font-weight: 600;
  font-size: 0.95rem;
}

/* ===== CURRENT READINGS ===== */
.current-readings-section {
  margin-bottom: 28px;
  animation: fadeInUp 0.4s ease 0.1s both;
}

.readings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.reading-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: transform 0.2s ease;
}

.reading-card:hover {
  transform: translateY(-2px);
}

.reading-card-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 8px;
}

.reading-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
  color: var(--primary);
}

.reading-card-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* ===== CHART ===== */
.chart-section {
  margin-bottom: 28px;
  animation: fadeInUp 0.4s ease 0.15s both;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.metric-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.metric-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: capitalize;
}

.metric-btn:hover {
  background: var(--surface);
}

.metric-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  height: 280px;
}

/* ===== READING HISTORY ===== */
.reading-history {
  animation: fadeInUp 0.4s ease 0.2s both;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.history-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}

.history-data {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-chip {
  background: var(--bg);
  border-radius: var(--radius-xs);
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 500;
}

/* ===== DATA FEED ===== */
.feed-view {
  animation: fadeInUp 0.3s ease both;
}

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.feed-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.feed-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feed-filter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.feed-filter:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.feed-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.4s ease both;
}

.feed-item:nth-child(1) { animation-delay: 0s; }
.feed-item:nth-child(2) { animation-delay: 0.03s; }
.feed-item:nth-child(3) { animation-delay: 0.06s; }
.feed-item:nth-child(4) { animation-delay: 0.09s; }
.feed-item:nth-child(5) { animation-delay: 0.12s; }

.feed-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.feed-device {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-device-icon {
  font-size: 1.1rem;
}

.feed-device-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.feed-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.feed-data {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feed-chip {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 4px 10px;
  font-size: 0.8rem;
  display: flex;
  gap: 6px;
}

.feed-chip.muted {
  color: var(--text-muted);
  font-style: italic;
}

.chip-key {
  color: var(--text-muted);
}

.chip-val {
  font-weight: 600;
}

/* ===== DEVICE MANAGER ===== */
.manager-view {
  animation: fadeInUp 0.3s ease both;
}

.manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.manager-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.manager-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.device-list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.4s ease both;
}

.device-list-item:nth-child(1) { animation-delay: 0s; }
.device-list-item:nth-child(2) { animation-delay: 0.05s; }
.device-list-item:nth-child(3) { animation-delay: 0.1s; }

.dli-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.dli-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.dli-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dli-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.dli-location {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dli-id {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dli-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.dli-lastseen {
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-secondary {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--surface);
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg);
}

.btn-icon.danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.btn-danger-sm {
  background: var(--danger);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost-sm {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.confirm-row {
  display: flex;
  gap: 4px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 0.3s ease;
}

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

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

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

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

/* ===== FORM ===== */
.device-form {
  padding: 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-option {
  width: 42px;
  height: 42px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-option:hover {
  border-color: var(--primary);
}

.icon-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

/* ===== WEBHOOK INFO ===== */
.webhook-info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 20px 24px;
  animation: fadeInUp 0.4s ease 0.2s both;
}

.webhook-info-card h4 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.webhook-info-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hint-text code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
}

.code-block {
  background: var(--secondary);
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.webhook-hint {
  margin-top: 20px;
}

.webhook-hint h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.setup-steps {
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  animation: fadeInUp 0.4s ease both;
}

.empty-state.small {
  padding: 28px 16px;
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ===== SKELETONS ===== */
.loading-skeleton {
  animation: fadeIn 0.3s ease;
}

.skel-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.skel-stat {
  height: 88px;
  background: linear-gradient(110deg, var(--border-light) 30%, var(--surface) 50%, var(--border-light) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

.skel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.skel-card {
  height: 200px;
  background: linear-gradient(110deg, var(--border-light) 30%, var(--surface) 50%, var(--border-light) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

.skel-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skel-feed-item {
  height: 60px;
  background: linear-gradient(110deg, var(--border-light) 30%, var(--surface) 50%, var(--border-light) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-main {
    padding: 16px;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 1.35rem;
  }

  .device-grid {
    grid-template-columns: 1fr;
  }

  .detail-meta {
    grid-template-columns: 1fr;
  }

  .readings-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .feed-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .manager-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .device-list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .dli-main {
    width: 100%;
  }

  .dli-actions {
    align-self: flex-end;
  }

  .dli-status {
    flex-direction: row;
    gap: 10px;
    align-items: center;
  }

  .tab-label {
    display: none;
  }

  .tab-btn {
    padding: 12px 16px;
  }

  .tab-icon {
    font-size: 1.2rem;
  }

  .skel-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .skel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }

  .readings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-title {
    font-size: 1rem;
  }
}
```

<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to your IoT Command Center! This dashboard monitors all your connected devices in real-time. Let's take a tour.", "view": "dashboard", "highlight_selector": ".app-header", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "The top stats show your total devices, how many are online, offline, and any alerts from abnormal readings.", "view": "dashboard", "highlight_selector": ".stats-row", "wait_for": "tap_to_continue"},
  {"step": 3, "narration": "Each device card shows its current status, latest sensor readings, and when it last reported in. Click any card to see detailed history and charts.", "view": "dashboard", "highlight_selector": ".device-grid", "wait_for": "tap_to_continue"},
  {"step": 4, "narration": "The Live Feed tab shows every data point received from all devices in chronological order. You can filter by specific device.", "view": "feed", "highlight_selector": ".tab-btn:nth-child(2)", "wait_for": "tap_to_continue"},
  {"step": 5, "narration": "Head to the Devices tab to register your IoT devices. Each device gets a unique ID that you'll use in your webhook payloads.", "view": "devices", "highlight_selector": ".tab-btn:nth-child(3)", "wait_for": "tap_to_continue"},
  {"step": 6, "narration": "After registering a device, configure your IoT hardware to POST JSON data to your app's webhook endpoint. Include the device ID and any sensor readings in the payload.", "view": "devices", "highlight_selector": ".webhook-info-card", "wait_for": "tap_to_continue"},
  {"step": 7, "narration": "Click on any device from the dashboard to see its detailed view — including current readings, historical charts, and a log of all data points.", "view": "dashboard", "highlight_selector": ".device-card", "wait_for": "tap_to_continue"}
]
-->

.sensor-charts-section {
  margin-bottom: 28px;
  animation: fadeInUp 0.4s ease 0.18s both;
}

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

.sensor-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.sensor-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.sensor-chart-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: capitalize;
}

.sensor-chart-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sensor-chart-canvas-wrap {
  height: 220px;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.export-history-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.dli-api {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-command-actions {
  align-items: flex-start;
  gap: 10px;
}

.command-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.btn-command {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid transparent;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-command:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.btn-command:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.command-banner.success {
  background: var(--success-bg);
  border-color: var(--success);
  color: #065f46;
}

.command-banner.error {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: #991b1b;
}

.command-banner.info {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.command-info-card {
  margin-top: 16px;
}

@media (max-width: 768px) {
  .device-command-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .command-buttons {
    justify-content: flex-start;
  }
}
