/* ==================================================
   Variables!!!
================================================== */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700;800;900&display=swap");
:root {
  /* Core theme colors */
  --primary: #A949F3;
  --primary-color: #A949F3; /* legacy alias */
  --primary-light: #ba72f1;
  --secondary: #E431F7;
  --secondary-color: #E431F7;
  --secondary-light: #ea74f7;
  --background-color: #0f0f1a;
  --text-color: #ffffff;
  --accent-color: #ff6b6b;
  --success-color: #4ecdc4;

  /* Glassmorphism */
  --glass: rgba(30, 30, 36, 0.4);
  --glass-background: rgba(30, 30, 36, 0.4); /* legacy alias */
  --glass-border: rgba(255, 255, 255, 0.205);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --blur: 10px;
  --radius: 1rem;
  --transition-speed: 0.3s;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

  /* Gradients */
  --primary-gradient: linear-gradient(
    135deg,
    var(--primary),
    var(--primary-light)
  );
  --secondary-gradient: linear-gradient(
    135deg,
    var(--secondary),
    var(--secondary-light)
  );
  --dark-gradient: linear-gradient(135deg, #0f0f1a, #1a1a2e);
  --card-gradient: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.05)
  );

  /* Dock + layout */
  --dock-width: 220px;
  --dock-width-collapsed: 64px;
  --dock-gap: 12px;
  --center-gap: 12px;

  /* Aliases for component theming */
  --border-radius: var(--radius);
  --glass-blur: var(--blur);
  --glass-inner: rgba(255, 255, 255, 0.06);
  --card-bg: var(--card-gradient);
}

/* Respect user/system preference for reduced motion by defaulting variables */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition: none !important;
    --transition-speed: 0s !important;
  }
}

/* Global reduced motion toggle — applied by app logic via :root.reduce-motion */
:root.reduce-motion,
:root.reduce-motion * {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
:root.reduce-motion .services-drawer,
:root.reduce-motion .services-drawer::before,
:root.reduce-motion .services-card,
:root.reduce-motion .app-window,
:root.reduce-motion .toast {
  transition: none !important;
  animation: none !important;
}

/* Reset + Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Poppins", sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  height: 100vh;
  display: flex;
}

/* Enforce a minimum readable weight for body text (Poppins medium) */
html,
body,
input,
textarea,
select,
button {
  font-weight: 500;
}

/* Keep Font Awesome icons using their own font-family so they render correctly */
.fa,
.fas,
.far,
.fal,
.fab,
i[class^="fa-"] {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
  font-weight: 900;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-gradient);
}

* {
    scrollbar-width: thin; /* "auto" or "thin" */
    scrollbar-color: var(--primary-color) rgba(255, 255, 255, 0);
}

/* ===== APP LOADER OVERLAY ===== */
.app-loader {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2147483500; /* below toast (3647), above everything else */
}
.app-loader.show { display: flex; }
.app-loader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.app-loader-card {
  position: relative;
  z-index: 1;
  padding: 26px 28px 24px;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 260px;
}
.app-loader-icon {
  width: 92px;
  height: 92px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.1));
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}
.app-loader-icon i {
  font-size: 46px;
  color: var(--text-color);
}
.app-loader-icon img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 16px;
}
.app-loader-icon .fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-color);
}
.app-loader-title {
  margin-top: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.app-loader-spinner {
  margin-top: 14px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 5px solid rgba(255,255,255,0.12);
  border-top-color: var(--primary);
  animation: app-spin 0.9s linear infinite;
}
.app-loader-tip {
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.8;
}
@keyframes app-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ===== PER-WINDOW LOADER (inside app window) ===== */
.app-window { position: relative; }
.win-loader {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 900; /* above iframe, below header controls area if possible */
  pointer-events: none; /* allow clicks to window controls outside the card */
}
.win-loader.show { display: flex; }
.win-loader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.win-loader-card {
  position: relative;
  z-index: 1;
  padding: 22px 24px 20px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 240px;
  pointer-events: auto; /* card can be interacted with later if needed */
}
.win-loader-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.1));
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}
.win-loader-icon i { font-size: 38px; color: var(--text-color); }
.win-loader-icon img { width: 60px; height: 60px; object-fit: cover; border-radius: 14px; }
.win-loader-icon .fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; letter-spacing: 0.5px; color: var(--text-color);
}
.win-loader-title { margin-top: 10px; font-weight: 800; letter-spacing: 0.3px; }
.win-loader-spinner {
  margin-top: 12px; width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.12); border-top-color: var(--primary);
  animation: app-spin 0.9s linear infinite;
}
.win-loader-tip { margin-top: 8px; font-size: 12px; opacity: 0.8; }

/* ===== TOAST (top-middle, overlay) ===== */
.toast-container {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483647; /* place above everything (max safe z-index) */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none; /* allow clicks through when no toast present */
}
.toast {
  pointer-events: auto; /* allow interacting with the toast */
  min-width: 320px;
  max-width: 720px;
  background: linear-gradient(
    135deg,
    rgba(12, 14, 20, 0.95),
    rgba(30, 30, 36, 0.95)
  );
  color: var(--text);
  padding: 12px 14px 14px 14px;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
  display: block;
  position: relative;
  font-weight: 600;
  animation: toast-in 0.32s cubic-bezier(0.2, 0.9, 0.2, 1) both;
  /* ensure toast itself isn't blurred by backdrop filters in the page */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  will-change: transform, opacity;
}
.toast .toast-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.toast .toast-left {
  width: 36px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.toast .toast-left i {
  font-size: 18px;
  width: 36px;
  height: 36px;
  line-height: 36px;
  text-align: center;
}
.toast .toast-content {
  flex: 1;
  min-width: 0;
}
.toast .toast-title {
  font-weight: 700;
  margin-bottom: 2px;
}
.toast .toast-desc {
  font-size: 0.95rem;
  opacity: 0.92;
  line-height: 1.2;
}
.toast .toast-close {
  position: absolute;
  right: 8px;
  top: 8px;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 16px;
  opacity: 0.9;
}
.toast.hide {
  animation: toast-out 0.22s ease forwards;
}

@keyframes toast-in {
  from {
    transform: translateY(-8px) scale(0.995);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
@keyframes toast-out {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-8px) scale(0.995);
    opacity: 0;
  }
}

/* Light theme override (optional) */
[data-theme="light"] {
  --background-color: #f4f8fd;
  --text-color: #2c3d5e;
  --glass: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* =====  LIQUID-GLASS MIXIN  ===== */
.liquid-glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}

/* =====  LAYOUT  ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Poppins", sans-serif;
}
body {
  display: flex;
  height: 100vh;
  background: var(--background-color);
  color: var(--text-color);
  position: relative;
}
.app-wallpaper-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* Particle Background System */
.particle-bg-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.particle-bg-container .bg-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 60% at 85% 10%, rgba(139,30,229,.15), transparent 60%),
    radial-gradient(50% 50% at 15% 80%, rgba(30,136,229,.12), transparent 60%),
    linear-gradient(180deg, rgba(3,6,26,1) 0%, rgba(5,10,30,1) 100%);
}
.particle-bg-container .bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* When particle background is active */
body.has-particle-bg,
html:has(body.has-particle-bg) {
  background: transparent !important;
  background-color: transparent !important;
}
body.has-particle-bg .app-wallpaper-layer {
  display: none;
}

/* When wallpaper is present, use the CSS variable for the background and add a subtle overlay */
:root.has-wallpaper .app-wallpaper-layer {
  background-image: var(--workspace-wallpaper);
  filter: blur(18px) brightness(0.9);
  transform: scale(1.05);
  transform-origin: center;
  will-change: transform, filter;
}

/* Blur everything outside the workspace/dock when wallpaper is present to give depth
  but exclude UI overlays like services drawer and custom context menu so they're readable */
:root.has-wallpaper
  body
  > :not(#workspace):not(#sidebar):not(.app-wallpaper-layer):not(
    #services-drawer
  ):not(#custom-context):not(.toast-container):not(.toast):not(
    .dock-flyout-tooltip
  ):not(#widget-editor-modal):not(.shortcut-edit-modal):not(.app-loader):not(
    #onboarding-overlay
  ) {
  filter: blur(6px);
}
.sidebar {
  width: 220px;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.5rem;
}
/* Workspace spacing: keep a consistent gap (same as dock gap) at top/bottom and a left margin
   that accounts for dock width + dock gap so workspace never sits flush against the dock. */
.workspace {
  flex: 1;
  display: flex;
  position: relative;
  z-index: 1;
  margin-top: var(--dock-gap);
  margin-bottom: var(--dock-gap);
  margin-right: var(--dock-gap);
  /* default left margin for expanded dock; overridden when dock-collapsed root class is present */
  margin-left: calc(var(--dock-width) + var(--dock-gap) + 0.75rem);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 0.75rem;
  box-sizing: border-box;
  background: transparent; /* let the wallpaper show through; windows themselves are glass */
  overflow: hidden;
}
/* Keep the wallpaper sharp inside the workspace window */
:root.has-wallpaper .workspace::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--workspace-wallpaper);
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  pointer-events: none;
  z-index: -1;
}


/* Prevent user selection for decorative items (logo, welcome text) */
.no-select {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
}

/* Selection rectangle (desktop click-drag marquee) */
.selection-rect {
  position: fixed; /* use viewport coordinates so it always aligns with the mouse */
  pointer-events: none; /* allow mouse events to pass through */
  border: 1px solid color-mix(in srgb, var(--primary) 70%, transparent);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 6px;
  opacity: 0; /* toggled by JS */
  display: block; /* keep in DOM, visibility controlled by opacity */
  transition: opacity 0.28s cubic-bezier(0.2, 0.9, 0.2, 1);
  z-index: 9999; /* above workspace items */
}

/* Selected item visual: subtle outline using primary color */
.workspace .selectable.selected {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent)
      inset,
    0 8px 20px color-mix(in srgb, var(--primary) 18%, transparent);
  border-radius: 8px;
}

/* =====  APP WINDOW  ===== */
.app-window {
  position: absolute;
  inset: 1rem;
  display: none;
  flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}
.app-window.active {
  display: flex;
}
/* Closing animation state: keep visible, disable interaction, and animate out */
.app-window.closing {
  display: flex !important;
  pointer-events: none;
  z-index: 100;
  animation: win-close-scale 0.22s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}
.app-window.closing.closing-left {
  animation-name: win-close-left;
}
.app-window.closing.closing-right {
  animation-name: win-close-right;
}
/* Opening animation state: zoom-in and fade-in */
.app-window.opening {
  display: flex !important;
  animation: win-open-scale 0.24s cubic-bezier(0.2, 0.9, 0.2, 1) both;
  will-change: transform, opacity;
}
@keyframes win-open-scale {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0px);
  }
}
@keyframes win-close-scale {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0px);
  }
  to {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
    filter: blur(3px);
  }
}
@keyframes win-close-left {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0px);
  }
  to {
    opacity: 0;
    transform: translateX(-20%) scale(0.96);
    filter: blur(2px);
  }
}
@keyframes win-close-right {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0px);
  }
  to {
    opacity: 0;
    transform: translateX(20%) scale(0.96);
    filter: blur(2px);
  }
}
/* Only the currently focused window gets the thick primary border */
.app-window.focused {
  border: 3px solid var(--primary);
}
.app-header {
  position: absolute;
  inset: 0;
  height: 0;
  pointer-events: none; /* header is non-blocking; controls remain positioned */
}
.app-header .app-title {
  user-select: none;
  display: none;
} /* hide title from header; apps should render their own title inside their content */
.app-extras {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  display: none;
} /* hide extras to keep header minimal (controls only) */
.app-extras .header-search {
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: transparent;
  color: var(--text-color);
}
.app-frame {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: inherit;

/* Unified scaling: scale entire app content (iframe) uniformly when space is tight.
   JS sets --app-scale on .app-window; default 1. The width/height are expanded by the
   inverse so the scaled view fills the window without clipping, and transform keeps
   visuals and typography consistent. */
.app-window { --app-scale: 1; }
.app-window .app-frame {
  transform: scale(var(--app-scale));
  transform-origin: top left;
  /* Expand intrinsic size to compensate for scale so scrollbars/layout remain sensible */
  width: calc(100% / var(--app-scale));
  height: calc(100% / var(--app-scale));
}
}

/* Onboarding Overlay (similar to services-drawer but higher z-index) */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.onboarding-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.onboarding-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.onboarding-overlay.active::before {
  opacity: 1;
}
.onboarding-frame {
  position: relative;
  z-index: 310;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}

/* Services Drawer (centered) */
.services-drawer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.services-drawer.active {
  opacity: 1;
  pointer-events: auto;
}
.services-drawer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.services-drawer.active::before {
  opacity: 1;
}
.services-card {
  position: relative;
  z-index: 600;
  max-width: 980px;
  width: min(72vw, 980px);
  min-width: 360px;
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(80, 120, 255, 0.1),
    rgba(255, 255, 255, 0.04)
  );
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  transform: scale(0.94) translateY(8px);
  opacity: 0;
  filter: blur(2px);
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.2, 1), opacity 0.18s ease,
    filter 0.18s ease;
  will-change: transform, opacity, filter;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.services-drawer.active .services-card {
  transform: scale(1) translateY(0);
  opacity: 1;
  filter: blur(0);
}
.services-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.services-header h3 {
  font-weight: 700;
  letter-spacing: 0.2px;
}
.services-search {
  flex: 0 1 360px;
  max-width: 50%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-color);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
}
.services-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.services-section {
  padding-top: 8px;
}
.services-section + .services-section {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 16px;
}
.services-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 4px 8px;
}
.services-section-head h4 {
  font-size: 14px;
  opacity: 0.85;
  letter-spacing: 0.3px;
}
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 8px;
}
@media (max-width: 900px) {
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .services-search {
    max-width: 100%;
    flex-basis: 100%;
  }
}
.service-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border 0.12s ease;
  background: transparent;
  border: none;
  border-radius: 12px;
  padding: 14px;
}
.service-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0.1)
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}
.service-icon i {
  font-size: 30px;
  color: #fff;
  opacity: 0.98;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.service-img-icon {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}
.service-name {
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.2px;
  color: var(--text-color);
}

/* Pinned indicator on service tiles - REMOVED (no longer used) */
.service-tile {
  position: relative;
}

/* Pinned apps container in dock (services - above divider) */
.dock-pinned-apps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.dock-pinned-apps:empty {
  display: none;
}

/* Pinned system apps container in dock (below divider) */
.dock-pinned-system-apps {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dock-pinned-system-apps:empty {
  display: none;
}

.dock-pinned-item {
  position: relative;
  cursor: grab;
}
.dock-pinned-item .dock-item-img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
}

/* Dock drag and drop styles */
.dock-pinned-item.dock-dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.dock-pinned-item.dock-drag-over {
  background: rgba(var(--primary), 0.1);
}

.dock-pinned-item.dock-drag-above {
  box-shadow: inset 0 3px 0 0 var(--primary);
}

.dock-pinned-item.dock-drag-below {
  box-shadow: inset 0 -3px 0 0 var(--primary);
}

/* Prevent text selection during drag */
.dock-pinned-item[draggable="true"] {
  user-select: none;
  -webkit-user-select: none;
}

/* Selected service tile for keyboard navigation */
.service-tile.selected {
  transform: translateY(-2px);
}
/* When selected, emphasize the icon's border using primary color */
.service-tile.selected .service-icon {
  border-color: var(--primary);
  border-width: 3px;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--primary) 24%, transparent);
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Removed keyframe animations in favor of interruptible transitions */

/* Custom context menu */
.custom-context {
  position: fixed;
  display: none;
  z-index: 1000;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  min-width: 180px;
  padding: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}
.custom-context.active {
  display: block;
}
.custom-context .item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  border-radius: 6px;
}
.custom-context .item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.custom-context .item + .item {
  margin-top: 6px;
}

.custom-context .divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 6px 0;
}

.custom-context .item.danger {
  color: #ff6b6b;
}
.custom-context .item.danger:hover {
  background: rgba(255, 107, 107, 0.15);
}

/* =====  TILE RULES  ===== */
/* Data-count rules removed to avoid conflicts; layout uses explicit .half/.half.right classes */

/* ====  mouse unblock – push workspace behind dock  ==== */
.workspace {
  position: relative;
  z-index: 0;
}
.dock {
  position: fixed;
  z-index: 10;
}

/* =====  TILING STATES  ===== */
.app-window {
  position: absolute;
  inset: 1rem;
  display: none;
  flex-direction: column;
  transition: inset 0.25s;
  z-index: 50;
  border-radius: var(--radius);
  overflow: hidden;
}
.app-window.active {
  display: flex;
}

.app-window.maximised {
  inset: 1rem;
} /* full workspace */
.app-window.half {
  inset: 1rem calc(var(--center-gap) / 2) 1rem calc(var(--center-gap) / 2);
}
.app-window.half.left {
  left: 1rem;
  right: calc(50% + (var(--center-gap) / 2));
}
.app-window.half.right {
  left: calc(50% + (var(--center-gap) / 2));
  right: 1rem;
} /* right half  */
.app-window.minimised {
  display: none;
} /* (deprecated) kept for old states, but not used */

/* =====  Window controls (top-right of window header) ===== */
.app-header {
  display: flex;
}
.window-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.window-controls button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-color);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  height: 36px;
  width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.window-controls button:hover {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}
.window-controls button i {
  font-size: 14px;
}

/* Position controls absolutely so they're always in the header top-right */
.app-header .window-controls {
  position: absolute;
  right: 8px;
  top: 8px;
  pointer-events: auto;
} /* allow clicks on controls even though header is non-blocking */

/* Hide window controls when disabled via root flag */
:root.hide-window-controls .app-header .window-controls {
  display: none !important;
}

/* per-window header has no background so it visually blends with the workspace/dock */

.window-controls .btn-maximise {
  height: 40px;
  width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 6px;
}
.window-controls .btn-maximise:focus {
  outline: 2px solid rgba(104, 147, 236, 0.12);
}

/* Respect dock collapsed state using a root class so workspace doesn't slide under the dock */
/* Use root-level dock gap to ensure workspace stays clear of the dock */
:root.dock-collapsed .workspace {
  margin-left: calc(var(--dock-width-collapsed) + var(--dock-gap) + 0.75rem);
}
:root:not(.dock-collapsed) .workspace {
  margin-left: calc(var(--dock-width) + var(--dock-gap) + 0.75rem);
}

/* ===== Collapsed Dock Hover Tooltip (glass) ===== */
.dock-flyout-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-9999px, -9999px);
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.2);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 6px 10px;
  color: var(--text-color);
  font-weight: 600;
  font-size: 12px;
  z-index: 2147483600; /* keep above global overlay */
  pointer-events: none;
  box-shadow: var(--glass-shadow);
  opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.dock-flyout-tooltip.show {
  opacity: 1;
}

/* ==================================================
   BUTTONS (global)
================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1.8rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
  z-index: 1;
  background: transparent;
  color: var(--text-color);
  border: 1px solid transparent;
  box-shadow: inset 0 0 15px var(--glass-inner);
}

.btn:hover::before {
  transform: translateX(100%) rotate(45deg);
}

/* Primary (filled, uses secondary gradient by design for purple-themed CTA)
   Support both .btn-primary and legacy .btn.primary */
.btn-primary,
.btn.primary {
  background: var(--secondary-gradient);
  background-size: 150%;
  background-position-x: center;
  color: var(--text-color);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 15px color-mix(in srgb, var(--secondary) 40%, transparent),
    inset 0 0 15px var(--glass-inner);
}

.btn-primary img,
.btn.primary img {
  align-self: center;
  vertical-align: middle;
  padding: 0;
}

.btn-primary:hover,
.btn.primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px color-mix(in srgb, var(--secondary) 50%, transparent),
    inset 0 0 18px var(--glass-inner);
  border: 1px solid rgba(255, 255, 255, 0.74);
  color: var(--text-color);
}

/* Outline (subtle tinted fill based on secondary color) */
.btn-outline,
.btn.outline {
  background: color-mix(in srgb, var(--secondary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--secondary) 30%, transparent);
  color: var(--secondary-light);
  backdrop-filter: blur(var(--glass-blur));
}

.btn-outline:hover,
.btn.outline:hover {
  border-color: var(--secondary);
  color: var(--text-color);
  background: color-mix(in srgb, var(--secondary) 20%, transparent);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px color-mix(in srgb, var(--secondary) 25%, transparent);
}

/* Neutral/tertiary button using card glass */
.btn-three,
.btn.three {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  padding: 0.6rem 1.2rem;
  color: var(--text-color);
}

.btn-three:hover,
.btn.three:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--card-bg));
  transform: scale(1.05);
  border: 1px solid var(--primary);
  box-shadow: 0 10px 20px color-mix(in srgb, var(--primary) 0%, transparent);
}

/* ==================================================
   FORM CONTROLS: selects and file inputs (glass)
================================================== */
/* Dropdowns */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.03)
  );
  color: var(--text-color);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 10px 38px 10px 12px;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}
select:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
}
select:hover {
  border-color: color-mix(in srgb, #fff 30%, var(--glass-border));
}
/* custom chevron */
select {
  background-image: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.06),
      rgba(255, 255, 255, 0.03)
    ),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='white' fill-opacity='.85' d='M6 8L0 2.667 1.333 1.333 6 6l4.667-4.667L12 2.667z'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 12px center;
  background-size: auto, 12px 8px;
}

/* File input */
input[type="file"] {
  color: var(--text-color);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 8px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.03)
  );
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--glass-shadow);
}
input[type="file"]:hover {
  border-color: color-mix(in srgb, #fff 30%, var(--glass-border));
}
input[type="file"]::file-selector-button {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--secondary) 28%, transparent);
  background: color-mix(in srgb, var(--secondary) 14%, transparent);
  color: var(--text-color);
  padding: 6px 10px;
  margin-right: 10px;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  transition: var(--transition);
}
input[type="file"]::file-selector-button:hover {
  background: color-mix(in srgb, var(--secondary) 22%, transparent);
  border-color: var(--primary-light);
}

/* ===== WIDGET LAYER (Workspace Widgets) ===== */
.widget-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--widget-padding, 24px);
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  /* Default values - will be overridden by JS based on viewport */
  --widget-cell-size: 140px;
  --widget-gap: 12px;
  --widget-padding: 24px;
  --widget-scale: 1;
}

.widget-layer.has-widgets {
  pointer-events: auto;
}

/* Grid overlay shown while dragging */
.widget-grid-overlay {
  position: absolute;
  top: var(--widget-padding, 24px);
  left: var(--widget-padding, 24px);
  right: var(--widget-padding, 24px);
  bottom: var(--widget-padding, 24px);
  display: none;
  pointer-events: none;
  z-index: 4;
}

.widget-layer.dragging-active .widget-grid-overlay {
  display: block;
}

/* Drop zone indicators */
.widget-drop-zone {
  position: absolute;
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.widget-drop-zone.active {
  opacity: 1;
}

.widget-drop-zone.occupied {
  border-color: var(--accent-color);
  background: color-mix(in srgb, var(--accent-color) 10%, transparent);
}

.widget-drop-zone.valid {
  border-color: var(--success-color);
  background: color-mix(in srgb, var(--success-color) 15%, transparent);
}

/* Individual Widget */
.desktop-widget {
  position: absolute;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--glass-shadow);
  padding: calc(16px * var(--widget-scale, 1));
  pointer-events: auto;
  cursor: grab;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  user-select: none;
}

.desktop-widget:hover {
  border-color: color-mix(in srgb, var(--primary) 50%, var(--glass-border));
  box-shadow: 0 8px 32px rgba(169, 73, 243, 0.15);
}

/* Selected state (from marquee or click) */
.desktop-widget.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary), 0 8px 32px rgba(169, 73, 243, 0.25);
}

/* Dragging state */
.desktop-widget.dragging {
  cursor: grabbing;
  opacity: 0.85;
  transform: scale(1.02);
  z-index: 100;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  transition: none;
}

/* Ghost placeholder showing original position */
.widget-ghost {
  position: absolute;
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--glass) 30%, transparent);
  pointer-events: none;
  opacity: 0.5;
}

/* Widget sizes */
.desktop-widget.size-small {
  width: var(--widget-cell-size);
  height: var(--widget-cell-size);
}

.desktop-widget.size-medium {
  width: calc(var(--widget-cell-size) * 2 + var(--widget-gap));
  height: var(--widget-cell-size);
}

.desktop-widget.size-large {
  width: calc(var(--widget-cell-size) * 2 + var(--widget-gap));
  height: calc(var(--widget-cell-size) * 2 + var(--widget-gap));
}

/* App shortcut widget - fills the full 1x1 grid cell */
.desktop-widget.size-shortcut {
  width: var(--widget-cell-size);
  height: var(--widget-cell-size);
  padding: calc(16px * var(--widget-scale, 1));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  /* No background or border for shortcuts - clean look */
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.desktop-widget.size-shortcut:hover {
  /* Subtle hover effect */
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  box-shadow: none;
  border: none;
}

.desktop-widget.size-shortcut.selected {
  /* Selected state */
  background: rgba(169, 73, 243, 0.15);
  border-radius: var(--radius);
  box-shadow: 0 0 0 2px var(--primary);
}

.desktop-widget.size-shortcut .shortcut-icon {
  width: calc(56px * var(--widget-scale, 1));
  height: calc(56px * var(--widget-scale, 1));
  border-radius: calc(14px * var(--widget-scale, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(24px * var(--widget-scale, 1));
  color: white;
  flex-shrink: 0;
}

/* AppIcon as widget shortcut */
.desktop-widget.size-shortcut .app-icon {
  --icon-size: calc(56px * var(--widget-scale, 1));
  --icon-radius: calc(14px * var(--widget-scale, 1));
  --icon-font-size: calc(24px * var(--widget-scale, 1));
  flex-shrink: 0;
}

.desktop-widget.size-shortcut .shortcut-name {
  font-size: calc(12px * var(--widget-scale, 1));
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  opacity: 0.9;
}

/* Widget header */
.widget-header {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--widget-scale, 1));
  margin-bottom: calc(8px * var(--widget-scale, 1));
  min-height: calc(20px * var(--widget-scale, 1));
}

.widget-header .widget-icon {
  width: calc(24px * var(--widget-scale, 1));
  height: calc(24px * var(--widget-scale, 1));
  border-radius: calc(6px * var(--widget-scale, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(12px * var(--widget-scale, 1));
  flex-shrink: 0;
}

.widget-header .widget-title {
  font-size: calc(11px * var(--widget-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Widget remove button - HIDDEN, use Delete key instead */
.widget-remove {
  display: none;
}

.widget-remove:hover {
  transform: scale(1.1);
  background: rgba(255, 80, 80, 1);
}

/* Widget content area */
.widget-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.widget-content .widget-value {
  font-size: calc(28px * var(--widget-scale, 1));
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: calc(4px * var(--widget-scale, 1));
}

.widget-content .widget-label {
  font-size: calc(11px * var(--widget-scale, 1));
  opacity: 0.6;
}

.widget-content .widget-status {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--widget-scale, 1));
  font-size: calc(13px * var(--widget-scale, 1));
  font-weight: 600;
}

.widget-content .widget-status.online {
  color: var(--success-color);
}

.widget-content .widget-status.offline {
  color: var(--accent-color);
}

.widget-content .status-dot {
  width: calc(8px * var(--widget-scale, 1));
  height: calc(8px * var(--widget-scale, 1));
  border-radius: 50%;
  animation: pulse-status 2s infinite;
}

.widget-content .status-dot.online {
  background: var(--success-color);
}

.widget-content .status-dot.offline {
  background: var(--accent-color);
}

@keyframes pulse-status {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

/* Large widget specific (for announcements, etc.) */
.desktop-widget.size-large .widget-content {
  align-items: flex-start;
  text-align: left;
  overflow-y: auto;
}

.desktop-widget.size-large .announcement-item {
  padding: calc(8px * var(--widget-scale, 1)) 0;
  border-bottom: 1px solid var(--glass-border);
}

.desktop-widget.size-large .announcement-item:last-child {
  border-bottom: none;
}

/* Clock widget */
.widget-clock {
  font-size: calc(32px * var(--widget-scale, 1));
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.widget-clock-label {
  font-size: calc(11px * var(--widget-scale, 1));
  opacity: 0.5;
  margin-top: calc(4px * var(--widget-scale, 1));
}

/* Quick actions widget */
.widget-actions {
  display: flex;
  gap: calc(8px * var(--widget-scale, 1));
  flex-wrap: wrap;
  justify-content: center;
}

.widget-action-btn {
  width: calc(40px * var(--widget-scale, 1));
  height: calc(40px * var(--widget-scale, 1));
  border-radius: calc(10px * var(--widget-scale, 1));
  border: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget-action-btn:hover {
  background: var(--primary-gradient);
  border-color: var(--primary);
  transform: scale(1.05);
}

/* Performance bars */
.widget-perf-bars {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: calc(8px * var(--widget-scale, 1));
}

.perf-bar-row {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--widget-scale, 1));
}

.perf-bar-label {
  font-size: calc(10px * var(--widget-scale, 1));
  font-weight: 600;
  width: calc(32px * var(--widget-scale, 1));
  opacity: 0.7;
}

.perf-bar-track {
  flex: 1;
  height: calc(6px * var(--widget-scale, 1));
  background: rgba(255, 255, 255, 0.1);
  border-radius: calc(3px * var(--widget-scale, 1));
  overflow: hidden;
}

.perf-bar-fill {
  height: 100%;
  border-radius: calc(3px * var(--widget-scale, 1));
  transition: width 0.3s ease;
}

.perf-bar-fill.cpu { background: linear-gradient(90deg, #4CAF50, #8BC34A); }
.perf-bar-fill.ram { background: linear-gradient(90deg, #2196F3, #03A9F4); }
.perf-bar-fill.disk { background: linear-gradient(90deg, #FF9800, #FFC107); }

.perf-bar-value {
  font-size: calc(10px * var(--widget-scale, 1));
  font-weight: 700;
  width: calc(32px * var(--widget-scale, 1));
  text-align: right;
}

/* Drag preview styles */
.desktop-widget.drag-preview {
  pointer-events: none;
  opacity: 0.6;
}

/* Multi-select indicator */
.desktop-widget.selected::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 2px solid var(--primary);
  border-radius: calc(var(--radius) + 4px);
  pointer-events: none;
  animation: selection-pulse 1.5s ease infinite;
}

@keyframes selection-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Corner drop indicators during drag */
.widget-drop-corner {
  position: absolute;
  width: calc(12px * var(--widget-scale, 1));
  height: calc(12px * var(--widget-scale, 1));
  border-radius: 50%;
  background: var(--primary);
  opacity: 0;
  transform: scale(0);
  transition: all 0.15s ease;
  pointer-events: none;
  z-index: 1000;
}

.widget-layer.dragging-active .widget-drop-corner {
  opacity: 0.6;
  transform: scale(1);
}

.widget-layer.dragging-active .widget-drop-corner.highlight {
  opacity: 1;
  transform: scale(1.3);
  background: var(--success-color);
  box-shadow: 0 0 12px var(--success-color);
}

/* Widget resize handle */
.widget-resize-handle {
  position: absolute;
  bottom: calc(4px * var(--widget-scale, 1));
  right: calc(4px * var(--widget-scale, 1));
  width: calc(24px * var(--widget-scale, 1));
  height: calc(24px * var(--widget-scale, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
  border-radius: calc(6px * var(--widget-scale, 1));
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  font-size: calc(10px * var(--widget-scale, 1));
  z-index: 10;
}

.desktop-widget:hover .widget-resize-handle {
  opacity: 0.6;
}

.widget-resize-handle:hover {
  opacity: 1 !important;
  background: var(--primary);
}

.desktop-widget.resizing {
  z-index: 1000;
  opacity: 0.9;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.widget-layer.resizing-active .desktop-widget:not(.resizing) {
  opacity: 0.5;
}

/* Custom widget sizes */
.desktop-widget.size-custom {
  /* Width and height set dynamically via JS */
}

/* No background mode for widgets */
.widget-layer.no-widget-bg .desktop-widget:not(.size-shortcut) {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.widget-layer.no-widget-bg .desktop-widget:not(.size-shortcut).selected {
  background: rgba(169, 73, 243, 0.1);
  box-shadow: 0 0 0 2px var(--primary);
}

/* Per-widget no background */
.desktop-widget.no-bg {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.desktop-widget.no-bg.selected {
  background: rgba(169, 73, 243, 0.1) !important;
  box-shadow: 0 0 0 2px var(--primary) !important;
}

/* No hover effect mode */
.widget-layer.no-widget-hover .desktop-widget:hover {
  border-color: var(--glass-border);
  box-shadow: var(--glass-shadow);
  transform: none;
}

.widget-layer.no-widget-hover.no-widget-bg .desktop-widget:hover {
  border-color: transparent;
  box-shadow: none;
}

/* Hide resize handle when widgets are in no-hover mode or on shortcuts */
.widget-layer.no-widget-hover .widget-resize-handle,
.desktop-widget.size-shortcut .widget-resize-handle {
  display: none;
}

/* Empty state hint */
.widget-layer-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  opacity: 0.4;
  pointer-events: none;
}

.widget-layer-hint i {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.widget-layer-hint p {
  font-size: 14px;
}

/* ===== NEW WIDGET TYPE STYLES ===== */

/* Clock widget (overhauled) */
.widget-clock-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: calc(2px * var(--widget-scale, 1));
}
.widget-clock-time {
  font-size: calc(36px * var(--widget-scale, 1));
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.widget-clock-date {
  font-size: calc(12px * var(--widget-scale, 1));
  opacity: 0.6;
  font-weight: 600;
}
.widget-clock-tz {
  font-size: calc(10px * var(--widget-scale, 1));
  opacity: 0.4;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

/* Weather widget */
.widget-weather {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  gap: calc(6px * var(--widget-scale, 1));
}
.weather-main {
  display: flex;
  align-items: center;
  gap: calc(12px * var(--widget-scale, 1));
}
.weather-icon {
  font-size: calc(32px * var(--widget-scale, 1));
  color: #FFD54F;
}
.weather-temp {
  font-size: calc(32px * var(--widget-scale, 1));
  font-weight: 800;
  line-height: 1;
}
.weather-info {
  display: flex;
  gap: calc(8px * var(--widget-scale, 1));
  align-items: baseline;
}
.weather-condition {
  font-size: calc(13px * var(--widget-scale, 1));
  font-weight: 600;
  opacity: 0.8;
}
.weather-range {
  font-size: calc(11px * var(--widget-scale, 1));
  opacity: 0.5;
}
.weather-location {
  font-size: calc(10px * var(--widget-scale, 1));
  opacity: 0.4;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Quote widget */
.widget-quote {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  padding: calc(4px * var(--widget-scale, 1));
}
.quote-icon {
  font-size: calc(18px * var(--widget-scale, 1));
  color: var(--primary, #A949F3);
  opacity: 0.6;
  margin-bottom: calc(6px * var(--widget-scale, 1));
}
.quote-text {
  font-size: calc(13px * var(--widget-scale, 1));
  line-height: 1.5;
  font-style: italic;
  opacity: 0.85;
  margin-bottom: calc(8px * var(--widget-scale, 1));
}
.quote-author {
  font-size: calc(11px * var(--widget-scale, 1));
  opacity: 0.5;
  font-weight: 600;
}

/* Network indicator ring */
.network-indicator-ring {
  width: calc(60px * var(--widget-scale, 1));
  height: calc(60px * var(--widget-scale, 1));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.network-indicator-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: calc(4px * var(--widget-scale, 1)) solid;
  animation: ring-pulse 2s ease infinite;
}
.network-indicator-ring.excellent::before { border-color: #4CAF50; }
.network-indicator-ring.good::before { border-color: #8BC34A; }
.network-indicator-ring.fair::before { border-color: #FF9800; }
.network-indicator-ring.poor::before { border-color: #f44336; }
.ring-inner {
  font-size: calc(14px * var(--widget-scale, 1));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
@keyframes ring-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.95); }
}

/* ASCII Art widget */
.widget-ascii {
  font-size: calc(11px * var(--widget-scale, 1));
  line-height: 1.3;
  white-space: pre;
  overflow: auto;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  margin: 0;
  color: var(--primary, #A949F3);
}

/* Image widget */
.widget-image {
  width: 100%;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: var(--radius);
}
.widget-image-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  opacity: 0.4;
  gap: calc(8px * var(--widget-scale, 1));
}
.widget-image-empty i {
  font-size: calc(24px * var(--widget-scale, 1));
}
.widget-image-empty span {
  font-size: calc(11px * var(--widget-scale, 1));
}

/* Mini progress bar (player count etc) */
.widget-mini-bar {
  width: 80%;
  height: calc(4px * var(--widget-scale, 1));
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: calc(6px * var(--widget-scale, 1));
}
.widget-mini-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Value sub text (e.g. /100 in player count) */
.widget-value-sub {
  font-size: 0.5em;
  opacity: 0.5;
  font-weight: 600;
}

/* Network traffic */
.traffic-row {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--widget-scale, 1));
  width: 100%;
}
.traffic-stat {
  display: flex;
  align-items: baseline;
  gap: calc(4px * var(--widget-scale, 1));
  min-width: calc(80px * var(--widget-scale, 1));
}
.traffic-dir {
  font-size: calc(14px * var(--widget-scale, 1));
  font-weight: 800;
}
.traffic-dir.in { color: #4CAF50; }
.traffic-dir.out { color: #2196F3; }
.traffic-val {
  font-size: calc(16px * var(--widget-scale, 1));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.traffic-unit {
  font-size: calc(10px * var(--widget-scale, 1));
  opacity: 0.5;
}
.traffic-spark {
  flex: 1;
  height: calc(30px * var(--widget-scale, 1));
}

/* Uptime tracker bars */
.uptime-bars {
  display: flex;
  gap: 2px;
  width: 100%;
  margin-top: calc(8px * var(--widget-scale, 1));
  height: calc(12px * var(--widget-scale, 1));
}
.uptime-bar-day {
  flex: 1;
  border-radius: 2px;
  transition: background 0.2s ease;
}
.uptime-bar-day.up { background: #4CAF50; opacity: 0.7; }
.uptime-bar-day.down { background: #f44336; }

/* Disk breakdown donut */
.disk-ring {
  width: calc(70px * var(--widget-scale, 1));
  height: calc(70px * var(--widget-scale, 1));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.disk-ring-inner {
  width: calc(46px * var(--widget-scale, 1));
  height: calc(46px * var(--widget-scale, 1));
  border-radius: 50%;
  background: var(--glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(10px * var(--widget-scale, 1));
  font-weight: 700;
}
.disk-legend {
  display: flex;
  flex-direction: column;
  gap: calc(4px * var(--widget-scale, 1));
}
.disk-legend-item {
  font-size: calc(11px * var(--widget-scale, 1));
  display: flex;
  align-items: center;
  gap: calc(6px * var(--widget-scale, 1));
  opacity: 0.8;
}
.disk-dot {
  width: calc(8px * var(--widget-scale, 1));
  height: calc(8px * var(--widget-scale, 1));
  border-radius: 2px;
  flex-shrink: 0;
}
.disk-pct {
  opacity: 0.5;
  margin-left: auto;
  font-weight: 600;
}

/* Billing summary */
.billing-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(4px * var(--widget-scale, 1)) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.billing-row:last-child { border-bottom: none; }
.billing-label {
  font-size: calc(11px * var(--widget-scale, 1));
  opacity: 0.6;
}
.billing-val {
  font-size: calc(13px * var(--widget-scale, 1));
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Process monitor */
.proc-header {
  display: grid;
  grid-template-columns: 1fr calc(50px * var(--widget-scale, 1)) calc(60px * var(--widget-scale, 1));
  gap: calc(8px * var(--widget-scale, 1));
  padding: calc(4px * var(--widget-scale, 1)) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: calc(9px * var(--widget-scale, 1));
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.proc-row {
  display: grid;
  grid-template-columns: 1fr calc(50px * var(--widget-scale, 1)) calc(60px * var(--widget-scale, 1));
  gap: calc(8px * var(--widget-scale, 1));
  padding: calc(4px * var(--widget-scale, 1)) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: calc(11px * var(--widget-scale, 1));
}
.proc-name { font-weight: 600; opacity: 0.8; }
.proc-cpu { text-align: right; font-variant-numeric: tabular-nums; color: #8BC34A; }
.proc-ram { text-align: right; font-variant-numeric: tabular-nums; color: #29B6F6; }

/* Action button variants */
.widget-action-btn.success { border-color: #4CAF50; color: #4CAF50; }
.widget-action-btn.success:hover { background: #4CAF50; color: white; }
.widget-action-btn.danger { border-color: #f44336; color: #f44336; }
.widget-action-btn.danger:hover { background: #f44336; color: white; }
.widget-action-btn.warning { border-color: #FF9800; color: #FF9800; }
.widget-action-btn.warning:hover { background: #FF9800; color: white; }

/* Mass action button */
.mass-action-info {
  margin-bottom: calc(8px * var(--widget-scale, 1));
}
.mass-count {
  font-size: calc(12px * var(--widget-scale, 1));
  opacity: 0.6;
}
.mass-btn {
  width: auto !important;
  padding: 0 calc(16px * var(--widget-scale, 1)) !important;
  gap: calc(8px * var(--widget-scale, 1));
  display: inline-flex !important;
  font-size: calc(12px * var(--widget-scale, 1));
  font-weight: 600;
}
.mass-btn span {
  font-size: inherit;
}

/* Console widget */
.console-output {
  flex: 1;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: calc(11px * var(--widget-scale, 1));
  line-height: 1.6;
  padding: calc(8px * var(--widget-scale, 1));
  background: rgba(0, 0, 0, 0.3);
  border-radius: calc(8px * var(--widget-scale, 1));
  margin-bottom: calc(8px * var(--widget-scale, 1));
}
.console-line { opacity: 0.9; }
.console-line.dim { opacity: 0.5; }
.console-prefix { color: var(--primary, #A949F3); font-weight: 700; margin-right: 4px; }
.console-input-row {
  display: flex;
  align-items: center;
  gap: calc(6px * var(--widget-scale, 1));
  padding: calc(6px * var(--widget-scale, 1)) calc(8px * var(--widget-scale, 1));
  background: rgba(0, 0, 0, 0.2);
  border-radius: calc(8px * var(--widget-scale, 1));
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.console-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-color);
  font-family: 'Courier New', monospace;
  font-size: calc(11px * var(--widget-scale, 1));
}
.console-send {
  appearance: none;
  background: var(--primary, #A949F3);
  border: none;
  color: white;
  width: calc(24px * var(--widget-scale, 1));
  height: calc(24px * var(--widget-scale, 1));
  border-radius: calc(6px * var(--widget-scale, 1));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(10px * var(--widget-scale, 1));
}
.console-send:hover { opacity: 0.8; }

/* Quick nav actions */
.nav-actions {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
}
.nav-quick-btn {
  width: 100%;
  height: calc(36px * var(--widget-scale, 1));
  border-radius: calc(8px * var(--widget-scale, 1));
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(14px * var(--widget-scale, 1));
}
.nav-quick-btn:hover {
  background: var(--primary-gradient);
  border-color: var(--primary);
}

/* Database query result */
.db-result {
  flex: 1;
  overflow: auto;
  font-family: 'Courier New', monospace;
  font-size: calc(10px * var(--widget-scale, 1));
  margin-bottom: calc(8px * var(--widget-scale, 1));
}
.db-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(8px * var(--widget-scale, 1));
  padding: calc(4px * var(--widget-scale, 1)) calc(8px * var(--widget-scale, 1));
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.db-row.header {
  font-weight: 700;
  opacity: 0.6;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== Widget Editor Modal ===== */
.widget-editor-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}
.widget-editor-modal.active {
  display: flex;
}
.widget-editor-modal .we-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.we-card {
  position: relative;
  z-index: 1;
  width: 420px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: rgba(22, 22, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  overflow: hidden;
  animation: modal-enter 0.2s ease;
}
.we-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.we-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
}
.we-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}
.we-type {
  font-size: 11px;
  opacity: 0.4;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.we-close {
  appearance: none;
  background: none;
  border: none;
  color: var(--text-color, #fff);
  text-decoration: none;
  opacity: 0.5;
  cursor: pointer;
  margin-left: auto;
  font-size: 16px;
  padding: 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s ease;
}
.we-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.1); }
.we-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.we-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.we-field label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.we-field input[type="text"],
.we-field textarea,
.we-field select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-color, #fff);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}
.we-field input:focus,
.we-field textarea:focus,
.we-field select:focus {
  border-color: var(--primary, #A949F3);
}
.we-field select {
  cursor: pointer;
}
.we-field textarea {
  resize: vertical;
  min-height: 60px;
}
.we-field.we-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.we-field.we-row label {
  text-transform: none;
}
.we-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary, #A949F3);
  cursor: pointer;
}
.we-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.we-checkboxes label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  opacity: 1;
  text-transform: none;
  font-weight: 500;
  cursor: pointer;
}
.we-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}
.we-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.we-cancel {
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-color, #fff);
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.we-cancel:hover { background: rgba(255, 255, 255, 0.1); }
.we-save {
  appearance: none;
  background: var(--primary-gradient, linear-gradient(135deg, #A949F3, #7C3AED));
  border: none;
  color: white;
  text-decoration: none;
  padding: 8px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s ease;
}
.we-save:hover { opacity: 0.85; transform: scale(0.98); }

/* Glass Select – Widget Editor */
.widget-editor-modal .glass-select {
  position: relative;
  display: inline-block;
  width: 100%;
  z-index: 100;
}
.widget-editor-modal .glass-select.open { z-index: 1000; }
.widget-editor-modal .gs-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
  outline: none;
  width: 100%;
}
.widget-editor-modal .gs-trigger:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.15); }
.widget-editor-modal .gs-label { opacity: 0.95; white-space: nowrap; }
.widget-editor-modal .gs-caret { transition: transform 0.18s ease; opacity: 0.8; flex-shrink: 0; font-size: 11px; }
.widget-editor-modal .glass-select.open .gs-caret { transform: rotate(180deg); }
.widget-editor-modal .gs-menu {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 30, 36, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: none;
}
.widget-editor-modal .glass-select.open .gs-menu { display: block; }
.widget-editor-modal .gs-item {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  transition: background 0.15s ease;
}
.widget-editor-modal .gs-item:hover { background: rgba(255, 255, 255, 0.08); }
.widget-editor-modal .gs-item[aria-selected="true"] { background: rgba(139, 30, 229, 0.22); }
.widget-editor-modal .gs-item[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.widget-editor-modal .gs-menu-scroll { max-height: 220px; overflow-y: auto; }
.widget-editor-modal .glass-select.disabled .gs-trigger { opacity: 0.55; cursor: not-allowed; }
.widget-editor-modal select { display: none; }

/* UI Switch – Widget Editor */
.widget-editor-modal .ui-switch {
  position: relative;
  width: 36px;
  height: 22px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.widget-editor-modal .ui-switch__progress {
  position: absolute; left: 0; top: 0;
  height: 100%; width: 0%;
  background: linear-gradient(117deg, var(--primary, #A949F3) 0%, var(--primary-light, #c084fc) 100%);
  border-radius: 999px; z-index: 1;
  transition: width 0.18s ease;
}
.widget-editor-modal .ui-switch__thumb {
  position: absolute; top: 50%;
  transform: translate(-50%, -50%);
  width: 16px; height: 16px;
  border-radius: 999px; cursor: pointer; z-index: 2;
  background-color: #fff;
  box-shadow: 0 1px 8px 0 rgba(0,30,63,0.1), 0 0 2px 0 rgba(0,9,20,0.1);
  overflow: hidden;
  transition: transform 0.15s ease, left 0.18s ease;
}
.widget-editor-modal .ui-switch__thumb-filter { position: absolute; inset: 0; z-index: 0; backdrop-filter: blur(0.6px); -webkit-backdrop-filter: blur(0.6px); }
.widget-editor-modal .ui-switch__thumb-overlay { position: absolute; inset: 0; z-index: 1; background-color: rgba(255,255,255,0.1); }
.widget-editor-modal .ui-switch__thumb-specular {
  position: absolute; inset: 0; z-index: 2; border-radius: inherit;
  box-shadow: inset 1px 1px 0 rgba(69,168,243,0.2), inset 1px 3px 0 rgba(28,63,90,0.05), inset 0 0 22px rgba(255,255,255,0.6), inset -1px -1px 0 rgba(69,168,243,0.12);
}
.widget-editor-modal .ui-switch:active .ui-switch__thumb { transform: translate(-50%, -50%) scaleY(0.98) scaleX(1.06); }
.widget-editor-modal .ui-switch[aria-checked="false"] .ui-switch__thumb { left: 11px; }
.widget-editor-modal .ui-switch[aria-checked="false"] .ui-switch__progress { width: 0%; }
.widget-editor-modal .ui-switch[aria-checked="true"] .ui-switch__thumb { left: calc(100% - 11px); }
.widget-editor-modal .ui-switch[aria-checked="true"] .ui-switch__progress { width: 100%; }

@keyframes modal-enter {
  from { transform: translateY(24px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ===== END NEW WIDGET STYLES ===== */

.shortcut-edit-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.shortcut-edit-modal.active {
  display: flex;
}

.shortcut-edit-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.shortcut-edit-card {
  position: relative;
  width: 400px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: modal-enter 0.2s ease;
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.shortcut-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.shortcut-edit-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.shortcut-edit-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.shortcut-edit-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.shortcut-edit-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.shortcut-edit-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
}

.shortcut-preview-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  background: linear-gradient(135deg, var(--primary), #6366f1);
}

.shortcut-preview-name {
  font-weight: 600;
  font-size: 15px;
}

.shortcut-edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shortcut-edit-field label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.shortcut-edit-field input[type="text"] {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.shortcut-edit-field input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(169, 73, 243, 0.2);
}

/* Icon picker */
.shortcut-icon-picker {
  position: relative;
}

.shortcut-icon-current {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.shortcut-icon-current:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.shortcut-icon-current i {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.shortcut-icon-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: rgba(30, 30, 40, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 10;
  display: none;
  flex-direction: column;
  max-height: 250px;
}

.shortcut-icon-dropdown.active {
  display: flex;
}

.shortcut-icon-dropdown input {
  margin: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.shortcut-icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 8px;
  overflow-y: auto;
  max-height: 180px;
}

.shortcut-icon-grid button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.1s ease;
}

.shortcut-icon-grid button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.shortcut-icon-grid button.selected {
  background: var(--primary);
  color: white;
}

/* Color picker container */
.shortcut-color-picker {
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.shortcut-edit-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.shortcut-edit-footer .btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.shortcut-edit-footer .btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.shortcut-edit-footer .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.shortcut-edit-footer .btn-primary {
  background: var(--primary);
  border: none;
  color: white;
}

.shortcut-edit-footer .btn-primary:hover {
  filter: brightness(1.1);
}
