/*
 * styles-2-dashboard-tiles.css
 *
 * Micro-interactions, dashboard tiles, weather column, bottom nav, drag handles.
 *
 * Phase 5 S3 pass-2: extracted from the monolithic styles.css
 * (8 286 LOC) to bring every CSS source file under the < 1 500
 * LOC bar. Load order in index.html preserves the original
 * cascade exactly: this file occupies lines 382 - 1430 of the
 * pre-split styles.css.
 */

/* ---------------------------------------------------------------------------
   Micro-interactions — compositor-friendly (transform / opacity only on tap).
   --------------------------------------------------------------------------- */

@keyframes micro-content-reveal {
  from {
    opacity: 0.82;
  }

  to {
    opacity: 1;
  }
}

.micro-content-reveal {
  animation: micro-content-reveal var(--duration-card-motion) var(--ease-out) both;
}

@media (prefers-reduced-motion: reduce) {
  .micro-content-reveal {
    animation: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  body.micro-interactions .sortable-drag,
  body.micro-interactions .sortable-ghost {
    transform: none !important;
  }

  body.micro-interactions button:not(:disabled):not(.no-micro-tap):active,
  body.micro-interactions .prefs-toggle:active,
  body.micro-interactions #offline-banner-dismiss:active,
  body.micro-interactions .tile-collapse-btn:active,
  body.micro-interactions .glance-collapsible__trigger:active,
  body.micro-interactions .glance-rotate__dot:active,
  body.micro-interactions .app-bottom-nav__link:active,
  body.micro-interactions .surface-interactive:active {
    transform: scale(var(--micro-tap-scale));
    transition: transform var(--micro-tap-press-ms) var(--ease-micro-press);
  }

  body.micro-interactions button:not(:disabled):not(.no-micro-tap),
  body.micro-interactions .prefs-toggle,
  body.micro-interactions #offline-banner-dismiss,
  body.micro-interactions .tile-collapse-btn,
  body.micro-interactions .glance-collapsible__trigger,
  body.micro-interactions .glance-rotate__dot,
  body.micro-interactions .app-bottom-nav__link,
  body.micro-interactions .surface-interactive {
    transition: transform var(--micro-tap-release-ms) var(--ease-micro-spring);
    transform: translateZ(0);
  }

  body.micro-interactions .today-brief__card.card-interactive,
  body.micro-interactions #weather-card.card-interactive,
  body.micro-interactions #dashboard-tiles .dashboard-tile.card-interactive {
    transition: transform var(--micro-tap-release-ms) var(--ease-micro-spring);
    transform: translateZ(0);
  }
}

@supports selector(:has(*)) {
  @media (prefers-reduced-motion: no-preference) {
    body.micro-interactions .today-brief__card.card-interactive:active:not(:has(button:active)):not(:has(summary:active)):not(
        :has(a[href]:active)
      ),
    body.micro-interactions #weather-card.card-interactive:active:not(:has(button:active)):not(:has(summary:active)):not(
        :has(a[href]:active)
      ),
    body.micro-interactions #dashboard-tiles .dashboard-tile.card-interactive:active:not(:has(button:active)):not(
        :has(summary:active)
      ):not(:has(a[href]:active)) {
      transform: scale(var(--micro-tap-scale));
      transition: transform var(--micro-tap-press-ms) var(--ease-micro-press);
    }
  }
}

.dashboard-tile.card-interactive {
  transition:
    box-shadow var(--duration-card-motion) var(--ease-standard),
    transform var(--micro-tap-release-ms) var(--ease-micro-spring);
}

.surface-interactive {
  transition:
    box-shadow var(--duration-card-motion) var(--ease-standard),
    transform var(--micro-tap-release-ms) var(--ease-micro-spring);
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-tile.card-interactive,
  .surface-interactive {
    transition: none;
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.35rem;
  z-index: 10000;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  background: var(--btn-solid-bg);
  color: var(--btn-solid-fg);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-tight);
}

.skip-link:focus {
  left: max(0.5rem, env(safe-area-inset-left, 0px));
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#main-content:focus {
  outline: none;
}

#main-content:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.offline-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin: 0 auto 0.45rem;
  max-width: min(1440px, calc(100% - 2rem));
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border));
  background: var(--status-error-bg);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.35;
  box-sizing: border-box;
}

.offline-banner[hidden] {
  display: none !important;
}

.offline-banner__text {
  flex: 1;
  min-width: 0;
}

.offline-banner__dismiss {
  flex-shrink: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  min-height: var(--touch-target-min);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.offline-banner__dismiss:hover {
  background: var(--surface-alt);
}

.offline-banner__dismiss:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.offline-banner__dismiss:active {
  transform: scale(0.97);
}

.prefs-wrap {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
}

@media (max-width: 480px) {
  .dashboard__quote-column .quote-of-day {
    max-height: 5.5rem;
    overflow: hidden;
  }

  .dashboard__quote-column .quote-of-day__text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
  }

}

html[data-theme="midnight"] body,
html[data-theme="nord"] body {
  background:
    radial-gradient(ellipse 78% 52% at 94% -8%, rgba(129, 140, 248, 0.14), transparent 48%),
    radial-gradient(ellipse 52% 44% at 4% 102%, rgba(99, 102, 241, 0.12), transparent 46%),
    var(--bg);
}

html[data-theme="solarized"] body {
  background:
    radial-gradient(ellipse 72% 48% at 92% 0%, rgba(38, 139, 210, 0.09), transparent 52%),
    radial-gradient(ellipse 48% 38% at 6% 100%, rgba(133, 153, 0, 0.06), transparent 48%),
    var(--bg);
}

.app-shell {
  width: min(1440px, calc(100% - var(--space-8)));
  margin: var(--space-4) auto;
}

.dashboard {
  flex: 1;
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-shell, 20px);
  padding: clamp(1.125rem, 1rem + 0.5vw, 1.5rem) clamp(1.125rem, 0.85rem + 1vw, 1.65rem);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

@supports (backdrop-filter: blur(12px)) {
  html[data-theme="light"] .dashboard,
  html[data-theme="solarized"] .dashboard {
    backdrop-filter: saturate(1.15) blur(14px);
    -webkit-backdrop-filter: saturate(1.15) blur(14px);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  html,
  body,
  .dashboard,
  .card {
    transition: none !important;
  }

  html[data-theme="light"] .dashboard,
  html[data-theme="solarized"] .dashboard {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--surface);
  }
}

.dashboard__header {
  margin-bottom: var(--space-4);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

/* Grid + align-items:start so the quote never stretches to the title stack height (flex row bug). */
.dashboard__header-lead {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, max-content);
  grid-template-rows: auto auto;
  column-gap: var(--space-4);
  row-gap: var(--space-3);
  align-items: start;
  justify-items: start;
}

.dashboard__title-row {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  min-width: 0;
}

.dashboard__title-stack {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.dashboard__title-row .theme-toolbar-wrap {
  flex-shrink: 0;
}

/* Icons-only in the title row; label stays for aria-labelledby. */
.dashboard__title-row .theme-toolbar__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dashboard__title-row .theme-toolbar {
  flex-wrap: nowrap;
  gap: 0.28rem;
}

.dashboard__title-row .theme-toolbar__icons {
  flex-wrap: nowrap;
}

.dashboard__title-row .dashboard__title-stack h1 {
  margin-top: 0;
  margin-bottom: 0;
}

.eyebrow {
  margin: 0;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1 {
  margin: 0.35rem 0 0.5rem;
  font-size: var(--type-title);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
  line-height: var(--font-line-tight);
  color: var(--text);
}

.dashboard-update-hint__prefix {
  color: var(--hint-prefix-color);
  font-weight: 600;
}

.dashboard__quote-column {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  width: fit-content;
  max-width: min(40ch, 100%);
  justify-self: start;
}

.dashboard-update-hint {
  margin: 0;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--type-body);
  line-height: var(--font-line-snug);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border-left: 3px solid var(--accent-soft);
  box-sizing: border-box;
}

.dashboard-update-hint__text {
  flex: 1;
  min-width: 0;
}

.dashboard-update-hint__close {
  flex-shrink: 0;
  margin: -0.15rem -0.05rem 0 0;
  padding: 0.2rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.dashboard-update-hint__close:hover {
  background: rgba(128, 128, 128, 0.14);
  color: var(--text);
}

.dashboard-update-hint__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.dashboard-update-hint__close-icon {
  display: block;
  vertical-align: middle;
  opacity: 0.85;
}

.quote-of-day {
  box-sizing: border-box;
  display: block;
  margin: 0;
  padding: var(--space-2) var(--space-3) var(--space-2);
  width: fit-content;
  max-width: min(40ch, 100%);
  height: -webkit-fit-content;
  height: fit-content;
  min-height: 0;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--surface-alt);
}

.quote-of-day__label {
  display: block;
  margin: 0 0 var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: 700;
  line-height: var(--font-line-tight);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.quote-of-day__blockquote {
  display: block;
  margin: 0;
  margin-inline: 0;
  padding: 0;
  border: 0;
  min-height: 0;
}

.quote-of-day__text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  margin: 0;
  overflow: hidden;
  font-size: var(--font-size-sm);
  line-height: var(--font-line-snug);
  color: var(--text);
  font-style: italic;
}

.quote-of-day__footer {
  display: block;
  margin: 0.3rem 0 0;
  padding: 0;
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--muted);
}

.quote-of-day__footer[hidden] {
  display: none !important;
}

.quote-of-day__author {
  margin: 0;
  font-style: normal;
  font-weight: 600;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

.prefs-toggle {
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
  min-height: var(--touch-target-min);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.prefs-toggle:hover {
  background: var(--prefs-toggle-hover);
}

.prefs-toggle:active {
  transform: scale(0.98);
}

.prefs-toggle:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.prefs-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.prefs-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  left: auto;
  z-index: 40;
  width: min(18rem, calc(100vw - var(--space-8)));
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: visible;
}

[dir="rtl"] .prefs-panel {
  right: auto;
  left: 0;
}

.prefs-panel[hidden] {
  display: none !important;
}

.prefs-panel__scroll {
  overflow: visible;
}

.prefs-panel__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  margin: 0 0 var(--space-2);
}

.prefs-panel__home-btn {
  display: none;
}

.prefs-panel__head .prefs-panel__title {
  margin: 0;
  flex: 1;
  text-align: center;
  font-size: var(--font-size-md);
  font-weight: 700;
}

body.mobile-prefs-screen .prefs-panel__home-btn {
  display: inline-flex !important;
}

.prefs-panel__head .prefs-panel__home-btn {
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  transform: translateY(-50%);
}

.prefs-field {
  margin-bottom: var(--space-3);
}

.prefs-field--hint {
  font-size: var(--font-size-xs);
  line-height: var(--font-line-snug);
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.prefs-field__label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: var(--space-1);
}

.prefs-select {
  width: 100%;
  font: inherit;
  /* Min 16px: iOS Safari zooms the page when focused inputs are smaller, breaking prefs autocomplete layout. */
  font-size: max(16px, 0.85rem);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
}

.prefs-input {
  width: 100%;
  font: inherit;
  font-size: max(16px, 0.85rem);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
}

.prefs-select:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.prefs-input:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/*
 * Home / work address fields: use a literal 16px size so iOS Safari does not zoom the viewport on
 * focus (zoom breaks suggestion dropdown placement vs visualViewport). Generic .prefs-input max()
 * is not always enough when ancestors or dynamic text sizing interact with the keyboard.
 */
.prefs-field--address #prefs-home-address.prefs-input,
.prefs-field--address #prefs-work-address.prefs-input {
  font-size: 16px;
  line-height: 1.4;
}

.prefs-field--address {
  position: relative;
}

.prefs-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 60;
  touch-action: manipulation;
  margin: 0.2rem 0 0;
  padding: 0.2rem 0;
  list-style: none;
  max-height: 10.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.prefs-suggestions__item {
  padding: 0.38rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text);
  cursor: pointer;
}

.prefs-suggestions__item:hover {
  background: var(--primary-soft);
}

.prefs-suggestions__item--meta {
  cursor: default;
  color: var(--muted);
  font-size: 0.74rem;
}

.prefs-suggestions__item--meta:hover {
  background: transparent;
}

.lang-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lang-toolbar__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.lang-toolbar__select {
  font: inherit;
  font-size: 0.85rem;
  min-height: var(--touch-target-min);
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  min-width: 7.5rem;
  cursor: pointer;
}

.lang-toolbar__select:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.cards {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap-tiles);
  align-items: stretch;
}

.cards > #tile-order-live {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  min-height: 0;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-card-primary);
  box-shadow: var(--card-elev-standard);
  padding: var(--card-padding);
  border: 1px solid var(--border);
  transition:
    box-shadow var(--duration-base) var(--ease-standard),
    border-color var(--duration-base) var(--ease-standard),
    transform var(--duration-fast) var(--ease-out),
    background-color var(--duration-base) var(--ease-standard);
}

.card:hover {
  box-shadow: var(--card-elev-hover);
  border-color: var(--border);
}

/* Tap / press: soft radial highlight (Material-style scale 1 → 0.98) */
.card.card-interactive {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.card.card-interactive::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at 50% 50%,
    color-mix(in srgb, var(--accent) 22%, transparent),
    transparent 62%
  );
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-standard);
  pointer-events: none;
}

.card.card-interactive:active::before {
  opacity: 1;
}

/* Primary grid tiles: stronger focus ring when any control inside is focused */
.card.card-interactive:focus-within {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  box-shadow: var(--card-elev-hover);
}

.card.card-interactive:active {
  transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }

  .card.card-interactive::before {
    transition: none;
    opacity: 0 !important;
  }

  .card.card-interactive:active {
    transform: none;
  }
}

/* Movable dashboard tiles (order persisted in preferences cookie) */
.dashboard-tiles {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  /* Row flow keeps variable-height tiles in document order and avoids gaps/overlap quirks from dense packing. */
  grid-auto-flow: row;
  gap: var(--gap-tiles);
  align-items: stretch;
}

.dashboard-tile {
  grid-column: span 4;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* To-do tile grows with the list + composer so later tiles are pushed down (no max-height clip / overlap). */
#todo-card.dashboard-tile {
  height: auto;
  align-self: start;
  max-height: none;
  overflow-x: hidden;
  overflow-y: visible;
}

.tile-type-square {
  grid-column: span 3;
  overflow: hidden;
}

.tile-type-square h2,
.tile-type-square .meta,
.tile-type-square .metric {
  overflow-wrap: anywhere;
}

.tile-type-horizontal,
.tile-type-vertical {
  grid-column: span 6;
}

.tile-type-square,
.tile-type-horizontal {
  min-height: 12rem;
}

.tile-type-horizontal {
  overflow: hidden;
}

.tile-type-horizontal-scroll {
  grid-column: span 6;
  min-height: 12rem;
  overflow-x: hidden;
  overflow-y: hidden;
}

/* Weather: optional column split on Today’s Brief; horizontal scroll only on #weather-hourly. */
#weather-card.dashboard-tile.tile-type-horizontal-scroll {
  min-width: 0;
  max-width: 100%;
  min-height: min(17rem, 30vh);
  overflow-x: hidden;
  overflow-y: hidden;
}

.tile-type-vertical {
  max-height: min(26rem, 58vh);
  overflow-y: hidden;
  overflow-x: hidden;
}

#tile-news.tile-type-vertical.dashboard-tile--resizable-v,
#stocks-tile.tile-type-vertical.dashboard-tile--resizable-v {
  max-height: none;
  align-self: start;
  overflow: hidden;
}

.dashboard-tile--weather .weather-inline {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-tile--weather .hourly-forecast {
  flex: 1;
  min-height: 0;
}

.card__top--tile {
  --drag-handle-size: 2rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.45rem 0.55rem;
  margin-bottom: 0.5rem;
}

.card__top--tile > h2 {
  margin: 0;
  min-width: 0;
  font-size: var(--type-section);
  font-weight: var(--font-weight-medium);
  letter-spacing: -0.015em;
  line-height: var(--font-line-snug);
  color: var(--text);
}

 .tile-drag-handle {
  flex-shrink: 0;
  /* Phase 4 S4 a11y: visual handle stays compact, hit area grows to the
     WCAG floor. Drag-handle reachability matters for motor users too. */
  width: var(--drag-handle-size, 2rem);
  height: var(--drag-handle-size, 2rem);
  min-width: var(--touch-target-min, 48px);
  min-height: var(--touch-target-min, 48px);
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}

.tile-drag-handle:hover {
  color: var(--text);
  border-color: var(--border);
}

.tile-drag-handle:active {
  cursor: grabbing;
}

.tile-drag-handle__icon {
  display: block;
}

.tile-resize-handle {
  flex-shrink: 0;
  width: 100%;
  margin: 0.35rem 0 0;
  padding: 0.35rem 0 0.15rem;
  border: none;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 calc(var(--radius) - 3px) calc(var(--radius) - 3px);
  background: linear-gradient(180deg, transparent 0%, var(--surface-alt) 55%);
  cursor: ns-resize;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.25rem;
}

.tile-resize-handle:hover,
.tile-resize-handle:focus-visible {
  background: var(--prefs-toggle-hover);
}

.tile-resize-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.tile-resize-handle__grip {
  display: block;
  width: 2.5rem;
  height: 0.28rem;
  border-radius: 999px;
  background: var(--muted);
  opacity: 0.65;
}

body.is-resizing-tile {
  cursor: ns-resize !important;
  user-select: none;
}

.sortable-drag {
  opacity: 0.95;
  box-shadow: var(--shadow-hover);
}

.sortable-ghost {
  opacity: 0.42;
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

/* Fixed bottom nav sits above the dashboard; let drag gestures reach tiles underneath */
body:has(.sortable-ghost) .app-bottom-nav,
body:has(.sortable-drag) .app-bottom-nav {
  pointer-events: none;
}

.dashboard-tile.dashboard-tile--ipl {
  padding: 1rem 1.05rem 1.05rem;
  border-radius: calc(var(--radius) - 2px);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--accent-soft);
  background: linear-gradient(165deg, var(--surface) 0%, var(--surface-alt) 100%);
  max-height: none;
}

.dashboard-tile.dashboard-tile--ipl:hover {
  box-shadow: var(--shadow-hover), inset 0 0 0 1px rgba(56, 142, 60, 0.22);
}

html[data-theme="midnight"] .dashboard-tile.dashboard-tile--ipl:hover,
html[data-theme="nord"] .dashboard-tile.dashboard-tile--ipl:hover {
  box-shadow: var(--shadow-hover), inset 0 0 0 1px rgba(129, 199, 132, 0.28);
}

.ipl-scroll {
  margin-top: 0.35rem;
  max-height: none;
  overflow: hidden;
  padding-right: 0;
}
