/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Global focus ring (a11y) ───────────────────────────────────────────────
   Many components below set `outline: none` for visual cleanup. This rule
   guarantees that EVERY interactive element keeps a visible focus indicator
   when reached via keyboard (Tab) — pointer focus stays clean.
   Tests: WCAG 2.1 SC 2.4.7 (Focus Visible).
─────────────────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent, #5B8BFF);
  outline-offset: 2px;
  border-radius: inherit;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   DESIGN TOKENS  (dark-first — Figma spec: Box/Fill #131313, blur 12px)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
:root {
  /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
     LAYER 2 — Semantic tokens  (dark-first defaults)
     Swapped wholesale in [data-theme="light"] below.
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

  /* Backgrounds */
  --bg:        #0A0A0A;
  --bg-2:      #111111;
  --surface:   #181818;
  --surface-2: #1F1F1F;
  --surface-3: #262626;

  /* Borders */
  --border:   #2C2C2C;
  --border-2: #3A3A3A;

  /* Text */
  --text:         #F0F0F0;
  --text-2:       #9A9A9A;  /* ≥4.5:1 on bg → surface-3 (WCAG AA, verified) */
  --text-3:       #909090;  /* ≥4.5:1 on bg → surface-3 (was #808080: failed AA on surface-2/-3) */
  --text-inverse: #FFFFFF;

  /* Accent blue */
  --accent:       #5B8BFF;
  --accent-h:     #4470EE;
  --accent-light: #7AABFF;
  --accent-soft:  rgba(91, 139, 255, .13);
  --accent-grad-end:   #7B5EFF;   /* .btn-accent gradient end */
  --accent-grad-end-h: #6B4EEF;   /* .btn-accent:hover gradient end */

  /* Purple — primary CTA */
  --purple:      #9855D4;
  --purple-h:    #7A3FB5;
  --purple-soft: rgba(152, 85, 212, .16);

  /* Semantic status */
  --danger:       #EF4444;
  --danger-soft:  rgba(239, 68, 68, .13);
  --success:      #22C55E;
  --success-soft: rgba(34, 197, 94, .13);
  --warning:      #F59E0B;
  --warning-soft: rgba(245, 158, 11, .13);

  /* Trip status */
  --status-booked:    #4ADE80;
  --status-planned:   #5B8BFF;
  --status-completed: #8888AA;

  /* Activity categories */
  --cat-transport:     #A78BFA;
  --cat-culture:       #5B8BFF;
  --cat-food:          #F59E0B;
  --cat-leisure:       #22C55E;
  --cat-accommodation: #06B6D4;

  /* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
     LAYER 3 — Component tokens  (reference semantic tokens above)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

  /* Glass morphism */
  --glass-bg:       rgba(20, 20, 20, 0.9);
  --glass-bg-deep:  rgba(13, 13, 13, 0.88);
  --glass-border:   rgba(255, 255, 255, 0.10);
  --glass-border-2: rgba(255, 255, 255, 0.07);
  --glass-blur:     blur(24px) saturate(180%);

  /* Border radius */
  --r-xs:  4px;
  --r-sm:  8px;
  --r:     12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 28px;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, .40);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, .45), 0 4px 14px rgba(0, 0, 0, .28);
  --shadow:    0 3px 10px rgba(0, 0, 0, .50), 0 8px 28px rgba(0, 0, 0, .34);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .32);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, .62), 0 2px 10px rgba(0, 0, 0, .38);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, .72), 0 4px 18px rgba(0, 0, 0, .44);

  /* Box system */
  --box-bg:     rgba(19, 19, 19, 0.80);
  --box-border: rgba(255, 255, 255, 0.06);

  /* Button system — btn-bg/border reference box tokens (same base surface) */
  --btn-bg:              var(--box-bg);
  --btn-border:          var(--box-border);
  --btn-color:           #ACB1B1;
  --btn-active-bg:       #4361EE;
  --btn-active-color:    #DFE9E9;
  --btn-primary-hover:   #3451d1;
  --btn-icon-active-bg:  #383838;
  --btn-danger-hover-bg: rgba(239, 68, 68, .18);
  --btn-accent-shadow:       0 3px 14px rgba(91, 139, 255, .38);
  --btn-accent-shadow-hover: 0 4px 18px rgba(91, 139, 255, .52);

  /* Interaction */
  --hover-overlay: rgba(255, 255, 255, .08);

  /* Input */
  --input-border:       var(--glass-border);
  --input-bg:           rgba(255, 255, 255, 0.05);
  --input-border-focus: rgba(91, 139, 255, 0.60);
  --input-bg-focus:     rgba(91, 139, 255, 0.06);
  --input-bg-readonly:  rgba(255, 255, 255, 0.85);

  /* Status chips */
  --chip-todo-bg:          rgba(245, 158, 11, .15);
  --chip-todo-border:      rgba(245, 158, 11, .28);
  --chip-ready-bg:         rgba(34, 197, 94, .15);
  --chip-ready-border:     rgba(34, 197, 94, .28);
  --chip-progress-bg:      rgba(91, 139, 255, .18);
  --chip-progress-border:  rgba(91, 139, 255, .25);
  --chip-completed-bg:     rgba(136, 136, 170, .15);
  --chip-completed-border: rgba(136, 136, 170, .20);

  /* Status badges — solid colors for use over photos */
  --badge-warning-bg:     #92500A;
  --badge-warning-color:  #FDE68A;
  --badge-warning-border: #B45309;
  --badge-success-bg:     #14532D;
  --badge-success-color:  #86EFAC;
  --badge-success-border: #16A34A;
  --badge-info-bg:        #1E3A6E;
  --badge-info-color:     #93C5FD;
  --badge-info-border:    #3B6DD4;
  --badge-neutral-bg:     #2A2A3A;
  --badge-neutral-color:  #A8A8C8;
  --badge-neutral-border: #4A4A6A;

  /* Overlays & photo text */
  --overlay-soft:     rgba(0, 0, 0, .35);
  --overlay-medium:   rgba(0, 0, 0, .55);
  --overlay-border:   rgba(255, 255, 255, .15);
  --text-photo:       #FFFFFF;
  --text-photo-75:    rgba(255, 255, 255, .75);
  --text-photo-65:    rgba(255, 255, 255, .65);
  --text-photo-60:    rgba(255, 255, 255, .60);
  --text-photo-55:    rgba(255, 255, 255, .55);
  --text-shadow-dark: 0 4px 24px rgba(0, 0, 0, .35);
  --photo-gradient:   linear-gradient(to bottom, transparent 40%, rgba(0, 0, 0, 0.35) 100%);

  /* Decorative accent */
  --accent-border-soft:  rgba(91, 139, 255, .22);
  --accent-border-hover: rgba(91, 139, 255, .50);
  --accent-bg-subtle:    rgba(91, 139, 255, .05);
  --accent-bg-soft:      rgba(91, 139, 255, .06);
  --accent-bg-medium:    rgba(91, 139, 255, .18);
  --purple-border-soft:  rgba(152, 85, 212, .25);
  --purple-glow-sm:      0 2px 10px rgba(152, 85, 212, .28);
  --focus-ring-shadow:   0 0 0 2px rgba(91, 139, 255, .18);
  --glow-accent:         0 0 6px rgba(82, 113, 255, .5);
  --danger-border-soft:  rgba(239, 68, 68, .2);
  --success-border-soft: rgba(16, 185, 129, .20);
  --warning-border-soft: rgba(245, 158, 11, .25);

  /* Surfaces & separators */
  --separator:              rgba(255, 255, 255, .07);
  --separator-faint:        rgba(255, 255, 255, .05);
  --surface-overlay-trace:  rgba(255, 255, 255, .025);
  --surface-overlay-faint:  rgba(255, 255, 255, .05);
  --surface-overlay-subtle: rgba(255, 255, 255, .04);
  --border-photo-bright:    rgba(255, 255, 255, .8);
  --border-subtle:          rgba(255, 255, 255, .20);
  --scrollbar-thumb:        rgba(255, 255, 255, .12);
  --scrollbar-thumb-faint:  rgba(255, 255, 255, .06);

  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-snappy:    cubic-bezier(0.4, 0, 0.2, 1);
  --transition: .18s var(--ease-out-quart);
  --sidebar-w: 232px;
  --sidebar-w-icons: 60px;
  --header-h: 52px;
}

/* ── Light mode overrides ──────────────────────────────────────────────── */
[data-theme="light"] {
  /* Layer 2 — semantic overrides */
  --bg:        #F0F0F5;
  --bg-2:      #E6E6EE;
  --surface:   #FFFFFF;
  --surface-2: #F5F5FA;
  --surface-3: #EBEBF2;
  --border:    #E0E0EE;
  --border-2:  #C8C8D8;
  --text:      #111118;
  --text-2:    #6B6B88;
  --text-3:    #6E6E96;  /* darkened for WCAG AA 4.5:1 on white surfaces */

  --accent:       #4761EE;  /* darkened for WCAG AA 4.5:1 on white surfaces */
  --accent-h:     #3852D4;
  --accent-light: #7B95FF;
  --accent-soft:  rgba(82, 113, 255, .10);
  /* chip tokens and focus-ring-shadow auto-update via accent-soft */

  --purple:      #9855D4;
  --purple-h:    #7A3FB5;
  --purple-soft: rgba(152, 85, 212, .10);

  --danger-soft:  rgba(239, 68, 68, .10);
  --success:      #10B981;
  --success-soft: rgba(16, 185, 129, .10);
  --warning-soft: rgba(245, 158, 11, .10);

  /* Layer 3 — component overrides */
  --glass-bg:       rgba(255, 255, 255, .55);
  --glass-bg-deep:  rgba(255, 255, 255, .88);
  --glass-border:   rgba(255, 255, 255, .80);
  --glass-border-2: rgba(0, 0, 0, .08);

  --box-bg:     rgba(255, 255, 255, 0.80);
  --box-border: rgba(0, 0, 0, 0.07);
  /* --btn-bg → var(--box-bg) auto-updates to rgba(255,255,255,.80) */

  --btn-bg:           rgba(255, 255, 255, 0.70);
  --btn-border:       rgba(0, 0, 0, 0.09);
  --btn-color:        #4A4A6E;
  --btn-active-bg:    #4361EE;
  --btn-active-color: var(--text-inverse);
  --btn-icon-active-bg: var(--accent-soft);

  --hover-overlay: rgba(0, 0, 0, .06);

  --input-border:      var(--border);
  --input-bg:          rgba(255, 255, 255, 0.90);
  --input-bg-readonly: rgba(255, 255, 255, 0.90);

  --separator:              var(--glass-border-2);
  --separator-faint:        rgba(0, 0, 0, .04);
  --surface-overlay-trace:  rgba(0, 0, 0, .02);
  --surface-overlay-faint:  rgba(0, 0, 0, .04);
  --surface-overlay-subtle: rgba(0, 0, 0, .03);
  --border-subtle:          rgba(0, 0, 0, .15);
  --scrollbar-thumb:        rgba(0, 0, 0, .15);
  --scrollbar-thumb-faint:  rgba(0, 0, 0, .08);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .07), 0 4px 12px rgba(0, 0, 0, .05);
  --shadow:    0 2px 8px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .10), 0 1px 4px rgba(0, 0, 0, .06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .14), 0 2px 8px rgba(0, 0, 0, .08);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, .18), 0 4px 16px rgba(0, 0, 0, .10);
}


/* ── Base ──────────────────────────────────────────────────────────────────── */
html {
  font-size: 15px;
}

body {
  font-family: 'Urbanist', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;   /* fallback */
  min-height: 100dvh;  /* iOS Safari: accounts for the dynamic address bar */
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

/* Lucide sizing */
svg.lucide,
i[data-lucide]~svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.btn svg.lucide {
  width: 14px;
  height: 14px;
}

.map-zoom-btn svg.lucide {
  width: 18px;
  height: 18px;
}


/* ── Skip navigation ───────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -50px;
  left: 8px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--surface);
  color: var(--accent);
  font-size: .875rem;
  font-weight: 600;
  border: 2px solid var(--accent);
  border-radius: var(--r);
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus {
  top: 8px;
}

/* ── App loading screen ────────────────────────────────────────────────────── */
#app-loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: opacity 0.28s var(--ease-out-quart);
  pointer-events: none; /* let clicks fall through once content is underneath */
}

#app-loading.fade-out {
  opacity: 0;
}

.app-loading-icon {
  width: 36px;
  height: 36px;
  color: var(--accent);
  animation: app-loading-pulse 1.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.app-loading-wordmark {
  font-family: 'Urbanist', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@keyframes app-loading-pulse {
  0%, 100% { opacity: 1;    transform: translateY(0);    }
  50%       { opacity: 0.4; transform: translateY(-3px); }
}

/* ── Global focus ring — WCAG 2.4.7 ───────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Inputs/selects have a dedicated border-color focus style — suppress outline ring */
.input:focus-visible,
.todo-add-input:focus-visible,
.user-role-select:focus-visible {
  outline: none;
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.ml-auto {
  margin-left: auto;
}

.mt-2 {
  margin-top: 8px;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .01em;
}

.chip-todo {
  background: var(--chip-todo-bg);
  color: var(--warning);
  border: 1px solid var(--chip-todo-border);
}

.chip-ready {
  background: var(--chip-ready-bg);
  color: var(--success);
  border: 1px solid var(--chip-ready-border);
}

.chip-progress {
  background: var(--chip-progress-bg);
  color: var(--accent-light);
  border: 1px solid var(--chip-progress-border);
}

.chip-completed {
  background: var(--chip-completed-bg);
  color: var(--status-completed);
  border: 1px solid var(--chip-completed-border);
}

/* Legacy aliases */
.chip-planned {
  background: var(--chip-progress-bg);
  color: var(--accent-light);
  border: 1px solid var(--chip-progress-border);
}

.chip-active {
  background: var(--chip-ready-bg);
  color: var(--success);
  border: 1px solid var(--chip-ready-border);
}

.chip-booked {
  background: var(--chip-ready-bg);
  color: var(--success);
  border: 1px solid var(--chip-ready-border);
}

/* ══════════════════════════════════════════════════════════════════════════════
   BUTTON SYSTEM — 6 tipi (Figma spec Lorenzo)
   Stato default: bg rgba(19,19,19,.80) · border rgba(255,255,255,.06) · color #ACB1B1
   Stato active:  bg #4361EE · color #DFE9E9   (btn-icon active: bg #383838)
   ══════════════════════════════════════════════════════════════════════════════ */

/* Button tokens defined in :root above — overridden in [data-theme="light"] */

/* ── 1. Bottone normale orizzontale ─────────────────────────────────────────
   min-width 40px · height 40px · padding-x 16px · gap 12px
   border-radius 12px · font 14px Regular · icona max 14px                  */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 40px;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-color);
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn svg.lucide {
  width: 14px;
  height: 14px;
}

.btn:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.btn:active {
  transform: scale(.97);
}

.btn.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
  border-color: transparent;
}

/* Stato disabilitato condiviso per tutte le classi bottone del DS */
.btn:disabled,        .btn[disabled],
.btn-icon:disabled,   .btn-icon[disabled],
.btn-menu:disabled,   .btn-menu[disabled],
.btn-tab:disabled,    .btn-tab[disabled],
.btn-filter:disabled, .btn-filter[disabled],
.btn-vertical:disabled, .btn-vertical[disabled] {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

/* Varianti colore — override sul base */
.btn-primary {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
  border-color: var(--box-border);
  font-weight: 600;
}

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

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-grad-end) 100%);
  color: var(--text-inverse);
  border-color: transparent;
  border-radius: 99px;
  font-weight: 700;
  box-shadow: var(--btn-accent-shadow);
}

.btn-accent:hover {
  background: linear-gradient(135deg, var(--accent-h) 0%, var(--accent-grad-end-h) 100%);
  box-shadow: var(--btn-accent-shadow-hover);
}

.btn-ghost {
  background: var(--btn-bg);
  border-color: var(--btn-border);
  color: var(--btn-color);
}

.btn-ghost:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.btn-danger:hover {
  background: var(--btn-danger-hover-bg);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 8px;
}

/* ── 2. Bottone con icona verticale ─────────────────────────────────────────
   min-width 100px · height 48px · gap 4px · border-radius 12px
   font 12px Regular · icona max 14px · contenuto centrato               */
.btn-vertical {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 100px;
  height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-color);
  font-size: 12px;
  font-weight: 400;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-vertical svg.lucide {
  width: 14px;
  height: 14px;
}

.btn-vertical:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.btn-vertical.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
  border-color: transparent;
}

/* ── 3. Bottone dei filtri ───────────────────────────────────────────────────
   min-width 40px · height 26px · padding-x 8px · icona max-h 9px
   font 10px SemiBold · contenuto centrato
   Height bumped from 18px → 26px for WCAG 2.5.8 minimum touch target       */
.btn-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 40px;
  height: 26px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-color);
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-filter svg.lucide {
  max-height: 9px;
  width: auto;
}

.btn-filter:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.btn-filter.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
  border-color: transparent;
}

/* ── 4. Bottone azioni icona ─────────────────────────────────────────────────
   min-width 36px · height 28px · border-radius 8px · icona 12px
   default active: bg #383838                                              */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-color);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-icon svg.lucide {
  width: 14px;
  height: 14px;
}

.btn-icon:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.btn-icon.active {
  background: var(--btn-icon-active-bg);
  color: var(--btn-active-color);
  border-color: transparent;
}

/* ── 5. Bottone tab ──────────────────────────────────────────────────────────
   min-width 50px · height 28px · gap 4px · border-radius 20px
   font 10px Regular · icona max-h 8px · contenuto centrato               */
.btn-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 50px;
  height: 28px;
  padding: 0 12px;
  border-radius: 20px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-color);
  font-size: 10px;
  font-weight: 400;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-tab svg.lucide {
  max-height: 8px;
  width: auto;
}

.btn-tab:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.btn-tab.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
  border-color: transparent;
}

/* ── 6. Bottone menu (nav items) ─────────────────────────────────────────────
   min-width 220px · height 32px · padding 8px · gap 10px
   icona 12px · font 12px · allineamento contenuto a sinistra             */
.btn-menu {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 220px;
  height: 32px;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-color);
  font-size: 12px;
  font-weight: 400;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  transition: background var(--transition), color var(--transition);
}

.btn-menu svg.lucide {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.btn-menu:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.btn-menu.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
  border-color: transparent;
}

/* Danger icon variant */

/* ── Form ──────────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: .875rem;
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition), background var(--transition);
}

.input:focus {
  border-color: var(--input-border-focus);
  background: var(--input-bg-focus);
}

.input::placeholder {
  color: var(--text-3);
}

[data-theme="light"] .input {
  background: var(--input-bg-readonly);
  border-color: var(--border);
}

[data-theme="light"] .input:focus {
  background: var(--surface);
  border-color: var(--accent);
}

.label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
  display: block;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

select.input {
  appearance: none;
  cursor: pointer;
}

textarea.input {
  resize: vertical;
  min-height: 72px;
}

/* ── Login ─────────────────────────────────────────────────────────────────── */
#login-page, .login-page, .reset-page {
  min-height: 100vh;   /* fallback */
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}

.login-logo {
  font-size: 2rem;
  margin-bottom: 4px;
  text-align: center;
}

.login-title {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: .85rem;
  color: var(--text-2);
  text-align: center;
  margin-bottom: 28px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.forgot-link {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--transition);
}
.forgot-link:hover,
.forgot-link:focus {
  color: var(--accent);
}

.login-error {
  background: var(--danger-soft);
  border: 1px solid var(--danger-border-soft);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: .85rem;
}

.login-theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
}

.register-link {
  text-align: center;
  font-size: .85rem;
  color: var(--text-2);
  margin-top: 12px;
}

.register-link a {
  color: var(--accent);
  font-weight: 600;
}

/* Google OAuth button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  color: var(--text);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  margin-bottom: 4px;
}
.btn-google:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

/* Login divider "or" */
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--text-3);
  font-size: .75rem;
  font-weight: 600;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ══════════════════════════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════════════════════════ */
#app-page {
  display: flex;
  height: 100vh;   /* fallback */
  height: 100dvh;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════════════
   BOX SYSTEM — 3 dimensioni (L / M / S)
   Tokens --box-bg e --box-border definiti in :root sopra, override in [data-theme="light"]
   ══════════════════════════════════════════════════════════════════════════════ */

/* Box L — border-radius 20px · padding 4px */
.box-l {
  background: var(--box-bg);
  border: 1px solid var(--box-border);
  border-radius: 20px;
  padding: 4px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* Box M — border-radius 16px · padding 4px */
.box-m {
  background: var(--box-bg);
  border: 1px solid var(--box-border);
  border-radius: 16px;
  padding: 4px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* Box S — border-radius 12px · padding 12px */
.box-s {
  background: var(--box-bg);
  border: 1px solid var(--box-border);
  border-radius: 12px;
  padding: 12px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* ══════════════════════════════════════════════════════════════════════════════
   SIDEBAR — box-L floating con 16px di margine da top/left/bottom
   ══════════════════════════════════════════════════════════════════════════════ */
.sidebar {
  /* Dimensioni + posizione */
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  flex-shrink: 0;
  z-index: 200;
  margin: 16px 0 16px 16px;
  height: calc(100vh - 32px);   /* fallback */
  height: calc(100dvh - 32px);
  /* Glass overlay styling — alpha basso per far vedere la mappa attraverso il blur */
  background: var(--glass-bg);
  border: 1px solid var(--box-border);
  border-radius: 20px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  /* Layout interno */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .28s cubic-bezier(.4, 0, .2, 1),
    min-width .28s cubic-bezier(.4, 0, .2, 1);
}

.sidebar.icons-only {
  width: var(--sidebar-w-icons);
  min-width: var(--sidebar-w-icons);
}

/* ── Header: LOGO + collapse btn ────────────────────────────────────────── */
.sidebar-header {
  padding: 12px 12px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

/* Logo espanso */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity .2s ease, width .28s ease;
}

.sidebar-brand-icon {
  width: 18px !important;
  height: 18px !important;
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -.01em;
  overflow: hidden;
  transition: opacity .18s ease;
}

/* Logo collapsed — visibile solo quando icons-only */
.sidebar-brand-collapsed {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--btn-color);
  position: relative;
  transition: background var(--transition), border-color var(--transition);
}

.sidebar-brand-icon-default,
.sidebar-brand-icon-hover {
  width: 18px !important;
  height: 18px !important;
  position: absolute;
  transition: opacity .15s ease;
}

.sidebar-brand-icon-default {
  opacity: 1;
  color: var(--accent);
}

.sidebar-brand-icon-hover {
  opacity: 0;
  color: var(--text);
}

.sidebar-brand-collapsed:hover {
  background: var(--hover-overlay);
  border-color: var(--btn-border);
}

.sidebar-brand-collapsed:hover .sidebar-brand-icon-default {
  opacity: 0;
}

.sidebar-brand-collapsed:hover .sidebar-brand-icon-hover {
  opacity: 1;
}

/* Stato collapsed */
.sidebar.icons-only .sidebar-brand {
  display: none;
}

.sidebar.icons-only #sidebar-collapse-btn {
  display: none;
}

.sidebar.icons-only .sidebar-brand-collapsed {
  display: flex;
}

.sidebar.icons-only .sidebar-header {
  padding: 12px 0;
  justify-content: center;
}

/* ── Nav: box-M per ogni sezione ────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: none;
}

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

.nav-section {
  /* Box-M */
  background: var(--box-bg);
  border: 1px solid var(--box-border);
  border-radius: 16px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar.icons-only .nav-section {
  padding: 4px;
  border-radius: 12px;
  align-items: center;
}

.nav-label {
  font-size: .60rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: 5px 8px 3px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .2s ease, height .2s ease, padding .2s ease;
}

.sidebar.icons-only .nav-label {
  opacity: 0;
  height: 0;
  padding: 0;
  pointer-events: none;
}

.nav-item {
  /* btn-menu spec: h32 · gap10 · px8 · r12 · font12 · icona12 · align sx */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  height: 32px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  background: transparent;
  border: 1px solid transparent;
  color: var(--btn-color);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--transition), color var(--transition);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.nav-item.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
  border-color: transparent;
  font-weight: 600;
}

.sidebar.icons-only .nav-item {
  padding: 0;
  justify-content: center;
  gap: 0;
  width: 36px;
  min-width: 36px;
  position: relative;
}

/* Tooltip shown on hover when sidebar is collapsed */
.sidebar.icons-only .nav-item[title]:hover::after,
.sidebar.icons-only .nav-item[title]:focus-visible::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  z-index: 200;
  font-family: inherit;
}

.nav-icon {
  font-size: .95rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-icon-svg {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
}

.nav-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .18s ease, width .28s ease;
}

.sidebar.icons-only .nav-text {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.nav-trip-color {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: opacity .2s;
}

.sidebar.icons-only .nav-trip-color {
  opacity: 0;
  width: 0;
}

/* Footer */
.sidebar-footer {
  padding: 4px;
  flex-shrink: 0;
  background: transparent;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-lg);
  background: var(--box-bg);
  border: 1px solid var(--box-border);
}

.sidebar.icons-only .user-row {
  padding: 8px;
  justify-content: center;
  gap: 0;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: opacity .18s, width .28s;
}

.sidebar.icons-only .user-info {
  opacity: 0;
  width: 0;
  pointer-events: none;
}

.sidebar.icons-only .user-row-chevron {
  display: none;
}

.user-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}

.user-role {
  font-size: .70rem;
  color: var(--text-3);
}

.sidebar.icons-only #logout-btn {
  display: none;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  position: relative;
  overflow: clip;   /* clip (non hidden) — preserva il clipping visuale senza
                       creare uno scroll-container BFC, così il backdrop-filter
                       dei pannelli riesce a catturare il #map fixed sottostante */
  min-width: 0;
  background: transparent;
}

/* Background map — fixed full-viewport layer, sits below sidebar + header */
#map {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg-2);
  transition: opacity .3s ease;
}

#map.hidden-on-dashboard {
  display: none;
}

/* Custom zoom controls — z-index 20 = above view-layers, outside #map context */
.map-zoom-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 20px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: auto;
  transition: right .28s cubic-bezier(.4, 0, .2, 1);
}

.map-zoom-controls.hidden {
  display: none;
}

.map-zoom-btn {
  width: 40px;
  height: 40px;
  background: var(--glass-bg-deep);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-2);
  border-radius: var(--r-sm);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: background var(--transition), color var(--transition);
}

.map-zoom-btn:hover {
  background: var(--surface);
  color: var(--accent);
}

/* ── Map engine toggle (2D MapLibre ↔ 3D Mapbox) ─────────────────── */
.map-engine-toggle {
  position: absolute;
  bottom: 24px;
  right: 20px;
  z-index: 20;
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--glass-bg-deep);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
}

.map-engine-toggle.hidden {
  display: none;
}

.map-engine-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  border-radius: calc(var(--r) - 4px);
  color: var(--btn-color);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.map-engine-btn svg.lucide {
  width: 13px;
  height: 13px;
}

.map-engine-btn:hover {
  color: var(--text);
}

.map-engine-btn.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
}

/* Header shell — invisible, height 0, only keeps JS targets alive */
.app-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  overflow: visible;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 30;
  pointer-events: none;
}

/* Floating actions box — top right glass pill
   z-index 20: above view-layer (10); detail-panel covers it by JS class when open */
.header-actions-box {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--glass-bg);
  border: 1px solid var(--box-border);
  border-radius: var(--r-lg);
  padding: 4px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  pointer-events: auto;
  box-shadow: var(--shadow-sm);
  transition: opacity var(--transition);
}

/* Dashboard hides actions box — globe covers full screen */
body.view-is-dashboard .header-actions-box {
  opacity: 0;
  pointer-events: none;
}

/* On dashboard: theme toggle repositioned top-right floating */
.dash-theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--overlay-soft);
  border: 1px solid var(--overlay-border);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
  color: var(--text-photo-75);
  pointer-events: auto;
}

.dash-theme-toggle:hover {
  background: var(--overlay-medium);
  color: var(--text-photo);
}

.dash-theme-toggle svg {
  width: 14px;
  height: 14px;
}

.page-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  flex: 1;
  letter-spacing: -.01em;
}

.theme-toggle {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}

.theme-toggle:hover {
  background: var(--surface-2);
}

/* View layers — start from top since header has no visual presence */
.view-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════════════════
   DASHBOARD — globe full-screen + overlay panels
   ══════════════════════════════════════════════════════════════════════════════ */

/* Dashboard view covers full area incl. header */
.dash-view {
  top: 0 !important;
  z-index: 15 !important;
  pointer-events: none;
}

/* Globe fills entire content area */
.dash-globe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 0;
  overflow: hidden;
}

#dashboard-map {
  width: 100%;
  height: 100%;
  /* Fallback per quando Mapbox non riesce a renderizzare (WebGL assente) */
  background: #080808;
}

[data-theme="light"] #dashboard-map {
  background: #e8eaf0;
}

/* Bagliore chiaro e sottilissimo attorno al globo — overlay CSS puro */
.dash-globe::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 55% at 50% 50%,
    rgba(255,255,255,0.055) 0%,
    rgba(255,255,255,0.018) 40%,
    transparent 68%
  );
  pointer-events: none;
  z-index: 1;
}

/* Pin delle destinazioni sul globo Mapbox */
.dash-globe-pin {
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease;
  will-change: transform, filter;
}

.dash-globe-pin:hover {
  transform: scale(1.28) translateY(-2px);
  filter: brightness(1.18) drop-shadow(0 0 9px rgba(152, 85, 212, .80));
}

/* Welcome overlay — top left */
.dash-welcome-slot {
  position: absolute;
  top: 72px;
  left: 52px;
  z-index: 5;
  pointer-events: none;
}

/* Tip bar is interactive — re-enable pointer events when it's present */
.dash-welcome-slot:has(.dash-tip-bar) {
  pointer-events: auto;
}

.dash-welcome-eyebrow {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-photo-65);
  margin-bottom: 4px;
  letter-spacing: -.01em;
}

.dash-welcome-name {
  font-size: 4.5rem;
  font-weight: 500;
  color: var(--text-photo);
  line-height: 1;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  text-shadow: var(--text-shadow-dark);
}

.dash-welcome-emoji {
  font-size: 3.2rem;
  line-height: 1;
}

/* Next Up overlay — top right */
.dash-nextup-slot {
  position: absolute;
  min-width: 220px;
  top: 72px;
  right: 24px;
  z-index: 5;
  pointer-events: auto;
}

.next-up-eyebrow {
  font-size: .58rem;
  font-weight: 700;
  color: var(--text-photo-55);
  text-transform: uppercase;
  letter-spacing: .14em;
  margin-bottom: 3px;
}

.next-up-city {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-photo);
  line-height: 1.2;
  margin-bottom: 2px;
}

.next-up-countdown-big {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-photo);
  line-height: 1;
  letter-spacing: -.03em;
}

.next-up-arrow {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  color: var(--text-photo-60);
}

/* Bottom trips panel — compact preview, expands on chevron.
   Default 40vh (was 30vh) so ~2 card rows are visible without expanding. */
.dash-bottom-panel {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  z-index: 5;
  min-height: 40vh;
  min-height: 40dvh;   /* iOS Safari: account for dynamic toolbar */
  overflow: hidden;
  pointer-events: auto;
  transition: max-height .5s cubic-bezier(.4, 0, .2, 1), min-height .5s cubic-bezier(.4, 0, .2, 1);
}

.dash-bottom-panel.dash-panel-expanded {
  max-height: 100vh;   /* fallback */
  max-height: 100dvh;
  min-height: 100vh;   /* fallback */
  min-height: 100dvh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.dash-bottom-panel.dash-panel-expanded::-webkit-scrollbar {
  width: 4px;
}

.dash-bottom-panel.dash-panel-expanded::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

/* Welcome e Next Up — si nascondono quando il panel è espanso */
.dash-welcome-slot,
.dash-nextup-slot {
  transition: opacity .3s ease, transform .3s ease;
}

.dash-view.panel-fullscreen .dash-welcome-slot,
.dash-view.panel-fullscreen .dash-nextup-slot {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-16px);
}

.dash-bottom-inner {
  padding: 104px 16px 0px;
  min-height: 100%;
}

/* Trips header */
.dash-trips-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  position: relative;
}

.dash-trips-center {
  display: flex;
  align-items: center;
  gap: 48px;
}

.dash-trips-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.02em;
}

#dash-collapse-btn {
  position: absolute;
  right: 0;
}

/* .btn icon-only → 40×40 quadrato */
.btn.btn-sq {
  width: 40px;
  min-width: 40px;
  padding: 0;
}


/* Filter chips */
.dash-filter-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 16px;
  justify-content: center;
}

.dash-filter-label {
  font-size: .60rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .09em;
  margin-right: 2px;
}

.dash-filter-chip {
  /* btn-filter spec: h26 · px8 · r10 · font10 SemiBold · centrato (WCAG 2.5.8 ≥24px) */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 8px;
  height: 26px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-color);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  user-select: none;
}

.dash-filter-chip:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.dash-filter-chip.active {
  background: var(--btn-active-bg);
  border-color: transparent;
  color: var(--btn-active-color);
}

/* Trips grid — 3 columns */
.dash-trips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* Dashboard trip pin markers */
.dash-trip-pin {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--shadow-md);
  border: 2.5px solid var(--border-photo-bright);
  transition: transform .2s ease;
}

.dash-trip-pin:hover {
  transform: scale(1.15);
}

.dash-trip-emoji {
  line-height: 1;
}

.tp-dash-tooltip .maplibregl-popup-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: Urbanist, sans-serif;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

/* Trip cards */
.trip-card {
  background: var(--surface);
  border: 1px solid var(--glass-border-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 220ms var(--ease-out-expo),
              box-shadow 220ms var(--ease-out-expo),
              border-color 180ms var(--ease-out-quart);
  pointer-events: auto;
  user-select: none;
}

/* Force pointer on every child so cursor never reverts to default */
.trip-card * {
  cursor: pointer;
}

.trip-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-subtle);
}

/* Tactile press feedback */
.trip-card:active {
  transform: translateY(-1px) scale(0.985);
  box-shadow: var(--shadow-sm);
  transition-duration: 80ms;
}

.trip-card-banner {
  height: 124px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
  background: var(--surface-overlay-subtle);
}

.trip-card-banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trip-card-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--photo-gradient);
  pointer-events: none;
}

.trip-card-status {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

/* Solid chip backgrounds on trip cards — semi-transparent chips blend
   with the banner image and become unreadable */
.trip-card-status .chip-todo {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-color);
  border-color: var(--badge-warning-border);
}
.trip-card-status .chip-ready {
  background: var(--badge-success-bg);
  color: var(--badge-success-color);
  border-color: var(--badge-success-border);
}
.trip-card-status .chip-progress {
  background: var(--badge-info-bg);
  color: var(--badge-info-color);
  border-color: var(--badge-info-border);
}
.trip-card-status .chip-completed {
  background: var(--badge-neutral-bg);
  color: var(--badge-neutral-color);
  border-color: var(--badge-neutral-border);
}
.trip-card-status .chip-planned {
  background: var(--badge-info-bg);
  color: var(--badge-info-color);
  border-color: var(--badge-info-border);
}
.trip-card-status .chip-active {
  background: var(--badge-success-bg);
  color: var(--badge-success-color);
  border-color: var(--badge-success-border);
}
.trip-card-status .chip-booked {
  background: var(--badge-success-bg);
  color: var(--badge-success-color);
  border-color: var(--badge-success-border);
}

.trip-card-body {
  padding: 10px 12px 12px;
}

.trip-card-city {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.01em;
  margin-bottom: 1px;
}

.trip-card-country {
  font-size: 0.85rem;
  color: var(--text-2);
  font-weight: 500;
}

.trip-card-dates {
  font-size: .85rem;
  color: var(--text-2);
  margin: 3px 0 8px;
}

/* Trip card hover actions */
.trip-card {
  position: relative;
}

.trip-card-actions {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  z-index: 2;
}

.trip-card:hover .trip-card-actions,
.trip-card:focus-within .trip-card-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.trip-card-act {
  width: 30px;
  height: 30px;
  background: var(--glass-bg-deep);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  border-radius: var(--r-sm);
  color: var(--text-2);
  transition: background .13s, color .13s, border-color .13s;
}

.trip-card-act:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-2);
}

.trip-card-act-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

/* Mouse-click focus: suppress ring, show bg change instead */
.trip-card-act:focus:not(:focus-visible) {
  outline: none;
  background: var(--glass-bg-deep);
  color: var(--text-2);
  border-color: var(--glass-border);
}

.cal-act-btn:focus:not(:focus-visible) {
  outline: none;
  background: var(--glass-bg-deep);
  color: var(--text-2);
}

.trip-countdown {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-inverse);
  background: linear-gradient(135deg, var(--purple-h) 0%, var(--purple) 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 13px;
  border-radius: 99px;
  border: 1px solid var(--purple-soft);
  box-shadow: var(--purple-glow-sm);
}

.trip-countdown-past {
  color: var(--text-3);
  background: var(--surface-overlay-faint);
  border-color: var(--border);
  box-shadow: none;
}

/* Shared trip badge (shown instead of actions for trips shared with you) */
.trip-card-shared-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-2);
  backdrop-filter: var(--glass-blur);
  border-radius: var(--r-xs);
  padding: 3px 8px;
  pointer-events: none;
}
.trip-card-shared-badge svg.lucide {
  width: 11px; height: 11px;
}

/* ── Shared with me view ───────────────────────────────────────────────────── */
.shared-view-layout {
  padding: 28px 32px;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.shared-view-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.shared-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  color: var(--text-2);
  font-size: 0.88rem;
  text-align: center;
  gap: 6px;
}
/* Meta row sul fondo della card per trip condivisi */
.trip-card-shared-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  gap: 8px;
}
.shared-creator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shared-perm-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: var(--r-xs);
  padding: 2px 7px;
  white-space: nowrap;
  flex-shrink: 0;
}
.shared-perm-viewer {
  background: var(--accent-soft);
  color: var(--accent-light);
  border: 1px solid var(--accent-border-soft);
}
.shared-perm-editor {
  background: var(--purple-soft);
  color: var(--purple);
  border: 1px solid var(--purple-border-soft);
}
/* Badge contatore nella sidebar */
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--text-inverse);
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  line-height: 16px;
}

/* ── Share Overlay ─────────────────────────────────────────────────────────── */
.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--overlay-medium);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.share-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.share-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  padding: 24px;
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: 80vh;
  max-height: 80dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.share-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.share-title svg.lucide {
  width: 16px; height: 16px;
  color: var(--accent);
}

.share-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 8px;
}

.share-email-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.share-email-input {
  flex: 1;
  min-width: 160px;
}

.share-role-pills {
  display: flex;
  gap: 4px;
}

.share-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.share-link-input {
  flex: 1;
  min-width: 160px;
  font-size: .78rem;
  color: var(--accent);
}

.share-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.share-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: background .14s;
}
.share-user-row:hover {
  background: var(--surface-3);
}

.share-user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.share-user-name {
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-user-email {
  font-size: .72rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-permission-badge {
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
  flex-shrink: 0;
}
.share-perm-viewer {
  background: var(--accent-soft);
  color: var(--accent-light);
  border: 1px solid var(--accent-border-soft);
}
.share-perm-editor {
  background: var(--purple-soft);
  color: var(--purple);
  border: 1px solid var(--purple-border-soft);
}

.share-revoke-btn {
  flex-shrink: 0;
  opacity: .5;
  transition: opacity .14s;
}
.share-user-row:hover .share-revoke-btn {
  opacity: 1;
}

.share-empty,
.share-loading {
  font-size: .82rem;
  color: var(--text-2);
  text-align: center;
  padding: 14px 0;
}

/* "New trip" dashed card */
.add-trip-card {
  border: var(--border-2) 1.5px dashed;
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 168px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  color: var(--border-2);
  pointer-events: auto;
}

.add-trip-card:hover {
  border: var(--accent) 2px dashed;
  color: var(--accent);
}

.add-trip-card span {
  font-size: .82rem;
  font-weight: 600;
}

/* Empty state — shown in the dashboard grid when no trips exist yet */
.dash-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--text-2);
  text-align: center;
}

.dash-empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
}

.dash-empty-sub {
  font-size: .82rem;
  color: var(--text-2);
  max-width: 300px;
  line-height: 1.6;
}

.dash-empty-cta {
  margin-top: 8px;
}

/* ── Panel: expanded for zero-trip state ───────────────────────────────────── */
.dash-bottom-panel.has-empty {
  min-height: 66vh;
  min-height: 66dvh;
}

.dash-bottom-panel.has-empty .dash-bottom-inner {
  padding-top: 20px;
}

/* ── Tip bar — dismissible feature hint (welcome slot, first-time users) ───── */
.dash-tip-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-2);
  backdrop-filter: var(--glass-blur);
  border-radius: var(--r-lg);
  padding: 10px 12px 10px 16px;
  box-shadow: var(--shadow-md);
  animation: tip-bar-in .38s var(--ease-out-quart) both;
  max-width: 520px;
}

@keyframes tip-bar-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dash-tip-bar.tip-bar-exit {
  animation: tip-bar-out .28s ease forwards;
}

@keyframes tip-bar-out {
  to { opacity: 0; transform: translateY(-8px); }
}

.dash-tip-bar-left {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.dash-tip-bar-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.dash-tip-bar-features {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dash-tip-feature {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  font-weight: 500;
  border-radius: var(--r-sm);
  padding: 4px 9px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.dash-tip-feature svg.lucide {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.dash-tip-feature-blue   { color: var(--accent);   background: var(--accent-soft);   border-color: rgba(91,139,255,.18); }
.dash-tip-feature-purple { color: var(--purple);   background: var(--purple-soft);   border-color: rgba(152,85,212,.22); }
.dash-tip-feature-green  { color: var(--success);  background: var(--success-soft);  border-color: rgba(34,197,94,.18); }
.dash-tip-feature-amber  { color: var(--warning);  background: var(--warning-soft);  border-color: rgba(245,158,11,.18); }

.dash-tip-dismiss {
  flex-shrink: 0;
  align-self: flex-start;
}

/* ── First-trip empty state — rich onboarding ─────────────────────────────── */
.dash-empty-first {
  gap: 6px;
  padding: 24px 24px 36px;
}

/* Bigger title when panel has room */
.has-empty .dash-empty-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.has-empty .dash-empty-sub {
  font-size: .84rem;
  max-width: 360px;
}

.dash-empty-illustration {
  width: 260px;
  height: 110px;
  flex-shrink: 0;
  margin-bottom: 6px;
  animation: illustration-float 3.6s var(--ease-out-quart) infinite alternate;
}

@keyframes illustration-float {
  from { transform: translateY(0); }
  to   { transform: translateY(-7px); }
}

.dash-empty-features {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.dash-empty-feature {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .74rem;
  font-weight: 500;
  color: var(--text-3);
}

.dash-empty-feature svg.lucide {
  width: 12px;
  height: 12px;
  stroke-width: 2;
  flex-shrink: 0;
}

.dash-empty-feature-sep {
  color: var(--text-3);
  font-size: .74rem;
  opacity: .4;
  user-select: none;
}

/* ── Filtered empty state — no trips matching active filter ───────────────── */
.dash-filtered-empty {
  padding: 36px 24px;
}

.dash-filtered-empty svg.lucide {
  width: 22px;
  height: 22px;
  opacity: .3;
  margin-bottom: 4px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TRIP VIEW
   ══════════════════════════════════════════════════════════════════════════════ */
.trip-view-flex {
  position: absolute;
  inset: 16px;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  pointer-events: none;
}

.schedule-panel {
  width: 390px;
  min-width: 0;
  /* height driven by stretch on parent flex — matches sidebar full-height style */
  display: flex;
  flex-direction: row;
  background: var(--glass-bg);
  border: 1px solid var(--box-border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  overflow: hidden;
  transition: width .32s cubic-bezier(.4, 0, .2, 1);
  pointer-events: auto;
  flex-shrink: 0;
}

/* Wide mode for All-days view — max 50vw, leave ≥ 130px on right for header-actions-box */
.schedule-panel.is-all-view {
  width: min(48vw, calc(100% - 130px));
}

/* ── Day title row ──────────────────────────────────────────── */
.day-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 4px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--separator-faint);
  min-height: 36px;
}

.day-title-text {
  flex: 1;
  font-size: .84rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-title-empty {
  color: var(--text-3);
  font-weight: 400;
  font-style: italic;
}

.day-title-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ── All-days column view ───────────────────────────────────── */
/* Preview bar — confirm/cancel pending moves */
/* All-days preview: blue outline on scroll container */
.calendar-scroll.all-view-scroll.in-preview {
  box-shadow: 0 0 0 2px var(--accent), 0 0 14px rgba(91, 139, 255, .14);
  border-radius: var(--r-sm);
}

/* Preview footer — rendered OUTSIDE the scroll, at bottom of schedule-inner */
.all-preview-footer-outer {
  display: flex;
  gap: 8px;
  padding: 10px 14px 12px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

.all-preview-footer-outer .btn {
  flex: 1;
  justify-content: center;
}

/* Legacy bar (kept for calendar view) */
.all-preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-border-soft);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
}

.all-preview-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--accent-light);
  flex: 1;
}

.all-preview-actions {
  display: flex;
  gap: 6px;
}

/* Pending chip (moved in preview, keeps original color) */
.all-act-chip-pending {
  border-style: dashed !important;
  opacity: .88;
}

.all-act-chip-pending-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 4px var(--accent);
  margin-left: auto;
}

/* ── All-days column view — full card style ─────────────────── */

/* calendar-scroll gets this class in all-view */
.calendar-scroll.all-view-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.all-v-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: max-content;
  /* key: allows horizontal scroll */
}

.all-v-cols {
  flex: 1;
  display: flex;
  gap: 10px;
  padding: 12px 14px 14px;
  align-items: stretch;
  min-height: 0;
}

.all-v-col {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--box-bg);
  border: 1px solid var(--box-border);
  border-radius: var(--r-xl);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}

.all-v-col.drag-over {
  border-color: var(--accent-border-hover);
  box-shadow: var(--focus-ring-shadow);
}

/* Column header */
.all-v-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 9px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface-overlay-trace);
}

.all-v-col-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.all-v-col-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.all-v-col-name {
  font-size: .80rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.all-v-col-title {
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.all-v-col-date {
  font-size: .66rem;
  color: var(--text-3);
  font-weight: 500;
}

.all-v-col-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s;
}

.all-v-col-header:hover .all-v-col-actions {
  opacity: 1;
}

/* Column scrollable body */
.all-v-col-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.all-v-col-acts {
  flex: 1;
  padding: 6px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.all-v-col-footer {
  padding: 6px 10px 10px;
  flex-shrink: 0;
}

.all-v-add-btn {
  width: 100%;
  justify-content: center;
  font-size: .78rem;
  color: var(--text-3);
  border-color: transparent;
}

.all-v-add-btn:hover {
  color: var(--text-2);
  border-color: var(--border);
}

/* Empty column placeholder */
.all-v-empty {
  padding: 20px 12px;
  text-align: center;
  font-size: .78rem;
  color: var(--text-3);
  font-style: italic;
}

/* ── Activity card inside all-view column ───────────────────── */
.all-v-item {
  position: relative;
  display: flex;
  align-items: stretch;
  margin: 2px 8px;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  user-select: none;
}

.all-v-item:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
}

.all-v-item[draggable="true"] {
  cursor: grab;
}

.all-v-item[draggable="true"]:active {
  cursor: grabbing;
  opacity: .65;
}

.all-v-item.dragging {
  opacity: .35;
}

/* Pending within-day reorder — subtle indicator */
.all-v-item-pending {
  border-color: var(--border-2);
  background: var(--surface-3);
}

/* Moved cross-day — prominent highlight */
.all-v-item-moved {
  border-color: var(--accent);
  border-style: dashed;
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.all-v-item-moved::after {
  content: '↗';
  position: absolute;
  top: 2px;
  right: 5px;
  font-size: 10px;
  line-height: 1;
  color: var(--accent-light);
  font-weight: 700;
}

/* Colored left stripe = category */
.all-v-item-stripe {
  width: 3px;
  flex-shrink: 0;
}

/* Content */
.all-v-item-content {
  flex: 1;
  padding: 7px 10px 7px 8px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.all-v-item-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}

.all-v-item-time {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
}

.all-v-item-emoji {
  font-size: .82rem;
  line-height: 1;
}

.all-v-item-cat-label {
  font-size: .60rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
}

.all-v-item-title {
  font-size: .80rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.all-v-item-sub {
  font-size: .70rem;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.all-v-item-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 3px;
}

/* Item hover actions (admin) */
.all-v-item-actions {
  position: absolute;
  top: 5px;
  right: 5px;
  display: none;
  gap: 2px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
}

.all-v-item:hover .all-v-item-actions {
  display: flex;
}

.all-v-item-actions:focus-within {
  display: flex;
}

/* Drag insert line indicator */
.drag-insert-line {
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  margin: 2px 4px;
  pointer-events: none;
  box-shadow: 0 0 6px var(--accent-soft);
}

/* Archive panel day separator */
.archive-panel-day-sep {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

.archive-panel-day-sep:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 4px;
}

/* Archive panel upload box */
.archive-panel-upload-box {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: border-color .18s, background .18s;
}

.archive-panel-upload-box.drag-active,
.archive-panel-upload-box:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.archive-panel-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 12px;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}

.archive-panel-upload-label svg.lucide {
  width: 22px;
  height: 22px;
  color: var(--text-3);
}

.archive-panel-upload-box:hover .archive-panel-upload-label svg.lucide,
.archive-panel-upload-box.drag-active .archive-panel-upload-label svg.lucide {
  color: var(--accent);
}

.archive-panel-upload-label span:first-of-type {
  font-size: .80rem;
  font-weight: 600;
  color: var(--text-2);
}

.archive-panel-upload-hint {
  font-size: .70rem;
  color: var(--text-3);
  font-weight: 500;
}

/* Archive full-view upload zone */
.archive-view-upload-box {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-xl);
  background: var(--surface);
  transition: border-color .18s, background .18s;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.archive-view-upload-box.drag-active,
.archive-view-upload-box:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.archive-view-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 20px;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}

.archive-view-upload-label svg.lucide {
  width: 28px;
  height: 28px;
  color: var(--text-3);
  transition: color .18s;
}

.archive-view-upload-box:hover .archive-view-upload-label svg.lucide,
.archive-view-upload-box.drag-active .archive-view-upload-label svg.lucide {
  color: var(--accent);
}

.archive-view-upload-label span:first-of-type {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-2);
}

.archive-view-upload-hint {
  font-size: .75rem;
  color: var(--text-3);
  font-weight: 500;
}

/* ── Right detail panel ─────────────────────────────────────── */
.detail-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 340px;
  background: var(--glass-bg);
  border: 1px solid var(--box-border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  transform: translateX(calc(100% + 24px));
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  z-index: 25;
}

.detail-panel:not(.hidden) {
  transform: translateX(0);
}

.detail-panel.hidden {
  display: flex !important;
  /* keep in DOM for animation */
  transform: translateX(calc(100% + 24px));
  pointer-events: none;
}

.detail-panel-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 44px 12px 14px;
  /* right padding leaves space for absolute close btn */
  border-bottom: 1px solid var(--separator);
  flex-shrink: 0;
}

.detail-panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
}

.detail-panel-inner {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 20px;
}

.detail-panel-section {
  margin-bottom: 14px;
}

.detail-panel-label {
  font-size: .62rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 4px;
}

.detail-panel-value {
  font-size: .82rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.5;
}

.detail-panel-value a {
  color: var(--accent);
  text-decoration: none;
}

.detail-panel-value a:hover {
  text-decoration: underline;
}

/* Draggable day pills */
.day-pill[draggable="true"] {
  cursor: grab;
}

.day-pill[draggable="true"]:active {
  cursor: grabbing;
}

.day-pill.drag-over-pill {
  border-color: var(--accent);
  background: var(--accent-bg-medium);
}

.schedule-panel.collapsed {
  width: 0;
  border: none;
}

.schedule-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.schedule-panel.collapsed .schedule-inner {
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}

/* FAB toggle */
.panel-fab-toggle {
  pointer-events: auto;
  flex-shrink: 0;
  align-self: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-lg);
  background: var(--glass-bg-deep);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-2);
  box-shadow: var(--shadow-md);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.panel-fab-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* Trip panel header — Figma style */
.trip-panel-header {
  padding: 10px 14px 0;
  flex-shrink: 0;
  border-bottom: 1px solid var(--separator);
}

/* Breadcrumb inside the trip panel */
.panel-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 8px;
}

.panel-breadcrumb .breadcrumb-item.link {
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--transition);
}

.panel-breadcrumb .breadcrumb-item.link:hover {
  color: var(--accent);
}

.panel-breadcrumb .breadcrumb-sep {
  color: var(--text-3);
  font-weight: 400;
}

.panel-breadcrumb .breadcrumb-item.active {
  color: var(--text);
}

.trip-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2px;
}

.trip-header-city {
  font-size: 1.30rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1.1;
}

.trip-header-country {
  font-size: .85rem;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 1px;
}

.trip-header-dates {
  font-size: .85rem;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 2px;
  margin-bottom: 10px;
}

.trip-header-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Trip panel header layout — Figma redesign */
.trip-panel-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
}

.trip-hd-text {
  flex: 1;
  min-width: 0;
}

.trip-hd-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-top: 2px;
}

.trip-hd-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  position: relative;
}

/* Status chip is clickable to change status */
.trip-status-chip-btn {
  cursor: pointer;
  user-select: none;
  transition: opacity var(--transition), transform var(--transition);
}

.trip-status-chip-btn:hover {
  opacity: .85;
  transform: scale(1.04);
}

/* Status dropdown — position:fixed so it escapes any overflow:hidden ancestor */
.status-dropdown {
  position: fixed;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 9999;
  min-width: 140px;
  display: none;
}

.status-dropdown.open {
  display: block;
  animation: dropdown-in 180ms var(--ease-out-expo) both;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.status-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  color: var(--text);
}

.status-dropdown-item:hover {
  background: var(--surface-3);
}

.status-dropdown-item .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dropdown-item[data-status="todo"] .status-dot {
  background: var(--warning);
}

.status-dropdown-item[data-status="ready"] .status-dot {
  background: var(--success);
}

.status-dropdown-item[data-status="progress"] .status-dot {
  background: var(--accent);
}

.status-dropdown-item[data-status="completed"] .status-dot {
  background: var(--text-3);
}

.status-dropdown-item.active-status {
  background: var(--surface-3);
}

.trip-hd-emoji {
  font-size: 1.15rem;
  line-height: 1;
}

/* Danger icon button */
.btn-icon-danger {
  color: var(--danger) !important;
}

.btn-icon-danger:hover {
  background: var(--danger-soft) !important;
}

/* Schedule nav — full-width main tabs */
.schedule-nav-bar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--separator);
}

.schedule-tab-row {
  display: flex;
  gap: 4px;
  padding: 8px 0px;
}

/* schedule-main-tab eredita tutto da .btn-vertical, solo override necessari */
.schedule-main-tab {
  flex: 1;
  min-width: 0;
}

/* Extra chips row (extras sections) */
.schedule-nav-chips {
  display: flex;
  gap: 4px;
  padding: 0 10px 8px;
  flex-wrap: wrap;
}

.schedule-nav-chip {
  /* btn-tab spec */
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 400;
  font-family: inherit;
  cursor: pointer;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-color);
  transition: background var(--transition), color var(--transition);
}

.schedule-nav-chip:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.schedule-nav-chip.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
  border-color: transparent;
}

/* Day pills */
.day-pills-wrap {
  display: flex;
  gap: 5px;
  padding: 7px 10px;
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid var(--separator);
}

.day-pills-wrap.hidden-pills {
  display: none;
}

.day-pills-wrap::-webkit-scrollbar {
  height: 3px;
}

.day-pill {
  /* btn-tab spec: h28 · r20 · font10 · centrato */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 20px;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 400;
  cursor: pointer;
  font-family: inherit;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-color);
  transition: background var(--transition), color var(--transition);
}

.day-pill:hover {
  background: var(--hover-overlay);
  color: var(--text);
}

.day-pill.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-color);
  border-color: transparent;
}

/* "All" pill — slightly distinct */
.day-pill-all {
  font-weight: 600;
  letter-spacing: .01em;
}

/* Calendar scroll */
.calendar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
}

.cal-day-title {
  padding: 6px 14px 2px;
  font-size: .66rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* Calendar items */
.cal-item {
  display: flex;
  gap: 6px;
  padding: 1px 10px 0;
  position: relative;
}

/* Drop indicators */
.cal-item.drop-before::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  z-index: 10;
  pointer-events: none;
  box-shadow: var(--glow-accent);
}

.cal-item.drop-after::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  z-index: 10;
  pointer-events: none;
  box-shadow: var(--glow-accent);
}

.cal-item-time {
  width: 40px;
  padding-top: 9px;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-3);
  text-align: right;
  flex-shrink: 0;
  line-height: 1;
}

/* Day section header (title + edit/delete + view toggle) */
.cal-day-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 4px;
  flex-shrink: 0;
}

.cal-day-header-title {
  font-size: .90rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  flex: 1;
}

.cal-day-header-date {
  font-size: .70rem;
  color: var(--text-3);
  font-weight: 500;
}

.cal-day-view-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.cal-day-view-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  border-radius: var(--r-xs);
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.cal-day-view-btn.active {
  background: var(--surface-2);
  color: var(--text);
}

.cal-day-view-btn:hover {
  color: var(--text);
}

.cal-day-view-btn svg {
  width: 13px;
  height: 13px;
}

/* Timeline dot/connector — show icon only, hide connector */
.cal-item-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.cal-item-connector {
  display: none !important;
}

.cal-item-dot {
  width: 22px;
  text-align: center;
  font-size: .88rem;
  line-height: 1;
  padding-top: 9px;
  background: none !important;
  border-radius: 0 !important;
  color: inherit !important;
}

/* Inline delete on time cell */
.cal-item-del {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--danger);
  padding: 1px 2px;
  border-radius: var(--r-xs);
  transition: background var(--transition);
  line-height: 1;
}

.cal-item-del svg {
  width: 11px;
  height: 11px;
}

.cal-item:hover .cal-item-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-item-del:hover {
  background: var(--danger-soft);
}

.cal-item-card {
  flex: 1;
  background: var(--surface-overlay-subtle);
  border: 1px solid var(--glass-border-2);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  margin-bottom: 5px;
  cursor: pointer;
  min-width: 0;
  transition: box-shadow var(--transition), border-color var(--transition), background var(--transition), transform var(--transition);
}

.cal-item-card:hover {
  box-shadow: 0 0 0 1px var(--accent-border-soft), var(--shadow-sm);
  border-color: var(--accent-border-hover);
  background: var(--accent-bg-subtle);
  transform: translateX(2px);
}

/* Highlighted from map pin click */
.cal-item.highlighted .cal-item-card {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm) !important;
  animation: highlight-pulse .45s ease;
}

@keyframes highlight-pulse {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.025);
  }

  100% {
    transform: scale(1);
  }
}

/* Pin number badge in activity list */
.cal-item-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-pin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
  color: var(--text-inverse);
  flex-shrink: 0;
  letter-spacing: -.5px;
}

.cal-item-title {
  font-size: .90rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.01em;
}

/* All-days overview legend */
.all-days-overview {
  padding: 20px 16px;
}

.all-days-title {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 14px;
}

.all-days-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.all-days-leg-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.all-days-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.all-days-leg-label {
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
}

.cal-item-sub {
  font-size: .73rem;
  color: var(--text-2);
  margin-top: 2px;
  font-weight: 500;
}

.cal-item-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 5px;
}

/* Extras */
.extras-panel {
  padding: 10px 12px;
}

.extras-section {
  margin-bottom: 20px;
}

.extras-section-title {
  font-size: .67rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}

.extras-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.extra-item {
  background: var(--glass-bg-deep);
  border: 1px solid var(--glass-border-2);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.extra-item-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}

.extra-item-note {
  font-size: .70rem;
  color: var(--text-2);
  margin-top: 2px;
}

/* Badges */
.badge-ticket {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: .70rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent-border-soft);
  transition: background var(--transition);
}

.badge-ticket:hover {
  background: var(--accent-bg-medium);
}

.badge-booked {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: .70rem;
  font-weight: 600;
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border-soft);
  cursor: pointer;
  transition: background var(--transition);
}

.badge-needs-ticket {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: .70rem;
  font-weight: 600;
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid var(--warning-border-soft);
  cursor: pointer;
}

/* Orange "Get ticket" badge — needs ticket, not yet confirmed */
.badge-get-ticket {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: .70rem;
  font-weight: 600;
  background: rgba(245, 124, 0, .14);
  color: #F57C00;
  border: 1px solid rgba(245, 124, 0, .28);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.badge-get-ticket:hover {
  background: rgba(245, 124, 0, .24);
  transform: scale(1.04);
}

/* ── Emoji input with live preview ──────────────────────────────────────── */
.emoji-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.emoji-input-wrap .input {
  flex: 1;
}
.emoji-live-preview {
  font-size: 1.6rem;
  line-height: 1;
  display: inline-block;
  transition: transform .15s ease;
  user-select: none;
}
.emoji-live-preview.emoji-preview-pop {
  transform: scale(1.35);
}

/* ── Select wrapper with chevron ─────────────────────────────────────────── */
.select-wrap {
  position: relative;
}
.select-wrap::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  width: 10px;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  width: 100%;
}

.activity-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
}

/* Resize handle — 10px click area, visible grip dots on hover */
.resize-handle {
  width: 10px;
  flex-shrink: 0;
  cursor: ew-resize;
  background: transparent;
  position: relative;
  z-index: 2;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.resize-handle::before {
  content: '';
  display: block;
  width: 2px;
  height: 32px;
  border-radius: 2px;
  background: var(--border-2);
  opacity: 0;
  transition: opacity var(--transition);
}

.resize-handle::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  border-radius: 3px;
  transition: opacity var(--transition);
}

.resize-handle:hover::before {
  opacity: 1;
}

.resize-handle:hover::after {
  opacity: .15;
}

body.is-resizing .resize-handle::before {
  opacity: 1;
}

body.is-resizing .resize-handle::after {
  opacity: .25;
}

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

/* ── Bottom sheet handle (mobile only) ──────────────────────── */
.sheet-handle {
  /* Hidden on desktop; shown via @media (max-width: 767px) */
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  height: 20px;
  width: 100%;
  cursor: grab;
  touch-action: none; /* we handle all touch events manually */
  -webkit-user-select: none;
  user-select: none;
}

.sheet-handle-bar {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--border-2);
  opacity: .6;
  transition: opacity .15s, width .15s;
}

.sheet-handle:active .sheet-handle-bar,
.sheet-handle:hover .sheet-handle-bar {
  opacity: 1;
  width: 44px;
}

/* Drag & reorder */
.drag-handle {
  width: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8px;
  cursor: grab;
  color: var(--text-3);
  opacity: 0;
  transition: opacity var(--transition);
  user-select: none;
}

.cal-item:hover .drag-handle {
  opacity: 1;
}

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

.drag-handle svg {
  width: 14px;
  height: 14px;
}

.cal-item.is-dragging {
  opacity: .3;
}

/* Attività locked (booked con biglietto confermato) */
.cal-item.is-locked {
  opacity: .92;
}
.cal-item.is-locked .cal-item-card {
  border-left: 2px solid var(--success);
}
.drag-handle-locked {
  cursor: not-allowed !important;
  color: var(--success) !important;
  opacity: .6 !important;
}
.cal-item.is-locked:hover .drag-handle-locked {
  opacity: .8 !important;
}

/* Preview bar giorno singolo */
.day-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 10px 2px;
  padding: 8px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--r);
  animation: fadeIn .15s ease;
}
.day-preview-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--accent-light);
}
.day-preview-actions {
  display: flex;
  gap: 6px;
}

.cal-arrows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  padding-top: 6px;
  flex-shrink: 0;
  width: 18px;
}

.arrow-btn {
  background: none;
  border: none;
  padding: 2px;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}

.arrow-btn svg {
  width: 12px;
  height: 12px;
}

.cal-item:hover .arrow-btn {
  opacity: 1;
}

.arrow-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.cal-item-card-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
}

.cal-item-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
}

.cal-item-card-wrap:hover .cal-item-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.cal-act-btn {
  width: 26px !important;
  height: 26px !important;
  background: var(--glass-bg-deep);
  border: 1px solid var(--glass-border-2) !important;
  backdrop-filter: var(--glass-blur);
  border-radius: var(--r-sm) !important;
  color: var(--text-2);
}

.cal-act-btn svg {
  width: 12px;
  height: 12px;
}

.cal-act-btn:hover {
  color: var(--accent);
  background: var(--surface-3);
}

.cal-act-btn-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent !important;
}

/* ══════════════════════════════════════════════════════════════════════════════
   DETAIL OVERLAY — with inline editing
   ══════════════════════════════════════════════════════════════════════════════ */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-medium);
  backdrop-filter: blur(8px);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .18s ease;
}

.detail-modal {
  background: rgba(14, 14, 14, 0.98);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-2xl);
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  animation: slideUp .22s ease;
}

.detail-modal-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--separator);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}

.detail-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-title-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.01em;
}

.detail-subtitle-text {
  font-size: .82rem;
  color: var(--text-2);
  margin-top: 3px;
  font-weight: 500;
}

.detail-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}

.detail-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--separator);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-end;
}

/* Photo gallery */
.detail-photos {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 12px 18px 8px;
  overflow-x: auto;
  min-height: 100px;
}

.detail-photos.has-photos {}

.detail-photos::-webkit-scrollbar {
  height: 3px;
}

.detail-photo-placeholder {
  width: 120px;
  height: 80px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--input-bg);
  border: 1.5px dashed var(--overlay-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.detail-photo-placeholder:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.detail-photo-placeholder svg {
  width: 20px;
  height: 20px;
  color: var(--text-3);
}

/* Both old .gallery-photo and new .detail-photo */
.detail-photo,
.gallery-photo {
  height: 100px;
  width: auto;
  min-width: 80px;
  max-width: 170px;
  border-radius: var(--r-sm);
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--glass-border-2);
  flex-shrink: 0;
  transition: transform .2s ease;
}

.detail-photo:hover,
.gallery-photo:hover {
  transform: scale(1.04);
}

.gallery-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--text-3);
  padding: 8px 0;
  white-space: nowrap;
}

/* Detail rows (shared base) */
.detail-row {
  padding: 8px 10px;
  margin-bottom: 2px;
  border-radius: var(--r-sm);
  transition: background var(--transition);
}

.detail-row .detail-label {
  font-size: .67rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 3px;
}

.detail-row .detail-value {
  font-size: .85rem;
  color: var(--text);
  word-break: break-word;
}

/* Inline-editable variant */
.detail-row-editable {
  cursor: default;
}

.detail-row-editable:hover {
  background: var(--surface-2);
}

.detail-row-editable .detail-value-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-row-editable .detail-value.detail-display {
  flex: 1;
}

.detail-placeholder {
  color: var(--text-3);
  font-style: italic;
}

.det-edit-btn {
  flex-shrink: 0;
  padding: 3px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  border-radius: var(--r-xs);
  display: inline-flex;
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition), background var(--transition);
}

.det-edit-btn svg {
  width: 13px;
  height: 13px;
}

.detail-row-editable:hover .det-edit-btn {
  opacity: 1;
}

.det-edit-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.det-confirm-btn,
.det-cancel-btn {
  flex-shrink: 0;
}

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

.det-edit-form .input {
  font-size: .84rem;
  padding: 6px 9px;
}

.det-edit-actions {
  display: flex;
  gap: 5px;
}

.gmaps-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .75rem;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.gmaps-link:hover {
  text-decoration: underline;
}


/* ── Detail modal — Ticket section ───────────────────────────────────────── */
.det-ticket-section {
  margin-top: 4px;
  padding: 14px 0 4px;
}

.det-buy-tickets-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--text-inverse);
  font-size: .85rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 16px rgba(91, 139, 255, .35);
  margin-bottom: 10px;
}

.det-buy-tickets-btn:hover {
  background: var(--accent-h);
  box-shadow: 0 6px 20px rgba(91, 139, 255, .50);
}

.det-ticket-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.det-ticket-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  border: 1px dashed var(--overlay-border);
  font-size: .80rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.det-ticket-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* PDF section */
.pdf-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border-2);
}

.pdf-section-title {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 8px;
}

.pdf-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  background: var(--glass-bg);
  border: 1.5px dashed var(--glass-border-2);
  color: var(--text-2);
  font-size: .80rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.pdf-upload-label:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pdf-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pdf-uploading {
  font-size: .78rem;
  color: var(--text-2);
}

/* ══════════════════════════════════════════════════════════════════════════════
   USERS VIEW
   ══════════════════════════════════════════════════════════════════════════════ */

/* Full-page container — fills the view-layer, scrollable */
.users-page {
  pointer-events: auto;   /* view-layer is pointer-events:none — re-enable here */
  padding: 32px 36px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  height: 100%;
  box-sizing: border-box;
}

/* Header row: title + action buttons */
.users-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.users-page-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.02em;
}

.users-page-subtitle {
  font-size: .82rem;
  color: var(--text-2);
  margin-top: 3px;
}

.users-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Main table card */
.users-card {
  background: var(--box-bg);
  border: 1px solid var(--box-border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table thead {
  background: var(--surface-2);
}

.users-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--box-border);
}

.users-table td {
  padding: 12px 16px;
  font-size: .85rem;
  border-bottom: 1px solid var(--box-border);
  vertical-align: middle;
}

.users-table tbody tr:last-child td {
  border-bottom: none;
}

.users-table tbody tr {
  transition: background .12s;
}

.users-table tbody tr:hover {
  background: var(--surface-2);
}

/* User cell: avatar + name */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--box-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.user-name-text {
  font-weight: 600;
  color: var(--text);
}

.user-you-badge {
  font-size: .6rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 700;
}

/* Role select */
.user-role-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color .15s;
  appearance: auto;
}

.user-role-select:focus {
  outline: none;
  border-color: var(--accent);
}

.user-role-select:disabled {
  opacity: .45;
  cursor: default;
}

/* Email cell */
.user-email-text {
  color: var(--text-2);
  font-size: .82rem;
}

/* Date cell */
.user-date-text {
  color: var(--text-2);
  font-size: .80rem;
}

/* Empty / loading state */
.users-loading {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-2);
  font-size: .88rem;
}

/* Role color variants on select (applied via JS style) */
.role-admin   { color: var(--accent); }
.role-creator { color: var(--purple); }
.role-viewer  { color: var(--text-2); }

/* ══════════════════════════════════════════════════════════════════════════════
   VIEW TRANSITIONS
   ══════════════════════════════════════════════════════════════════════════════ */

/* Fade-in each top-level view when it becomes visible (hidden → not-hidden).
   The animation fires because display:none → display:block causes a new
   compositing frame, which triggers any @keyframes on the element. */
#view-dashboard:not(.hidden),
#view-trip:not(.hidden),
#view-reading:not(.hidden),
#view-users:not(.hidden),
#view-archive:not(.hidden),
#view-todo:not(.hidden),
#view-shared:not(.hidden) {
  animation: view-enter 180ms var(--ease-out-expo) both;
}

@keyframes view-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   GENERIC MODAL
   ══════════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(8px);
  animation: overlay-in 220ms var(--ease-out-quart) both;
}

.modal {
  background: var(--box-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-2xl);
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .70), 0 4px 20px rgba(0, 0, 0, .40);
  animation: modal-in 300ms var(--ease-out-expo) both;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

.modal-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--separator);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

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

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--separator);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: var(--box-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-radius: 0 0 var(--r-2xl) var(--r-2xl);
}

.color-picker-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: border-color var(--transition), transform var(--transition);
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  border-color: var(--text);
}

/* Location search */
.loc-search-bar {
  display: flex;
  gap: 6px;
}

.loc-results {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  margin-top: 2px;
}

.loc-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: .82rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.loc-result-item:last-child {
  border-bottom: none;
}

.loc-result-item:hover {
  background: var(--accent-soft);
}

.loc-result-name {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-weight: 500;
}

.loc-result-type {
  font-size: .68rem;
  color: var(--text-3);
  font-weight: 600;
  text-transform: capitalize;
  flex-shrink: 0;
}

.loc-confirmed {
  margin-top: 6px;
  font-size: .78rem;
  color: var(--success);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Auto-fill highlight animation */
@keyframes autofill-flash {
  0% {
    background: var(--accent-soft);
    border-color: var(--accent);
  }

  70% {
    background: var(--accent-soft);
    border-color: var(--accent);
  }

  100% {
    background: transparent;
    border-color: var(--border);
  }
}

.input-autofilled {
  animation: autofill-flash 1.4s ease forwards;
}

/* ── Date Range Picker ───────────────────────────────────────────────────── */
.date-range-trigger {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  background: var(--surface-2);
}

.date-range-trigger:hover {
  border-color: var(--border-2);
}

.date-range-trigger.open {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.date-range-half {
  flex: 1;
  padding: 9px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background .12s;
}

.date-range-half:first-child {
  border-right: 1px solid var(--border);
}

.date-range-half.active {
  background: var(--surface-3);
}

.date-range-lbl {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
}

.date-range-val {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.date-range-val.empty {
  color: var(--text-3);
  font-weight: 400;
}

.date-range-panel {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  margin-top: 6px;
  padding: 16px;
  user-select: none;
}

.drp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.drp-month-label {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
}

.drp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.drp-dow {
  text-align: center;
  font-size: .6rem;
  font-weight: 700;
  color: var(--text-3);
  padding: 0 0 7px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.drp-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 500;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .1s, color .1s;
  color: var(--text);
  position: relative;
}

.drp-day.empty {
  cursor: default;
}

.drp-day.other-month {
  color: var(--text-3);
}

.drp-day.today:not(.range-start):not(.range-end) {
  color: var(--accent);
  font-weight: 700;
}

.drp-day:hover:not(.empty) {
  background: var(--surface-3);
}

.drp-day.in-range {
  background: var(--accent-soft);
  border-radius: 0;
  color: var(--accent-light);
}

.drp-day.range-start,
.drp-day.range-end {
  background: var(--accent) !important;
  color: var(--text-inverse) !important;
  font-weight: 700;
  z-index: 1;
  border-radius: var(--r-sm) !important;
}

.drp-day.range-start.in-range-after::after,
.drp-day.range-end.in-range-before::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: var(--accent-soft);
  z-index: -1;
}

.drp-day.range-start.in-range-after::after {
  right: 0;
}

.drp-day.range-end.in-range-before::before {
  left: 0;
}

.drp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.drp-hint {
  font-size: .72rem;
  color: var(--text-3);
  font-style: italic;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  background: var(--text);
  color: var(--bg);
  padding: 9px 15px;
  border-radius: var(--r-sm);
  font-size: .83rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: slideUp .24s var(--ease-out-expo) both;
}

.toast.error {
  background: var(--danger);
  color: var(--text-inverse);
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* MapLibre GL & Mapbox GL overrides (stessi selettori, due prefissi) */
.maplibregl-map,
.mapboxgl-map {
  background: var(--bg-2);
}

.maplibregl-ctrl-attrib,
.maplibregl-ctrl-logo,
.mapboxgl-ctrl-attrib,
.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right {
  display: none !important;
}

/* Popup shell */
.maplibregl-popup-content,
.mapboxgl-popup-content {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-radius: var(--r) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md) !important;
  padding: 10px 14px !important;
  font-family: 'Urbanist', system-ui, sans-serif;
}

/* Popup arrow — match surface color per anchor direction */
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip,
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip {
  border-top-color: var(--surface) !important;
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
  border-bottom-color: var(--surface) !important;
}

.maplibregl-popup-anchor-left .maplibregl-popup-tip,
.mapboxgl-popup-anchor-left .mapboxgl-popup-tip {
  border-right-color: var(--surface) !important;
}

.maplibregl-popup-anchor-right .maplibregl-popup-tip,
.mapboxgl-popup-anchor-right .mapboxgl-popup-tip {
  border-left-color: var(--surface) !important;
}

/* use custom zoom controls instead */

/* ══════════════════════════════════════════════════════════════════════════════
   VIEW MODE TOGGLE (map ↔ reading)
   ══════════════════════════════════════════════════════════════════════════════ */
.view-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-2);
  border-radius: var(--r-sm);
  padding: 2px;
}


/* ══════════════════════════════════════════════════════════════════════════════
   TRANSPORT SEPARATOR in calendar
   ══════════════════════════════════════════════════════════════════════════════ */
.transport-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 4px;
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.transport-sep::before,
.transport-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border-2);
}

/* Transport activity cards — subtler style */
.cal-item.is-transport .cal-item-card {
  background: rgba(167, 139, 250, 0.06);
  border: 1px dashed rgba(167, 139, 250, 0.25); /* cat-transport tint — intentional dashed style */
  opacity: .90;
}

.cal-item.is-transport .cal-item-card:hover {
  opacity: 1;
}

/* ══════════════════════════════════════════════════════════════════════════════
   DIRECT-CLICK EDIT FIELDS in detail overlay
   ══════════════════════════════════════════════════════════════════════════════ */
/* Category chip — big, clickable */
.det-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px 6px 10px;
  border-radius: 99px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: 14px;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  user-select: none;
}

.det-cat-chip:hover {
  filter: brightness(1.08);
  border-color: rgba(0, 0, 0, .12);
}

.det-cat-chip .cat-emoji {
  font-size: 1rem;
}

.det-cat-chip svg {
  width: 12px;
  height: 12px;
  opacity: .65;
}

/* Category dropdown */
.det-cat-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 50;
  animation: slideUp .12s ease;
}

.det-cat-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: .83rem;
  font-weight: 600;
  transition: background var(--transition);
}

.det-cat-option:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.det-cat-option.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Click-to-edit field */
.det-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  margin-bottom: 2px;
  transition: background var(--transition);
}

.det-field.clickable {
  cursor: text;
}

.det-field.clickable:hover {
  background: var(--surface-overlay-subtle);
  border-radius: var(--r-sm);
}

.det-field-icon {
  font-size: .95rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  margin-top: 1px;
}

.det-field-content {
  flex: 1;
  min-width: 0;
}

.det-field-label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 2px;
}

.det-field-value {
  font-size: .88rem;
  color: var(--text);
  font-weight: 600;
  min-height: 18px;
  cursor: text;
  word-break: break-word;
}

.det-field-value.empty {
  color: var(--text-3);
  font-style: italic;
  font-weight: 400;
}

.det-field.clickable:hover .det-field-value {
  color: var(--accent);
}

.det-field .input {
  width: 100%;
  margin-top: 2px;
  font-size: .88rem;
  padding: 5px 8px;
}

.det-field-actions {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}

.det-field textarea.input {
  min-height: 70px;
  resize: vertical;
}

/* ══════════════════════════════════════════════════════════════════════════════
   FLIGHT INFO panel in detail overlay
   ══════════════════════════════════════════════════════════════════════════════ */
.detail-flight {
  margin: 0 18px 2px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #0F172A 0%, #1e3a5f 100%);
  border-radius: var(--r-lg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-flight.hidden {
  display: none;
}

.flight-number {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-photo);
  letter-spacing: .04em;
  line-height: 1;
}

.flight-airline {
  font-size: .72rem;
  color: var(--text-photo-65);
  margin-top: 2px;
  font-weight: 600;
}

.flight-links {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.flight-link {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: .70rem;
  font-weight: 700;
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .85);
  border: 1px solid rgba(255, 255, 255, .18);
  text-decoration: none;
  transition: background var(--transition);
}

.flight-link:hover {
  background: rgba(255, 255, 255, .22);
  color: var(--text-photo);
}

/* ══════════════════════════════════════════════════════════════════════════════
   NOTES PAGE — Google Keep style
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Keep palette: note background colors ───────────────────────────────── */
:root {
  --keep-coral:    #77172e;
  --keep-peach:    #692b17;
  --keep-sand:     #7c4a03;
  --keep-sage:     #264d3b;
  --keep-fog:      #0d3b33;
  --keep-storm:    #1d3557;
  --keep-dusk:     #472e5b;
  --keep-blossom:  #6c394f;
  --keep-clay:     #4b443a;
}
[data-theme="light"] {
  --keep-coral:    #faafa8;
  --keep-peach:    #f39f76;
  --keep-sand:     #fff8b8;
  --keep-sage:     #e2f6d3;
  --keep-fog:      #b4ddd3;
  --keep-storm:    #d4e4ed;
  --keep-dusk:     #d7aefb;
  --keep-blossom:  #fdcfe8;
  --keep-clay:     #e9e3d4;
}

/* ── Page wrapper ────────────────────────────────────────────────────────── */
.keep-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  pointer-events: auto;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.keep-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.keep-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.keep-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.notes-count-badge {
  background: var(--surface-3);
  color: var(--text-2);
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}

/* ── Search ──────────────────────────────────────────────────────────────── */
.keep-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.keep-search-icon {
  position: absolute;
  left: 9px;
  width: 13px;
  height: 13px;
  color: var(--text-3);
  pointer-events: none;
}

.keep-search {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-size: .78rem;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 12px 6px 28px;
  width: 200px;
  transition: border-color var(--transition), width var(--transition);
}
.keep-search:focus {
  outline: none;
  border-color: var(--accent);
  width: 240px;
}
.keep-search::placeholder { color: var(--text-3); }

/* Shared select style */
.notes-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: .72rem;
  font-weight: 500;
  font-family: inherit;
  padding: 4px 22px 4px 8px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: border-color var(--transition);
}
.notes-select:focus { outline: none; border-color: var(--accent); }

/* ── Always-open create form ─────────────────────────────────────────────── */
.keep-create-wrap {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 2px 20px 18px;
}

.keep-create-card {
  width: 100%;
  max-width: 680px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  overflow: visible;
  transition: box-shadow 220ms cubic-bezier(0.22,1,0.36,1), border-color 220ms, background var(--transition);
  display: flex;
  flex-direction: column;
}
.keep-create-card:focus-within {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-2);
}

.keep-quick-title {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: .92rem;
  font-weight: 700;
  font-family: inherit;
  padding: 14px 18px 4px;
  width: 100%;
}
.keep-quick-title:focus:not(:focus-visible) { outline: none; }
.keep-quick-title::placeholder { color: var(--text-3); font-weight: 500; }

/* Rich-text contenteditable body */
.keep-rich-body {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: .85rem;
  font-weight: 400;
  font-family: inherit;
  padding: 4px 18px 10px;
  width: 100%;
  min-height: 64px;
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.6;
  outline: none;
  box-sizing: border-box;
}
.keep-rich-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text-3);
  pointer-events: none;
}
.keep-rich-body ul, .keep-rich-body ol {
  padding-left: 20px;
  margin: 4px 0;
}
.keep-rich-body li { margin: 2px 0; }

/* ── Formatting toolbar ──────────────────────────────────────────────────── */
.keep-format-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 12px 6px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.keep-fmt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: .9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform 80ms;
  position: relative;
  flex-shrink: 0;
}
.keep-fmt-btn:hover { background: var(--surface-3); color: var(--text); transform: scale(1.05); }
.keep-fmt-btn:active { transform: scale(0.94); }
.keep-fmt-btn.active { background: var(--accent-soft); color: var(--accent); }
.keep-fmt-btn svg { width: 16px; height: 16px; }

.keep-fmt-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Text-color button */
.keep-fmt-color-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.keep-fmt-color-bar {
  display: block;
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--text);
}

.keep-fmt-color-popover {
  position: fixed;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  z-index: 600;
  min-width: 160px;
}
.keep-fmt-color-popover.hidden { display: none; }

.keep-fmt-clr {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 80ms, border-color 80ms;
  flex-shrink: 0;
}
.keep-fmt-clr:hover { transform: scale(1.15); border-color: var(--text-2); }
.keep-fmt-clr-default {
  background: var(--surface-3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cline x1='1' y1='11' x2='11' y2='1' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* ── Options row: urgency + trip + date + color + save ───────────────────── */
.keep-options-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* Urgency slider */
.keep-urgency-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  flex-shrink: 0;
}

.keep-urgency-slider {
  --thumb-color: #F59E0B;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--success) 0%, var(--warning) 50%, var(--danger) 100%);
  outline: none;
  cursor: pointer;
}
.keep-urgency-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--accent-soft), 0 1px 6px rgba(0,0,0,.45);
}
.keep-urgency-slider:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--accent-soft), 0 1px 6px rgba(0,0,0,.45);
}
.keep-urgency-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--thumb-color, #F59E0B);
  border: 2.5px solid var(--surface);
  box-shadow: 0 1px 6px rgba(0,0,0,.45);
  cursor: pointer;
  transition: background 200ms, transform 100ms;
}
.keep-urgency-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--thumb-color, #F59E0B);
  border: 2.5px solid var(--surface);
  box-shadow: 0 1px 6px rgba(0,0,0,.45);
  cursor: pointer;
}
.keep-urgency-slider:hover::-webkit-slider-thumb { transform: scale(1.25); }

.keep-urgency-labels {
  display: flex;
  justify-content: space-between;
  font-size: .62rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 0 2px;
}

/* Right side of options row */
.keep-options-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

/* Make all icon buttons in options row bigger */
.keep-options-right .btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
}
.keep-options-right .btn-icon svg { width: 17px; height: 17px; }
.keep-options-right .btn-icon:hover { background: var(--surface-3); color: var(--text); }

/* Trip select bigger */
.keep-options-right .notes-select {
  height: 40px;
  font-size: .83rem;
  padding: 0 10px;
  border-radius: var(--r);
}

/* Due date toggle */
.keep-duedate-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

/* Full calendar date panel — JS-positioned via positionPopover() */
.mini-date-panel {
  position: fixed;
  z-index: 600;
  min-width: 300px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-xl);
  user-select: none;
  animation: miniCalIn 160ms cubic-bezier(0.22,1,0.36,1) both;
}
.mini-date-panel.hidden { display: none; }
@keyframes miniCalIn {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Bigger grid cells */
.mini-date-panel .drp-grid {
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.mini-date-panel .drp-day,
.mini-date-panel .drp-dow {
  width: 36px;
  height: 36px;
  font-size: .82rem;
}
.mini-date-panel .drp-header { margin-bottom: 10px; }
.mini-date-panel .drp-month-label { font-size: .92rem; font-weight: 700; }

/* Note color wrap */
.keep-note-color-wrap {
  position: relative;
}

/* ── Trip filter dropdown ─────────────────────────────────────────────────── */
.notes-trip-dropdown {
  position: relative;
}

.notes-trip-menu {
  position: fixed;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  z-index: 600;
  min-width: 180px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px 0;
}
.notes-trip-menu.hidden { display: none; }

.notes-trip-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition);
}
.notes-trip-option:hover { background: var(--surface-3); color: var(--text); }
.notes-trip-option input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  width: 13px;
  height: 13px;
}

.ntd-chevron { width: 11px !important; height: 11px !important; flex-shrink: 0; }

/* Bottom toolbar of expanded create — keep for compatibility */
.keep-quick-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 8px;
  border-top: 1px solid var(--border);
  gap: 6px;
}
.keep-quick-toolbar-left { display: flex; align-items: center; gap: 2px; }
.keep-quick-toolbar-right { display: flex; align-items: center; gap: 6px; }

/* ── Color picker ────────────────────────────────────────────────────────── */
.keep-color-picker {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  flex-wrap: wrap;
}

.keep-color-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 80ms, border-color 80ms;
  flex-shrink: 0;
}
.keep-color-btn:hover { transform: scale(1.15); }
.keep-color-btn.active { border-color: var(--text); }
.keep-color-btn[data-color="none"] {
  background: var(--surface-3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cline x1='1' y1='11' x2='11' y2='1' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
.keep-color-btn[data-color="coral"]   { background: var(--keep-coral); }
.keep-color-btn[data-color="peach"]   { background: var(--keep-peach); }
.keep-color-btn[data-color="sand"]    { background: var(--keep-sand); }
.keep-color-btn[data-color="sage"]    { background: var(--keep-sage); }
.keep-color-btn[data-color="fog"]     { background: var(--keep-fog); }
.keep-color-btn[data-color="storm"]   { background: var(--keep-storm); }
.keep-color-btn[data-color="dusk"]    { background: var(--keep-dusk); }
.keep-color-btn[data-color="blossom"] { background: var(--keep-blossom); }
.keep-color-btn[data-color="clay"]    { background: var(--keep-clay); }

/* Color picker popover — JS-positioned via positionPopover() */
.keep-color-popover {
  position: fixed;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  z-index: 600;
  min-width: 200px;
}
.keep-color-popover.hidden { display: none; }

/* ── Grid sections (Pinned / Others) ─────────────────────────────────────── */
.keep-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.keep-section { margin-bottom: 4px; }
.keep-section.hidden { display: none; }

.keep-section-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 4px 8px;
}

/* CSS masonry via columns */
.keep-grid {
  column-count: 4;
  column-gap: 10px;
}

@media (max-width: 1200px) { .keep-grid { column-count: 3; } }
@media (max-width: 860px)  { .keep-grid { column-count: 2; } }
@media (max-width: 540px)  { .keep-grid { column-count: 1; } }

/* ── Note cards ──────────────────────────────────────────────────────────── */
@keyframes keepCardIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes keepCardOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(.94); }
}
@keyframes keepSectionIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.keep-section { animation: keepSectionIn 300ms cubic-bezier(0.22,1,0.36,1) both; }
.keep-section:nth-child(2) { animation-delay: 40ms; }

.keep-card {
  break-inside: avoid;
  display: inline-block; /* required for CSS columns masonry */
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 14px 10px;
  margin-bottom: 10px;
  cursor: pointer;
  position: relative;
  transition: box-shadow 180ms cubic-bezier(0.22,1,0.36,1), border-color 180ms, transform 180ms cubic-bezier(0.22,1,0.36,1);
  box-sizing: border-box;
  animation: keepCardIn 280ms cubic-bezier(0.22,1,0.36,1) both;
  animation-delay: var(--card-delay, 0ms);
}
.keep-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-2);
  transform: translateY(-2px);
}
.keep-card:active { transform: translateY(0) scale(.99); }
.keep-card.removing {
  animation: keepCardOut 160ms cubic-bezier(0.25,1,0.5,1) forwards;
  pointer-events: none;
}
.keep-card:hover .keep-card-actions { opacity: 1; }

/* Color tinted cards */
.keep-card[data-color="coral"]   { background: var(--keep-coral);   border-color: transparent; }
.keep-card[data-color="peach"]   { background: var(--keep-peach);   border-color: transparent; }
.keep-card[data-color="sand"]    { background: var(--keep-sand);    border-color: transparent; }
.keep-card[data-color="sage"]    { background: var(--keep-sage);    border-color: transparent; }
.keep-card[data-color="fog"]     { background: var(--keep-fog);     border-color: transparent; }
.keep-card[data-color="storm"]   { background: var(--keep-storm);   border-color: transparent; }
.keep-card[data-color="dusk"]    { background: var(--keep-dusk);    border-color: transparent; }
.keep-card[data-color="blossom"] { background: var(--keep-blossom); border-color: transparent; }
.keep-card[data-color="clay"]    { background: var(--keep-clay);    border-color: transparent; }

.keep-card.done { opacity: .52; }

/* Top-right action cluster (pin + delete) */
.keep-card-top-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 160ms cubic-bezier(0.22,1,0.36,1);
}
.keep-card:hover .keep-card-top-actions,
.keep-card-pin.pinned ~ .keep-card-top-actions,
.keep-card-top-actions:has(.keep-card-pin.pinned) { opacity: 1; }

/* When pin is pinned the whole cluster is always visible */
.keep-card-top-actions:has(.pinned) { opacity: 1; }

.keep-card-pin,
.keep-card-del-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  transition: background 120ms, color 120ms, transform 80ms;
  flex-shrink: 0;
}
.keep-card-pin:hover  { background: rgba(255,255,255,.10); color: var(--text); transform: scale(1.1); }
.keep-card-del-btn:hover { background: var(--danger-soft); color: var(--danger); transform: scale(1.1); }
.keep-card-pin.pinned { color: var(--accent); }
.keep-card-pin svg, .keep-card-del-btn svg { width: 13px; height: 13px; }

/* Card title */
.keep-card-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
  padding-right: 60px; /* space for top-actions cluster */
  word-break: break-word;
  min-height: 1.2em;
}
.keep-card.done .keep-card-title { text-decoration: line-through; color: var(--text-2); }

/* Inline editing state */
.keep-card-editable:focus,
.keep-card-editing {
  outline: none;
  background: rgba(255,255,255,.04);
  border-radius: var(--r-xs);
  padding: 3px 5px;
  margin: -3px -5px;
  cursor: text;
}
.keep-card-title-empty::before {
  content: attr(data-placeholder);
  color: var(--text-3);
  font-weight: 500;
  pointer-events: none;
}
.keep-card-title-empty:not(:empty)::before { display: none; }

/* Card body preview */
.keep-card-preview {
  font-size: .80rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 4px;
  word-break: break-word;
  max-height: 120px;
  overflow: hidden;
  position: relative;
}
/* After max-height: fade out bottom */
.keep-card-preview--collapsible:not(.keep-card-preview--expanded)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(transparent, var(--surface));
  pointer-events: none;
}
.keep-card[data-color="coral"]   .keep-card-preview--collapsible:not(.keep-card-preview--expanded)::after { background: linear-gradient(transparent, var(--keep-coral)); }
.keep-card[data-color="peach"]   .keep-card-preview--collapsible:not(.keep-card-preview--expanded)::after { background: linear-gradient(transparent, var(--keep-peach)); }
.keep-card[data-color="sand"]    .keep-card-preview--collapsible:not(.keep-card-preview--expanded)::after { background: linear-gradient(transparent, var(--keep-sand)); }
.keep-card[data-color="sage"]    .keep-card-preview--collapsible:not(.keep-card-preview--expanded)::after { background: linear-gradient(transparent, var(--keep-sage)); }
.keep-card[data-color="fog"]     .keep-card-preview--collapsible:not(.keep-card-preview--expanded)::after { background: linear-gradient(transparent, var(--keep-fog)); }
.keep-card[data-color="storm"]   .keep-card-preview--collapsible:not(.keep-card-preview--expanded)::after { background: linear-gradient(transparent, var(--keep-storm)); }
.keep-card[data-color="dusk"]    .keep-card-preview--collapsible:not(.keep-card-preview--expanded)::after { background: linear-gradient(transparent, var(--keep-dusk)); }
.keep-card[data-color="blossom"] .keep-card-preview--collapsible:not(.keep-card-preview--expanded)::after { background: linear-gradient(transparent, var(--keep-blossom)); }
.keep-card[data-color="clay"]    .keep-card-preview--collapsible:not(.keep-card-preview--expanded)::after { background: linear-gradient(transparent, var(--keep-clay)); }
.keep-card-preview--expanded {
  max-height: none;
  overflow: visible;
}
.keep-card-preview--expanded::after { display: none; }

/* Read more button */
.keep-card-readmore {
  display: block;
  background: none;
  border: none;
  color: var(--accent);
  font-size: .73rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0 0 6px;
  margin-bottom: 2px;
  text-align: left;
  transition: color var(--transition);
}
.keep-card-readmore:hover { color: var(--accent-light); }
.keep-card-readmore.hidden { display: none; }

/* Checklist preview inside card */
.keep-card-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.keep-card-check-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: .80rem;
  color: var(--text-2);
  line-height: 1.4;
}
.keep-card-check-item.checked {
  color: var(--text-3);
  text-decoration: line-through;
}

.keep-card-check-box {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  border: 1.5px solid var(--text-3);
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.keep-card-check-item.checked .keep-card-check-box {
  background: var(--text-3);
  border-color: var(--text-3);
}
.keep-card-check-box svg { width: 9px; height: 9px; color: var(--bg); }

.keep-card-checklist-more {
  font-size: .74rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* Card footer: chips + date */
.keep-card-footer {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.keep-card-trip {
  background: rgba(91,139,255,.15);
  color: var(--accent-light);
  border-radius: var(--r-xs);
  font-size: .66rem;
  font-weight: 600;
  padding: 2px 5px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keep-card-prio {
  border-radius: var(--r-xs);
  font-size: .64rem;
  font-weight: 700;
  padding: 2px 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.keep-card-prio.urgent  { background: var(--danger-soft);  color: var(--danger); }
.keep-card-prio.normal  { background: var(--accent-soft);  color: var(--accent); }
.keep-card-prio.low     { background: var(--success-soft); color: var(--success); }

.keep-card-date {
  font-size: .68rem;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
}

.keep-card-due {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: .66rem;
  font-weight: 600;
  color: var(--warning);
  background: var(--warning-soft);
  border-radius: var(--r-xs);
  padding: 2px 5px;
}
.keep-card-due svg { width: 10px; height: 10px; }

.keep-card-doc {
  color: var(--text-3);
  display: flex;
  align-items: center;
}
.keep-card-doc svg { width: 11px; height: 11px; }

/* Card hover actions (bottom-right overlay) */
.keep-card-actions {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.keep-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-3);
  text-align: center;
  width: 100%;
}
.keep-empty svg { width: 40px; height: 40px; opacity: .28; }
.keep-empty p   { font-size: .85rem; margin: 0; line-height: 1.5; }

/* ── Note modal ──────────────────────────────────────────────────────────── */
.keep-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.keep-modal-overlay.hidden { display: none; }

.keep-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: keepModalIn 200ms cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes keepModalIn {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes keepModalOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(.95) translateY(6px); }
}
@keyframes keepOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes keepOverlayOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
.keep-modal-overlay {
  animation: keepOverlayIn 200ms ease both;
}
.keep-modal-overlay.closing { animation: keepOverlayOut 160ms ease forwards; }
.keep-modal.closing { animation: keepModalOut 160ms cubic-bezier(0.25,1,0.5,1) forwards; }

/* Tinted modal */
.keep-modal[data-color="coral"]   { background: var(--keep-coral);   border-color: transparent; }
.keep-modal[data-color="peach"]   { background: var(--keep-peach);   border-color: transparent; }
.keep-modal[data-color="sand"]    { background: var(--keep-sand);    border-color: transparent; }
.keep-modal[data-color="sage"]    { background: var(--keep-sage);    border-color: transparent; }
.keep-modal[data-color="fog"]     { background: var(--keep-fog);     border-color: transparent; }
.keep-modal[data-color="storm"]   { background: var(--keep-storm);   border-color: transparent; }
.keep-modal[data-color="dusk"]    { background: var(--keep-dusk);    border-color: transparent; }
.keep-modal[data-color="blossom"] { background: var(--keep-blossom); border-color: transparent; }
.keep-modal[data-color="clay"]    { background: var(--keep-clay);    border-color: transparent; }

.keep-modal-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 4px;
}

.keep-modal-title {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  width: 100%;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.keep-modal-title:focus:not(:focus-visible) { outline: none; }
.keep-modal-title::placeholder { color: var(--text-3); font-weight: 500; }

.keep-modal-body {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: .88rem;
  font-weight: 400;
  font-family: inherit;
  width: 100%;
  resize: none;
  min-height: 80px;
  line-height: 1.6;
  padding: 0;
}
.keep-modal-body:focus:not(:focus-visible) { outline: none; }
.keep-modal-body::placeholder { color: var(--text-3); }

/* Checklist inside modal */
.keep-modal-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 60px;
}

.keep-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  border-radius: var(--r-xs);
}
.keep-check-item:hover .keep-check-del { opacity: 1; }

.keep-check-toggle {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border-2);
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.keep-check-toggle.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.keep-check-toggle svg { width: 10px; height: 10px; color: #fff; }

.keep-check-text {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: .85rem;
  font-family: inherit;
  line-height: 1.4;
  padding: 0;
}
.keep-check-text:focus:not(:focus-visible) { outline: none; }
.keep-check-text.checked { text-decoration: line-through; color: var(--text-3); }

.keep-check-del {
  opacity: 0;
  transition: opacity var(--transition);
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  display: flex;
}
.keep-check-del svg { width: 13px; height: 13px; }
.keep-check-del:hover { color: var(--text-2); }

.keep-add-item-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 2px;
  font-size: .82rem;
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: color var(--transition);
}
.keep-add-item-btn:hover { color: var(--text-2); }
.keep-add-item-btn svg { width: 14px; height: 14px; }

/* Modal meta row (trip, priority) */
.keep-modal-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 0 4px;
}

/* Modal toolbar (bottom) */
.keep-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 6px;
  position: relative;
}
.keep-modal-toolbar-left  { display: flex; align-items: center; gap: 2px; position: relative; }
.keep-modal-toolbar-right { display: flex; align-items: center; gap: 6px; }

.keep-modal-meta-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Checklist items spinner/loading ─────────────────────────────────────── */
.keep-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: .84rem;
}
.keep-loading svg { width: 16px; height: 16px; animation: spin 1s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }



/* ══════════════════════════════════════════════════════════════════════════════
   READING VIEW — kanban/full horizontal column layout (matches Figma)
   ══════════════════════════════════════════════════════════════════════════════ */
.reading-layout {
  display: flex;
  height: 100%;
  pointer-events: auto;
  overflow: hidden;
  padding: 0;
}

/* Hide the separate reading sidebar — main app sidebar is used for trip nav */
.reading-sidebar {
  display: none;
}

.reading-main {
  flex: 1;
  overflow: hidden;
  display: flex;
}

/* Horizontal scroll container — one column per day */
.reading-scroll {
  flex: 1;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  gap: 10px;
  padding: 16px 20px 20px;
  align-items: flex-start;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb-faint) transparent;
}

.reading-scroll::-webkit-scrollbar {
  height: 4px;
}

.reading-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

/* ── Day column ─────────────────────────────────────────────────────────── */
.reading-day-col {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 100%;
}

.reading-day-col-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-bg-deep);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-2);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  flex-shrink: 0;
}

.reading-day-col-num {
  font-size: .63rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.reading-day-col-date {
  font-size: .68rem;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 1px;
}

.reading-day-col-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

.reading-day-col-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb-faint) transparent;
}

/* ── Activity item in kanban column ─────────────────────────────────────── */
.rdg-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--glass-border-2);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.rdg-item:hover {
  background: var(--surface-2);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.rdg-dot {
  width: 3px;
  border-radius: 99px;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 20px;
}

.rdg-body {
  flex: 1;
  min-width: 0;
}

.rdg-title {
  font-size: .80rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.rdg-sub {
  font-size: .68rem;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 1px;
  line-height: 1.3;
}

.rdg-time {
  font-size: .63rem;
  font-weight: 700;
  color: var(--text-3);
  flex-shrink: 0;
  padding-top: 2px;
}

.rdg-empty {
  color: var(--text-3);
  font-size: .78rem;
  padding: 8px 4px;
}

/* Legacy reading card classes kept for any references */
.reading-card {
  padding: 12px 13px;
  border-radius: var(--r-lg);
  background: var(--glass-bg-deep);
  border: 1px solid var(--glass-border-2);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reading-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.reading-card-emoji {
  font-size: 1.4rem;
  line-height: 1;
  margin-bottom: 2px;
}

.reading-card-time {
  font-size: .67rem;
  font-weight: 700;
  color: var(--text-3);
}

.reading-card-title {
  font-size: .88rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.01em;
  line-height: 1.2;
}

.reading-card-sub {
  font-size: .72rem;
  color: var(--text-2);
  font-weight: 500;
}

/* Accommodation card (full-width) */
.reading-accommodation {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  background: rgba(6, 182, 212, .07);
  border: 1px solid rgba(6, 182, 212, .20);
  cursor: pointer;
  transition: background var(--transition);
}

.reading-accommodation:hover {
  background: rgba(6, 182, 212, .12);
}

.reading-accommodation-emoji {
  font-size: 1.5rem;
}

.reading-accommodation-title {
  font-size: .90rem;
  font-weight: 800;
  color: var(--text);
}

.reading-accommodation-sub {
  font-size: .73rem;
  color: var(--text-2);
  margin-top: 1px;
}

.reading-accommodation-time {
  margin-left: auto;
  font-size: .75rem;
  font-weight: 700;
  color: var(--cat-accommodation);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TODOS section
   ══════════════════════════════════════════════════════════════════════════════ */
.todos-section {
  padding: 16px 18px;
  border-radius: var(--r-2xl);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-2);
  box-shadow: var(--shadow-sm);
}

.todos-title {
  font-size: .80rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.todos-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  background: var(--glass-bg-deep);
  border: 1px solid var(--glass-border-2);
  transition: background var(--transition);
}

.todo-item:hover {
  background: var(--surface-2);
}

.todo-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid var(--border-2);
  background: transparent;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}

.todo-check:checked {
  background: var(--success);
  border-color: var(--success);
}

.todo-check:checked::after {
  content: '✓';
  color: var(--text-inverse);
  font-size: .65rem;
  font-weight: 900;
}

.todo-text {
  flex: 1;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.todo-item.done .todo-text {
  text-decoration: line-through;
  color: var(--text-3);
}

.todo-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  opacity: 0;
  padding: 2px;
  border-radius: 4px;
  transition: opacity var(--transition), color var(--transition);
}

.todo-item:hover .todo-del {
  opacity: 1;
}

.todo-del:hover {
  color: var(--danger);
}

.todo-add-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.todo-add-input {
  flex: 1;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--glass-border-2);
  background: var(--glass-bg-deep);
  font-size: .83rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.todo-add-input:focus {
  border-color: var(--accent);
}

.todo-add-btn {
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: none;
  background: var(--accent);
  color: var(--text-inverse);
  cursor: pointer;
  font-family: inherit;
  font-size: .80rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: background var(--transition);
}

.todo-add-btn:hover {
  background: var(--accent-h);
}

/* ══════════════════════════════════════════════════════════════════════════════
   INLINE TODOS in map view calendar
   ══════════════════════════════════════════════════════════════════════════════ */
.cal-todos-section {
  padding: 10px 12px 6px;
}

.cal-todos-title {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cal-todo-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border-radius: var(--r-xs);
  transition: background var(--transition);
}

.cal-todo-item:hover {
  background: var(--glass-bg);
}

.cal-todo-text {
  font-size: .78rem;
  flex: 1;
  font-weight: 500;
  color: var(--text-2);
}

.cal-todo-item.done .cal-todo-text {
  text-decoration: line-through;
  color: var(--text-3);
}

.cal-todo-del {
  background: none;
  border: none;
  cursor: pointer;
  color: transparent;
  font-size: .65rem;
  padding: 1px 3px;
}

.cal-todo-item:hover .cal-todo-del {
  color: var(--text-3);
}

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE HEADER (new component — shown only on mobile)
   ══════════════════════════════════════════════════════════════════════════════ */
.mobile-header {
  display: none; /* hidden on desktop */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  z-index: 500;
  background: var(--box-bg);
  border-bottom: 1px solid var(--box-border);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  align-items: center;
  padding: 0 12px;
  gap: 6px;
}

.mobile-menu-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--btn-color);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.mobile-menu-btn:hover {
  background: var(--hover-overlay);
  color: var(--text);
}
.mobile-menu-btn svg.lucide {
  width: 20px;
  height: 20px;
}

/* Logo icon next to hamburger — placeholder until real logo is available */
.mobile-brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--r-sm);
  color: var(--accent);
  flex-shrink: 0;
}
.mobile-brand-logo svg.lucide {
  width: 20px;
  height: 20px;
}

/* Mobile sidebar overlay backdrop */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .54);
  z-index: 450;
  opacity: 0;
  pointer-events: none; /* ← FIX: non blocca touch/click quando il drawer è chiuso */
  transition: opacity .28s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.mobile-sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto; /* ← ripristina blocco solo quando il drawer è aperto */
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET  (768px – 1024px)
   ──────────────────────────────────────────────────────────────────────────────
   Su tablet (iPad portrait/landscape, laptop piccoli) la sidebar parte
   collapsed di default per recuperare ~170px di larghezza. L'utente può
   sempre espanderla manualmente (e la nuova larghezza viene persistita
   da app.js come su desktop). Trip grid rimane a 3 colonne come desktop:
   le card si stringono un po' ma il layout resta coerente.
   ══════════════════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1024px) {
  /* Sidebar collapsed di default (l'utente può espanderla con il toggle) */
  .sidebar:not(.icons-only) {
    width: var(--sidebar-w-icons);
    min-width: var(--sidebar-w-icons);
  }
  .sidebar:not(.icons-only) .nav-label,
  .sidebar:not(.icons-only) .nav-text,
  .sidebar:not(.icons-only) .user-info,
  .sidebar:not(.icons-only) .user-row-chevron,
  .sidebar:not(.icons-only) .sidebar-brand,
  .sidebar:not(.icons-only) #sidebar-collapse-btn {
    display: none;
  }
  .sidebar:not(.icons-only) .sidebar-brand-collapsed {
    display: flex;
  }

  /* Pannelli laterali (schedule/detail) un filo più stretti per non rubare
     spazio alla mappa quando la sidebar viene espansa manualmente */
  .schedule-panel {
    max-width: 380px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE  (≤ 767px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Tokens ──────────────────────────────────────────────── */
  :root {
    --sidebar-w: 0px;
    --header-h: 52px;
  }

  /* ── Show mobile header, show overlay ───────────────────── */
  .mobile-header {
    display: flex;
  }
  .mobile-sidebar-overlay {
    display: block;
  }

  /* ── App shell: account for fixed mobile header ─────────── */
  body {
    overflow: hidden;
  }

  #app-page {
    margin-top: 52px;
    height: calc(100vh - 52px);   /* fallback */
    height: calc(100dvh - 52px);
  }

  /* ── Sidebar becomes a fixed left drawer ─────────────────── */
  .sidebar {
    position: fixed;
    top: 52px;
    left: -280px;
    width: 280px !important;
    min-width: 280px !important;
    height: calc(100vh - 52px);   /* fallback */
    height: calc(100dvh - 52px);
    margin: 0;
    border-radius: 0 var(--r-xl) var(--r-xl) 0;
    z-index: 460;
    transition: left .28s cubic-bezier(.4, 0, .2, 1);
    display: flex !important; /* override the display:none from old rule */
  }

  .sidebar.mobile-open {
    left: 0;
  }

  /* In icons-only mode on desktop this fires but on mobile we always show full sidebar */
  .sidebar.icons-only {
    width: 280px !important;
    min-width: 280px !important;
  }
  .sidebar.icons-only .nav-label,
  .sidebar.icons-only .nav-text,
  .sidebar.icons-only .user-info,
  .sidebar.icons-only .user-row-chevron {
    display: flex !important;
    opacity: 1 !important;
    width: auto !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }
  .sidebar.icons-only .nav-item {
    justify-content: flex-start !important;
    padding: 0 12px !important;
  }
  .sidebar.icons-only .nav-item::after {
    display: none !important; /* hide collapsed tooltip on mobile */
  }
  .sidebar.icons-only .user-row {
    padding: 8px 12px !important;
    gap: 10px !important;
    justify-content: flex-start !important;
  }
  .sidebar.icons-only .nav-trip-color {
    display: flex !important;
    width: 6px !important;
  }
  .sidebar.icons-only .sidebar-brand-collapsed {
    display: none !important;
  }
  .sidebar.icons-only .sidebar-brand,
  .sidebar.icons-only #sidebar-collapse-btn {
    display: flex !important;
  }

  /* ── Main content — no left margin needed ────────────────── */
  .main-content {
    margin-left: 0 !important;
    width: 100%;
  }

  /* ── Dashboard view ──────────────────────────────────────── */
  /* NOTE: NON impostare position:relative qui — sovrascrive position:absolute
     di .view-layer e collassa l'altezza a 0 (bottom-panel scompare). */
  .dash-view {
    position: absolute;
  }

  #dashboard-map {
    border-radius: 0 !important;
  }

  /* Welcome slot: scaled down for mobile */
  .dash-welcome-slot {
    top: 12px;
    left: 12px;
    right: 12px;
    max-width: 100%;
  }
  .dash-welcome-eyebrow {
    font-size: .9rem;
    margin-bottom: 2px;
  }
  .dash-welcome-name {
    font-size: 2.2rem;
    gap: 8px;
  }
  .dash-welcome-emoji {
    font-size: 1.8rem;
  }

  /* Next Up slot: hidden on mobile to avoid overlap with welcome */
  .dash-nextup-slot {
    display: none;
  }

  /* Bottom panel: taller by default so cards are visible */
  .dash-bottom-panel {
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    min-height: 52vh;
    min-height: 52dvh;
    max-height: 52vh;
    max-height: 52dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    /* Explicit background so panel is visible on mobile (globe may not render) */
    background: var(--glass-bg-deep);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-top: 1px solid var(--glass-border);
  }

  .dash-bottom-panel.dash-panel-expanded {
    border-radius: 0;
    min-height: calc(100vh - 52px);   /* fallback */
    min-height: calc(100dvh - 52px);
    max-height: calc(100vh - 52px);   /* fallback */
    max-height: calc(100dvh - 52px);
    overflow-y: auto;
  }

  .dash-bottom-inner {
    padding: 20px 12px 80px;
  }

  /* Trip cards grid: 1 column on small screens, 2 on wider mobile */
  .dash-trips-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dash-trips-title {
    font-size: 1.1rem;
  }

  .dash-trips-center {
    gap: 20px;
  }

  /* Filter bar wraps on mobile */
  .dash-filter-bar {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
    padding: 0 4px;
  }

  /* Next up card: full width on mobile */
  .next-up-card {
    max-width: 100%;
    width: 100%;
  }

  /* ── Header actions box: integrato visivamente dentro la striscia del mobile-header ───────── */
  .header-actions-box {
    position: fixed;        /* fixed → posizione viewport-relative, sopra ogni view-layer */
    top: 8px;
    right: 8px;
    z-index: 600;           /* mobile-header è 500 → questo box sta sopra */
    padding: 0;
    gap: 6px;
    background: transparent;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }

  /* Dark/light mode toggle nascosto su mobile */
  .header-actions-box .theme-toggle {
    display: none;
  }

  /* "+ New Trip" diventa pulsante quadrato icon-only su mobile */
  .header-actions-box #add-trip-btn {
    padding: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: var(--r-sm);
  }
  .header-actions-box #add-trip-btn span,
  .header-actions-box #add-trip-btn .btn-text {
    display: none;
  }

  /* View-mode toggle (map ↔ calendar): bottoni quadrati separati su mobile */
  .header-actions-box .view-mode-toggle {
    gap: 6px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
  }
  .header-actions-box .view-mode-toggle .btn-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: var(--r-sm);
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--btn-color);
  }
  .header-actions-box .view-mode-toggle .btn-icon.active {
    background: var(--btn-active-bg);
    color: var(--btn-active-color);
    border-color: transparent;
  }
  .header-actions-box .view-mode-toggle .btn-icon svg.lucide {
    width: 16px;
    height: 16px;
  }

  /* Dashboard theme toggle hidden — su mobile non c'è dark/light switch */
  .dash-theme-toggle {
    display: none;
  }

  /* ── Sheet handle: visible on mobile ────────────────────────── */
  .sheet-handle {
    display: flex;
  }

  /* ── Trip view: map stays fixed bg, schedule is position:fixed sheet ── */
  /* IMPORTANT: do NOT use display:none here — it would hide position:fixed
     children too. Instead, keep the wrapper as a transparent passthrough with
     pointer-events:none so map touches fall through to the globe/tiles layer. */
  .trip-view-flex {
    pointer-events: none;
    background: transparent;
  }

  /* Schedule panel: fixed bottom sheet.
     position:fixed escapes the flex parent entirely, which sidesteps the
     iOS Safari bug where pointer-events:auto children of a
     pointer-events:none absolute flex container don't receive touch events.
     Critically: the PARENT must NOT be display:none — that hides fixed
     children too. Use pointer-events:none on the parent instead (see above). */
  .schedule-panel {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: var(--sheet-h, 55vh);
    max-height: none !important;
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    border-bottom: none !important;
    flex-shrink: 0;
    pointer-events: auto !important;
    overflow: hidden;
    z-index: 50;
    /* No transition by default — JS adds .is-snapping during snap */
    transition: none;
    display: flex !important;
    flex-direction: column !important;
    /* CSS containment: panel layout is self-contained, no effect on surroundings */
    contain: layout style;
  }

  /* Spring snap animation — class added/removed by JS */
  .schedule-panel.is-snapping {
    transition: height 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  }

  /* Performance: promote layer during drag to keep 60fps */
  .schedule-panel.is-dragging {
    will-change: height;
  }

  .schedule-panel.is-all-view {
    width: 100% !important;
  }

  /* Schedule inner: native momentum scroll */
  .schedule-inner {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Browser handles vertical panning; JS only intercepts drags on handle */
    touch-action: pan-y;
  }

  /* Calendar scroll: contained scroll + safe-area bottom padding */
  .calendar-scroll {
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  /* Trip panel header draggable — JS handles touches on it */
  .trip-panel-header {
    touch-action: none;
    cursor: grab;
    cursor: -webkit-grab;
  }

  /* Map zoom controls float above the sheet */
  .map-zoom-controls {
    top: auto;
    bottom: calc(var(--sheet-h, 55vh) + 12px);
    right: 10px;
    transform: none;
    /* Smooth track when sheet snaps */
    transition: bottom 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  }

  /* Panel toggle FAB: replaced by sheet handle on mobile */
  .panel-fab-toggle {
    display: none !important;
  }

  /* Desktop resize handle: not needed on mobile */
  .resize-handle {
    display: none !important;
  }

  /* Detail panel (activity detail): full-screen overlay on mobile */
  #detail-panel {
    position: fixed !important;
    inset: 52px 0 0 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    z-index: 200 !important;
  }

  /* ── Reading view ────────────────────────────────────────── */
  .reading-layout {
    flex-direction: column;
  }

  .reading-sidebar {
    width: 100% !important;
    min-width: 0 !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
    max-height: 44px;
    overflow: hidden;
    flex-direction: row;
    flex-shrink: 0;
  }

  .reading-main {
    flex: 1;
    overflow-y: auto;
  }

  /* ── Archive view ────────────────────────────────────────── */
  .archive-layout {
    padding: 12px 12px 16px;
  }

  /* ── Notes page — stack on mobile ───────────────────────── */
  .keep-grid { column-count: 2; }
  .keep-topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .keep-topbar-right { width: 100%; }

  /* ── Shared view ─────────────────────────────────────────── */
  .shared-view-layout {
    padding: 12px;
  }

  .trips-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Users table: scroll horizontally ───────────────────── */
  .users-card {
    overflow-x: auto;
  }
  .users-table {
    min-width: 480px;
  }
  .users-page {
    padding: 12px;
  }

  /* ── Modals: full-screen on mobile ───────────────────────── */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    max-height: 94dvh;
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    overflow-y: auto;
    flex: 1;
  }

  /* Detail overlay modal: full-screen */
  .detail-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .detail-modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .detail-modal-body {
    overflow-y: auto;
    flex: 1;
  }

  /* Shortcuts overlay: full-screen */
  .shortcuts-panel {
    width: 100%;
    max-width: 100%;
    max-height: 80vh;
    max-height: 80dvh;
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    overflow-y: auto;
  }
  .shortcuts-overlay {
    align-items: flex-end;
  }
  .shortcuts-body {
    flex-direction: column;
  }

  /* Profile dropdown: JS-positioned via positionPopover(), max-width cap on mobile */
  .profile-dropdown {
    max-width: 260px;
  }

  /* ── Touch targets: all interactive ≥ 44px ───────────────── */
  .btn {
    min-height: 44px;
  }
  .btn-filter {
    min-height: 32px;
    min-width: 44px;
  }
  .btn-icon {
    min-width: 40px;
    min-height: 40px;
  }
  .nav-item {
    min-height: 44px;
  }
  .input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px; /* prevent iOS zoom */
  }

  /* ── Typography: scale down slightly ─────────────────────── */
  .page-title {
    font-size: .95rem;
  }

  /* ── Login / Register cards ──────────────────────────────── */
  .login-card {
    padding: 28px 20px;
    border-radius: var(--r-lg);
  }

  #login-page {
    padding: 16px;
    align-items: flex-start;
    padding-top: 48px;
  }

  /* ── Trip panel header ───────────────────────────────────── */
  .trip-panel-header {
    padding: 10px 12px;
  }

  /* ── Day pills: scroll horizontally ─────────────────────── */
  .day-pills-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 8px;
  }
  .day-pills-wrap::-webkit-scrollbar {
    display: none;
  }

  /* ── Schedule nav: scrollable tabs ──────────────────────── */
  .schedule-nav-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .schedule-nav-bar::-webkit-scrollbar {
    display: none;
  }

  /* ── Breadcrumb: hidden on mobile (space-constrained) ────── */
  .breadcrumb {
    display: none !important;
  }

  /* ── App header: not needed, we have mobile-header ───────── */
  .app-header {
    display: none;
  }

  /* ── iOS safe area (notch / home bar) ────────────────────── */
  .mobile-header {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(52px + env(safe-area-inset-top, 0px));
  }

  .dash-bottom-inner,
  .modal,
  .detail-modal,
  .schedule-panel {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  /* ── Prevent body scroll on iOS when sidebar is open ─────── */
  body.sidebar-mobile-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  /* ── Trip cards: consistent height on mobile ─────────────── */
  .trip-card {
    min-height: 160px;
  }

  /* ── Ensure no horizontal overflow ───────────────────────── */
  #app-page,
  .main-content,
  .view-layer {
    max-width: 100vw;
    overflow-x: hidden;
  }

}

/* ── Wider mobile (≥ 480px): 2-column trip cards ──────────── */
@media (min-width: 480px) and (max-width: 767px) {
  .dash-trips-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   CATEGORY GROUP SEPARATORS in calendar list
   ══════════════════════════════════════════════════════════════════════════════ */
.cat-group-sep {
  height: 8px;
  margin: 2px 12px;
  position: relative;
}

.cat-group-sep::after {
  content: '';
  display: block;
  height: 1px;
  background: var(--glass-border);
  opacity: .5;
  margin-top: 3px;
}

/* Transport block gets a slightly more visible separator with label */
.cat-group-sep.is-transport-boundary {
  height: 14px;
  margin: 2px 8px;
}

.cat-group-sep.is-transport-boundary::before {
  content: attr(data-label);
  display: block;
  font-size: .6rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: 0 2px;
  margin-bottom: 3px;
}

.cat-group-sep.is-transport-boundary::after {
  opacity: .7;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TODO DRAWER (slides between sidebar and main content)
   ══════════════════════════════════════════════════════════════════════════════ */
.sidebar-todo-btn-wrap {
  padding: 6px 8px 4px;
  border-top: 1px solid var(--glass-border-2);
  margin-top: auto;
}

/* .todo-drawer removed — drawer replaced by full notes page */

/* ══════════════════════════════════════════════════════════════════════════════
   ARCHIVE VIEW
   ══════════════════════════════════════════════════════════════════════════════ */

/* Top-level upload zone — prominent, always visible */
.archive-top-upload {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-xl);
  background: var(--surface);
  transition: border-color .18s, background .18s;
  flex-shrink: 0;
}

.archive-top-upload.drag-active,
.archive-top-upload:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.archive-top-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 20px;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}

.archive-top-upload-label svg.lucide {
  width: 26px;
  height: 26px;
  color: var(--text-3);
  transition: color .18s;
}

.archive-top-upload:hover .archive-top-upload-label svg.lucide,
.archive-top-upload.drag-active .archive-top-upload-label svg.lucide {
  color: var(--accent);
}

.archive-top-upload-label span:first-of-type {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-2);
}

.archive-top-upload-hint {
  font-size: .74rem;
  color: var(--text-3);
  font-weight: 500;
}

.archive-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 24px 24px;
  overflow: hidden;
  pointer-events: auto; /* view-layer is pointer-events:none — re-enable here */
}

.archive-header-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.archive-title-text {
  font-size: 1.05rem;
  font-weight: 800;
}

.archive-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-empty {
  font-size: .85rem;
  color: var(--text-3);
  text-align: center;
  padding: 40px;
}

/* ── Archive folder (Drive-like) ─────────────────────────────────────────── */
.archive-folder {
  background: var(--glass-bg);
  border: 1px solid var(--box-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color .15s;
}

.archive-folder:hover {
  border-color: var(--border-2);
}

.archive-folder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background .12s;
}

.archive-folder-header:hover {
  background: var(--surface-2);
}

.archive-folder-icon {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

.archive-folder-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  letter-spacing: -.01em;
}

.archive-folder-count {
  font-size: .70rem;
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
  flex-shrink: 0;
}

.archive-folder-chevron {
  width: 14px !important;
  height: 14px !important;
  color: var(--text-3);
  flex-shrink: 0;
  transition: transform .2s var(--ease-out-quart);
}

.archive-folder.collapsed .archive-folder-chevron {
  transform: rotate(-90deg);
}

.archive-folder-body {
  border-top: 1px solid var(--border);
  overflow: hidden;
}

.archive-folder.collapsed .archive-folder-body {
  display: none;
}

.archive-folder-empty {
  padding: 12px 16px;
  font-size: .78rem;
  color: var(--text-3);
}

/* Upload zone inside folder */
.archive-folder-upload {
  border-top: 1px dashed var(--border);
  border-radius: 0;
  transition: background .15s, border-color .15s;
}

.archive-folder-upload.drag-active,
.archive-folder-upload:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.archive-folder-upload-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
}

.archive-folder-upload-label svg.lucide {
  width: 14px;
  height: 14px;
  color: var(--text-3);
  flex-shrink: 0;
  transition: color .15s;
}

.archive-folder-upload:hover .archive-folder-upload-label svg.lucide,
.archive-folder-upload.drag-active .archive-folder-upload-label svg.lucide {
  color: var(--accent);
}

.archive-folder-upload-label span {
  font-size: .76rem;
  font-weight: 500;
  color: var(--text-3);
  transition: color .15s;
}

.archive-folder-upload:hover .archive-folder-upload-label span,
.archive-folder-upload.drag-active .archive-folder-upload-label span {
  color: var(--accent-light);
}

.archive-group {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  overflow: hidden;
}

.archive-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-3);
  border-bottom: 1px solid var(--glass-border-2);
  letter-spacing: -.01em;
}

.archive-doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--glass-border-2);
  transition: background var(--transition);
}

.archive-doc-row:last-child {
  border-bottom: none;
}

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

.archive-doc-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.archive-doc-info {
  flex: 1;
  min-width: 0;
}

.archive-doc-name {
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.archive-doc-meta {
  font-size: .68rem;
  color: var(--text-3);
  margin-top: 1px;
}

.archive-doc-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   LUCIDE NAV ICONS (replaces emoji .nav-icon)
   ══════════════════════════════════════════════════════════════════════════════ */
.nav-icon-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2;
  transition: color var(--transition);
}

.sidebar.icons-only .nav-item {
  padding: 9px;
  justify-content: center;
  gap: 0;
}

.sidebar.icons-only .nav-icon-svg {
  width: 18px;
  height: 18px;
}

/* Trip emoji in sidebar nav (replaces colored map-pin) */
.nav-trip-emoji {
  font-size: .95rem;
  line-height: 1;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  display: inline-block;
  user-select: none;
}

.sidebar.icons-only .nav-trip-emoji {
  font-size: 1.1rem;
  width: 22px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   BREADCRUMB
   ══════════════════════════════════════════════════════════════════════════════ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-3);
}

.breadcrumb-sep {
  opacity: .45;
  font-size: .7rem;
  flex-shrink: 0;
}

.breadcrumb-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.breadcrumb-item.active {
  color: var(--text);
  font-weight: 800;
}

.breadcrumb-item.link {
  cursor: pointer;
  color: var(--text-2);
}

.breadcrumb-item.link:hover {
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════════════════════
   SCHEDULE NAV — Days is primary, extras are suggestion chips
   ══════════════════════════════════════════════════════════════════════════════ */
.schedule-nav-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 8px 4px;
  flex-shrink: 0;
}

.schedule-nav-primary {
  display: flex;
  gap: 4px;
}

.schedule-nav-tab-primary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid var(--glass-border-2);
  background: var(--glass-bg);
  color: var(--text-2);
  transition: all var(--transition);
}

.schedule-nav-tab-primary:hover {
  background: var(--glass-bg-deep);
  color: var(--text);
}

.schedule-nav-tab-primary.active {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

.schedule-nav-suggestions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.schedule-nav-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--glass-border-2);
  background: transparent;
  color: var(--text-3);
  transition: all var(--transition);
}

.schedule-nav-chip:hover {
  background: var(--glass-bg);
  color: var(--text-2);
  border-color: var(--glass-border);
}

.schedule-nav-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border-soft);
}

/* ══════════════════════════════════════════════════════════════════════════════
   INLINE TIME EDIT in activity list
   ══════════════════════════════════════════════════════════════════════════════ */
.cal-item-time {
  width: 40px;
  padding-top: 9px;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-3);
  text-align: right;
  flex-shrink: 0;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
  position: relative;
}

.cal-item-time:hover {
  color: var(--accent);
}

.cal-item-time .time-display {
  display: block;
}

.cal-item-time input.time-inline-input {
  width: 44px;
  padding: 2px 3px;
  font-size: .68rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  /* Remove native time picker chrome */
  appearance: none;
  -webkit-appearance: none;
}

/* todo-drawer CSS removed — replaced by notes page styles above */

/* Needs-ticket toggle in modal */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.toggle-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  flex: 1;
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--glass-border);
  border-radius: 20px;
  cursor: pointer;
  transition: background .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-inverse);
  left: 3px;
  top: 3px;
  transition: transform .2s;
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(16px);
}

/* Auto-fill flash on toggle row */
@keyframes toggle-autofill-flash {
  0% {
    background: var(--accent-soft);
    border-radius: var(--r-sm);
  }

  70% {
    background: var(--accent-soft);
  }

  100% {
    background: transparent;
  }
}

.toggle-row.input-autofilled {
  animation: toggle-autofill-flash 1.4s ease forwards;
  padding: 4px 6px;
  margin: -4px -6px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   NEXT-UP WIDGET — purple gradient card on dashboard
   ══════════════════════════════════════════════════════════════════════════════ */
.next-up-widget {
  background: var(--box-bg);
  border-radius: var(--r-xl);
  padding: 14px 16px 12px;
  min-width: 220px;
  max-width: 268px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--box-border);
  transition: .1s linear;
  pointer-events: auto;
  backdrop-filter: var(--glass-blur);
}

.next-up-widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 0px 40px rgba(109, 40, 217, .60);
}

/* Layout: big number left + label/city right */
.next-up-body {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.next-up-number {
  font-size: 4rem;
  font-weight: 500;
  color: rgba(255, 255, 255, .92);
  line-height: 1;
  letter-spacing: -.04em;
  flex-shrink: 0;
}

.next-up-right {
  flex: 1;
  min-width: 0;
}

.next-up-label {
  font-size: .52rem;
  font-weight: 700;
  color: rgba(255, 255, 255, .48);
  text-transform: uppercase;
  letter-spacing: .14em;
  margin-bottom: 3px;
}

.next-up-dest {
  font-size: 1.42rem;
  font-weight: 800;
  color: #C084FC;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress bar */
.next-up-bar-track {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
}

.next-up-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #7C3AED 0%, #C084FC 100%);
}

/* ══════════════════════════════════════════════════════════════════════════════
   GLOBE CONTAINER — full-fill, no overflow, dark bg
   ══════════════════════════════════════════════════════════════════════════════ */
.dashboard-map-frame {
  border: 1px solid var(--border);
  background: #08080D;
  /* matches Globe backgroundColor */
  overflow: hidden;
}

#dashboard-map {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#dashboard-map canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

/* Globe.gl injects a div wrapper — make it fill too */
#dashboard-map>div {
  width: 100% !important;
  height: 100% !important;
}

/* ══════════════════════════════════════════════════════════════════════════════
   DASHBOARD LAYOUT dark polish
   ══════════════════════════════════════════════════════════════════════════════ */
.dashboard-scroll {
  background: transparent;
}

.dashboard-controls .sort-select {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-2);
}

[data-theme="light"] .dashboard-controls .sort-select {
  background: var(--glass-bg);
  border-color: var(--glass-border-2);
}

/* ══════════════════════════════════════════════════════════════════════════════
   CHIP — updated for dark
   ══════════════════════════════════════════════════════════════════════════════ */
.chip-todo {
  background: var(--chip-todo-bg);
  color: var(--warning);
  border: 1px solid var(--chip-todo-border);
}

.chip-ready {
  background: var(--chip-ready-bg);
  color: var(--success);
  border: 1px solid var(--chip-ready-border);
}

.chip-progress {
  background: var(--chip-progress-bg);
  color: var(--accent-light);
  border: 1px solid var(--chip-progress-border);
}

.chip-completed {
  background: var(--chip-completed-bg);
  color: var(--status-completed);
  border: 1px solid var(--chip-completed-border);
}

/* Legacy aliases */
.chip-planned {
  background: var(--chip-progress-bg);
  color: var(--accent-light);
  border: 1px solid var(--chip-progress-border);
}

.chip-active {
  background: var(--chip-ready-bg);
  color: var(--success);
  border: 1px solid var(--chip-ready-border);
}

.chip-booked {
  background: var(--chip-ready-bg);
  color: var(--success);
  border: 1px solid var(--chip-ready-border);
}

/* ══════════════════════════════════════════════════════════════════════════════
   LOGIN PAGE — dark polished card
   ══════════════════════════════════════════════════════════════════════════════ */
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
}

[data-theme="light"] .login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

/* ══════════════════════════════════════════════════════════════════════════════
   EXTRAS / PANELS — dark card style
   ══════════════════════════════════════════════════════════════════════════════ */
.extra-item {
  background: var(--surface-2);
  border-color: var(--border);
}

.reading-day {
  background: var(--surface-2);
  border-color: var(--border);
}

.reading-day-header {
  background: var(--surface-3);
}

/* ══════════════════════════════════════════════════════════════════════════════
   CATEGORY DOT in activity card (small color accent, left border)
   ══════════════════════════════════════════════════════════════════════════════ */
.cal-item-card[data-cat="transport"] {
  border-left: 2px solid var(--cat-transport);
}

.cal-item-card[data-cat="culture"] {
  border-left: 2px solid var(--cat-culture);
}

.cal-item-card[data-cat="food"] {
  border-left: 2px solid var(--cat-food);
}

.cal-item-card[data-cat="leisure"] {
  border-left: 2px solid var(--cat-leisure);
}

.cal-item-card[data-cat="accommodation"] {
  border-left: 2px solid var(--cat-accommodation);
}

/* todo-drawer dark-polish removed */

/* ══════════════════════════════════════════════════════════════════════════════
   SCROLLBAR — dark refined
   ══════════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* ══════════════════════════════════════════════════════════════════════════════
   TRANSPORT SEPARATOR — update for dark
   ══════════════════════════════════════════════════════════════════════════════ */
.cal-item.is-transport .cal-item-card {
  background: var(--surface-3);
  border-style: solid;
  border-color: var(--border-2);
  opacity: .9;
}

[data-theme="light"] .cal-item.is-transport .cal-item-card {
  background: var(--surface-2);
  border-style: dashed;
}

/* ══════════════════════════════════════════════════════════════════════════════
   COMPACT ALL-VIEW CARDS
   ══════════════════════════════════════════════════════════════════════════════ */
.all-v-item-compact {
  align-items: center;
}

.all-v-compact-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 0;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.all-v-compact-emoji {
  font-size: .82rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  line-height: 1;
}

.all-v-compact-title {
  font-size: .74rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.all-v-compact-time {
  font-size: .64rem;
  font-weight: 600;
  color: var(--text-3);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

/* ══════════════════════════════════════════════════════════════════════════════
   CALENDAR VIEW  (trip view mode — vmode-reading)
   ══════════════════════════════════════════════════════════════════════════════ */

#view-reading .cal-view-layout {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 16px;
  gap: 12px;
  overflow: hidden;
  pointer-events: auto;
}

/* ── Top bar: trip info + navigation ──────────────────────────── */
.cal-view-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  flex-shrink: 0;
}

/* Vertical separator between trip info and nav controls */
.cal-nav-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 14px;
  flex-shrink: 0;
}

.cal-trip-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cal-trip-emoji {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.cal-trip-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cal-trip-city {
  font-size: .90rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.cal-trip-dates {
  font-size: .70rem;
  color: var(--text-2);
  font-weight: 500;
}

.cal-nav-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Timeline: horizontal scroll container ─────────────────────── */
.cal-tl-outer {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.cal-tl-outer::-webkit-scrollbar {
  height: 5px;
}

.cal-tl-outer::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

.cal-tl-inner {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 0 4px 4px;
  min-height: 100%;
}

/* ── Day column ───────────────────────────────────────────────── */
.cal-tl-col {
  width: 246px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--box-bg);
  border: 1px solid var(--box-border);
  border-radius: var(--r-xl);
  overflow: hidden;
  transition: border-color .15s;
}

.cal-tl-col.is-weekend {
  background: var(--bg-2);
}

.cal-tl-col.has-trip-day {
  background: var(--box-bg);
  border-color: var(--border);
}

.cal-tl-col.is-today {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.cal-tl-col.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* ── Column header ────────────────────────────────────────────── */
.cal-tl-hd {
  padding: 10px 12px 8px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--box-border);
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--glass-bg-deep);
  backdrop-filter: var(--glass-blur);
  position: relative;
  overflow: hidden;
}

/* Hover action buttons on day header */
.cal-tl-hd-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}

.cal-tl-hd:hover .cal-tl-hd-actions {
  opacity: 1;
  pointer-events: auto;
}

.cal-day-btn-danger {
  color: var(--danger) !important;
}

/* Add-activity button at top of column */
.cal-tl-add-top {
  padding: 6px 8px 2px;
  flex-shrink: 0;
}

.cal-tl-col.has-trip-day .cal-tl-hd {
  border-bottom-color: var(--border);
}

.cal-tl-wday {
  font-size: .60rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  line-height: 1;
}

.cal-tl-date {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-3);
  line-height: 1.2;
}

.cal-tl-col.has-trip-day .cal-tl-date {
  color: var(--text);
}

.cal-tl-col.is-today .cal-tl-date {
  color: var(--accent);
}

.cal-tl-col.is-today .cal-tl-wday {
  color: var(--accent);
}

.cal-tl-month {
  font-size: .68rem;
  font-weight: 700;
  color: var(--accent-light);
}

.cal-tl-day-info {
  font-size: .82rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Column body (scrolls vertically) ────────────────────────── */
.cal-tl-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb-faint) transparent;
}

.cal-tl-col-acts {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  gap: 2px;
  flex: 1;
}

/* Calendar timeline cards — reuse .cal-item / .cal-item-card */
.cal-tl-item {
  padding: 1px 6px 0;
  cursor: grab;
}

.cal-tl-item[draggable="true"]:active {
  cursor: grabbing;
  opacity: .65;
}

.cal-tl-item.dragging {
  opacity: .35;
}

.cal-tl-item .cal-item-dot {
  padding-top: 10px;
  font-size: .84rem;
  line-height: 1;
  width: 20px;
  flex-shrink: 0;
}

.cal-tl-item .cal-item-card {
  margin-bottom: 4px;
  padding: 8px 10px;
}

/* Time + category label row inside calendar card */
.cal-tl-card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}

.cal-tl-card-time {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}

.cal-tl-card-cat {
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Pending drag-preview state for cal-item */
.cal-tl-item.cal-item-pending .cal-item-card {
  border-style: dashed;
  opacity: .85;
}

.cal-tl-item.cal-item-pending .cal-item-card::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 4px var(--accent);
}

/* Light mode */
[data-theme="light"] .cal-tl-col {
  border-color: var(--border);
  background: var(--surface);
}

[data-theme="light"] .cal-tl-col.is-weekend {
  background: var(--surface-2);
}

[data-theme="light"] .cal-tl-hd {
  background: var(--surface);
  border-bottom-color: var(--border);
}

/* ── Excel Import UI ─────────────────────────────────────────────────────── */

.modal-wide { max-width: 620px !important; }

/* ── New Trip Wizard ─────────────────────────────────────────────────────── */

/* Breadcrumb */
.wizard-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 2px 4px;
  flex-shrink: 0;
}

.wbc-step {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 600;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.wbc-step:not(:disabled):hover {
  background: var(--surface-3);
  color: var(--text-2);
}

.wbc-step.active {
  color: var(--text);
}

.wbc-step.done {
  color: var(--accent-light);
  cursor: pointer;
}

.wbc-step:disabled {
  cursor: default;
  opacity: .45;
}

.wbc-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text-2);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}

.wbc-step.active .wbc-num {
  background: var(--accent);
  color: #fff;
}

.wbc-step.done .wbc-num {
  background: var(--success);
  color: #fff;
}

.wbc-sep {
  color: var(--text-3);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: .6;
}

.wbc-sep svg { width: 13px; height: 13px; }

/* Panes */
.wizard-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: wiz-fade-in .18s ease;
}

@keyframes wiz-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* "or" separator */
.wizard-or-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: .75rem;
  font-weight: 600;
  margin: 2px 0;
}

.wizard-or-sep::before,
.wizard-or-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Excel import card */
.wizard-excel-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s, box-shadow .15s;
  text-align: left;
  width: 100%;
}

.wizard-excel-card:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
  box-shadow: var(--shadow-xs);
}

.wizard-excel-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: rgba(34,197,94,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--success);
}

.wizard-excel-icon svg { width: 17px; height: 17px; }

.wizard-excel-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.wizard-excel-title {
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
}

.wizard-excel-sub {
  font-size: .74rem;
  color: var(--text-2);
}

.wizard-excel-arrow {
  color: var(--text-3);
  flex-shrink: 0;
}

.wizard-excel-arrow svg { width: 14px; height: 14px; }

/* Wizard footer layout */

/* When wizard footers are inside modal-footer, override its justify */
.modal-footer:has(.wizard-footer-row) {
  justify-content: flex-start;
  gap: 0;
}

.wizard-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.wizard-footer-row .wizard-footer-right {
  display: flex;
  gap: 8px;
}

/* Light mode adjustments */
[data-theme="light"] .wizard-excel-card {
  background: var(--surface-2);
  border-color: var(--border);
}

[data-theme="light"] .wizard-excel-card:hover {
  background: var(--surface-3);
}

[data-theme="light"] .wbc-num {
  background: var(--surface-3);
}

/* Tab switcher inside modal */
.import-tab-row {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 3px;
  flex-shrink: 0;
}

.import-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  border-radius: calc(var(--r) - 2px);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.import-tab-btn svg { width: 13px; height: 13px; }

.import-tab-btn:hover { background: var(--surface-3); color: var(--text); }

.import-tab-btn.active {
  background: var(--accent-soft);
  color: var(--accent-light);
}

/* Template download link */
.import-tpl-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-2);
}

.import-tpl-link svg { width: 14px; height: 14px; color: var(--success); flex-shrink: 0; }
.import-tpl-link a { color: var(--accent-light); font-weight: 600; text-decoration: none; }
.import-tpl-link a:hover { text-decoration: underline; }

/* Dropzone */
.import-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 160px;
  border: 2px dashed var(--border-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  padding: 24px 20px;
  text-align: center;
}

.import-dropzone:hover,
.import-dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.import-dropzone.drag-over { border-style: solid; }

.import-dz-icon { color: var(--text-3); transition: color var(--transition); }
.import-dz-icon svg { width: 36px; height: 36px; }
.import-dropzone:hover .import-dz-icon,
.import-dropzone.drag-over .import-dz-icon { color: var(--accent); }

.import-dz-title { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.import-dz-sub   { font-size: 0.80rem; color: var(--text-2); }
.import-dz-note  { font-size: 0.72rem; color: var(--text-3); margin-top: 2px; }

/* Preview box */
.import-preview-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn .2s ease;
}

.import-trip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--r);
}

.import-trip-emoji { font-size: 1.4rem; }

.import-trip-meta { flex: 1; }
.import-trip-name { font-size: 0.9rem; font-weight: 800; color: var(--text); }
.import-trip-sub  { font-size: 0.75rem; color: var(--text-2); margin-top: 2px; }

.import-counts {
  display: flex;
  gap: 8px;
}

.import-count-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-2);
}

/* Geocoding progress */
.import-geocode-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.import-geocode-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-2);
}

.import-progress-track {
  height: 4px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}

.import-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .3s ease;
  width: 0%;
}

/* Day groups in preview */
.import-days-list { display: flex; flex-direction: column; gap: 8px; }

.import-day-group {}

.import-day-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--surface-2);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom: none;
}

.import-day-header svg { width: 12px; height: 12px; color: var(--accent); }

.import-acts-list {
  border: 1px solid var(--border);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  overflow: hidden;
}

.import-act-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background var(--transition);
}

.import-act-row:last-child { border-bottom: none; }
.import-act-row:nth-child(even) { background: var(--surface-2); }

.import-act-time {
  font-size: 0.70rem;
  font-weight: 600;
  color: var(--text-3);
  width: 34px;
  flex-shrink: 0;
}

.import-act-cat {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  flex-shrink: 0;
}

.import-act-cat.cat-transport     { background: rgba(167,139,250,.18); color: var(--cat-transport); }
.import-act-cat.cat-culture       { background: var(--accent-soft);    color: var(--accent-light); }
.import-act-cat.cat-food          { background: rgba(245,158,11,.15);   color: var(--warning); }
.import-act-cat.cat-leisure       { background: var(--success-soft);    color: var(--success); }
.import-act-cat.cat-accommodation { background: rgba(6,182,212,.15);    color: var(--cat-accommodation); }

.import-act-title { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.import-act-geo {
  font-size: 0.68rem;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  border-radius: var(--r-xs);
  padding: 2px 5px;
  transition: background .15s, color .15s;
}

.import-act-geo.found    { color: var(--success); }
.import-act-geo.pending  { color: var(--text-3);  }
.import-act-geo svg      { width: 10px; height: 10px; }

/* Notfound: clickable to manually fix */
.import-act-geo.notfound {
  color: var(--text-3);
  cursor: pointer;
  border: 1px dashed var(--border-2);
}
.import-act-geo.notfound:hover {
  color: var(--warning);
  border-color: var(--warning);
  background: var(--warning-soft);
}

/* Geo fix modal search */
.geo-fix-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.geo-fix-search-bar .input { flex: 1; }

.geo-fix-results {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}
.geo-fix-result {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.geo-fix-result:last-child { border-bottom: none; }
.geo-fix-result:hover { background: var(--surface-2); }
.geo-fix-result-name { font-size: .85rem; font-weight: 600; color: var(--text); }
.geo-fix-result-addr { font-size: .75rem; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.geo-fix-empty { padding: 20px; text-align: center; color: var(--text-3); font-size: .82rem; }

/* Extras preview */
.import-extras-list {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.import-extra-row {
  display: flex;
  gap: 8px;
  padding: 5px 10px;
  font-size: 0.78rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.import-extra-row:last-child { border-bottom: none; }
.import-extra-row:nth-child(even) { background: var(--surface-2); }

.import-extra-section {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--purple-soft);
  color: var(--purple);
  flex-shrink: 0;
  align-self: center;
}

/* Import status bar (during creation) */
.import-status-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
}

.import-status-icon { color: var(--accent); }
.import-status-icon svg { width: 32px; height: 32px; }
.import-status-title { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.import-status-sub   { font-size: 0.78rem; color: var(--text-2); }

/* Light mode overrides */
[data-theme="light"] .import-dropzone { background: var(--surface); }
[data-theme="light"] .import-act-row  { background: var(--surface); }
[data-theme="light"] .import-act-row:nth-child(even) { background: var(--surface-2); }
/* ── Profile Modal ───────────────────────────────────────────────────────── */

.user-row { cursor: pointer; transition: background .15s; }
.user-row:hover { background: var(--surface-3); }

.profile-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--accent));
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  flex-shrink: 0;
  margin: 0 auto 6px;
  position: relative;
  overflow: hidden;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.profile-avatar-clickable {
  cursor: pointer;
  transition: box-shadow .18s;
}
.profile-avatar-clickable:hover {
  box-shadow: 0 0 0 3px var(--accent);
}

.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
}
.profile-avatar-overlay svg.lucide {
  width: 22px;
  height: 22px;
  color: var(--text-inverse);
}
.profile-avatar-clickable:hover .profile-avatar-overlay {
  opacity: 1;
}
.profile-avatar-clickable.uploading .profile-avatar-overlay {
  opacity: 1;
  background: rgba(0,0,0,.6);
}
.profile-avatar-clickable.uploading .profile-avatar-overlay::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border: 3px solid var(--overlay-border);
  border-top-color: var(--text-inverse);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.profile-avatar-clickable.uploading svg.lucide {
  display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.profile-header-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.profile-header-email {
  font-size: .78rem;
  color: var(--text-2);
}

.profile-section-label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 8px;
  margin-top: 4px;
}

.profile-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.profile-info-row:last-child { border-bottom: none; }

.profile-info-label {
  font-size: .78rem;
  color: var(--text-2);
  width: 90px;
  flex-shrink: 0;
}

.profile-info-value {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.profile-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border-soft);
}
.profile-role-badge.admin   { background: var(--purple-soft); color: var(--purple); border-color: rgba(152,85,212,.28); }
.profile-role-badge.viewer  { background: var(--surface-3);   color: var(--text-2); border-color: var(--border); }

.profile-danger-zone {
  margin-top: 6px;
  padding: 12px;
  border-radius: var(--r);
  border: 1px solid var(--danger-soft);
  background: var(--danger-soft);
}

.profile-danger-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

.profile-danger-desc {
  font-size: .78rem;
  color: var(--text-2);
  margin-bottom: 10px;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════════════════════
   LIGHT MODE — component-level overrides
   These fix dark-hardcoded rgba() values that don't adapt via tokens alone.
   Edit the values below to customise the light theme.
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Button hovers — rgba(255,255,255,.08) is invisible on light bg ── */
[data-theme="light"] .btn:hover,
[data-theme="light"] .btn-ghost:hover       { background: rgba(0,0,0,.06); color: var(--text); }
[data-theme="light"] .btn-vertical:hover    { background: rgba(0,0,0,.06); color: var(--text); }
[data-theme="light"] .btn-filter:hover      { background: rgba(0,0,0,.06); color: var(--text); }
[data-theme="light"] .btn-icon:hover        { background: rgba(0,0,0,.06); color: var(--text); }
[data-theme="light"] .btn-tab:hover         { background: rgba(0,0,0,.06); color: var(--text); }
[data-theme="light"] .btn-menu:hover        { background: rgba(0,0,0,.06); color: var(--text); }
[data-theme="light"] .nav-item:hover        { background: rgba(0,0,0,.06); color: var(--text); }
[data-theme="light"] .sidebar-brand-collapsed:hover { background: rgba(0,0,0,.06); }
[data-theme="light"] .trip-card-act:hover   { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }

/* ── btn-icon active — #383838 → accent-soft in light ── */
[data-theme="light"] .btn-icon.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

/* ── Dashboard theme toggle (floats over globe) ── */
[data-theme="light"] .dash-theme-toggle {
  background: rgba(255, 255, 255, .65);
  border-color: rgba(0, 0, 0, .12);
  color: #2A2A44;
}
[data-theme="light"] .dash-theme-toggle:hover {
  background: rgba(255, 255, 255, .88);
  color: #000;
}

/* ── Dashboard bottom panel ── */
[data-theme="light"] .dash-bottom-inner {
  background: transparent;
}

/* ── Trip cards ── */
[data-theme="light"] .trip-card {
  border-color: var(--border);
}
[data-theme="light"] .trip-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-md);
}
[data-theme="light"] .trip-card-banner {
  background: var(--surface-2);
}
[data-theme="light"] .trip-card-banner::after {
  background: linear-gradient(to bottom, transparent 40%, var(--overlay-soft) 100%);
}
[data-theme="light"] .trip-countdown-past {
  color: var(--text-3);
  background: rgba(0, 0, 0, .05);
  border-color: var(--border);
}

/* ── Schedule panel internal separators ── */
[data-theme="light"] .trip-panel-header         { border-bottom-color: var(--border); }
[data-theme="light"] .day-title-row             { border-bottom-color: var(--border); }
[data-theme="light"] .detail-panel-header       { border-bottom-color: var(--border); }
[data-theme="light"] .schedule-day-header       { border-bottom-color: var(--border); }

/* ── Activity cards ── */
[data-theme="light"] .cal-act-card              { border-bottom-color: var(--border); }
[data-theme="light"] .cal-day-block             { border-bottom-color: var(--border); }

/* ── Activity detail modal ── */
[data-theme="light"] .detail-modal {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="light"] .detail-modal-header       { border-bottom-color: var(--border); }
[data-theme="light"] .detail-modal-footer       { border-top-color:    var(--border); }
[data-theme="light"] .detail-photo-placeholder {
  background: rgba(0, 0, 0, .03);
  border-color: rgba(0, 0, 0, .12);
}

/* ── Generic modal ── */
[data-theme="light"] .modal {
  border-color: var(--border);
  box-shadow: var(--shadow-xl);
}
[data-theme="light"] .modal-header             { border-bottom-color: var(--border); }
[data-theme="light"] .modal-footer             { border-top-color:    var(--border); }

/* ── Reading view ── */
[data-theme="light"] .reading-day-header       { border-bottom-color: var(--border); }
[data-theme="light"] .reading-act-row          { border-bottom-color: var(--border); }

/* ── Notes page light mode ── */
[data-theme="light"] .keep-card:hover      { box-shadow: var(--shadow-sm); }
[data-theme="light"] .keep-modal          { background: var(--surface); }
[data-theme="light"] .keep-create-bar     { background: var(--surface); }

/* ── Scrollbars ── */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border-2); }

/* ── Input ── */
[data-theme="light"] .input {
  background: rgba(255, 255, 255, 0.90);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="light"] .input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Map zoom controls (on trip view) ── */
[data-theme="light"] .map-zoom-btn {
  background: rgba(255, 255, 255, .88);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="light"] .map-zoom-btn:hover {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY — REDUCED MOTION
   Always the last rule block so it wins the cascade without !important battles.
   ══════════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   PROFILE DROPDOWN
   ══════════════════════════════════════════════════════════════════════════════ */

.profile-menu-wrap {
  position: relative;
}

/* Make user-row a button */
button.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
  transition: background .15s ease;
  color: inherit;
}

button.user-row:hover {
  background: var(--surface-2);
}

button.user-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.user-row-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-3);
  flex-shrink: 0;
  margin-left: auto;
  transition: color .15s ease;
}

button.user-row:hover .user-row-chevron {
  color: var(--text-2);
}

.profile-dropdown {
  position: fixed; /* JS-positioned via positionPopover() */
  z-index: 600;
  background: var(--glass-bg-deep);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  overflow: hidden;
  animation: dropdown-up .2s var(--ease-out-quart) both;
}

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

.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
}

.profile-dropdown-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-dropdown-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-dropdown-info {
  min-width: 0;
  flex: 1;
}

.profile-dropdown-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-dropdown-role {
  font-size: .68rem;
  font-weight: 500;
  color: var(--text-3);
  text-transform: capitalize;
  margin-top: 1px;
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .12s ease, color .12s ease;
}

.profile-dropdown-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.profile-dropdown-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.profile-dropdown-item svg.lucide {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-3);
  transition: color .12s ease;
}

.profile-dropdown-item:hover svg.lucide {
  color: var(--text-2);
}

.profile-dropdown-item span {
  flex: 1;
}

.profile-dropdown-hint {
  font-family: inherit;
  font-size: .65rem;
  font-weight: 600;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 1px 5px;
  color: var(--text-3);
  letter-spacing: .02em;
}

.profile-dropdown-item-danger {
  color: var(--danger);
}

.profile-dropdown-item-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.profile-dropdown-item-danger svg.lucide {
  color: var(--danger);
  opacity: .7;
}

.profile-dropdown-item-danger:hover svg.lucide {
  color: var(--danger);
  opacity: 1;
}

/* ── Profile dropdown chevron (for items with sub-views) */
.profile-dropdown-chevron {
  width: 12px !important;
  height: 12px !important;
  color: var(--text-3);
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Preferences sub-view ─────────────────────────────── */
.profile-dropdown-prefs-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 10px 8px;
}

.profile-dropdown-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  flex-shrink: 0;
  transition: background .12s, color .12s;
}

.profile-dropdown-back:hover {
  background: var(--surface-2);
  color: var(--text);
}

.profile-dropdown-back svg.lucide {
  width: 14px;
  height: 14px;
}

.profile-dropdown-prefs-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}

.profile-dropdown-prefs-section {
  padding: 10px 14px 12px;
}

.profile-dropdown-prefs-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

.pref-theme-grid {
  display: flex;
  gap: 6px;
}

.pref-theme-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}

.pref-theme-btn svg.lucide {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  transition: color .15s;
}

.pref-theme-btn:hover {
  border-color: var(--border-2);
  background: var(--surface-3);
  color: var(--text);
}

.pref-theme-btn:hover svg.lucide {
  color: var(--text-2);
}

.pref-theme-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-light);
}

.pref-theme-btn.active svg.lucide {
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════════════════════
   KEYBOARD SHORTCUTS OVERLAY
   ══════════════════════════════════════════════════════════════════════════════ */

.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .52);
  backdrop-filter: blur(4px);
  animation: shortcuts-overlay-in .18s ease both;
}

.shortcuts-overlay.hidden {
  display: none;
}

@keyframes shortcuts-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.shortcuts-panel {
  background: var(--glass-bg-deep);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  width: 540px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);   /* fallback */
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  animation: shortcuts-panel-in .22s var(--ease-out-quart) both;
}

@keyframes shortcuts-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

.shortcuts-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shortcuts-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.shortcuts-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -.01em;
}

.shortcuts-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 8px 0;
}

.shortcuts-col {
  padding: 12px 20px;
}

.shortcuts-col + .shortcuts-col {
  border-left: 1px solid var(--border);
}

.shortcuts-group {
  margin-bottom: 20px;
}

.shortcuts-group:last-child {
  margin-bottom: 0;
}

.shortcuts-group-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.shortcuts-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}

.shortcuts-row span {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-2);
  flex: 1;
  min-width: 0;
}

.shortcuts-row kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  font-family: inherit;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 1px 0 var(--border-2);
}

.shortcuts-footer {
  padding: 10px 20px 14px;
  border-top: 1px solid var(--border);
  font-size: .74rem;
  color: var(--text-3);
  text-align: center;
}

.shortcuts-footer-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  font-family: inherit;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-3);
  vertical-align: middle;
  box-shadow: 0 1px 0 var(--border-2);
}

/* Light mode adjustments */
[data-theme="light"] .shortcuts-panel,
[data-theme="light"] .profile-dropdown {
  background: rgba(255, 255, 255, .96);
  border-color: var(--border);
}

[data-theme="light"] .shortcuts-row kbd,
[data-theme="light"] .shortcuts-footer-kbd,
[data-theme="light"] .profile-dropdown-hint {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text);
}

/* ══════════════════════════════════════════════════════════════════════════════
   EURICA THEME — placeholder (inherits dark, customizable later)
   ══════════════════════════════════════════════════════════════════════════════ */
[data-theme="eurica"] {
  /* Same base as dark for now — will be defined in a future sprint */
  --bg:        #0A0A0A;
  --bg-2:      #111111;
  --surface:   #181818;
  --surface-2: #1F1F1F;
  --surface-3: #262626;
  --border:    #2C2C2C;
  --border-2:  #3A3A3A;
  --text:      #F0F0F0;
  --text-2:    #888888;
  --text-3:    #808080;
  --accent:       #9855D4;
  --accent-h:     #7A3FB5;
  --accent-light: #BC80F0;
  --accent-soft:  rgba(152,85,212,.13);
  --purple:      #9855D4;
  --purple-h:    #7A3FB5;
  --purple-soft: rgba(152,85,212,.16);
}
