/* ─── Variables ─────────────────────────────────── */
:root {
  --bg:        #1a1a1a;
  --surface:   #242424;
  --surface2:  #2e2e2e;
  --border:    rgba(255,255,255,0.08);
  --accent:    #F4C542;
  --accent-bg: rgba(244,197,66,0.12);
  --text:      #f0f0f0;
  --muted:     #888;
  --red:       #FF453A;
  --green:     #30D158;
  --blue:      #0A84FF;
  --radius:    12px;
  --radius-sm: 8px;
  --sidebar-w: 240px;
  --header-h:  60px;
}

/* ─── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  overflow-x: hidden;
}
a { cursor: pointer; text-decoration: none; }
.hidden { display: none !important; }

/* ─── Auth Loading ───────────────────────────────── */
.auth-loading {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg); display: flex;
  align-items: center; justify-content: center;
}
.auth-loading-content {
  display: flex; flex-direction: column;
  align-items: center; gap: 24px;
}
.loading-spinner {
  width: 40px; height: 40px; border: 3px solid var(--surface2);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Auth screen ────────────────────────────────── */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--bg); padding: 20px;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 40px 36px; width: 100%; max-width: 420px;
  display: flex; flex-direction: column; gap: 14px;
}
.brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 8px; }
.brand-logo { width: 64px; height: 64px; margin-bottom: 12px; object-fit: contain; }
.brand-name { font-size: 28px; font-weight: 700; color: var(--accent); letter-spacing: -0.5px; }
.brand-tag  { font-size: 12px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

.auth-footer {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 8px; font-size: 13px;
}
.auth-link-text { color: var(--muted); }
.auth-link {
  color: var(--accent); font-weight: 600; cursor: pointer;
  text-decoration: none; transition: opacity 0.2s;
}
.auth-link:hover { opacity: 0.8; }

/* Password field with eye toggle */
.input-password-wrap {
  position: relative; display: flex; align-items: center;
}
.input-password-wrap .input {
  flex: 1; padding-right: 44px;
}
.btn-eye {
  position: absolute; right: 12px;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); display: flex; align-items: center; padding: 4px;
  transition: color 0.2s;
}
.btn-eye:hover { color: var(--accent); }
.btn-eye svg { width: 20px; height: 20px; fill: currentColor; }

/* Forgot password link */
.auth-forgot {
  display: flex; justify-content: flex-end; margin-top: -4px;
}
.auth-forgot .auth-link { font-size: 13px; font-weight: 500; }

/* ─── Header (Mobile) ────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; z-index: 900;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.brand-header .brand-name { font-size: 18px; font-weight: 700; color: var(--accent); }
.user-email { font-size: 13px; color: var(--muted); display: none; }

.menu-toggle {
  background: transparent; border: none; color: var(--text);
  cursor: pointer; padding: 8px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.menu-toggle svg { width: 24px; height: 24px; fill: currentColor; }
.menu-toggle:hover { background: var(--surface2); }

.btn-icon {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; padding: 8px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.btn-icon svg { width: 20px; height: 20px; fill: currentColor; }
.btn-icon:hover { background: var(--surface2); color: var(--text); }

/* MQTT Status Indicator */
.mqtt-status {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 12px; font-size: 11px;
  font-weight: 600;
}
.mqtt-status svg { width: 10px; height: 10px; }
.mqtt-status-text { display: none; }
.mqtt-status.online { background: rgba(48,209,88,0.15); color: var(--green); }
.mqtt-status.online svg { fill: var(--green); }
.mqtt-status.offline { background: rgba(255,255,255,0.07); color: var(--muted); }
.mqtt-status.offline svg { fill: var(--muted); }

/* ─── App Shell ──────────────────────────────────── */
#appShell { padding-top: var(--header-h); min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: var(--surface);
  border-right: 1px solid var(--border); display: flex;
  flex-direction: column; padding: 24px 0; position: fixed;
  top: var(--header-h); left: 0; height: calc(100vh - var(--header-h));
  z-index: 800; transform: translateX(-100%);
  transition: transform 0.3s ease;
}
.sidebar.open { transform: translateX(0); }

.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 700; display: none; backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

.sidebar-brand {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 20px 20px; border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-name { font-size: 20px; }

nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; font-weight: 500;
  transition: all 0.15s; cursor: pointer;
}
.nav-item svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); }

.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}

.sidebar-mqtt-status {
  display: none; /* Hidden on mobile */
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.sidebar-mqtt-status .mqtt-status {
  width: 100%; justify-content: center; padding: 8px 12px;
  border-radius: 8px; font-size: 12px;
}

.sidebar-mqtt-status .mqtt-status-text {
  display: inline; /* Show text in sidebar */
}

.sidebar-mqtt-status .mqtt-status svg {
  width: 12px; height: 12px;
}

.sidebar-user-info {
  display: flex; flex-direction: column; gap: 2px;
  padding-bottom: 8px;
}

.sidebar-user-name {
  font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ─── Main content ───────────────────────────────── */
.main-content {
  padding: 24px 16px; min-height: calc(100vh - var(--header-h));
  max-width: 1400px; margin: 0 auto;
}

/* ─── Tabs ───────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Page header ────────────────────────────────── */
.page-title  { font-size: 24px; font-weight: 700; margin-bottom: 24px; }

/* ─── Alert Banner ───────────────────────────────── */
.alert-banner {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 20px;
  display: flex; flex-direction: column; gap: 12px;
  border-left: 4px solid var(--accent);
}
.alert-banner.hidden { display: none; }

.alert-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px; background: var(--bg);
  border-radius: var(--radius-sm);
}
.alert-item-content {
  display: flex; align-items: center; gap: 10px; flex: 1;
}
.alert-item-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.alert-item-icon.warning { background: rgba(244,197,66,0.15); color: var(--accent); }
.alert-item-icon.error { background: rgba(255,69,58,0.15); color: var(--red); }
.alert-item-icon.info { background: rgba(10,132,255,0.15); color: var(--blue); }
.alert-item-icon svg { width: 18px; height: 18px; fill: currentColor; }

.alert-item-text {
  flex: 1;
}
.alert-item-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 2px;
}
.alert-item-message {
  font-size: 12px; color: var(--muted);
}
.alert-item-time {
  font-size: 11px; color: var(--muted);
  white-space: nowrap;
}
.alert-dismiss {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; padding: 4px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.alert-dismiss:hover { background: var(--surface2); color: var(--text); }
.alert-dismiss svg { width: 16px; height: 16px; fill: currentColor; }


/* ─── Devices Grid ───────────────────────────────── */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 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;
  position: relative; overflow: hidden;
}
.device-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--accent); transform: scaleX(0);
  transition: transform 0.2s;
}
.device-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.device-card:hover::before { transform: scaleX(1); }

.device-card-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.device-card-disabled:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}
.device-card-disabled::before { display: none; }

.device-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 12px;
}
.device-icon {
  width: 64px; height: 64px; background: var(--surface2);
  border-radius: var(--radius-sm); display: flex;
  align-items: center; justify-content: center;
  padding: 8px;
}
.device-icon img { 
  width: 100%; height: 100%; object-fit: contain; 
}

.device-status-badge {
  padding: 4px 10px; border-radius: 12px; font-size: 10px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.device-status-badge.online { background: rgba(48,209,88,0.15); color: var(--green); }
.device-status-badge.offline { background: rgba(255,255,255,0.07); color: var(--muted); }

.device-card-body h3 {
  font-size: 16px; font-weight: 600; margin-bottom: 4px;
  color: var(--text);
}
.device-card-body .device-type {
  font-size: 12px; color: var(--muted);
}

.device-card-content {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-top: 12px;
}

.device-stats {
  display: flex; gap: 12px; align-items: center;
  margin-left: auto;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.device-stat {
  display: flex; flex-direction: column; align-items: center;
}
.stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  margin: 0 4px;
}
.stat-value {
  font-size: 20px; font-weight: 700; color: var(--accent);
}
.stat-label {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-top: 2px;
}

.device-update {
  font-size: 11px; color: var(--muted); margin-top: 8px;
  display: flex; align-items: center; gap: 4px;
}

/* ─── Card ───────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.card-body { padding: 24px; }

/* ─── Profile sections ────────────────────────────── */
.profile-section {
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.profile-section:last-child { border-bottom: none; }
.profile-value {
  font-size: 15px; color: var(--text); margin-top: 6px;
}

/* ─── Empty state ────────────────────────────────── */
.empty-state { 
  padding: 64px 24px; text-align: center; 
  color: var(--muted); font-size: 14px;
}
.empty-icon {
  width: 64px; height: 64px; fill: var(--muted);
  opacity: 0.3; margin: 0 auto 16px;
}
.empty-state p { margin: 8px 0; }

/* ─── Inputs ─────────────────────────────────────── */
.input {
  width: 100%; padding: 12px 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; outline: none; transition: border 0.2s;
}
.input:focus { border-color: var(--accent); }
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--surface2) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* ─── Buttons ────────────────────────────────────── */
.btn {
  padding: 12px 24px; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 600; cursor: pointer; border: none; transition: all 0.15s;
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 8px;
}
.btn-accent  { background: var(--accent); color: #1a1000; }
.btn-accent:hover  { background: #f7d060; color: #000000; }
.btn-primary {
  background: var(--accent); color: #1a1000;
  padding: 10px 24px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.15s;
}
.btn-primary:hover { background: #f7d060; }
.btn-secondary {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 24px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover {
  background: var(--border); border-color: var(--accent);
}
.btn-outline-sm { 
  padding: 8px 16px; font-size: 13px; background: transparent;
  color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; width: 100%;
}
.btn-outline-sm:hover { color: var(--text); background: var(--surface2); }

/* ─── Modals ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px); padding: 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; width: 100%; max-width: 500px;
  max-height: 90vh; overflow-y: auto; 
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.modal-device { max-width: 600px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  font-size: 18px; font-weight: 700;
}
.modal-title-block { flex: 1; }
.modal-title-block span:first-child { 
  font-size: 18px; font-weight: 700; display: block;
}
.modal-subtitle {
  font-size: 13px; color: var(--muted); display: block; margin-top: 2px;
}

.modal-header-actions {
  display: flex; align-items: center; gap: 8px;
  margin-left: 12px; flex-shrink: 0;
}

.modal-action-btn {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; font-size: 12px;
  padding: 6px 10px; border-radius: 6px;
  display: flex; align-items: center; gap: 6px;
  font-weight: 500; transition: all 0.15s;
}
.modal-action-btn svg {
  width: 16px; height: 16px; fill: currentColor;
}
.modal-action-btn:hover {
  color: var(--text); background: var(--accent-bg);
  border-color: var(--accent);
}

.modal-close {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 20px; padding: 4px 8px; border-radius: 4px;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }

.modal-body  { padding: 20px; }

/* Confirmation Modal */
.modal-confirm { max-width: 480px; }
.modal-confirm .modal-body { padding: 24px; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; }

/* ─── Create Account Modal ────────────────────────── */
.modal-create-account { max-width: 520px; }

.app-download-info {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}

.app-icon {
  width: 64px; height: 64px; fill: var(--accent);
  margin-bottom: 16px;
}

.app-download-title {
  font-size: 20px; font-weight: 700; margin-bottom: 12px;
  color: var(--text);
}

.app-download-desc {
  font-size: 14px; color: var(--muted); line-height: 1.6;
  margin-bottom: 24px; max-width: 400px;
}

.app-steps {
  width: 100%; max-width: 450px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 24px; text-align: left;
}

.app-step {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.app-step:last-child { border-bottom: none; }

.step-number {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}

.step-text {
  font-size: 14px; color: var(--text); line-height: 1.4;
}

.download-buttons {
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 450px;
  align-items: center; justify-content: center;
}

.download-btn {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 20px;
  cursor: pointer; transition: all 0.2s; text-decoration: none;
  width: 100%; max-width: 220px;
}
.download-btn:hover {
  background: var(--bg); border-color: var(--accent);
  transform: translateY(-1px);
}

.download-btn svg {
  width: 30px; height: 30px; fill: var(--text); flex-shrink: 0;
}

.download-btn > div {
  display: flex; flex-direction: column; align-items: flex-start;
  text-align: left;
}

.download-label {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.3px; display: block; line-height: 1.2;
}

.download-store {
  font-size: 15px; font-weight: 600; color: var(--text);
  display: block; margin-top: 2px; line-height: 1.2;
}

/* ─── Device Control Modal ────────────────────────── */
.device-status-bar {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin-bottom: 24px;
}
.status-item {
  background: var(--surface2); border-radius: var(--radius-sm);
  padding: 12px; text-align: center;
}
.status-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; display: block; margin-bottom: 6px;
}
.status-value {
  font-size: 14px; font-weight: 600; color: var(--text);
}

.control-panel {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}

.control-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.control-item:last-child { border-bottom: none; }
.control-label {
  font-size: 14px; font-weight: 500; color: var(--text);
}
.control-label-desc {
  font-size: 12px; color: var(--muted); margin-top: 2px;
}

/* Toggle Switch */
.switch {
  position: relative; display: inline-block;
  width: 48px; height: 26px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: var(--surface2); transition: 0.3s;
  border-radius: 26px; border: 1px solid var(--border);
}
.slider:before {
  position: absolute; content: ""; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background-color: var(--muted);
  transition: 0.3s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-bg); border-color: var(--accent); }
input:checked + .slider:before { transform: translateX(22px); background-color: var(--accent); }

/* Brightness Slider */
.brightness-slider {
  width: 120px; height: 4px; -webkit-appearance: none; appearance: none;
  background: var(--surface2); outline: none; border-radius: 2px;
}
.brightness-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; background: var(--accent);
  cursor: pointer; border-radius: 50%;
}
.brightness-slider::-moz-range-thumb {
  width: 16px; height: 16px; background: var(--accent);
  cursor: pointer; border-radius: 50%; border: none;
}

/* Device Info Section */
.device-info-section {
  background: var(--surface2); border-radius: var(--radius-sm);
  padding: 16px;
}
.info-section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.info-section-header h3 {
  font-size: 13px; font-weight: 600; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-small {
  padding: 6px 12px; font-size: 12px; border-radius: 6px;
  border: none; cursor: pointer; display: flex; align-items: center;
  gap: 6px; font-weight: 600; transition: all 0.2s;
  background: var(--surface2);
  color: var(--text);
}
.btn-small:hover { opacity: 0.8; }
.btn-accent { background: var(--accent-bg); color: var(--accent); }
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
}
.info-divider {
  height: 1px; background: var(--border); margin: 12px 0;
}
.info-label { font-size: 12px; color: var(--muted); }
.info-value { font-size: 13px; color: var(--text); }

/* ─── Form elements ──────────────────────────────── */
.form-label { 
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px; display: block;
}

/* ─── Misc ───────────────────────────────────────── */
.muted  { color: var(--muted); }
.accent { color: var(--accent); }
.mono   { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; }
.error-msg { color: var(--red); font-size: 13px; min-height: 18px; }

/* ─── Toast ──────────────────────────────────────── */
/* Toast Container */
.toast-container {
  position: fixed; 
  bottom: 28px; 
  left: 50%; 
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); padding: 12px 24px; border-radius: 100px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4); 
  transition: opacity 0.3s, transform 0.3s;
  max-width: 90vw; text-align: center;
  pointer-events: auto;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.success { background: rgba(48,209,88,0.2); border-color: var(--green); color: var(--green); }
.toast.error   { background: rgba(255,69,58,0.2);  border-color: var(--red);   color: var(--red); }
.toast.info    { background: rgba(10,132,255,0.2); border-color: var(--blue);  color: var(--blue); }
.toast.warning { background: rgba(255,214,10,0.2); border-color: var(--accent); color: var(--accent); }

/* ─── Responsive Design ──────────────────────────── */

/* Mobile */
@media (max-width: 767px) {
  /* Hide sidebar brand — header already shows the name on mobile */
  .sidebar-brand { display: none; }

  /* Tighten up font sizes */
  .page-title { font-size: 18px; margin-bottom: 16px; }
  .device-card-body h3 { font-size: 14px; }
  .nav-item { font-size: 13px; padding: 10px; }
  .sidebar-user-name { font-size: 13px; }
  .sidebar-user-email { font-size: 11px; }

  /* Tighter card padding */
  .device-card { padding: 14px; }
  .main-content { padding: 16px 12px; }

  /* Add bottom margin to sidebar for mobile browser nav */
  .sidebar-footer { margin-bottom: 40px; }
}

/* Tablet */
@media (min-width: 768px) {
  .main-content { padding: 32px 24px; }
  .user-email { display: block; }
  .devices-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .download-buttons { flex-direction: row; gap: 16px; }
}

/* Desktop */
@media (min-width: 1024px) {
  .menu-toggle { display: none; }
  .header { display: none; }
  #appShell { padding-top: 0; }
  
  .sidebar-mqtt-status { display: block; } /* Show MQTT status in sidebar on desktop */
  
  .sidebar {
    transform: translateX(0);
    top: 0; height: 100vh;
  }
  .sidebar-overlay { display: none !important; }
  
  .sidebar-footer {
    padding: 16px 20px; /* Consistent padding for desktop */
    margin-bottom: 0; /* Remove bottom margin on desktop */
  }
  
  .main-content {
    margin-left: var(--sidebar-w);
    padding: 40px;
  }
  
  .devices-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}

/* ─── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface2); }

/* ─── Enhanced Profile ───────────────────────────── */
.profile-banner {
  display: flex; align-items: center; gap: 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 0;
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent-bg); border: 2px solid var(--accent);
  color: var(--accent); font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-banner-name {
  font-size: 18px; font-weight: 700; color: var(--text);
}
.profile-banner-email {
  font-size: 13px; color: var(--muted); margin-top: 4px;
  word-break: break-all;
}

/* Stats row */
.profile-stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-top: 12px;
}
.profile-stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 12px;
  text-align: center;
}
.profile-stat-value {
  font-size: 22px; font-weight: 700; color: var(--accent);
}
.profile-stat-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-top: 4px;
}

/* Info rows */
.profile-info-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.profile-info-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface2); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--accent);
}
.profile-info-icon svg { width: 18px; height: 18px; fill: currentColor; }
.profile-info-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin-bottom: 3px;
}
.profile-info-value { font-size: 15px; color: var(--text); font-weight: 500; }

/* Account actions */
.profile-actions-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin-bottom: 8px;
}
.profile-action-btn {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: transparent; border: none; padding: 14px 0;
  color: var(--text); cursor: pointer; font-size: 14px; font-weight: 500;
  border-bottom: 1px solid var(--border); transition: color 0.2s;
}
.profile-action-btn:last-child { border-bottom: none; }
.profile-action-btn svg:first-child { width: 20px; height: 20px; fill: currentColor; color: var(--muted); }
.profile-action-chevron { width: 18px; height: 18px; fill: currentColor; color: var(--muted); margin-left: auto; }
.profile-action-btn:hover { color: var(--accent); }
.profile-action-danger { color: var(--red) !important; }
.profile-action-danger:hover { color: var(--red) !important; opacity: 0.8; }

/* Sessions List */
.sessions-list {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 12px;
}
.sessions-loading {
  padding: 20px; text-align: center; color: var(--muted);
  font-size: 13px;
}
.session-item {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color 0.2s;
}
.session-item.current-session {
  border-color: var(--accent); background: var(--accent-bg);
}
.session-item-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg); display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}
.session-item-icon svg {
  width: 20px; height: 20px; fill: var(--text);
}
.session-item.current-session .session-item-icon {
  background: var(--accent-bg);
}
.session-item.current-session .session-item-icon svg {
  fill: var(--accent);
}
.session-item-content {
  flex: 1; min-width: 0;
}
.session-item-header {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 3px;
}
.session-item-title {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.session-item-badge {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: var(--accent-bg); color: var(--accent);
  text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px;
}
.session-item-info {
  font-size: 12px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.session-item-time {
  font-size: 11px; color: var(--muted); margin-top: 2px;
}
.session-item-logout {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); padding: 6px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; flex-shrink: 0;
}
.session-item-logout:hover {
  background: var(--red); border-color: var(--red);
  color: #fff;
}

/* ─── Slide-to-Verify ────────────────────────────── */
.modal-slide-verify { max-width: 380px; }

.verify-desc {
  font-size: 13px; color: var(--muted); text-align: center;
  margin-bottom: 24px; line-height: 1.6;
}

.slide-track {
  position: relative; height: 54px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 27px; overflow: hidden;
  user-select: none; touch-action: none;
}

.slide-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: linear-gradient(90deg, rgba(244,197,66,0.25), rgba(244,197,66,0.1));
  pointer-events: none; transition: background 0.3s;
}
.slide-fill.sv-fill-success {
  background: linear-gradient(90deg, rgba(48,209,88,0.35), rgba(48,209,88,0.15));
}

.slide-thumb {
  position: absolute; left: 4px; top: 4px;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); cursor: grab;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4); z-index: 2;
  transition: background 0.3s;
}
.slide-thumb svg { width: 22px; height: 22px; fill: #1a1a1a; pointer-events: none; }
.slide-thumb.dragging { cursor: grabbing; }
.slide-thumb.sv-snap { transition: left 0.3s ease; }
.slide-thumb.sv-success { background: var(--green); }

.slide-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted); pointer-events: none;
  z-index: 1; transition: opacity 0.2s;
}
.slide-label.sv-label-hidden { opacity: 0; }

/* ─── Disable Hover Effects on Touch Devices ───────────────────────────────── */
/* Remove all hover effects on mobile/touch screens */
@media (hover: none) {
  .auth-link:hover { opacity: 1; }
  .btn-eye:hover { color: var(--muted); }
  .menu-toggle:hover { background: transparent; }
  .btn-icon:hover { background: transparent; color: var(--muted); }
  .nav-item:hover { background: transparent; color: var(--muted); }
  .alert-dismiss:hover { background: transparent; color: var(--muted); }
  .device-card:hover {
    border-color: var(--border);
    transform: none;
    box-shadow: none;
  }
  .device-card:hover::before { transform: scaleX(0); }
  .device-card-disabled:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: none;
  }
  .btn-accent:hover { background: var(--accent); color: #1a1000; }
  .btn-primary:hover { background: var(--accent); }
  .btn-secondary:hover {
    background: var(--surface2);
    border-color: var(--border);
  }
  .btn-outline-sm:hover { color: var(--muted); background: transparent; }
  .modal-action-btn:hover {
    color: var(--muted);
    background: transparent;
    border-color: var(--border);
  }
  .modal-close:hover { color: var(--muted); background: transparent; }
  .download-btn:hover {
    background: var(--surface2);
    border-color: var(--border);
    transform: none;
  }
  .btn-small:hover { opacity: 1; }
  .profile-action-btn:hover { color: var(--text); }
  .profile-action-danger:hover { color: var(--red) !important; opacity: 1; }
}

