/* ==========================================================================
   StartPage — Adaptive Glassmorphism Styles
   Cross-browser: Safari (macOS/iOS/iPadOS), Firefox, Chrome
   ========================================================================== */

:root {
  --glass-opacity: 0.58;
  --glass-blur: 18px;
  --grid-columns: 3;
  --grid-gap: 22px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --transition: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Dark theme tokens (default) */
  --bg-base: #0b1120;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --glass-bg: rgba(15, 23, 42, var(--glass-opacity));
  --glass-bg-hover: rgba(30, 41, 59, calc(var(--glass-opacity) + 0.12));
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-border-hover: rgba(255, 255, 255, 0.28);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(15, 23, 42, 0.48);
  --shadow-card: 0 10px 32px rgba(2, 6, 23, 0.35);
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-text: #082f49;
  --positive: #34d399;
  --negative: #fb7185;
  --warning: #fbbf24;
  --overlay-dim: rgba(2, 6, 23, 0.25);
}

/* Light theme tokens */
html[data-theme="light"] {
  --bg-base: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --glass-bg: rgba(255, 255, 255, var(--glass-opacity));
  --glass-bg-hover: rgba(255, 255, 255, calc(var(--glass-opacity) + 0.16));
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-border-hover: rgba(15, 23, 42, 0.22);
  --glass-highlight: rgba(255, 255, 255, 0.45);
  --input-bg: rgba(255, 255, 255, 0.55);
  --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.12);
  --accent: #0284c7;
  --accent-strong: #0369a1;
  --accent-text: #ffffff;
  --positive: #059669;
  --negative: #e11d48;
  --warning: #d97706;
  --overlay-dim: rgba(255, 255, 255, 0.12);
}

/* Grey theme tokens */
html[data-theme="grey"] {
  --bg-base: #3a3e45;
  --text-primary: #f4f4f5;
  --text-secondary: #d4d4d8;
  --text-muted: #a1a1aa;
  --glass-bg: rgba(52, 56, 63, var(--glass-opacity));
  --glass-bg-hover: rgba(72, 77, 86, calc(var(--glass-opacity) + 0.14));
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-border-hover: rgba(255, 255, 255, 0.3);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(39, 42, 48, 0.58);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.32);
  --accent: #d4d4d8;
  --accent-strong: #e4e4e7;
  --accent-text: #18181b;
  --positive: #4ade80;
  --negative: #fb7185;
  --warning: #fbbf24;
  --overlay-dim: rgba(24, 24, 27, 0.22);
}

/* VMware VCF Operations Dark Mode tokens */
html[data-theme="vcf-dark"] {
  --bg-base: #13171d;
  --text-primary: #eaedf0;
  --text-secondary: #acbac3;
  --text-muted: #7b8a97;
  --glass-bg: rgba(27, 34, 42, var(--glass-opacity));
  --glass-bg-hover: rgba(37, 47, 58, calc(var(--glass-opacity) + 0.14));
  --glass-border: rgba(73, 175, 217, 0.24);
  --glass-border-hover: rgba(73, 175, 217, 0.48);
  --glass-highlight: rgba(255, 255, 255, 0.06);
  --input-bg: rgba(19, 23, 29, 0.72);
  --shadow-card: 0 10px 32px rgba(0, 0, 0, 0.48);
  --accent: #49afd9;
  --accent-strong: #0091da;
  --accent-text: #09131a;
  --positive: #60b515;
  --negative: #f54f47;
  --warning: #f59e0b;
  --overlay-dim: rgba(11, 15, 20, 0.32);
}

@media (prefers-color-scheme: light) {
  html[data-theme="auto"] {
    --bg-base: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, var(--glass-opacity));
    --glass-bg-hover: rgba(255, 255, 255, calc(var(--glass-opacity) + 0.16));
    --glass-border: rgba(255, 255, 255, 0.65);
    --glass-highlight: rgba(255, 255, 255, 0.45);
    --input-bg: rgba(255, 255, 255, 0.55);
    --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.12);
    --accent: #0284c7;
    --accent-strong: #0369a1;
    --accent-text: #ffffff;
    --positive: #059669;
    --negative: #e11d48;
    --warning: #d97706;
    --overlay-dim: rgba(255, 255, 255, 0.12);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Wallpaper & Overlay
   ========================================================================== */
.wallpaper-layer,
.wallpaper-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.wallpaper-layer {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background 0.4s ease;
}

.wallpaper-overlay {
  background: var(--overlay-dim);
}

/* ==========================================================================
   Glass Surfaces
   ========================================================================== */
.glass-surface {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card), inset 0 1px 0 var(--glass-highlight);
}

.glass-input {
  background: var(--input-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
}

/* ==========================================================================
   App Shell & Top Bar
   ========================================================================== */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1680px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.top-bar {
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: max(10px, env(safe-area-inset-top));
  z-index: 30;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: #fff;
  font-size: 0.95rem;
}

/* Tab-driven Menu */
.tabs-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tabs-list {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
}

.tab-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  min-height: 30px;
}

.tab-btn:hover {
  background: var(--glass-highlight);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.28);
}

.tab-btn.tab-dragging {
  opacity: 0.45;
}

.tab-btn.tab-drop-target {
  box-shadow: 0 0 0 2px var(--accent);
}

/* Search Bar */
.top-bar-center {
  flex: 1 1 260px;
  max-width: 420px;
}

.search-bar {
  display: flex;
  align-items: center;
  border-radius: 12px;
  padding: 4px 8px;
  gap: 6px;
}

.search-bar select {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
}

.search-bar select option {
  background: var(--bg-base);
  color: var(--text-primary);
}

.search-bar input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 4px;
  outline: none;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.kbd-hint {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--glass-highlight);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 2px 6px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  user-select: none;
  pointer-events: none;
}

/* SVG Icons */
.ui-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.ui-icon.sm {
  width: 14px;
  height: 14px;
}

.chevron-icon {
  transition: transform var(--transition);
}

.top-bar.menu-collapsed .menu-toggle-btn .chevron-icon {
  transform: rotate(180deg);
}

/* Keyboard Focus Rings */
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.search-bar input:focus-visible,
.search-bar select:focus-visible {
  outline: none;
}

.search-bar:focus-within {
  border-color: var(--accent);
}

/* Action Buttons */
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-btn,
.icon-btn,
.text-btn {
  appearance: none;
  font: inherit;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
}

.pill-btn {
  border: 1px solid var(--glass-border);
  background: var(--glass-highlight);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 10px;
  min-height: 36px;
  white-space: nowrap;
}

.pill-btn:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-1px);
}

.pill-btn.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}

.pill-btn.primary:hover {
  background: var(--accent-strong);
}

.pill-btn.danger {
  background: rgba(244, 63, 94, 0.18);
  color: var(--negative);
  border-color: rgba(244, 63, 94, 0.35);
}

.pill-btn.small {
  padding: 5px 10px;
  font-size: 0.8rem;
  min-height: 30px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-highlight);
  color: var(--text-primary);
  font-size: 0.95rem;
}

.icon-btn.subtle {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}

.icon-btn.tiny {
  width: 26px;
  height: 26px;
  font-size: 0.78rem;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
}

.icon-btn:hover,
.icon-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}

.icon-btn.tiny:hover {
  background: var(--glass-highlight);
  color: var(--text-primary);
}

.text-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.text-btn:hover {
  background: var(--glass-highlight);
}

.text-btn.danger {
  color: var(--negative);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.25);
}

/* ==========================================================================
   Tab Controls Sub-bar
   ========================================================================== */
.tab-controls-bar {
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tab-controls-left,
.tab-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.control-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.inline-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--glass-highlight);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-primary);
}

/* ==========================================================================
   Multi-Column Adjustable Dashboard Grid
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
  gap: var(--grid-gap);
  align-items: start;
}

.grid-column {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
  min-width: 0;
  min-height: 120px;
  border-radius: var(--radius-lg);
  transition: background var(--transition), outline var(--transition);
}

.grid-column.drag-over {
  background: var(--glass-highlight);
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}

.column-drop-hint {
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==========================================================================
   Widget Cards
   ========================================================================== */
.widget-card {
  border-radius: var(--radius-lg);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
  min-width: 0;
  position: relative;
  overflow: hidden;
  --card-tint: transparent;
  --card-accent: var(--glass-border);
  background: linear-gradient(165deg, var(--card-tint) 0%, transparent 60%), var(--glass-bg);
}

.widget-card[data-color="blue"] {
  --card-tint: rgba(56, 189, 248, 0.14);
  --card-accent: rgba(56, 189, 248, 0.55);
  border-color: rgba(56, 189, 248, 0.28);
}

.widget-card[data-color="indigo"] {
  --card-tint: rgba(129, 140, 248, 0.14);
  --card-accent: rgba(129, 140, 248, 0.55);
  border-color: rgba(129, 140, 248, 0.28);
}

.widget-card[data-color="teal"] {
  --card-tint: rgba(45, 212, 191, 0.13);
  --card-accent: rgba(45, 212, 191, 0.52);
  border-color: rgba(45, 212, 191, 0.26);
}

.widget-card[data-color="emerald"] {
  --card-tint: rgba(52, 211, 153, 0.13);
  --card-accent: rgba(52, 211, 153, 0.52);
  border-color: rgba(52, 211, 153, 0.26);
}

.widget-card[data-color="amber"] {
  --card-tint: rgba(251, 191, 36, 0.12);
  --card-accent: rgba(251, 191, 36, 0.52);
  border-color: rgba(251, 191, 36, 0.25);
}

.widget-card[data-color="rose"] {
  --card-tint: rgba(251, 113, 133, 0.13);
  --card-accent: rgba(251, 113, 133, 0.52);
  border-color: rgba(251, 113, 133, 0.26);
}

.widget-card[data-color="violet"] {
  --card-tint: rgba(167, 139, 250, 0.14);
  --card-accent: rgba(167, 139, 250, 0.55);
  border-color: rgba(167, 139, 250, 0.28);
}

.widget-card[data-color]:not([data-color="none"]) {
  box-shadow: var(--shadow-card), inset 0 2px 0 var(--card-accent);
}

.widget-card:hover {
  border-color: var(--glass-border-hover);
}

.widget-card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

.widget-card.widget-insert-before {
  border-top: 2px solid var(--accent);
}

.widget-drag-grip {
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: -1px;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.widget-card.collapsed {
  padding: 11px 15px;
  gap: 0;
}

.widget-card.collapsed .widget-body {
  display: none;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
}

.widget-card.collapsed .widget-header {
  padding-bottom: 0;
  border-bottom-color: transparent;
}

.widget-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
  flex: 1;
}

.widget-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}

.widget-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn.collapse-btn {
  width: 28px;
  height: 28px;
  color: var(--text-secondary);
}

.widget-card.collapsed .collapse-btn .chevron-icon {
  transform: rotate(-90deg);
}

.widget-body {
  min-width: 0;
  max-width: 100%;
}

.edit-only {
  display: none;
}

body.edit-mode .edit-only {
  display: inline-flex;
}

body.edit-mode .widget-card {
  cursor: grab;
}

/* ==========================================================================
   Bookmarks / Favorites Widget
   ========================================================================== */
.bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--glass-highlight);
  border: 1px solid transparent;
  transition: all var(--transition);
}

.bookmark-item:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border);
  transform: translateX(2px);
}

.bm-drag-handle {
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: -1px;
  cursor: grab;
  opacity: 0;
  user-select: none;
  flex-shrink: 0;
  transition: opacity var(--transition);
}

.bookmark-item:hover .bm-drag-handle,
body.edit-mode .bm-drag-handle {
  opacity: 0.9;
}

.bookmark-item.bm-dragging {
  opacity: 0.4;
}

.bookmark-item.bm-insert-before {
  border-top: 2px solid var(--accent);
}

.bookmarks-list.bm-drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.bookmark-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: var(--text-primary);
}

.bookmark-favicon {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  flex-shrink: 0;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.12);
}

.bookmark-fallback-icon {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-text);
}

.bookmark-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bookmark-name {
  font-size: 0.88rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-url {
  font-size: 0.74rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-item-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* ==========================================================================
   Weather Widget
   ========================================================================== */
.weather-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.weather-temp-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weather-emoji {
  font-size: 2.2rem;
  line-height: 1;
}

.weather-temp {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.weather-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.weather-stats {
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.weather-forecast {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.forecast-day {
  background: var(--glass-highlight);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.forecast-day .day-name {
  color: var(--text-muted);
  font-weight: 600;
}

.weather-hourly-wrap {
  margin-top: 14px;
  padding-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.weather-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.weather-hourly {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.weather-hourly::-webkit-scrollbar {
  height: 5px;
}

.weather-hourly::-webkit-scrollbar-track {
  background: transparent;
}

.weather-hourly::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 999px;
}

.forecast-hour {
  flex: 0 0 54px;
  background: var(--glass-highlight);
  border-radius: var(--radius-sm);
  padding: 7px 4px;
  text-align: center;
  font-size: 0.76rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.forecast-hour .hour-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
}

.forecast-hour .hour-pop {
  font-size: 0.68rem;
  color: var(--accent);
  min-height: 12px;
}

/* ==========================================================================
   Sun Widget (Sunrise & Sunset)
   ========================================================================== */
.sun-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.sun-card {
  background: var(--glass-highlight);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sun-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sun-time {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sun-progress-wrap {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sun-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--glass-highlight);
  overflow: hidden;
}

.sun-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.sun-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   URL Status Monitor Widget
   ========================================================================== */
.url-status-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.url-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--glass-highlight);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
}

.url-status-row:hover {
  background: var(--glass-bg-hover);
}

.url-status-info {
  min-width: 0;
  flex: 1;
}

.url-status-label {
  font-weight: 600;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-status-url {
  font-size: 0.74rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--glass-highlight);
  color: var(--text-muted);
}

.status-pill.checking {
  animation: pillPulse 1.4s ease-in-out infinite;
}

@keyframes pillPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.status-pill.ok {
  background: rgba(52, 211, 153, 0.16);
  color: var(--positive);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.status-pill.down {
  background: rgba(251, 113, 133, 0.16);
  color: var(--negative);
  border: 1px solid rgba(251, 113, 133, 0.35);
}

/* ==========================================================================
   Stocks & Custom Tickers Widget
   ========================================================================== */
.stocks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--glass-highlight);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
}

.stock-row:hover {
  background: var(--glass-bg-hover);
}

.stock-symbol {
  font-weight: 700;
  font-size: 0.92rem;
}

.stock-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stock-price-wrap {
  text-align: right;
}

.stock-price {
  font-weight: 700;
  font-size: 0.94rem;
  font-variant-numeric: tabular-nums;
}

.stock-change {
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stock-change.up {
  color: var(--positive);
}

.stock-change.down {
  color: var(--negative);
}

/* ==========================================================================
   Stock Detail & Chart Widget (Apple Stocks Style)
   ========================================================================== */
.stock-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.stock-detail-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.stock-detail-sym {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stock-detail-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stock-detail-exchange {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.stock-detail-quotes {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.stock-quote-block {
  text-align: right;
}

.stock-quote-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}

.stock-quote-price {
  font-size: 1.05rem;
  font-weight: 700;
}

.stock-quote-pct {
  font-size: 0.8rem;
  font-weight: 700;
}

.stock-quote-pct.up {
  color: var(--positive);
}

.stock-quote-pct.down {
  color: var(--negative);
}

.stock-quote-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.stock-range-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
}

.stock-range-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all var(--transition);
}

.stock-range-btn:hover {
  background: var(--glass-highlight);
  color: var(--text-primary);
}

.stock-range-btn.active {
  background: var(--glass-bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.stock-chart-wrap {
  position: relative;
  margin-top: 8px;
  width: 100%;
  user-select: none;
}

.stock-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.stock-chart-tooltip {
  position: absolute;
  top: 4px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-base);
  border: 1px solid var(--glass-border);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.stock-chart-tooltip.visible {
  opacity: 1;
}

.stock-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 6px 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
}

.stock-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  font-size: 0.76rem;
}

.stock-stat-label {
  color: var(--text-muted);
}

.stock-stat-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* ==========================================================================
   Custom News Widget
   ========================================================================== */
.news-topics-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topic-chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-highlight);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.topic-chip.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.news-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border-bottom: 1px solid var(--glass-border);
  text-decoration: none;
  color: var(--text-primary);
  transition: background var(--transition), border-color var(--transition);
}

.news-item:last-child {
  border-bottom-color: transparent;
}

.news-item:hover {
  background: var(--glass-highlight);
  border-bottom-color: transparent;
}

.news-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
}

.news-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Clock, Notes, and Custom Embed Widgets
   ========================================================================== */
.clock-display {
  text-align: center;
  padding: 8px 4px;
}

.clock-time {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.notes-textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  border-radius: var(--radius-sm);
  padding: 10px;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  outline: none;
}

.notes-textarea:focus {
  border-color: var(--accent);
}

.embed-frame {
  width: 100%;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.15);
}

.widget-status {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 8px 0;
}

/* ==========================================================================
   Modal & Forms
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 23, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--input-bg);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
}

/* Custom Range Sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: var(--glass-highlight);
  border: 1px solid var(--glass-border);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--accent-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--accent-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.form-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.wallpaper-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.wallpaper-swatch {
  height: 44px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
}

.wallpaper-swatch.active {
  border-color: var(--accent);
  transform: scale(1.04);
}

.card-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-color-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-highlight);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.card-color-swatch:hover {
  border-color: var(--glass-border-hover);
  color: var(--text-primary);
}

.card-color-swatch.active {
  border-color: var(--accent);
  background: var(--glass-bg-hover);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px var(--accent);
}

.card-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.weather-locs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.weather-loc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--glass-highlight);
  border: 1px solid var(--glass-border);
}

.weather-loc-name {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.widget-type-btn {
  text-align: left;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-highlight);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all var(--transition);
}

.widget-type-btn:hover {
  background: var(--glass-bg-hover);
  border-color: var(--accent);
}

.widget-type-btn strong {
  font-size: 0.9rem;
}

.widget-type-btn span {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  right: max(18px, env(safe-area-inset-right));
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  animation: toastIn 0.2s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Responsive Breakpoints: iPad & iPhone
   ========================================================================== */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(min(var(--grid-columns), 2), minmax(0, 1fr));
  }

  .widget-card.embed-spanned {
    grid-column: 1 / -1 !important;
  }
}

.top-bar.menu-collapsed .top-bar-right {
  display: none;
}

.menu-toggle-btn {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 1.15rem;
}

@media (max-width: 720px) {
  .app-shell {
    width: 100%;
    padding: max(10px, env(safe-area-inset-top)) 12px max(22px, env(safe-area-inset-bottom)) 12px;
  }

  .top-bar {
    padding: 10px 12px;
    gap: 8px;
  }

  .top-bar-left {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .top-bar-right {
    flex: 1 1 100%;
    justify-content: flex-end;
  }

  .top-bar-center {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }

  .pill-btn .btn-label {
    display: none;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .tab-btn,
  .pill-btn,
  .icon-btn,
  .bookmark-item {
    min-height: 42px;
  }

  .widget-type-grid {
    grid-template-columns: 1fr;
  }

  .kbd-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
