#session {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#wallpaper {
  position: absolute;
  inset: 0;
  background-color: #1a0a14;
  background-image: var(--wallpaper);
  background-size: cover;
  background-position: center;
  z-index: 0;
}

#wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 20% 10%, transparent 40%, rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 8px;
  background: var(--bg-topbar);
  color: #f6f5f4;
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  z-index: 80;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.topbar-right { justify-content: flex-end; }
.topbar-center { display: flex; justify-content: center; }

.topbar-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  color: #f6f5f4;
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: 0.01em;
}
.topbar-btn:hover, .topbar-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.1); }

#clock-btn { min-width: 168px; font-variant-numeric: tabular-nums; }

#status-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}
#status-btn .status-icons {
  display: flex;
  align-items: center;
  gap: 7px;
}
#status-btn svg { width: 16px; height: 16px; fill: currentColor; }

#desktop {
  position: absolute;
  inset: var(--topbar-h) 0 0 0;
  z-index: 1;
}

#desktop-icons {
  position: absolute;
  top: 16px;
  left: 84px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}

.desk-icon {
  width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 8px;
  color: var(--desktop-icon-fg);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.desk-icon:hover, .desk-icon.selected { background: rgba(255, 255, 255, 0.14); }
.desk-icon .ico { width: 48px; height: 48px; }
.desk-icon span {
  font-size: 12px;
  text-align: center;
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dock {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--dock-pad) 6px;
  background: var(--bg-dock);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  z-index: 70;
}

#dock-apps, #dock-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.dock-sep {
  width: 28px;
  height: 1px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.16);
}

.dock-item {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
}
.dock-item:hover, .dock-item.focused { background: rgba(255, 255, 255, 0.1); }
.dock-item .app-icon { width: 42px; height: 42px; transition: transform 120ms ease; }
.dock-item:hover .app-icon { transform: scale(1.08); }
.dock-item.urgent { animation: urgency 1s ease-in-out infinite; }

.running-dots {
  position: absolute;
  left: 1px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.running-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

@keyframes urgency {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  50% { box-shadow: inset 0 0 0 2px var(--accent); }
}

#overview {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: rgba(12, 8, 14, 0.42);
  backdrop-filter: blur(22px) saturate(1.1);
  -webkit-backdrop-filter: blur(22px) saturate(1.1);
  display: none;
  flex-direction: column;
  padding: calc(var(--topbar-h) + 18px) 96px 28px 96px;
}
#overview.open { display: flex; }

#overview-search {
  align-self: center;
  width: min(560px, 70vw);
  height: 44px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(32, 32, 32, 0.72);
  color: #fff;
  padding: 0 18px 0 42px;
  outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23c0bfbc' stroke-width='1.7'><circle cx='8' cy='8' r='5.5'/><path d='M12.2 12.2 16 16'/></svg>");
  background-repeat: no-repeat;
  background-position: 14px 50%;
}
#overview-search:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

#overview-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 148px;
  gap: 24px;
  min-height: 0;
  margin-top: 22px;
}

#window-spread, #app-grid {
  min-height: 0;
  overflow: auto;
}

#window-spread {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 22px;
  padding: 12px;
}

.spread-card {
  width: min(340px, 32vw);
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  background: var(--win-bg);
  border: 2px solid transparent;
  box-shadow: var(--shadow-win);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transform: scale(0.98);
  transition: transform 160ms ease, border-color 160ms ease;
}
.spread-card:hover, .spread-card:focus-visible {
  transform: scale(1);
  border-color: var(--accent);
}
.spread-card .thumb {
  position: absolute;
  inset: 0 0 28px 0;
  background: linear-gradient(160deg, #3a3a3a, #222);
}
.spread-card .caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  background: rgba(20, 20, 20, 0.88);
  color: #eee;
  font-size: 12px;
}
.spread-card .caption .app-icon { width: 16px; height: 16px; }

#app-grid { display: none; }
#overview.apps #window-spread { display: none; }
#overview.apps #app-grid { display: block; }

.grid-pages { height: 100%; }
.grid-page {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 18px 10px;
  padding: 8px 20px;
}
.app-tile, .folder-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 6px;
  border-radius: 14px;
  color: #f6f5f4;
}
.app-tile:hover, .folder-tile:hover, .app-tile:focus-visible { background: rgba(255, 255, 255, 0.1); }
.app-tile .app-icon, .folder-tile .folder-preview { width: 64px; height: 64px; }
.app-tile span, .folder-tile span { font-size: 13px; text-align: center; }
.folder-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}
.folder-preview .app-icon { width: 24px; height: 24px; }

.grid-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.grid-dots button {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}
.grid-dots button.on { background: #fff; }

#workspaces {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
.ws-thumb {
  height: 84px;
  border-radius: 10px;
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.18)),
    var(--wallpaper);
  background-size: cover;
  position: relative;
  overflow: hidden;
}
.ws-thumb.active { border-color: var(--accent); }
.ws-thumb:hover { outline: 1px solid rgba(255, 255, 255, 0.24); }
.ws-win {
  position: absolute;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.ws-add {
  height: 36px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  color: #eee;
  font-size: 20px;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10% 0;
}
.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  color: #f6f5f4;
}
.search-row:hover, .search-row.active { background: rgba(255, 255, 255, 0.1); }
.search-row .app-icon { width: 32px; height: 32px; }
.search-row small { color: #c0bfbc; margin-left: auto; }

#calendar-pop, #status-pop {
  position: fixed;
  top: calc(var(--topbar-h) + 6px);
  min-width: 320px;
  background: var(--bg-popover);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  backdrop-filter: blur(24px);
  z-index: 400;
  display: none;
}
#calendar-pop.open, #status-pop.open { display: block; }
#calendar-pop { left: 50%; transform: translateX(-50%); padding: 14px; }
#status-pop { right: 8px; width: 360px; padding: 12px; }

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 500;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}
.cal-grid .dow { color: var(--fg-muted); font-size: 11px; padding: 4px 0; }
.cal-day {
  height: 34px;
  border-radius: 17px;
  display: grid;
  place-items: center;
}
.cal-day.today {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 500;
}
.cal-day.out { color: var(--fg-faint); }
.cal-day:hover:not(.today) { background: var(--bg-hover); }
.cal-events {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 13px;
}

.qs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qs-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bg-hover);
  text-align: left;
  min-height: 52px;
}
.qs-tile.on { background: color-mix(in srgb, var(--accent) 78%, #222); color: #fff; }
.qs-tile .ico {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.08);
}
.qs-tile svg { width: 16px; height: 16px; fill: currentColor; }
.qs-tile b { display: block; font-size: 13px; font-weight: 500; }
.qs-tile small { display: block; font-size: 11px; opacity: 0.78; }

.qs-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--bg-hover);
}
.qs-slider input[type="range"] { flex: 1; accent-color: var(--accent); }

.qs-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.qs-actions button {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
}
.qs-actions button:hover { background: var(--bg-hover); }
.qs-actions svg { width: 18px; height: 18px; fill: currentColor; }

#notif-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.notif-card {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg-hover);
}
.notif-card b { display: block; font-size: 13px; }
.notif-card p { margin: 2px 0 0; font-size: 12px; color: var(--fg-muted); }
.notif-card .x { opacity: 0.6; padding: 2px 6px; }

#toast-root {
  position: absolute;
  top: calc(var(--topbar-h) + 10px);
  right: 14px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 360px;
  background: var(--bg-popover);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  animation: toast-in 180ms ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

#osd {
  position: absolute;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  z-index: 96;
  background: var(--osd-bg);
  color: var(--fg);
  border-radius: 18px;
  padding: 16px 22px;
  min-width: 180px;
  text-align: center;
  box-shadow: var(--shadow-pop);
  display: none;
}
#osd.show { display: block; }
#osd .bar {
  height: 6px;
  margin-top: 10px;
  border-radius: 3px;
  background: var(--bg-hover);
  overflow: hidden;
}
#osd .bar > i { display: block; height: 100%; background: var(--accent); }

#context-menu {
  position: fixed;
  z-index: 420;
  min-width: 198px;
  padding: 6px;
  background: var(--bg-popover);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  display: none;
}
#context-menu.open { display: block; }
#context-menu button, #context-menu .mi {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 10px;
  border-radius: 8px;
  text-align: left;
  color: var(--fg);
  font-size: 13.5px;
}
#context-menu button:hover, #context-menu .mi:hover { background: var(--bg-selected); }
#context-menu .sep { height: 1px; margin: 4px 6px; background: var(--border); }
#context-menu kbd { color: var(--fg-muted); font-family: var(--font); font-size: 11px; }

#tooltip {
  position: fixed;
  z-index: 430;
  background: #1a1a1a;
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
  display: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
#tooltip.show { display: block; }

#modal-root {
  position: fixed;
  inset: 0;
  z-index: 410;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
}
#modal-root.open { display: grid; }
.dialog {
  width: min(420px, 92vw);
  background: var(--win-bg);
  color: var(--fg);
  border-radius: 16px;
  box-shadow: var(--shadow-win);
  overflow: hidden;
}
.dialog h3 { margin: 0; padding: 16px 18px 0; font-size: 17px; font-weight: 500; }
.dialog p { margin: 8px 0 0; padding: 0 18px; color: var(--fg-dim); }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px;
}
.btn {
  min-width: 88px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--bg-hover);
}
.btn:hover { background: var(--bg-active); }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.destructive { background: #c01c28; color: #fff; }

#lock-screen, #boot-screen, #suspend-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
}
#lock-screen.show, #boot-screen.show, #suspend-screen.show { display: flex; }

#boot-screen, #suspend-screen {
  background: #0b0b0b;
  color: #eee;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 28px;
}
.boot-mark { width: 92px; height: 92px; }
.boot-dots { display: flex; gap: 10px; }
.boot-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: #4a4a4a;
}
.boot-dots i.on { background: var(--orange); }
.boot-caption { color: #9a9996; font-size: 13px; }

#lock-screen {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background-color: #1a0614;
  background-image: var(--wallpaper);
  background-size: cover;
  color: #fff;
}
#lock-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 6, 12, 0.45);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
}
.lock-inner { position: relative; text-align: center; }
.lock-time { font-size: 72px; font-weight: 400; letter-spacing: -2px; line-height: 1; margin-top: 8vh; }
.lock-date { font-size: 22px; opacity: 0.9; margin-top: 4px; }
.lock-user {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(160deg, var(--accent), var(--light-aubergine));
  display: grid; place-items: center;
  font-size: 34px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.lock-user input {
  width: 220px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(20, 20, 20, 0.55);
  color: #fff;
  text-align: center;
  padding: 0 10px;
}
.lock-hint { font-size: 12px; opacity: 0.75; }

#snap-preview {
  position: absolute;
  z-index: 50;
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 12px;
  pointer-events: none;
  display: none;
}
#snap-preview.show { display: block; }

.low-battery #status-btn .bat { color: #ed333b; }

body.night-light #session::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 150;
  background: rgba(255, 150, 60, 0.12);
  mix-blend-mode: multiply;
}

@media (max-width: 860px) {
  #dock { left: 4px; padding: 6px 4px; }
  .dock-item { width: 44px; height: 44px; }
  .dock-item .app-icon { width: 34px; height: 34px; }
  #overview { padding-left: 64px; padding-right: 12px; }
  #overview-body { grid-template-columns: 1fr 96px; }
  #desktop-icons { left: 60px; }
}
