/* ============ top bar ============ */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  z-index: 6000;
  display: flex; align-items: stretch;
  background: var(--topbar-bg);
  color: #fff; font-size: 13px;
  backdrop-filter: blur(12px);
}
.tb-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; background: transparent; color: #fff;
  padding: 0 12px; font-size: 13px; border-radius: 999px;
  margin: 4px 2px; transition: background var(--dur-fast);
}
.tb-btn:hover { background: rgba(255,255,255,.12); }
.tb-btn:active, .tb-btn.open { background: rgba(255,255,255,.22); }
#tb-activities { margin-left: 6px; }
#tb-clock { position: absolute; left: 50%; transform: translateX(-50%); font-weight: 500; }
#tb-appname {
  position: absolute; left: 120px; display: flex; align-items: center;
  font-weight: 700; font-size: 13px; opacity: 0; transition: opacity var(--dur-med);
  pointer-events: none;
}
#tb-appname.visible { opacity: 1; }
#tb-right { margin-left: auto; display: flex; align-items: stretch; }
#tb-indicators { display: flex; align-items: center; gap: 6px; padding: 0 4px 0 8px; }
.tb-ind { display: flex; align-items: center; }
.tb-ind svg { width: 15px; height: 15px; }
.tb-ind.warn svg { color: var(--warning); }
.tb-ind.low svg { color: var(--error); }
#tb-tray { margin-right: 6px; }
#tb-tray svg { width: 15px; height: 15px; }

/* ============ dock ============ */
#dock {
  position: fixed; left: 0; top: var(--topbar-h); bottom: 0;
  width: var(--dock-w); z-index: 5000;
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0; gap: 4px;
  background: var(--dock-bg);
  backdrop-filter: blur(10px);
  transition: transform var(--dur-med) var(--ease-standard), opacity var(--dur-med);
}
#dock.dock-hidden { transform: translateX(-100%); opacity: 0; pointer-events: none; }
.dock-item {
  position: relative; width: 48px; height: 48px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; border: none; background: transparent;
  transition: background var(--dur-fast), transform var(--dur-fast);
}
.dock-item:hover { background: rgba(255,255,255,.14); }
.dock-item:active { background: rgba(255,255,255,.2); }
.dock-item img, .dock-item svg.app-icon { width: 40px; height: 40px; }
.dock-item .dock-dot {
  position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255,255,255,.85);
  opacity: 0; transition: opacity var(--dur-fast);
}
.dock-item.running .dock-dot { opacity: 1; }
.dock-item.focused { background: rgba(255,255,255,.22); }
.dock-item.urgent { animation: dock-urgent 1.2s ease-in-out infinite; }
@keyframes dock-urgent {
  0%, 100% { background: transparent; }
  50% { background: var(--accent-subtle); }
}
.dock-item.launching img, .dock-item.launching svg.app-icon { animation: dock-launch .5s var(--ease-decel); }
@keyframes dock-launch {
  0% { transform: scale(.6); opacity: .3; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.dock-sep { width: 32px; height: 1px; background: rgba(255,255,255,.2); margin: 4px 0; flex: none; }
.dock-spacer { flex: 1; }
.dock-tooltip {
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: rgba(20,20,20,.92); color: #fff; font-size: 12.5px;
  padding: 4px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity var(--dur-fast) var(--ease-standard);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.dock-item:hover .dock-tooltip { opacity: 1; transition-delay: .35s; }

/* ============ popovers ============ */
.popover {
  position: fixed; z-index: 7000;
  background: var(--popover-bg);
  border-radius: var(--radius-popover);
  box-shadow: var(--shadow-popover);
  color: var(--fg);
  backdrop-filter: blur(16px);
  animation: pop-in var(--dur-med) var(--ease-decel);
  transform-origin: top center;
}
@keyframes pop-in { from { opacity: 0; transform: scale(.97) translateY(-6px); } to { opacity: 1; transform: none; } }
.pop-arrow {
  position: absolute; top: -7px; width: 14px; height: 7px; overflow: hidden;
}
.pop-arrow::after {
  content: ""; position: absolute; left: 2px; top: 3px; width: 10px; height: 10px;
  background: var(--popover-bg); transform: rotate(45deg);
  border-radius: 2px;
}

/* calendar */
#calendar-popover { width: 380px; padding: 14px; }
.cal-notifs { margin-bottom: 10px; }
.cal-notifs-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; color: var(--fg-dim); margin-bottom: 6px;
}
.cal-notifs-head button {
  border: none; background: none; color: var(--fg-dim); font-size: 12px; font-weight: 700;
}
.cal-notifs-head button:hover { color: var(--fg); }
.cal-notif {
  display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px;
  background: var(--view-hover); margin-bottom: 6px; align-items: flex-start;
}
.cal-notif svg { width: 16px; height: 16px; margin-top: 2px; flex: none; color: var(--accent); }
.cal-notif .cn-title { font-size: 13px; font-weight: 500; }
.cal-notif .cn-body { font-size: 12px; color: var(--fg-dim); margin-top: 1px; }
.cal-notif .cn-time { font-size: 11px; color: var(--fg-faint); margin-top: 2px; }
.cal-notif .cn-close {
  margin-left: auto; border: none; background: none; color: var(--fg-faint);
  width: 20px; height: 20px; border-radius: 50%; flex: none;
}
.cal-notif .cn-close:hover { background: var(--view-active); color: var(--fg); }
.cal-notifs-empty { font-size: 12.5px; color: var(--fg-faint); text-align: center; padding: 8px 0 12px; }

.cal-month-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;
}
.cal-month-head .cal-month-label { font-size: 14px; font-weight: 700; }
.cal-month-nav { display: flex; gap: 2px; }
.cal-month-nav button {
  width: 26px; height: 26px; border-radius: 6px; border: none; background: none;
  color: var(--fg); display: flex; align-items: center; justify-content: center;
}
.cal-month-nav button:hover { background: var(--popover-item-hover); }
.cal-month-nav svg { width: 14px; height: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { font-size: 11px; color: var(--fg-faint); text-align: center; padding: 4px 0; font-weight: 500; }
.cal-day {
  position: relative; height: 34px; border: none; background: none; border-radius: 8px;
  font-size: 13px; color: var(--fg); display: flex; align-items: center; justify-content: center;
}
.cal-day:hover { background: var(--popover-item-hover); }
.cal-day.other { color: var(--fg-faint); }
.cal-day.today {
  background: var(--accent); color: var(--accent-fg); font-weight: 700;
}
.cal-day.selected:not(.today) { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-clock-row {
  display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border); font-size: 13px;
}
.cal-clock-row svg { width: 15px; height: 15px; color: var(--fg-dim); }
.cal-clock-row .btn { margin-left: auto; }

/* quick settings */
#quick-settings { width: 380px; padding: 14px; right: 8px; top: calc(var(--topbar-h) + 8px); }
.qs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.qs-tile {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; border: none;
  background: var(--view-hover); color: var(--fg); text-align: left;
  transition: background var(--dur-fast);
  min-height: 48px;
}
.qs-tile:hover { background: var(--view-active); }
.qs-tile.on { background: var(--accent); color: var(--accent-fg); }
.qs-tile svg { width: 17px; height: 17px; flex: none; }
.qs-tile .qs-label { font-size: 13px; font-weight: 500; line-height: 1.2; }
.qs-tile .qs-sub { font-size: 11px; opacity: .75; display: block; font-weight: 400; }
.qs-slider-row { display: flex; align-items: center; gap: 10px; padding: 4px 4px; }
.qs-slider-row svg { width: 17px; height: 17px; color: var(--fg-dim); flex: none; }
.qs-sep { height: 1px; background: var(--border); margin: 8px 0; }
.qs-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 8px; border-radius: 8px; border: none; background: none;
  color: var(--fg); font-size: 13.5px; text-align: left;
}
.qs-menu-item:hover { background: var(--popover-item-hover); }
.qs-menu-item svg { width: 16px; height: 16px; color: var(--fg-dim); }
.qs-menu-item .grow { flex: 1; }
.qs-menu-item .qs-check { width: 16px; color: var(--accent); }
.qs-power-row { display: flex; justify-content: space-between; padding: 4px 2px 0; }
.qs-power-row .icon-btn { width: 34px; height: 34px; }

/* wifi list in qs */
.qs-wifi-list { max-height: 180px; overflow-y: auto; margin-top: 4px; }
.qs-wifi-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px;
  border-radius: 8px; font-size: 13px; cursor: default;
}
.qs-wifi-item:hover { background: var(--popover-item-hover); }
.qs-wifi-item svg { width: 15px; height: 15px; color: var(--fg-dim); }
.qs-wifi-item .grow { flex: 1; }
.qs-wifi-item.connected { color: var(--fg); font-weight: 500; }
.qs-wifi-item.connected svg.sig { color: var(--accent); }
.qs-wifi-item .lock-ico { width: 12px; height: 12px; }

/* ============ boot / power screens ============ */
#boot-screen, #power-screen {
  position: fixed; inset: 0; z-index: 10000;
  background: #000; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px;
}
#power-screen { font-size: 15px; gap: 24px; }
.boot-logo {
  width: 96px; height: 96px;
  background: url("../assets/ubuntu-logo.svg") center/contain no-repeat;
}
.boot-spinner { display: flex; gap: 10px; }
.boot-spinner span {
  width: 10px; height: 10px; border-radius: 50%; background: #fff;
  animation: boot-dot 1.4s ease-in-out infinite;
}
.boot-spinner span:nth-child(2) { animation-delay: .15s; }
.boot-spinner span:nth-child(3) { animation-delay: .3s; }
.boot-spinner span:nth-child(4) { animation-delay: .45s; }
.boot-spinner span:nth-child(5) { animation-delay: .6s; }
@keyframes boot-dot {
  0%, 60%, 100% { opacity: .25; transform: scale(.85); }
  30% { opacity: 1; transform: scale(1); }
}
#power-screen .spinner { border-top-color: #fff; }

/* ============ lock screen ============ */
#lock-screen {
  position: fixed; inset: 0; z-index: 9900;
  display: flex; flex-direction: column; align-items: center;
  color: #fff; overflow: hidden;
}
.lock-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: brightness(.75);
  transform: scale(1.02);
  transition: filter var(--dur-slow), transform var(--dur-slow);
}
#lock-screen.unlocking .lock-bg { filter: brightness(1); transform: scale(1); }
#lock-screen { animation: lock-in var(--dur-slow) var(--ease-decel); }
@keyframes lock-in { from { opacity: 0; } to { opacity: 1; } }
#lock-screen.unlocking { animation: lock-out var(--dur-slow) var(--ease-accel) forwards; }
@keyframes lock-out { to { opacity: 0; } }
.lock-clock { margin-top: 12vh; text-align: center; z-index: 1; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
#lock-time { font-size: 72px; font-weight: 300; letter-spacing: -1px; }
#lock-date { font-size: 20px; font-weight: 400; margin-top: 4px; }
.lock-hint {
  position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%);
  font-size: 14px; color: rgba(255,255,255,.85); z-index: 1;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
  animation: lock-hint-pulse 2.4s ease-in-out infinite;
}
@keyframes lock-hint-pulse { 0%,100% { opacity: .7; } 50% { opacity: 1; } }
.lock-unlock {
  position: absolute; bottom: 12vh; left: 50%; transform: translateX(-50%);
  z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: lock-unlock-in var(--dur-med) var(--ease-decel);
}
@keyframes lock-unlock-in { from { opacity: 0; transform: translate(-50%, 24px); } to { opacity: 1; transform: translate(-50%,0); } }
.lock-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--yaru-aubergine), var(--yaru-orange));
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 500; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.lock-user { font-size: 18px; font-weight: 500; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.lock-password-row { display: flex; gap: 6px; }
#lock-password {
  width: 220px; height: 36px; padding: 0 12px;
  border-radius: 8px; border: none;
  background: rgba(255,255,255,.92); color: #222; font-size: 14px;
}
#lock-password:focus { outline: 2px solid var(--accent); }
.lock-unlock-btn {
  width: 36px; height: 36px; border-radius: 8px; border: none;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.lock-unlock-btn::after { content: "→"; font-size: 16px; }
.lock-unlock-btn:hover { background: var(--accent-hover); }
.lock-password-hint { font-size: 11.5px; color: rgba(255,255,255,.65); text-shadow: 0 1px 4px rgba(0,0,0,.6); }

/* ============ suspend ============ */
#suspend-overlay {
  position: fixed; inset: 0; z-index: 9950; background: #000;
  animation: suspend-fade 1.2s var(--ease-standard);
}
@keyframes suspend-fade { from { opacity: 0; } 30% { opacity: 1; } }

/* ============ night light ============ */
#night-light {
  position: fixed; inset: 0; z-index: 5900; pointer-events: none;
  background: #ff9329; mix-blend-mode: multiply; opacity: .28;
  transition: opacity 1.2s var(--ease-standard);
}

/* ============ responsive ============ */
@media (max-width: 900px) {
  :root { --dock-w: 56px; }
  .dock-item { width: 42px; height: 42px; }
  .dock-item img, .dock-item svg.app-icon { width: 34px; height: 34px; }
  #tb-appname { display: none; }
}
@media (max-width: 640px) {
  :root { --dock-w: 50px; }
  .dock-item { width: 38px; height: 38px; }
  .dock-item img, .dock-item svg.app-icon { width: 30px; height: 30px; }
  #calendar-popover, #quick-settings { width: min(380px, calc(100vw - 16px)); }
}
