:root {
  --bg: #09090b;
  --panel: #141414;
  --border: #27272a;
  --text: #fafafa;
  --muted: #71717a;
  --muted2: #a1a1aa;
  --brand: #22d3ee;
  --brand-dim: #0e7490;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.i { width: 1.4em; height: 1.4em; }

.farm {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
}

/* ---------- Header ---------- */
.header { padding: 1.5rem 0 1rem; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #06202a;
  background: linear-gradient(135deg, #22d3ee, #38bdf8);
}
.brand h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.brand p { font-size: 12px; color: var(--muted); }

.header-stats { display: flex; gap: 1.5rem; }
.stat { display: flex; flex-direction: column; align-items: flex-end; }
.stat-num { font-size: 20px; font-weight: 700; }
.stat-num.online { color: var(--green); }
.stat-num.accent { color: var(--brand); }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- Toolbar ---------- */
.toolbar { padding: 0.75rem 0; display: flex; flex-direction: column; gap: 0.625rem; }
.toolbar-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.add-group { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.select-group { display: flex; gap: 0.5rem; }

.num-input {
  width: 72px; height: 40px; padding: 0 0.625rem;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 14px; outline: none;
}
.num-input:focus { border-color: var(--brand-dim); }

.btn {
  height: 40px; padding: 0 0.875rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--muted2); font-size: 13px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.45rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s; white-space: nowrap;
}
.btn:hover { background: #1c1c1f; color: #fff; }
.btn .i { width: 1.15em; height: 1.15em; }
.btn.primary {
  background: linear-gradient(135deg, #22d3ee, #38bdf8); color: #06202a;
  border-color: transparent; font-weight: 700;
}
.btn.primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, #22d3ee, #38bdf8); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: rgba(248, 113, 113, 0.35); }
.btn.danger:hover { background: rgba(248, 113, 113, 0.1); }

.actions-bar { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 0.5rem 0.75rem; gap: 0.375rem; }
.actions-title { font-size: 12px; color: var(--muted); margin-right: 0.375rem; white-space: nowrap; }
.actions-title span { color: var(--brand); font-weight: 700; }
.btn.action { height: 34px; padding: 0 0.625rem; font-size: 12px; }

/* ---------- Grid ---------- */
.grid-wrap { flex: 1; padding: 0.5rem 0 1rem; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}

.empty { text-align: center; padding: 4rem 0; color: var(--muted); }
.empty p { font-size: 15px; }
.empty-sub { font-size: 13px; margin-top: 0.375rem; }

.sentinel { height: 1px; }

/* ---------- Device card ---------- */
.device {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 0.625rem; display: flex; flex-direction: column; gap: 0.5rem;
  transition: border-color 0.2s;
}
.device:hover { border-color: #3f3f46; }
.device.selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

.device-head { display: flex; align-items: center; justify-content: space-between; gap: 0.375rem; }
.device-check { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; flex-shrink: 0; }
.device-check-wrap { width: 18px; height: 18px; flex-shrink: 0; }
.device-title { min-width: 0; flex: 1; }
.device-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-meta { font-size: 11px; color: var(--muted); }

.status-pill {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.status-pill.online { color: var(--green); background: rgba(52, 211, 153, 0.12); }
.status-pill.offline { color: var(--muted); background: rgba(113, 113, 122, 0.15); }
.status-pill.booting { color: var(--amber); background: rgba(251, 191, 36, 0.12); }

/* =========================================================
   PHONE
========================================================= */
.phone {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 17;
  border-radius: 20px;
  border: 3px solid #3f3f46;
  overflow: hidden;
  background: #111;
  user-select: none;
}
.phone.off { filter: brightness(0.5) saturate(0.4); }
.phone.off .screen > * { display: none; }
.phone.booting .screen { animation: bootPulse 1s ease infinite; }
@keyframes bootPulse { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }

.notch {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 38%; height: 13px; border-radius: 999px; background: #0a0a0a; z-index: 12;
}

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  transition: background 0.4s ease;
  overflow: hidden;
}

.wallpaper { position: absolute; inset: 0; z-index: 0; }
.wall.aurora { background: linear-gradient(160deg, #0ea5e9, #22c55e, #3b0764); }
.wall.ocean { background: linear-gradient(160deg, #1e3a8a, #0e7490, #164e63); }
.wall.sunset { background: linear-gradient(160deg, #f97316, #dc2626, #7c2d12); }
.wall.forest { background: linear-gradient(160deg, #166534, #15803d, #1e3a8a); }
.wall.neon { background: linear-gradient(160deg, #d946ef, #8b5cf6, #0ea5e9); }
.wall.violet { background: linear-gradient(160deg, #6d28d9, #4c1d95, #1e1b4b); }

/* ---------- Status bar ---------- */
.statusbar {
  position: relative; z-index: 11;
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 10px; gap: 4px;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.sb-time { font-size: 8px; font-weight: 600; }
.sb-right { display: flex; align-items: center; gap: 4px; }
.sb-ic { font-size: 7px; font-weight: 700; opacity: 0.95; }
.sb-ic.off { opacity: 0.4; }
.battery {
  display: inline-flex; align-items: center; width: 15px; height: 8px;
  border: 1px solid rgba(255,255,255,0.7); border-radius: 2px; padding: 1px;
}
.bat-fill { display: block; height: 100%; background: #34d399; border-radius: 1px; }

/* ---------- Lockscreen ---------- */
.view { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.lockscreen { align-items: center; }
.lock-top { margin-top: 14%; text-align: center; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.5); }
.lock-top .clock-time { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.lock-date { font-size: 9px; opacity: 0.95; margin-top: 3px; }
.lock-notifs { margin-top: 8%; width: 84%; display: flex; flex-direction: column; gap: 5px; }
.notif {
  display: flex; gap: 6px; align-items: center;
  background: rgba(20,20,20,0.85); border-radius: 10px; padding: 6px 8px;
}
.notif-ic {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 7px; font-weight: 700; color: #fff;
}
.notif b { font-size: 8px; display: block; }
.notif span:last-child > span { font-size: 7px; opacity: 0.8; }
.notif.empty { justify-content: center; font-size: 8px; opacity: 0.6; }
.lock-hint { margin-top: auto; margin-bottom: 6px; font-size: 8px; color: rgba(255,255,255,0.8); text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.lock-handle {
  width: 72px; height: 16px; border-radius: 999px; background: rgba(255,255,255,0.85);
  margin-bottom: 8px; cursor: pointer;
}

/* ---------- Home ---------- */
.home { align-items: center; }
.home-widget { margin-top: 9%; text-align: center; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.5); }
.home-w-time { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.home-w-date { font-size: 8px; opacity: 0.95; margin-top: 2px; }
.home-apps {
  margin-top: auto; width: 100%;
  padding: 0 12px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.home-dock {
  width: 100%; margin-top: 8px; padding: 6px 12px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  background: rgba(0,0,0,0.25);
}
.app-icon {
  aspect-ratio: 1; width: 100%; border-radius: 22%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #fff; text-align: center; line-height: 1.05;
  cursor: pointer; user-select: none;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  transition: transform 0.1s;
}
.app-icon:active { transform: scale(0.9); }
.home-hint { font-size: 7px; color: rgba(255,255,255,0.7); padding: 4px 0 2px; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* ---------- Drawer ---------- */
.drawer { background: rgba(15,15,17,0.97); padding: 0 12px 8px; }
.drawer-head { font-size: 12px; font-weight: 700; color: #fff; padding: 12px 0 10px; }
.drawer .home-apps { margin-top: 0; }

/* ---------- App shell ---------- */
.app-screen { background: #f4f4f5; color: #18181b; flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.app-header {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border-bottom: 1px solid #e4e4e7;
  padding: 8px 10px; position: sticky; top: 0; z-index: 3;
}
.app-header span { font-size: 12px; font-weight: 600; flex: 1; text-align: center; }
.ah-btn { border: none; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: #18181b; padding: 0 2px; }

/* ---------- Settings ---------- */
.settings-list { display: flex; flex-direction: column; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-bottom: 1px solid #e4e4e7; background: #fff;
}
.set-label { font-size: 11px; font-weight: 500; }
.set-sub { font-size: 9px; color: #71717a; margin-top: 2px; font-weight: 400; }
.toggle {
  width: 34px; height: 18px; border-radius: 999px; border: none; background: #d4d4d8;
  position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.toggle span {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: left 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.toggle.on { background: #16a34a; }
.toggle.on span { left: 18px; }
.set-range { flex: 1; height: 4px; accent-color: #16a34a; }
.wall-thumbs { display: flex; gap: 5px; }
.wall-thumb { width: 24px; height: 24px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.wall-thumb.on { border-color: #16a34a; }
.storage-bar { flex: 1; height: 8px; background: #e4e4e7; border-radius: 999px; overflow: hidden; }
.storage-fill { height: 100%; background: #2563eb; border-radius: 999px; }
.storage-text { font-size: 9px; color: #71717a; margin: 4px 12px 10px; }

/* ---------- Calculator ---------- */
.app-calc { background: #18181b; }
.calc-display {
  color: #fff; font-size: 26px; font-weight: 300; text-align: right;
  padding: 14px 16px 8px; min-height: 52px; display: flex; align-items: flex-end; justify-content: flex-end;
  word-break: break-all;
}
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; }
.calc-key {
  aspect-ratio: 1.4 / 1; border: none; border-radius: 12px; background: #26262a; color: #fff;
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.calc-key.op { background: #1f6f52; color: #fff; }
.calc-key.clear { color: #f87171; }
.calc-key.eq { background: #16a34a; }
.calc-key.wide { grid-column: span 1; }

/* ---------- Notes ---------- */
.notes-list { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.note-card { background: #fff; border-radius: 10px; padding: 8px 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.note-text { font-size: 11px; line-height: 1.4; }
.note-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.note-foot span { font-size: 9px; color: #a1a1aa; }
.note-del { border: none; background: none; color: #ef4444; font-size: 9px; cursor: pointer; }
.note-compose { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #e4e4e7; background: #fff; }
.note-input { flex: 1; min-height: 34px; resize: none; border: 1px solid #d4d4d8; border-radius: 8px; padding: 6px; font-size: 11px; font-family: inherit; }
.empty-line { font-size: 10px; color: #a1a1aa; text-align: center; padding: 14px; }

/* ---------- Messages ---------- */
.msg-list { flex: 1; overflow-y: auto; }
.msg-thread { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: #fff; border-bottom: 1px solid #f0f0f2; cursor: pointer; }
.msg-thread:hover { background: #fafafa; }
.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: #16a34a; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.msg-info { flex: 1; min-width: 0; }
.msg-info b { font-size: 11px; display: block; }
.msg-info > span { font-size: 9px; color: #71717a; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-time { font-size: 8px; color: #a1a1aa; }
.thread-list { flex: 1; padding: 10px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.bubble { max-width: 78%; padding: 6px 9px; border-radius: 12px; font-size: 11px; line-height: 1.35; position: relative; }
.bubble.me { align-self: flex-end; background: #d1fae5; border-bottom-right-radius: 3px; }
.bubble.them { align-self: flex-start; background: #fff; border: 1px solid #e4e4e7; border-bottom-left-radius: 3px; }
.bubble-time { display: block; font-size: 7px; color: #6b7280; margin-top: 3px; text-align: right; }
.compose { display: flex; gap: 6px; padding: 8px; background: #fff; border-top: 1px solid #e4e4e7; }
.compose-input { flex: 1; height: 34px; border: 1px solid #d4d4d8; border-radius: 8px; padding: 0 9px; font-size: 11px; }
.compose-send { border: none; background: #16a34a; color: #fff; border-radius: 8px; padding: 0 12px; font-size: 10px; font-weight: 600; cursor: pointer; }

/* ---------- Dialer ---------- */
.app-dialer { background: #fff; }
.dial-display { font-size: 18px; font-weight: 600; text-align: center; padding: 12px 10px 6px; color: #18181b; letter-spacing: 0.05em; }
.dial-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 18px; }
.dial-key {
  aspect-ratio: 1.6 / 1; border: none; border-radius: 14px; background: #f4f4f5;
  font-size: 15px; font-weight: 600; color: #18181b; cursor: pointer;
}
.dial-key:active { background: #e4e4e7; }
.dial-actions { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 4px 0 8px; }
.dial-call {
  width: 46px; height: 46px; border-radius: 50%; border: none; background: #16a34a; color: #fff;
  font-size: 9px; font-weight: 700; cursor: pointer;
}
.call-log { border-top: 1px solid #e4e4e7; padding: 8px 12px; }
.call-item { font-size: 9px; color: #52525b; padding: 2px 0; }

/* ---------- Call screen ---------- */
.app-call { background: linear-gradient(160deg, #052e16, #14532d); align-items: center; color: #fff; }
.call-avatar {
  width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700;
  margin-top: 14%;
}
.call-name { font-size: 14px; font-weight: 600; margin-top: 12px; }
.call-status { font-size: 9px; opacity: 0.8; margin-top: 3px; }
.call-timer { font-size: 12px; font-weight: 300; margin-top: 8px; }
.call-end {
  margin-top: auto; margin-bottom: 26px;
  width: 48px; height: 48px; border-radius: 50%; border: none; background: #dc2626; color: #fff;
  font-size: 8px; font-weight: 700; cursor: pointer;
}

/* ---------- Camera ---------- */
.app-camera { background: #000; position: relative; }
.viewfinder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.vf-subject { color: #fff; font-size: 22px; opacity: 0.9; }
.cam-controls { position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; background: linear-gradient(transparent, rgba(0,0,0,0.6)); }
.cam-shutter {
  width: 42px; height: 42px; border-radius: 50%; border: 3px solid #fff; background: rgba(255,255,255,0.2);
  cursor: pointer; position: relative;
}
.cam-shutter::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.cam-thumb { border: none; background: rgba(255,255,255,0.2); color: #fff; font-size: 8px; font-weight: 700; border-radius: 6px; padding: 6px 8px; cursor: pointer; }

/* ---------- Photos ---------- */
.app-photos { background: #fff; }
.photos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 4px; cursor: pointer; }
.photo-badge {
  position: absolute; bottom: 3px; left: 3px; font-size: 7px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,0.5); border-radius: 4px; padding: 1px 4px;
}
.app-photo-view { background: #000; }
.photo-full { flex: 1; }

/* ---------- Clock ---------- */
.app-clock { background: #18181b; color: #fff; }
.clock-big { font-size: 30px; font-weight: 300; text-align: center; padding-top: 12%; }
.clock-sec { font-size: 9px; color: #a1a1aa; text-align: center; margin-top: 4px; }
.clock-tabs { display: flex; justify-content: center; gap: 14px; margin-top: 10%; font-size: 10px; color: #a1a1aa; }
.clock-tabs .on { color: #22d3ee; font-weight: 600; border-bottom: 2px solid #22d3ee; padding-bottom: 3px; }
.timer { text-align: center; margin-top: 10%; }
.timer-display { font-size: 24px; font-weight: 300; font-variant-numeric: tabular-nums; }
.timer-controls { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.timer-controls .mini-btn { background: #26262a; color: #e4e4e7; border: none; }

/* ---------- Weather ---------- */
.app-weather { background: linear-gradient(160deg, #0c4a6e, #0369a1); color: #fff; }
.weather-now { text-align: center; padding-top: 10%; }
.weather-ic { font-size: 22px; }
.weather-t { font-size: 28px; font-weight: 300; }
.weather-d { font-size: 11px; opacity: 0.9; }
.weather-week { display: flex; flex-direction: column; gap: 6px; margin: 10% 12px 0; }
.weather-day { display: flex; justify-content: space-between; font-size: 10px; background: rgba(255,255,255,0.1); border-radius: 8px; padding: 6px 10px; }
.w-ic { opacity: 0.9; }

/* ---------- Calendar ---------- */
.app-cal { background: #fff; }
.cal-title { text-align: center; font-size: 13px; font-weight: 700; padding: 10px 0 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 4px 8px; }
.cal-dow { text-align: center; font-size: 8px; font-weight: 600; color: #a1a1aa; padding: 4px 0; }
.cal-day { text-align: center; font-size: 9px; padding: 5px 0; border-radius: 6px; }
.cal-day.today { background: #dc2626; color: #fff; font-weight: 700; }
.cal-event { margin: 8px 12px; font-size: 10px; color: #52525b; background: #f4f4f5; border-radius: 8px; padding: 8px; text-align: center; }

/* ---------- Files ---------- */
.app-files { background: #fff; }
.files-path { font-size: 9px; color: #71717a; padding: 8px 12px; border-bottom: 1px solid #e4e4e7; word-break: break-all; }
.files-list { flex: 1; }
.file-item { padding: 9px 12px; border-bottom: 1px solid #f0f0f2; font-size: 11px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.file-item.folder { color: #2563eb; font-weight: 500; }
.file-item.file { color: #18181b; }
.file-item.up { color: #52525b; }

/* ---------- Browser ---------- */
.app-browser { background: #fff; }
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: #f4f4f5; border-bottom: 1px solid #e4e4e7; }
.bb-lock { font-size: 8px; color: #16a34a; font-weight: 700; }
.bb-input {
  flex: 1; height: 28px; border: none; background: #fff; border-radius: 6px;
  padding: 0 8px; font-size: 10px; outline: none; box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.browser-body { flex: 1; text-align: center; }
.browser-logo { font-size: 16px; font-weight: 700; color: #2563eb; margin-top: 12%; }
.browser-links { display: flex; flex-direction: column; gap: 8px; margin-top: 12%; padding: 0 20px; }
.bl { font-size: 11px; color: #2563eb; text-decoration: none; background: #f4f4f5; border-radius: 8px; padding: 8px; cursor: pointer; }
.webpage { text-align: left; padding: 14px; }
.wp-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.webpage p { font-size: 10px; color: #52525b; line-height: 1.5; margin-bottom: 8px; }

/* ---------- Nav bar ---------- */
.navbar {
  position: relative; z-index: 11;
  display: flex; align-items: center; justify-content: center; gap: 34px;
  height: 20px; background: rgba(0,0,0,0.35);
}
.nav-btn { background: none; border: none; cursor: pointer; padding: 0; width: 26px; height: 20px; display: flex; align-items: center; justify-content: center; }
.nv-back {
  width: 9px; height: 9px; border-left: 2px solid rgba(255,255,255,0.9); border-bottom: 2px solid rgba(255,255,255,0.9);
  transform: rotate(45deg);
}
.nv-home {
  width: 9px; height: 9px; border: 2px solid rgba(255,255,255,0.9); border-radius: 50%;
}
.nv-recents {
  width: 9px; height: 9px; border: 2px solid rgba(255,255,255,0.9); border-radius: 3px;
}

/* ---------- Shade ---------- */
.shade {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(17,17,19,0.96);
  display: flex; flex-direction: column; padding: 12px;
  animation: shadeIn 0.2s ease;
}
@keyframes shadeIn { from { transform: translateY(-12px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.shade-handle { width: 46px; height: 5px; border-radius: 999px; background: #3f3f46; margin: 2px auto 12px; cursor: pointer; }
.qs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qs-tile {
  background: #26262a; border: none; border-radius: 12px; color: #a1a1aa;
  padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.qs-tile.on { background: rgba(34, 211, 238, 0.2); color: #22d3ee; }
.qs-ic { font-size: 10px; font-weight: 700; }
.qs-tile span:last-child { font-size: 8px; }
.qs-bright { display: flex; align-items: center; gap: 8px; margin: 14px 4px; }
.qs-bright span { font-size: 9px; color: #a1a1aa; }
.qs-bright .set-range { accent-color: #22d3ee; }
.shade-notifs { display: flex; flex-direction: column; gap: 6px; }
.shade-notifs .notif { background: #1c1c1f; }
.shade-foot { margin-top: auto; text-align: center; padding-bottom: 6px; }
.shade-foot .mini-btn { border-color: #3f3f46; }

/* ---------- Power menu ---------- */
.power-menu {
  position: absolute; inset: 0; z-index: 21; background: rgba(0,0,0,0.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px;
}
.power-title { color: #fff; font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.pm-btn {
  width: 100%; max-width: 150px; height: 36px; border: none; border-radius: 12px;
  background: #26262a; color: #e4e4e7; font-size: 11px; font-weight: 600; cursor: pointer;
}
.pm-btn.danger { color: #f87171; }
.pm-btn:active { background: #33333a; }

/* ---------- Recents ---------- */
.recents {
  position: absolute; inset: 0; z-index: 22; background: rgba(9,9,11,0.92);
  display: flex; flex-direction: column; gap: 8px; padding: 30px 12px;
  overflow-y: auto;
}
.recents-title { color: #fff; font-size: 11px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.recent-item {
  display: flex; align-items: center; gap: 8px; background: #1c1c1f; border-radius: 12px; padding: 8px 10px;
  font-size: 11px; color: #e4e4e7; cursor: pointer;
}
.recent-ic { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 700; color: #fff; }

/* ---------- Device actions ---------- */
.device-actions { display: flex; gap: 0.375rem; }
.mini-btn {
  flex: 1; height: 28px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--muted2); font-size: 11px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mini-btn:hover { background: #1c1c1f; color: #fff; }
.mini-btn.power { color: var(--red); }
.mini-btn.power:hover { background: rgba(248,113,113,0.1); }

/* ---------- Console ---------- */
.console {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
}
.console-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
}
.console-head h2 { font-size: 14px; font-weight: 600; }
.console-actions { display: flex; gap: 0.375rem; }
.console.minimized .log-list { display: none; }

.log-list {
  max-height: 220px; overflow-y: auto; padding: 0.5rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; line-height: 1.7;
}
.log-line { display: flex; gap: 0.625rem; }
.log-time { color: var(--muted); flex-shrink: 0; }
.log-tag { color: var(--brand); flex-shrink: 0; }
.log-dev { color: var(--amber); flex-shrink: 0; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-msg { color: #d4d4d8; word-break: break-word; }
.log-line.warn .log-msg { color: var(--amber); }
.log-line.error .log-msg { color: var(--red); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-box {
  width: 100%; max-width: 460px; background: #18181b; border: 1px solid var(--border);
  border-radius: 16px; padding: 1.25rem; max-height: 92vh; overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.icon-btn { background: transparent; border: none; color: var(--muted2); font-size: 16px; cursor: pointer; }
.icon-btn:hover { color: #fff; }

.config-form { display: flex; flex-direction: column; gap: 0.75rem; }
.config-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 12px; color: var(--muted2); flex: 1; }
.config-form input,
.config-form select {
  height: 40px; padding: 0 0.75rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 13px; outline: none;
}
.config-form input:focus,
.config-form select:focus { border-color: var(--brand-dim); }
.form-row { display: flex; gap: 0.625rem; }
.form-actions { display: flex; gap: 0.625rem; margin-top: 0.25rem; }
.form-actions .btn { flex: 1; justify-content: center; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; bottom: 1rem; right: 1rem;
  display: flex; flex-direction: column; gap: 0.5rem; z-index: 70;
}
.toast {
  background: #18181b; border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: 10px; padding: 0.625rem 0.875rem; font-size: 12px; color: #e4e4e7;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5); animation: toastIn 0.2s ease; max-width: 320px;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .header-stats { width: 100%; justify-content: space-between; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .brand h1 { font-size: 16px; }
}
