h3 { line-height: 1.1; }

html {
  scrollbar-gutter: stable;
  -webkit-user-select: none;
  user-select: none;
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
}
/* Hide scrollbars on mobile (looks more native) */
@media (max-width: 767px) {
  html { scrollbar-gutter: auto; }
  html, body, * {
    scrollbar-width: none;           /* Firefox */
  }
  ::-webkit-scrollbar { display: none; } /* Chrome, Safari, Edge */
}
input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* custom scrollbar - webkit, desktop only */
@media (min-width: 768px) {
  ::-webkit-scrollbar { width: 6px }
  ::-webkit-scrollbar-track { background: transparent }
  ::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
  }
}

/* ── Category filter tags: horizontal scroll, bigger touch targets ──────────── */
#category-filters {
  --offset: 16px;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
  margin-left: calc(var(--offset) * -1);
  margin-right: calc(var(--offset) * -1);
  width: calc(100% + calc(var(--offset) * 2));
  padding-left: var(--offset);
  padding-right: var(--offset);
}
@media (min-width: 640px) {
  #category-filters { --offset: 20px; }
}
#category-filters::-webkit-scrollbar { display: none; }
.category-btn {
  white-space: nowrap;
  flex: 0 0 auto;
  padding: 0.6rem 0.875rem;
  border-radius: 99px;
  line-height: 1;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.15s;
}
@media (min-resolution: 2dppx) {
  .category-btn {
    padding: 0.45rem 0.875rem 0.65rem;
  }
}
.category-btn svg {
  margin-right: 4px;
  margin-top: -3px;
}

/* ── Input clear (×) button ────────────────────────────────────────────── */
.input-clear-wrap {
  position: relative;
}
.input-clear-btn {
  display: none;
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #cbd5e1;
  color: #fff;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.15s;
  min-height: auto !important;
  box-shadow: none !important;
  outline: none !important;
  z-index: 2;
}
.input-clear-btn:hover { background: #94a3b8; }
.input-clear-btn:focus { box-shadow: none !important; outline: none !important; }
.dark .input-clear-btn { background: #475569; color: #cbd5e1; }
.dark .input-clear-btn:hover { background: #64748b; }

/* Show clear button only when input is focused AND has content */
.input-clear-wrap.show-clear > .input-clear-btn,
.show-clear > .input-clear-btn { display: flex; }

/* ── Sort chips for subscription list ──────────────────────────────────────── */
.sort-bar {
  display: flex;
  gap: 0.375rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-top: -0.75rem;
  padding-top: calc(0.75rem + 2px)  ;
  padding-bottom: 0.75rem;
  transition: all 0.3s;
}
@media screen and (max-width: 425px) {
  .sort-bar {
    --offset: 1rem;
    margin-left: calc(var(--offset) * -1);
    margin-right: calc(var(--offset) * -1);
    padding-left: var(--offset);
    padding-right: var(--offset);
    width: calc(100% + calc(var(--offset) * 2));
  }
}
.sort-bar::-webkit-scrollbar { display: none; }

.sort-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex: 0 0 auto;
  padding: 0.5rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.3s;
  min-height: auto;
}
.sort-chip:hover { background: #eef2ff; color: #4f46e5; border-color: #c7d2fe; }
.sort-chip.active {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #c7d2fe;
}
.sort-chip-icon { width: 13px; height: 13px; flex-shrink: 0; color: inherit; }
.sort-label,
.sort-arrow {
  --mt: -1px;
  line-height: 1;
  margin-top: var(--mt);
}
.sort-arrow { 
  font-weight: 700; 
}
@media (min-resolution: 2dppx) {
  .sort-label,
  .sort-arrow {
    --mt: -2px;
  }
}

.dark .sort-chip {
  background: #1e293b !important;
  color: #94a3b8 !important;
  border-color: transparent !important;
}
.dark .sort-chip:hover { background: rgba(99, 102, 241, 0.2) !important; color: #a5b4fc !important; border-color: rgba(99, 102, 241, 0.4) !important; }
.dark .sort-chip.active {
  background: rgba(99, 102, 241, 0.2) !important;
  color: #a5b4fc !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
}

/* hide number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.iconify {
  display: inline-block;
  vertical-align: middle;
}

/* step wizard panels */
#step-1 {
  padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
}
#step-2 {
  padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

.step-panel { display: none }
.step-panel.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 200px);
}

/* Center content only when it's short (few or no subs) */
.step-panel.active.content-short {
  justify-content: center;
}

/* ─── Undo toast — iOS-style slide from top ──────────────────────────────── */
#undo-toast {
  pointer-events: none;
  opacity: 0;
  transform: translateY(-120%) scale(0.92);
  filter: blur(4px);
  transition:
    opacity    0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform  0.5s  cubic-bezier(0.22, 1, 0.36, 1),
    filter     0.35s ease;
}
#undo-toast.toast-visible {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0px);
}
#undo-toast > div {
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.06);
  border-radius: 16px;
}
.dark #undo-toast > div {
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 1px 3px rgba(0, 0, 0, 0.15);
}
.undo-ring-track { stroke: #e2e8f0; }
.dark .undo-ring-track { stroke: #334155; }

/* ─── Upcoming payments reminder section ─────────────────────────────────── */
.reminder-card {
  border: 1px solid #fde68a;
  background-color: #fffbeb;
}
.reminder-header { border-bottom: 1px solid #fde68a; }
.reminder-icon   { color: #f59e0b; }
.reminder-title  { color: #92400e; }
.reminder-name   { color: #1e293b; }
.reminder-amount { color: #64748b; }
.reminder-badge       { background: #fef3c7; color: #b45309; }
.reminder-count-badge { background: #fde68a; color: #92400e; }
.reminder-divider > * + * { border-color: #fef3c7; }
.reminder-header { border: none; background: none; text-align: left; }
.reminder-header:active { transform: none !important; box-shadow: none !important; }

/* Smooth collapse */
.reminder-rows-wrap {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.22s ease;
  opacity: 1;
}
.reminder-rows-wrap.collapsed {
  grid-template-rows: 0fr;
  opacity: 0;
}
.reminder-rows-inner { overflow: hidden; }
.reminder-paid-btn { color: #d1d5db; border: none; background: none; padding: 2px; border-radius: 50%; transition: color 0.15s ease; cursor: pointer; }
.reminder-paid-btn:hover,
.reminder-paid-btn:focus-visible { color: #22c55e; }
.dark .reminder-paid-btn { color: #374151; }
.dark .reminder-paid-btn:hover,
.dark .reminder-paid-btn:focus-visible { color: #4ade80; }

.dark .reminder-card        { border-color: rgba(245,158,11,0.25); background-color: rgba(245,158,11,0.08); }
.dark .reminder-header      { border-bottom-color: rgba(245,158,11,0.2); }
.dark .reminder-title       { color: #fbbf24; }
.dark .reminder-name        { color: #e2e8f0; }
.dark .reminder-amount      { color: #94a3b8; }
.dark .reminder-badge       { background: rgba(245,158,11,0.15); color: #fbbf24; }
.dark .reminder-count-badge { background: rgba(245,158,11,0.2); color: #fbbf24; }
.dark .reminder-divider > * + * { border-color: rgba(245,158,11,0.1); }

/* ─── List item animations ────────────────────────────────────────────────── */
@keyframes listItemIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes listItemOut {
  0%   { opacity: 1; transform: none; max-height: 90px; padding-top: 1rem; padding-bottom: 1rem; margin-top: 0.75rem; }
  100% { opacity: 0; transform: scale(0.93) translateY(-4px); max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; border-width: 0; }
}
.sub-list-item {
  overflow: hidden;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
@media (max-width: 389.98px) {
  .sub-list-item {
    padding: 8px 12px !important;
    border-radius: 12px !important;
  }
}
.sub-list-item:hover,
.sub-list-item:focus-visible {
  background-color: #f8fafc !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}
.dark .sub-list-item:hover,
.dark .sub-list-item:focus-visible {
  background-color: #1e293b !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.sub-list-item.entering {
  animation: listItemIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.sub-list-item.removing {
  animation: listItemOut 0.22s ease-in both;
  pointer-events: none;
}

/* ─── Step transitions ────────────────────────────────────────────────────── */
.step-transition-lock { overflow: hidden; position: relative; }

.bento-grid-container { grid-auto-flow: dense }

/* treemap grid thing */
.treemap-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 1.5rem;
  will-change: opacity, transform; /* smooth GPU-accelerated view transitions */
}

.treemap-cell {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  overflow: hidden;
  cursor: pointer;
  transition: z-index 0s;
  will-change: transform; /* helps with hover perf */
}
.treemap-cell:hover,
.treemap-cell:focus-visible { z-index: 50 }

.treemap-cell-inner {
  position: absolute;
  inset: 3px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform .1s ease-out, box-shadow .2s ease;
}

.treemap-cell:hover .treemap-cell-inner,
.treemap-cell:focus-visible .treemap-cell-inner {
  box-shadow: 0 20px 40px -10px rgba(0,0,0,.15);
  transform: scale(1.02);
}

.treemap-cell-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* tiny cells get centered content */
.treemap-cell.tiny .treemap-cell-inner {
  padding: 6px;
  justify-content: center;
  align-items: center;
}

/* beeswarm plot */
.beeswarm-label { text-shadow: 1px 1px #ffffff; }
.dark .beeswarm-label { text-shadow: 1px 1px #000000; }

.beeswarm-dot {
  transition: transform 0.2s ease, z-index 0s;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

.beeswarm-dot:hover,
.beeswarm-dot.active,
.beeswarm-dot:focus-visible {
  z-index: 100;
}

/* Show tooltip on tap for mobile */
.beeswarm-dot.active .beeswarm-tooltip {
  opacity: 1;
}

/* Thin semi-transparent border on swarm dots */
.beeswarm-dot-inner {
  border: 1px solid rgba(0,0,0,0.08) !important;
}
.dark .beeswarm-dot-inner {
  border-color: rgba(255,255,255,0.1) !important;
}


/* Circle pack bubbles */
.circlepack-bubble {
  transition: transform 0.2s ease, z-index 0s;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

.circlepack-bubble:hover,
.circlepack-bubble.active,
.circlepack-bubble:focus-visible {
  z-index: 100;
}

.circlepack-bubble.active .circlepack-tooltip {
  opacity: 1;
}

@media (max-width: 639px) {
  .circlepack-bubble-inner { border-width: 1px !important; }
}

/* Embed mode - show only visualization */
.embed-mode header,
.embed-mode #step-1,
.embed-mode .pointer-events-none {
  display: none !important;
}

.embed-mode main {
  padding-bottom: 1rem;
  padding-top: 1rem;
}

.embed-mode .step-panel {
  min-height: auto;
}

.embed-mode #export-container {
  margin: 0 auto;
}

/* Calendar view */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4px;
  border-radius: 8px;
  font-size: 12px;
  position: relative;
}

.calendar-day.today {
  background-color: #E0E7FF;
}

.calendar-day.has-payment {
  background-color: #FEF3C7;
}

.calendar-payment-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 2px;
}

/* Table view */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  max-width: 160px;
  overflow: hidden;
}
.data-table .sticky-col {
  border-right: 1px solid rgba(226, 232, 240, 0.5);
}
.dark .data-table .sticky-col {
  background: #1e293b;
  border-right: 1px solid rgba(51, 65, 85, 0.5);
}
.data-table thead .sticky-col {
  z-index: 3;
}
.data-table tfoot .sticky-col {
  z-index: 3;
}
@media (max-width: 767px) {
  .data-table .sticky-col { max-width: 140px; }
}

.data-table th.col-monthly,
.data-table th.col-yearly { min-width: 94px; }

.data-table .cell-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  height: 52px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  cursor: pointer;
  user-select: none;
}

.data-table th:hover,
.data-table th:focus-visible {
  color: #334155;
}

.data-table th.sorted {
  color: #4f46e5;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}

.data-table tfoot td {
  height: 52px;
}

.data-table tr:hover td,
.data-table tr:focus-visible td {
  background-color: #f8fafc;
}

/* Trend chart container */
.chart-container {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 16px;
}

/* Custom select/dropdown styling */
select {
  cursor: pointer;
  background-image: none; /* remove browser default arrow */
}

select:focus {
  outline: none;
}

/* Make select options look better */
select option {
  padding: 8px 12px;
  background-color: #fff;
  color: #1e293b;
}

select option:hover,
select option:focus {
  background-color: #f1f5f9;
}

/* Custom dropdown wrapper with icon */
.select-wrapper {
  position: relative;
}

.select-wrapper select {
  padding-right: 2.5rem;
}

.select-wrapper .select-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.select-wrapper select:focus + .select-icon {
  color: #6366f1;
}

/* ─── Content scale-down when modal is open (iOS-style, desktop only) ────── */
@media (min-width: 769px) {
  .modal-scale-down {
    transform: scale(0.975);
  }
}
@media (max-width: 425px) {
  #sub-list-items > div:not(:first-child) {
    margin-top: 0.5rem;
  }
}
#empty-state,
#empty-import-row,
#upcoming-payments-section,
#sub-list-container,
#presets-section,
#import-section,
#export-container,
#preview-toggles {
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  transform-origin: center top;
}

/* Modal animations */
.modal-backdrop {
  transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}

.modal-backdrop.hidden {
  opacity: 0;
  backdrop-filter: blur(0px);
}

.modal-backdrop.active {
  opacity: 1;
  backdrop-filter: blur(8px);
}

/* Mobile: slide up from bottom, opaque, no blur */
.modal-content {
  transform: translateY(100%);
  opacity: 1;
  filter: none;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1),
              opacity 0.32s ease,
              filter 0.32s ease;
}
/* Settings modal: smaller safe area padding on mobile */
@media (max-width: 639px) {
  #settings-panel .modal-content {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) * 0.5);
  }
}

.modal-content.active {
  transform: translateY(0);
  opacity: 1;
  filter: none;
}

/* Desktop: scale + fade from center */
@media (min-width: 640px) {
  .modal-content {
    transform: scale(1.1);
    opacity: 0;
    filter: blur(6px);
  }

  .modal-content.active {
    transform: scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

/* Percent badge in treemap cells */
.percent-badge {
  background: rgba(255, 255, 255, 0.7);
  color: #334155;
}

.dark .percent-badge {
  background: rgba(0, 0, 0, 0.35);
  color: rgba(241, 245, 249, 0.9);
}

/* Soft UI improvements */
.shadow-soft {
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.08),
              0 2px 8px -2px rgba(0, 0, 0, 0.04);
}

.shadow-soft-lg {
  box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.1),
              0 4px 12px -2px rgba(0, 0, 0, 0.05);
}

/* Softer borders */
.border-soft {
  border-color: rgba(148, 163, 184, 0.2);
}

/* Smooth button transitions */
button {
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Input focus glow */
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Theme toggle buttons */
.theme-btn {
  color: #94a3b8;
}

.theme-btn:hover,
.theme-btn:focus-visible {
  color: #64748b;
  background-color: rgba(148, 163, 184, 0.1);
}

.theme-btn.active {
  background: linear-gradient(to bottom, #ffffff, #ececec) !important;
  border-color: #a9a8c1c2 !important;
  color: #4f46e5 !important;
  box-shadow: 0px 2px 5px #5050562b !important;
}

/* Custom Dropdown Component */
.custom-dropdown {
  position: relative;
  width: 100%;
}

.custom-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 50px;
  padding: 0.6rem 1rem 0.8rem 1rem;
  background: linear-gradient(to bottom, #fafbfc, #f1f5f9);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  text-align: left;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.custom-dropdown-trigger:hover,
.custom-dropdown-trigger:focus-visible {
  border-color: #cbd5e1;
  background: linear-gradient(to bottom, #fff, #f8fafc);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.custom-dropdown-trigger:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.custom-dropdown-trigger.open {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.custom-dropdown-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 0.5rem;
}

.custom-dropdown-icon {
  display: flex;
  align-items: center;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.custom-dropdown-trigger.open .custom-dropdown-icon {
  transform: scaleY(-1);
}

.custom-dropdown-menu {
  position: fixed;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  box-shadow: 0 12px 40px -4px rgba(0, 0, 0, 0.12), 0 4px 16px -2px rgba(0, 0, 0, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top center;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.18s;
  z-index: 9999;
  padding: 0.25rem;
}

.custom-dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.custom-dropdown-menu.above {
  transform-origin: bottom center;
  transform: translateY(6px) scale(0.98);
}

.custom-dropdown-menu.above.open {
  transform: translateY(0) scale(1);
}

.custom-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.75rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: #475569;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.custom-dropdown-item:hover,
.custom-dropdown-item:focus-visible {
  background: #f1f5f9;
  color: #1e293b;
}

.custom-dropdown-item.selected {
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 600;
}

.custom-dropdown-item.selected:hover,
.custom-dropdown-item.selected:focus-visible {
  background: #e0e7ff;
}

/* Soft UI Improvements */
.shadow-soft-xs {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
}

.shadow-soft-sm {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
}

.shadow-soft-md {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.03);
}

/* Softer card styles */
.soft-card {
  background: linear-gradient(135deg, #fff 0%, #fafbfc 100%);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
}

/* Softer input styles */
.soft-input {
  background: linear-gradient(to bottom, #fafbfc, #f1f5f9);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.soft-input:hover,
.soft-input:focus-visible {
  border-color: #cbd5e1;
}

.soft-input:focus {
  background: #fff;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Softer button styles */
.soft-button {
  background: linear-gradient(to bottom, #fff, #f8fafc);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.soft-button:hover,
.soft-button:focus-visible {
  background: linear-gradient(to bottom, #fff, #f1f5f9);
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.soft-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Smooth scrollbar for dropdown */
.custom-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
  margin: 4px;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Global soft UI for form inputs */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="url"],
textarea {
  min-height: 50px;
  background: linear-gradient(to bottom, #fafbfc, #f1f5f9) !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) inset;
  transition: border-color 0.2s cubic-bezier(0.32, 0.72, 0, 1),
              box-shadow 0.2s cubic-bezier(0.32, 0.72, 0, 1),
              background 0.2s ease;
}

input[type="text"]:hover,
input[type="number"]:hover,
input[type="email"]:hover,
input[type="url"]:hover,
textarea:hover,
input[type="text"]:focus-visible,
input[type="number"]:focus-visible,
input[type="email"]:focus-visible,
input[type="url"]:focus-visible,
textarea:focus-visible {
  border-color: #cbd5e1 !important;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
textarea:focus {
  outline: none !important;
  background: #fff !important;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* ─── Day Picker ─────────────────────────────────────────────────────────── */

.day-picker-trigger .custom-dropdown-text {
  color: #1e293b;
  font-weight: 600;
}

.dark .day-picker-trigger .custom-dropdown-text {
  color: #e2e8f0;
}

.day-picker-trigger .day-picker-placeholder {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.875rem;
}

.dark .day-picker-trigger .day-picker-placeholder {
  color: #475569;
}

.dark .day-picker-trigger .day-picker-label-suffix {
  color: #64748b;
}

.dark .day-picker-trigger .day-picker-ordinal {
  color: #64748b;
}

/* Calendar icon: don't flip on open, just color it indigo */
.day-picker-trigger.open .day-picker-cal-icon {
  transform: none !important;
  color: #6366f1;
}
.dark .day-picker-trigger.open .day-picker-cal-icon {
  color: #818cf8;
}

/* "Disable" label when value is 0 */
.day-picker-disable {
  color: #94a3b8;
  font-style: italic;
  font-size: 0.9em;
}

.day-picker-ordinal {
  font-size: 0.65em;
  vertical-align: super;
  font-weight: 700;
  color: #94a3b8;
}
html:not([lang="en"]) .day-picker-ordinal {
  display: none;
}

.day-picker-label-suffix {
  font-size: 0.8em;
  font-weight: 400;
  color: #94a3b8;
  margin-left: 3px;
}

.day-picker-popover {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 12px 40px -4px rgba(0, 0, 0, 0.12), 0 4px 16px -2px rgba(0, 0, 0, 0.06);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top center;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.18s;
}

.day-picker-popover.above {
  transform-origin: bottom center;
  transform: translateY(6px) scale(0.98);
}

.day-picker-popover.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.day-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.5rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0.375rem;
}

.day-picker-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.day-picker-clear-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
  min-height: auto;
}

.day-picker-clear-btn:hover,
.day-picker-clear-btn:focus-visible {
  color: #ef4444;
  background: #fef2f2;
}

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

.day-picker-day {
  aspect-ratio: 1;
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
}

.day-picker-day:hover,
.day-picker-day:focus-visible {
  background: #eef2ff;
  color: #4f46e5;
}

.day-picker-day.selected {
  background: #6366f1;
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.day-picker-day.selected:hover,
.day-picker-day.selected:focus-visible {
  background: #4f46e5;
  color: #fff;
}

.day-picker-day.late {
  color: #94a3b8;
}

.day-picker-day.late:hover,
.day-picker-day.late:focus-visible {
  color: #4f46e5;
}

.day-picker-day-empty {
  aspect-ratio: 1;
}

/* Type-in input inside picker */
.day-picker-typein-wrap {
  padding: 0 0 0.375rem;
}

.day-picker-typein {
  width: 100% !important;
  min-height: auto !important;
  height: 32px !important;
  box-sizing: border-box;
  padding: 4px 10px !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  font-size: 0.8125rem;
  color: #1e293b;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  box-shadow: none !important;
}

.day-picker-typein:focus {
  outline: none !important;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12) !important;
  background: #fff !important;
}

.day-picker-typein::placeholder { color: #c8d0da; }

.dark .day-picker-typein {
  background: #0f172a !important;
  border-color: #1e293b !important;
  color: #e2e8f0;
}
.dark .day-picker-typein:focus {
  border-color: #818cf8 !important;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.15) !important;
  background: #1e293b !important;
}
.dark .day-picker-typein::placeholder { color: #334155; }

.day-picker-hint {
  font-size: 0.65rem;
  color: #94a3b8;
  text-align: center;
  padding: 0.375rem 0.25rem 0.125rem;
  border-top: 1px solid #f1f5f9;
  margin-top: 0.375rem;
}

/* Dark mode day picker */
.dark .day-picker-popover {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4) !important;
}

.dark .day-picker-header {
  border-bottom-color: #334155;
}

.dark .day-picker-title {
  color: #64748b;
}

.dark .day-picker-clear-btn {
  color: #475569 !important;
}

.dark .day-picker-clear-btn:hover,
.dark .day-picker-clear-btn:focus-visible {
  color: #f87171 !important;
  background: rgba(239, 68, 68, 0.15) !important;
}

.dark .day-picker-day {
  color: #94a3b8 !important;
  background: transparent !important;
}

.dark .day-picker-day:hover,
.dark .day-picker-day:focus-visible {
  background: rgba(99, 102, 241, 0.2) !important;
  color: #818cf8 !important;
}

.dark .day-picker-day.selected {
  background: #6366f1 !important;
  color: #fff !important;
}

.dark .day-picker-day.late {
  color: #475569 !important;
}

.dark .day-picker-day.late:hover,
.dark .day-picker-day.late:focus-visible {
  color: #818cf8 !important;
}

/* ─── Currency item styles ───────────────────────────────────────────────── */

.currency-item-symbol {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  min-width: 1.5rem;
  flex-shrink: 0;
}

.currency-item-code {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #64748b;
  flex-shrink: 0;
}

.currency-item-name {
  font-size: 0.8125rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* In trigger text */
.currency-trigger-symbol {
  font-weight: 700;
  color: #1e293b;
}

.currency-trigger-code {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  margin-left: 10px;
}

.dark .currency-item-symbol { color: #f1f5f9; }
.dark .currency-item-code   { color: #94a3b8; }
.dark .currency-item-name   { color: #475569; }
.dark .currency-trigger-symbol { color: #f1f5f9; }
.dark .currency-trigger-code   { color: #64748b; }

/* ─── Language flag items ─────────────────────────────────────────────────── */

.fi {
  width: 1.25em;
  height: 0.9em;
  border-radius: 0;
  flex-shrink: 0;
}

.lang-item-flag {
  flex-shrink: 0;
  line-height: 1;
  margin-right: 6px;
  transform: translateY(1px);
}
.lang-item-flag ~ span {
  transform: translateY(-1px);
}

.lang-item-name {
  flex: 1;
  font-weight: 500;
  color: #334155;
}

.dark .lang-item-name {
  color: #cbd5e1;
}

/* Soft card effect for subscription items */
#list-container > button {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

#list-container > button:hover,
#list-container > button:focus-visible {
  background-color: rgba(241, 245, 249, 0.7) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.dark #list-container > button:hover,
.dark #list-container > button:focus-visible {
  background-color: rgba(30, 41, 59, 0.6) !important;
}

/* Preset buttons soft styling */
#presets-grid button {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

#presets-grid button:hover,
#presets-grid button:focus-visible {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dark #presets-grid button {
  background: linear-gradient(145deg, #1a2438, #162032) !important;
  border-color: #253352 !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 2px 8px rgba(0, 0, 0, 0.25);
}

.dark #presets-grid button:hover,
.dark #presets-grid button:focus-visible {
  background: linear-gradient(145deg, #1f2d47, #1a2740) !important;
  border-color: #6366f1 !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 4px 16px rgba(99, 102, 241, 0.2),
    0 0 0 1px rgba(99, 102, 241, 0.1);
}

/* Browse all button — arrow slides right on hover */
.browse-all-btn {
  transition: all 0.2s ease;
}
.browse-all-arrow {
  margin-top: 1px;
  transition: transform 0.2s ease;
}
.browse-all-btn:hover .browse-all-arrow,
.browse-all-btn:focus-visible .browse-all-arrow {
  transform: translateX(3px);
}

/* View toggle container - no hover effects */
#view-toggle-container {
  background: #e2e8f0 !important;
  border: none !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06) !important;
}

/* Smooth tab button transitions (JS swaps classes, CSS interpolates) */
#view-toggle-container button {
  transition: background-color 0.18s cubic-bezier(0.4,0,0.2,1),
              color 0.18s cubic-bezier(0.4,0,0.2,1),
              box-shadow 0.18s cubic-bezier(0.4,0,0.2,1),
              transform 0.15s cubic-bezier(0.34,1.56,0.64,1) !important;
  will-change: transform;
}
#view-toggle-container button:active {
  transform: scale(0.93) !important;
}
@media (max-width: 511.98px) {
  #view-toggle-container { max-width: 355px; }
}

#view-toggle-container:hover,
#view-toggle-container:focus-visible {
  background: #e2e8f0 !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06) !important;
}

.dark #view-toggle-container {
  background: #0f172a !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

@media screen and (max-width: 767px) {
  #view-toggle-container,
  #view-toggle-container:hover,
  #view-toggle-container:focus-visible {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
  }
  .dark #view-toggle-container,
  .dark #view-toggle-container:hover,
  .dark #view-toggle-container:focus-visible {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
  }
}

/* View toggle buttons - Soft UI */
#view-treemap, #view-beeswarm, #view-circlepack, #view-trends, #view-calendar, #view-table {
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

/* View toggle - active state (Soft UI with blue text) */
#view-treemap.text-indigo-600,
#view-beeswarm.text-indigo-600,
#view-circlepack.text-indigo-600,
#view-trends.text-indigo-600,
#view-table.text-indigo-600,
#view-calendar.text-indigo-600 {
  background: linear-gradient(to bottom, #ffffff, #f8fafc) !important;
  border: 1px solid #e2e8f0 !important;
  color: #4f46e5 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06) !important;
}

/* View toggle - inactive state (Soft UI subtle) */
#view-treemap.text-slate-500,
#view-beeswarm.text-slate-500,
#view-circlepack.text-slate-500,
#view-trends.text-slate-500,
#view-table.text-slate-500,
#view-calendar.text-slate-500 {
  background: linear-gradient(to bottom, #f1f5f9, #e2e8f0) !important;
  border: 1px solid #cbd5e1 !important;
  color: #64748b !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

#view-treemap.text-slate-500:hover,
#view-beeswarm.text-slate-500:hover,
#view-circlepack.text-slate-500:hover,
#view-trends.text-slate-500:hover,
#view-table.text-slate-500:hover,
#view-calendar.text-slate-500:hover,
#view-treemap.text-slate-500:focus-visible,
#view-beeswarm.text-slate-500:focus-visible,
#view-circlepack.text-slate-500:focus-visible,
#view-trends.text-slate-500:focus-visible,
#view-table.text-slate-500:focus-visible,
#view-calendar.text-slate-500:focus-visible {
  background: linear-gradient(to bottom, #f8fafc, #f1f5f9) !important;
  color: #475569 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* Global button Soft UI styling */
button:not(.custom-dropdown-trigger):not(.custom-dropdown-item):not(.category-btn):not([data-theme]):not(#next-btn-1):not(#next-btn-2):not(.theme-btn):not([id^="view-"]):not(.bottom-action-btn):not(.settings-action-btn):not(#settings-clear-btn):not(.sort-chip) {
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1) !important;
}

button:not(.custom-dropdown-trigger):not(.custom-dropdown-item):not(.category-btn):not([data-theme]):not(#next-btn-1):not(#next-btn-2):not(.theme-btn):not([id^="view-"]):not(.bottom-action-btn):not(.settings-action-btn):not(#settings-clear-btn):not(.sort-chip):is(:hover,:focus-visible) {
  outline: none !important;
  box-shadow: none !important;
}


button:not(.custom-dropdown-trigger):not(.custom-dropdown-item):not(.category-btn):not([data-theme]):not(.sort-chip):not(.input-clear-btn):active {
  transform: translateY(0) scale(0.98);
}

button:not(.custom-dropdown-trigger):not(.custom-dropdown-item):not(.category-btn):not([data-theme]):not(.sort-chip):focus {
  outline: none;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* Dark mode button styles */
.dark button:not(.custom-dropdown-trigger):not(.custom-dropdown-item):not(.category-btn):not([data-theme]):not(#next-btn-1):not(#next-btn-2):not(.theme-btn):not([id^="view-"]):not(.bottom-action-btn):not(.settings-action-btn):not(#settings-clear-btn):not(.sub-action-edit):not(.sub-action-delete):not(#undo-btn):not(.sort-chip) {
  color: #e2e8f0 !important;
}

.dark button:not(.custom-dropdown-trigger):not(.custom-dropdown-item):not(.category-btn):not([data-theme]):not(#next-btn-1):not(#next-btn-2):not(.theme-btn):not([id^="view-"]):not(.bottom-action-btn):not(.settings-action-btn):not(#settings-clear-btn):not(.sub-action-edit):not(.sub-action-delete):not(#undo-btn):not(.sort-chip):hover,
.dark button:not(.custom-dropdown-trigger):not(.custom-dropdown-item):not(.category-btn):not([data-theme]):not(#next-btn-1):not(#next-btn-2):not(.theme-btn):not([id^="view-"]):not(.bottom-action-btn):not(.settings-action-btn):not(#settings-clear-btn):not(.sub-action-edit):not(.sub-action-delete):not(#undo-btn):not(.sort-chip):focus-visible {
  color: #f1f5f9 !important;
}

/* Subscription list action icons */
.sub-action-edit  { color: #cbd5e1; }
.sub-action-delete { color: #cbd5e1; }
.sub-action-edit:hover,
.sub-action-edit:focus-visible { color: #3b82f6; }
.sub-action-delete:hover,
.sub-action-delete:focus-visible { color: #ef4444; }
.dark .sub-action-edit  { color: #475569; }
.dark .sub-action-delete { color: #475569; }
.dark .sub-action-edit:hover,
.dark .sub-action-edit:focus-visible { color: #60a5fa; }
.dark .sub-action-delete:hover,
.dark .sub-action-delete:focus-visible { color: #f87171; }

/* Undo toast button */
.dark #undo-btn { color: #818cf8; }
.dark #undo-btn:hover,
.dark #undo-btn:focus-visible { color: #a5b4fc; }

/* ── Info toast (showToast) ────────────────────────────────────────────────── */
.info-toast-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow:
    0 2px 8px rgb(123,118,118,0.04), 
    0 8px 14px rgb(50,48,48,0.08), 
    0 0 2px rgb(63,59,59,0.06);
  max-width: min(420px, calc(100vw - 32px));
}
.info-toast-icon { width: 22px; height: 22px; flex-shrink: 0; }
.info-toast-text { font-size: 0.925rem; font-weight: 600; color: #334155; line-height: 1.1; }

.info-toast-error {
  box-shadow: inset 0 0 15px #ff00005c, inset 0 0 2px #ff0000ed
}

.info-toast-success .info-toast-icon { color: #22c55e; }
.info-toast-error   .info-toast-icon { color: #ef4444; }
.info-toast-error   .info-toast-text { color: #dc2626; }

/* Dark mode */
.dark .info-toast-inner {
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 1px 3px rgba(0, 0, 0, 0.15);
}
.dark .info-toast-text { color: #cbd5e1; }
.dark .info-toast-success .info-toast-icon { color: #4ade80; }
.dark .info-toast-error   .info-toast-icon { color: #f87171; }
.dark .info-toast-error   .info-toast-text { color: #fca5a5; }

/* Dark mode view toggle - active state (Soft UI) */
.dark #view-treemap.text-indigo-600,
.dark #view-beeswarm.text-indigo-600,
.dark #view-circlepack.text-indigo-600,
.dark #view-trends.text-indigo-600,
.dark #view-table.text-indigo-600,
.dark #view-calendar.text-indigo-600 {
  background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
  border: 1px solid #334155 !important;
  color: #818cf8 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* Dark mode view toggle - inactive state (Soft UI) */
.dark #view-treemap.text-slate-500,
.dark #view-beeswarm.text-slate-500,
.dark #view-circlepack.text-slate-500,
.dark #view-trends.text-slate-500,
.dark #view-table.text-slate-500,
.dark #view-calendar.text-slate-500 {
  background: linear-gradient(to bottom, #0f172a, #020617) !important;
  border: 1px solid #1e293b !important;
  color: #64748b !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

.dark #view-treemap.text-slate-500:hover,
.dark #view-beeswarm.text-slate-500:hover,
.dark #view-circlepack.text-slate-500:hover,
.dark #view-trends.text-slate-500:hover,
.dark #view-table.text-slate-500:hover,
.dark #view-calendar.text-slate-500:hover,
.dark #view-treemap.text-slate-500:focus-visible,
.dark #view-beeswarm.text-slate-500:focus-visible,
.dark #view-circlepack.text-slate-500:focus-visible,
.dark #view-trends.text-slate-500:focus-visible,
.dark #view-table.text-slate-500:focus-visible,
.dark #view-calendar.text-slate-500:focus-visible {
  background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

/* Theme switcher - Soft UI */
.theme-btn {
  background: linear-gradient(to bottom, #fafbfc, #f1f5f9) !important;
  border: 1px solid #e9dfdfb8 !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  color: #64748b !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.0) !important;
}

.theme-btn:hover,
.theme-btn:focus-visible {
  border-color: #bdc2c7 !important;
  box-shadow: none !important;
}

.theme-btn.active {
  background: linear-gradient(to bottom, #ffffff, #ececec) !important;
  border-color: #adabd4c2 !important;
  color: #4f46e5 !important;
  box-shadow: 0 1px 2px #20214b4d !important;
}

.dark .theme-btn {
  background: transparent !important;
  border-color: transparent !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
}

.dark .theme-btn:hover,
.dark .theme-btn:focus-visible {
  box-shadow: none !important;
}

.dark .theme-btn.active {
  background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
  border-color: #51546f !important;
  color: #e4e4eb !important;
  box-shadow: none !important;
}

/* ─── Progressive blur footer — layered backdrop-filter approach ─────────── */
/*
   8 stacked divs (id="progressive-blur"), each blurs a different band via
   mask-image windows. Blur doubles each layer: 0.055 → 0.11 → 0.22 → 0.44
   → 0.875 → 1.75 → 3.5 → 7 px. The result: near-zero blur at the top of
   the zone, smoothly increasing to ~7 px of glass blur at the very bottom.
   A .pb-tint div on top adds the solid background colour floor.
*/

/* Footer containers: transparent so the fixed blur layer shows through */
.footer-fade {
  background: none !important;
}

/* Fixed blur zone: always sits at the bottom, pointer-events:none */
#progressive-blur {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 130px;
  z-index: 9;          /* below footer z-10 buttons, above page content */
  pointer-events: none;
}

/* Background colour tint: solid floor → transparent, light mode */
.pb-tint {
  background: linear-gradient(
    to top,
    #F8F9FB              0%,
    rgba(248,249,251,0.92) 35%,
    rgba(248,249,251,0)    100%
  );
}

/* Dark mode tint */
.dark #progressive-blur .pb-tint {
  background: linear-gradient(
    to top,
    #0f172a            0%,
    rgba(15,23,42,0.92) 35%,
    rgba(15,23,42,0)    100%
  );
}

/* ─── Mobile top / bottom bars (< 768px) ────────────────────────────────── */

/* Push header content below the fixed mobile top bar (accounts for PWA safe area) */
@media (max-width: 767px) {
  header {
    padding-top: calc(60px + env(safe-area-inset-top, 0px)) !important;
  }
}

/* ── Mobile header summary (between Settings & Generate) ──────────────────── */
.mob-header-appname { color: #0f172a; }
.dark .mob-header-appname { color: #f1f5f9; }

/* Below 389px: hide mob summary in top bar, show header > div as usual */
@media (max-width: 388px) {
  .mob-header-summary { display: none !important; }
}
/* 389px – 767px: hide header > div, rely on mob top bar for the info */
@media (min-width: 389px) and (max-width: 767px) {
  header > div { display: none !important; }
}

/* Mobile top bar: solid background */
.mob-top-bar {
  background: #f8f9fb;
  border-bottom: 1px solid #e2e8f0;
  padding-top: env(safe-area-inset-top, 0px);
}
.dark .mob-top-bar {
  background: #0f172a !important;
  border-bottom-color: #334155 !important;
}

/* Mobile bottom bar: no own background — progressive blur layer handles it */
#s1-mob-bottom,
#s2-mob-bottom {
  background: none;
}

/* Icon buttons inside mobile bottom bar: stretch to fill equally */
.mob-icon-flex {
  flex: 1 !important;
  width: auto !important;
  min-width: 0 !important;
}

/* "+" add button in mobile bottom bar: base indigo style (hover/active overrides are after .add-another-icon-btn) */
.mob-plus-btn {
  background: linear-gradient(to bottom, #6366f1, #4f46e5) !important;
  border-color: #4f46e5 !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3) !important;
}
/* < 360px: "+" button matches other nav buttons (no indigo) */
@media (max-width: 359px) {
  .mob-plus-btn {
    background: linear-gradient(to bottom, #fafbfc, #f1f5f9) !important;
    border-color: #e2e8f0 !important;
    color: #64748b !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  }
  .mob-plus-btn .iconify {
    color: inherit !important;
  }
  .dark .mob-plus-btn {
    background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
    box-shadow: none !important;
  }
  .dark .mob-plus-btn .iconify {
    color: #e2e8f0 !important;
  }
}

/* "Camera" button in mobile bottoms bar */
.mobile-bar-btn-camera path {
  fill: #4f627d;
}
.dark .mobile-bar-btn-camera path {
  fill: #e7edf5;
}

/* Hide import section on touch-only mobile devices */
@media (max-width: 767px) and (hover: none) and (pointer: coarse) {
  #import-section {
    display: none !important;
  }
}

/* Mobile bottom bar button sizes: < 390px */
@media (max-width: 389.98px) {
  .mob-icon-flex {
    flex: 0 0 auto !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 52px;
    height: 48px;
    min-height: 48px;
  }
  #s1-mob-bottom > div,
  #s2-mob-bottom > div {
    gap: 0rem;
  }
}
/* Mobile bottom bar button sizes: 390px – 475px */
@media (min-width: 390px) and (max-width: 475px) {
  .mob-icon-flex {
    flex: 0 0 auto !important;
    width: 62px !important;
    min-width: 0 !important;
    min-height: 58px;
  }
}

/* Fewer preset columns & cards on very small screens */
@media (max-width: 389.98px) {
  #presets-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  #presets-grid > :nth-child(n+10) {
    display: none !important;
  }
  #s1-mob-bottom :is(button, label),
  #s2-mob-bottom :is(button, label) {
    border-radius: 0 !important;
  }
  #s1-mob-bottom :is(button, label):first-child,
  #s2-mob-bottom :is(button, label):first-child {
    border-radius: 16px 0 0 16px !important;
  }
  #s1-mob-bottom :is(button, label):last-child,
  #s2-mob-bottom :is(button, label):last-child {
    border-radius: 0 16px 16px 0 !important;
  }
}
@media (min-width: 360px) and (max-width: 474.98px) {
  #presets-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
  }
  #presets-grid > :nth-child(n+10) {
    display: none !important;
  }
  #presets-grid button {
    padding: 0.75rem 0.5rem !important;
  }
}

/* Hide Add Another icon buttons on mobile (they live in the fixed bottom bar) */
@media (max-width: 767px) {
  .add-another-icons {
    display: none !important;
  }
  .add-another-main {
    flex-basis: 100%;
  }
}

@media (max-width: 269.98px) {
  .mob-icon-flex {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px;
  }
  #s1-mob-bottom :is(button, label):first-child, #s2-mob-bottom :is(button, label):first-child {
    border-radius: 8px 0 0 8px !important;
  }
  #s1-mob-bottom :is(button, label):last-child, #s2-mob-bottom :is(button, label):last-child {
    border-radius: 0 8px 8px 0 !important;
  }
}

/* ─── Drag-over state for mobile bottom bar buttons (photo & json) ────────── */
.mob-drop-target.drag-over {
  border: 2px dashed #6366f1 !important;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 0 16px rgba(99, 102, 241, 0.15) !important;
  animation: dragOverGlow 1.4s ease-in-out infinite;
}
.mob-drop-target.drag-over * {
  color: #4f46e5 !important;
}
.dark .mob-drop-target.drag-over {
  border: 2px dashed #818cf8 !important;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(129, 140, 248, 0.12) 100%) !important;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25), 0 0 16px rgba(129, 140, 248, 0.15) !important;
  animation: dragOverGlowDark 1.4s ease-in-out infinite;
}
.dark .mob-drop-target.drag-over * {
  color: #a5b4fc !important;
}

/* Bottom action buttons (Back, Share, Save Image) - Soft UI */
.bottom-action-btn {
  background: linear-gradient(to bottom, #fafbfc, #f1f5f9) !important;
  border: 1px solid #e2e8f0 !important;
  color: #334155 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  font-size: 14px;
  white-space: nowrap;
}

.bottom-action-btn:hover,
.bottom-action-btn:focus-visible {
  background: linear-gradient(to bottom, #fff, #f8fafc) !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

.dark .bottom-action-btn {
  background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
  font-size: 14px;
  white-space: nowrap;
}

.dark .bottom-action-btn:hover,
.dark .bottom-action-btn:focus-visible {
  background: linear-gradient(to bottom, #334155, #1e293b) !important;
  border-color: #475569 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Settings action buttons (Export, Import) - Soft UI */
.settings-action-btn {
  min-height: 50px;
  background: linear-gradient(to bottom, #fafbfc, #f1f5f9) !important;
  border: 1px solid #e2e8f0 !important;
  color: #334155 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

.settings-action-btn:hover,
.settings-action-btn:focus-visible {
  background: linear-gradient(to bottom, #fff, #f8fafc) !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
}

.dark .settings-action-btn {
  background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

.dark .settings-action-btn:hover,
.dark .settings-action-btn:focus-visible {
  background: linear-gradient(to bottom, #334155, #1e293b) !important;
  border-color: #475569 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

/* Clear all data button - Soft UI */
#settings-clear-btn {
  background: linear-gradient(to bottom, #fef2f2, #fee2e2) !important;
  border: 1px solid #fecaca !important;
  color: #dc2626 !important;
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.1) !important;
}

#settings-clear-btn:hover,
#settings-clear-btn:focus-visible {
  background: linear-gradient(to bottom, #fee2e2, #fecaca) !important;
  border-color: #f87171 !important;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.15) !important;
}

.dark #settings-clear-btn {
  background: linear-gradient(to bottom, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.1)) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #f87171 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

.dark #settings-clear-btn:hover,
.dark #settings-clear-btn:focus-visible {
  background: linear-gradient(to bottom, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.15)) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2) !important;
}

/* Dropdown search box */
.custom-dropdown-search {
  position: relative;
  padding: 8px 8px 6px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafbfc;
  border-radius: 0.625rem 0.625rem 0 0;
  margin: -0.25rem -0.25rem 0.25rem;
}

.custom-dropdown-search-icon {
  position: absolute;
  left: 18px;
  top: calc(50% + 1px);
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  color: #94a3b8;
  font-size: 13px;
  pointer-events: none;
}

.custom-dropdown-search-input {
  width: 100%;
  min-height: 36px !important;
  box-sizing: border-box;
  padding: 7px 10px 7px 30px;
  border: 1px solid #e8edf2;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.custom-dropdown-search-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.custom-dropdown-search-input::placeholder {
  color: #c8d0da;
}

.custom-dropdown-options {
  overflow-y: auto;
}

.custom-dropdown-empty {
  padding: 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

/* Dropdown item with secondary text */
.custom-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-dropdown-item-main {
  font-weight: 600;
  color: #1e293b;
  flex-shrink: 0;
  min-width: 3.5rem;
}

.custom-dropdown-item-secondary {
  font-size: 12px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dark mode dropdown styles */
.dark .custom-dropdown-trigger {
  background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

.dark .custom-dropdown-trigger:hover,
.dark .custom-dropdown-trigger:focus-visible {
  background: linear-gradient(to bottom, #334155, #1e293b) !important;
  border-color: #475569 !important;
}

.dark .custom-dropdown-trigger.open {
  border-color: #818cf8 !important;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2) !important;
}

.dark .custom-dropdown-menu {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

.dark .custom-dropdown-item {
  color: #94a3b8 !important;
}

.dark .custom-dropdown-item:hover,
.dark .custom-dropdown-item:focus-visible {
  background: #334155 !important;
  color: #e2e8f0 !important;
}

.dark .custom-dropdown-item.selected {
  background: rgba(99, 102, 241, 0.2) !important;
  color: #818cf8 !important;
}

.dark .custom-dropdown-item.selected:hover,
.dark .custom-dropdown-item.selected:focus-visible {
  background: rgba(99, 102, 241, 0.3) !important;
}

.dark .custom-dropdown-search {
  background: #1e293b;
  border-bottom-color: #1e293b;
}

.dark .custom-dropdown-search-icon {
  color: #475569;
}

.dark .custom-dropdown-search-input {
  background: #1e293b;
  border-color: #2d3f55;
  color: #e2e8f0;
}

.dark .custom-dropdown-search-input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.15);
}

.dark .custom-dropdown-search-input::placeholder {
  color: #334155;
}

.dark .custom-dropdown-item-main {
  color: #e2e8f0;
}

.dark .custom-dropdown-item-secondary {
  color: #64748b;
}

.dark .custom-dropdown-icon {
  color: #64748b;
}

/* ─── Tooltip ─────────────────────────────────────────────────────────────── */

.subify-tooltip {
  position: fixed;
  z-index: 99999;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px) scale(0.95);
  transform-origin: bottom center;
  transition:
    opacity 0.15s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.15s cubic-bezier(0.32, 0.72, 0, 1);

  /* Light theme: white card with border */
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;

  --arrow-size: 7px;
  --arrow-color: #ffffff;
  --arrow-border-color: #e2e8f0;
}

.subify-tooltip::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(-1 * var(--arrow-size));
  transform: translateX(-50%);
  border: var(--arrow-size) solid transparent;
  border-bottom-width: 0;
  border-top-color: var(--arrow-border-color);
}

.subify-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(-1 * var(--arrow-size) + 2px);
  transform: translateX(-50%);
  border: var(--arrow-size) solid transparent;
  border-bottom-width: 0;
  border-top-color: var(--arrow-color);
}

/* When tooltip is below the element, flip arrow */
.subify-tooltip--below {
  transform-origin: top center;
}

.subify-tooltip--below::before {
  bottom: auto;
  top: calc(-1 * var(--arrow-size));
  border-top-width: 0;
  border-bottom-color: var(--arrow-border-color);
  border-top-color: transparent;
}

.subify-tooltip--below::after {
  bottom: auto;
  top: calc(-1 * var(--arrow-size) + 2px);
  border-top-width: 0;
  border-bottom-color: var(--arrow-color);
  border-top-color: transparent;
}

.subify-tooltip-icon {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  color: #22c55e;
}

/* Dark theme: dark tooltip */
.dark .subify-tooltip {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 1px 4px rgba(0, 0, 0, 0.2);
  --arrow-color: #1e293b;
  --arrow-border-color: #334155;
}

/* ─── Color picker auto (rainbow) tile ───────────────────────────────────── */
.color-option-auto {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
/* Slightly boost the star icon contrast */
.color-option-auto span { color: #fff; }

/* ─── Import action cards ─────────────────────────────────────────────────── */

.import-action-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  min-height: 62px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 0 rgba(255,255,255,0.8) inset;
  text-align: left;
}

.import-action-card:hover,
.import-action-card:focus-visible {
  background: #f8faff;
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

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

.import-action-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #6366f1;
  flex-shrink: 0;
}

.import-action-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  line-height: 1.3;
}

.import-action-card-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.3;
  margin-top: 2px;
  /* allow wrapping so long hints don't get cut off */
  white-space: normal;
}

/* ── 575px: icon top-left, text stacks below it — still 2 columns ─────────── */
@media (max-width: 574px) {
  .import-action-card {
    flex-direction: column;
    align-items: stretch;   /* children fill card width */
    min-height: auto;
    padding: 11px 12px 13px;
    gap: 8px;
  }
  /* Icon stays its natural 34px size, left-aligned */
  .import-action-card .import-action-card-icon {
    align-self: flex-start;
    flex-shrink: 0;
    width: 34px;
    min-width: 34px;
  }
  /* Text wrapper fills available width so text wraps naturally */
  .import-action-card .import-action-card-name,
  .import-action-card .import-action-card-hint {
    overflow: visible;
    white-space: normal;
    text-overflow: unset;
  }
}

/* ── 424px: single-column, back to horizontal layout ───────────────────────── */
@media (max-width: 424px) {
  /* Return to row layout */
  .import-action-card {
    flex-direction: row;
    align-items: center;
    min-height: 62px;
    padding: 12px 14px;
    gap: 10px;
  }
  .import-action-card .import-action-card-icon {
    align-self: auto;
  }
}

/* ─── Add Another row ─────────────────────────────────────────────────────── */

.add-another-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

/* On very small screens: main button full-width, icons on second row */
@media (max-width: 474px) {
  .add-another-row   { flex-wrap: wrap; }
  .add-another-main  { flex-basis: 100%; }
  .add-another-icons { display: flex; flex: 1 1 100%; gap: 8px; }
  .add-another-icons .add-another-icon-btn { flex: 1; width: auto; min-width: 0; }
}

.add-another-icons {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Main "Add Another" button expands to fill remaining space */
.add-another-main {
  flex: 1;
  min-width: 0;
  padding-bottom: 2px;
}
.add-another-main .iconify {
  margin-top: 2px;
}

.add-another-btn {
  height: 50px;
  line-height: 1;
  background: linear-gradient(to bottom, #fafbfc, #f1f5f9);
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.875rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}


.add-another-btn:hover,
.add-another-btn:focus-visible {
  background: linear-gradient(to bottom, #fff, #f8fafc) !important;
  border-color: #c7d2fe !important;
  color: #4f46e5 !important;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.1) !important;
}

.dark .add-another-btn {
  background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
  border-color: #334155 !important;
  color: #94a3b8;
}

.dark .add-another-btn:hover,
.dark .add-another-btn:focus-visible {
  background: linear-gradient(to bottom, #334155, #1e293b) !important;
  border-color: #475569 !important;
  color: #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
}

.dark .add-another-btn:focus {
  outline: none !important;
  box-shadow: none !important;
}

.add-another-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  min-width: 50px;
  height: 50px;
  border-radius: 1rem;
  background: linear-gradient(to bottom, #fafbfc, #f1f5f9);
  border: 1px solid #e2e8f0;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.add-another-icon-btn:hover,
.add-another-icon-btn:focus-visible {
  background: linear-gradient(to bottom, #fff, #f8fafc) !important;
  border-color: #c7d2fe !important;
  color: #4f46e5 !important;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.1) !important;
}

/* Force same dark background + icon color on both <button> and <label> */
.dark .add-another-icon-btn {
  background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
  border-color: #334155 !important;
}
.dark .add-another-icon-btn,
.dark .add-another-icon-btn * {
  color: #e2e8f0 !important;
}

.dark .add-another-icon-btn:hover,
.dark .add-another-icon-btn:hover *,
.dark .add-another-icon-btn:focus-visible,
.dark .add-another-icon-btn:focus-visible * {
  color: #818cf8 !important;
}

/* Override generic hover/active for the indigo "+" button */
.mob-plus-btn.add-another-icon-btn:hover,
.mob-plus-btn.add-another-icon-btn:focus-visible {
  background: linear-gradient(to bottom, #818cf8, #6366f1) !important;
  border-color: #4f46e5 !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4) !important;
}
.mob-plus-btn.add-another-icon-btn:active {
  background: linear-gradient(to bottom, #4338ca, #3730a3) !important;
  border-color: #3730a3 !important;
  color: #fff !important;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.3) !important;
}
.dark .mob-plus-btn.add-another-icon-btn,
.dark .mob-plus-btn.add-another-icon-btn * {
  background: linear-gradient(to bottom, #4f46e5, #4338ca) !important;
  border-color: #4338ca !important;
  color: #e0e7ff !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25) !important;
}
.dark .mob-plus-btn.add-another-icon-btn:hover,
.dark .mob-plus-btn.add-another-icon-btn:hover *,
.dark .mob-plus-btn.add-another-icon-btn:focus-visible,
.dark .mob-plus-btn.add-another-icon-btn:focus-visible * {
  background: linear-gradient(to bottom, #6366f1, #4f46e5) !important;
  border-color: #4338ca !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35) !important;
}
.dark .mob-plus-btn.add-another-icon-btn:active,
.dark .mob-plus-btn.add-another-icon-btn:active * {
  background: linear-gradient(to bottom, #3730a3, #312e81) !important;
  border-color: #312e81 !important;
  color: #c7d2fe !important;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.2) !important;
}

.dark .mob-plus-btn.add-another-icon-btn .iconify {
  background: transparent !important;
  box-shadow: none !important;
}

.voice-import-btn.voice-recording.add-another-icon-btn,
.voice-import-btn.voice-recording.bottom-action-btn {
  border-color: #ef4444 !important;
  background: linear-gradient(to bottom, #fff1f2, #fef2f2) !important;
  color: #ef4444 !important;
}

.dark .voice-import-btn.voice-recording.add-another-icon-btn,
.dark .voice-import-btn.voice-recording.add-another-icon-btn *,
.dark .voice-import-btn.voice-recording.bottom-action-btn,
.dark .voice-import-btn.voice-recording.bottom-action-btn * {
  color: #ef4444 !important;
}

/* ─── Icon button tooltip ─────────────────────────────────────────────────── */

.icon-tooltip {
  position: fixed;
  z-index: 99998;
  max-width: 220px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 13px 11px;
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.09),
    0 2px 8px rgba(0, 0, 0, 0.05);
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px) scale(0.95);
  transition:
    opacity 0.18s ease,
    transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-tooltip.open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Arrow pointing downward (tooltip above button) — border layer */
.icon-tooltip::before {
  content: '';
  position: absolute;
  bottom: -7px;
  left: var(--arr, 50%);
  transform: translateX(-50%);
  width: 0; height: 0;
  border: 7px solid transparent;
  border-bottom-width: 0;
  border-top-color: #e2e8f0;
  pointer-events: none;
}
/* Arrow fill layer */
.icon-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: var(--arr, 50%);
  transform: translateX(-50%);
  width: 0; height: 0;
  border: 6px solid transparent;
  border-bottom-width: 0;
  border-top-color: #fff;
  pointer-events: none;
}

/* Flip arrows when tooltip is below the button */
.icon-tooltip--below::before {
  bottom: auto; top: -7px;
  border-top-width: 0;
  border-top-color: transparent;
  border-bottom-width: 7px;
  border-bottom-color: #e2e8f0;
}
.icon-tooltip--below::after {
  bottom: auto; top: -6px;
  border-top-width: 0;
  border-top-color: transparent;
  border-bottom-width: 6px;
  border-bottom-color: #fff;
}

.icon-tooltip-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.icon-tooltip-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #6366f1;
}

.icon-tooltip-desc {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.45;
  margin-top: 3px;
}

.dark .icon-tooltip {
  background: #1e293b;
  border-color: #334155;
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.25);
}
.dark .icon-tooltip::before { border-top-color: #334155; }
.dark .icon-tooltip::after  { border-top-color: #1e293b; }
.dark .icon-tooltip--below::before { border-top-color: transparent; border-bottom-color: #334155; }
.dark .icon-tooltip--below::after  { border-top-color: transparent; border-bottom-color: #1e293b; }

.dark .icon-tooltip-title { color: #f1f5f9; }
.dark .icon-tooltip-desc  { color: #94a3b8; }
.dark .icon-tooltip-icon  { color: #818cf8; }

/* Drag-over highlight (photo and backup) */
.import-action-card.drag-over {
  border-width: 1px !important;
  border-style: dashed !important;
  border-color: #6366f1 !important;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%) !important;
  box-shadow:
    inset 0 0 0 1px rgba(99, 102, 241, 0.25),
    0 0 0 3px rgba(99, 102, 241, 0.12),
    0 4px 16px rgba(99, 102, 241, 0.12) !important;
  animation: dragOverGlow 1.4s ease-in-out infinite;
}

.import-action-card.drag-over .import-action-card-icon {
  border-color: #6366f1 !important;
  background: #e0e7ff !important;
  color: #4f46e5 !important;
  animation: dragIconBounce 0.7s ease-in-out infinite alternate;
}

.import-action-card.drag-over .import-action-card-name {
  color: #4f46e5 !important;
}

@keyframes dragOverGlow {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12), 0 4px 16px rgba(99, 102, 241, 0.1);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.22), 0 6px 24px rgba(99, 102, 241, 0.18);
  }
}

@keyframes dragIconBounce {
  from { transform: scale(1) translateY(0); }
  to   { transform: scale(1.12) translateY(-2px); }
}

/* Dark mode drag-over */
.dark .import-action-card.drag-over {
  border-width: 1px !important;
  border-style: dashed !important;
  border-color: #818cf8 !important;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(129, 140, 248, 0.1) 100%) !important;
  animation: dragOverGlowDark 1.4s ease-in-out infinite;
}

.dark .import-action-card.drag-over .import-action-card-icon {
  border-color: #818cf8 !important;
  background: rgba(99, 102, 241, 0.25) !important;
  color: #a5b4fc !important;
}

.dark .import-action-card.drag-over .import-action-card-name {
  color: #a5b4fc !important;
}

@keyframes dragOverGlowDark {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2), 0 4px 16px rgba(129, 140, 248, 0.1);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(129, 140, 248, 0.35), 0 6px 24px rgba(129, 140, 248, 0.2);
  }
}

/* Voice recording state */
.voice-import-btn.voice-recording {
  border-color: #ef4444 !important;
  background: linear-gradient(to bottom, #fff1f2, #fef2f2) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
  animation: voicePulse 1.2s ease-in-out infinite;
}

.voice-import-btn.voice-recording .import-action-card-icon {
  border-color: #ef4444;
  background: #fee2e2;
  color: #ef4444;
}

@keyframes voicePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Dark mode */
.dark .import-action-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255,255,255,0.04) inset;
}

.dark .import-action-card:hover,
.dark .import-action-card:focus-visible {
  background: #253348;
  border-color: #4f46e5;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.dark .import-action-card-icon {
  background: #0f172a;
  border-color: #334155;
  color: #818cf8;
}

.dark .import-action-card-name {
  color: #e2e8f0;
}

.dark .import-action-card-hint {
  color: #475569;
}

.dark .voice-import-btn.voice-recording {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.12) !important;
}

/* ── Bottom-sheet drag handle (mobile only) ────────────────────────────────── */
.bottom-sheet-handle {
  display: none;
  width: 36px;
  height: 4px;
  background: rgba(0, 0, 0, 0.13);
  border-radius: 9999px;
  margin: 8px auto 0;
  flex-shrink: 0;
  cursor: grab;
}
.dark .bottom-sheet-handle { background: rgba(255, 255, 255, 0.2); }
@media (max-width: 639px) {
  .bottom-sheet-handle { display: block; }
}

/* Text / Voice import modal */
.text-import-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(15, 23, 42, 0);
  overscroll-behavior: contain;
  backdrop-filter: blur(0px);
  transition: background 0.25s ease, backdrop-filter 0.25s ease;
}
.text-import-overlay.open {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}
/* Mobile: bottom sheet */
@media (max-width: 767px) {
  .text-import-overlay { align-items: flex-end !important; }
  .text-import-panel {
    max-width: 100% !important;
    width: 100% !important;
    max-height: 90dvh !important;
    overflow-y: auto;
    border-radius: 24px 24px 0 0 !important;
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease !important;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  }
  .text-import-panel.open { transform: translateY(0); opacity: 1; }
}
@media (max-width: 767px) and (display-mode: standalone) {
  .text-import-panel {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
  }
}
@media (min-width: 768px) {
  .text-import-overlay { align-items: center; }
}

.text-import-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 1.5rem;
  padding: 0px 1.25rem 1.25rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  transform: translateY(40px);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
}
.text-import-panel.open {
  transform: translateY(0);
  opacity: 1;
}
.dark .text-import-panel {
  background: #1e293b;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.text-import-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}
.text-import-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
}
@media (max-width: 639px) {
  .text-import-header-row { padding-top: 0.5rem; }
}

.ti-close-btn {
  position: absolute;
  right: .75rem;
  top: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.ti-close-btn:hover,
.ti-close-btn:focus-visible { color: #475569; background: #f1f5f9; }
.ti-close-btn:active { background: #e2e8f0; }
.dark .ti-close-btn { color: #64748b; }
.dark .ti-close-btn:hover,
.dark .ti-close-btn:focus-visible { color: #cbd5e1; background: #1e293b; }
.dark .ti-close-btn:active { background: #0f172a; }

.text-import-textarea {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #0f172a;
  resize: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.text-import-textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.dark .text-import-textarea {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

.text-import-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
/* Analyze and Stop buttons pushed to the right */
.text-import-submit,
.voice-stop-btn {
  margin-left: auto;
}

.text-import-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: #6366f1;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  transition: background 0.15s;
  flex: 1;
  min-height: 48px;
}
.text-import-submit:hover,
.text-import-submit:focus-visible { background: #4f46e5; }

/* Voice recording indicator dot */
.voice-rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: voiceRecPulse 1s ease-in-out infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes voiceRecPulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* Textarea in live-recording state */
.voice-recording-textarea {
  border-color: #fca5a5 !important;
  background: #fff8f8 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08) !important;
  caret-color: transparent;
}
.dark .voice-recording-textarea {
  border-color: #7f1d1d !important;
  background: #1c0a0a !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

/* Stop recording button */
.voice-stop-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: #fef2f2;
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid #fecaca;
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
  flex: 1;
  justify-content: center;
  min-height: 48px;
}
.voice-stop-btn:hover,
.voice-stop-btn:focus-visible {
  background: #fee2e2;
  border-color: #fca5a5;
}
.dark .voice-stop-btn {
  background: rgba(220, 38, 38, 0.12) !important;
  border-color: rgba(220, 38, 38, 0.3) !important;
  color: #fca5a5 !important;
}
.voice-resume-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #4f46e5;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.voice-resume-btn:hover,
.voice-resume-btn:focus-visible { background: #e0e7ff; border-color: #a5b4fc; }
.dark .voice-resume-btn { background: rgba(99,102,241,0.12); border-color: rgba(99,102,241,0.3); color: #a5b4fc; }
.dark .voice-resume-btn:hover,
.dark .voice-resume-btn:focus-visible { background: rgba(99,102,241,0.2); }

/* Analyzing loader button */
.voice-transcribe-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: #f0f4ff;
  color: #6366f1;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid #c7d2fe;
  flex: 1;
  justify-content: center;
  cursor: default;
  opacity: 0.85;
  min-height: 48px;
}
.dark .voice-transcribe-btn {
  background: rgba(99,102,241,0.12) !important;
  border-color: rgba(99,102,241,0.3) !important;
  color: #a5b4fc !important;
}

/* Audio visualizer */
.voice-visualizer {
  display: none;
  width: 100%;
  height: 56px;
  border-radius: 12px 12px 0 0;
  background: rgba(99, 102, 241, 0.04);
}
.dark .voice-visualizer {
  background: rgba(99, 102, 241, 0.08);
}

/* CSS fallback visualizer (when canvas/AudioContext fails, e.g. iOS) */
.voice-css-visualizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 56px;
  padding: 8px 12px;
  border-radius: 12px 12px 0 0;
  background: rgba(99, 102, 241, 0.04);
}
.dark .voice-css-visualizer {
  background: rgba(99, 102, 241, 0.08);
}
.voice-css-visualizer > div {
  flex: 1;
  max-width: 8px;
  min-height: 3px;
  border-radius: 2px;
  background: rgba(99, 102, 241, 0.5);
  animation: cssVisBounce 1.2s ease-in-out infinite alternate;
}
.dark .voice-css-visualizer > div {
  background: rgba(129, 140, 248, 0.5);
}
@keyframes cssVisBounce {
  0%   { height: 15%; opacity: 0.4; }
  50%  { height: 80%; opacity: 0.9; }
  100% { height: 25%; opacity: 0.5; }
}

/* Realtime voice input (single line, transparent) */
.voice-realtime-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  color: #64748bb8;
  padding: 10px 2px;
  font-style: italic;
  text-overflow: ellipsis;
  text-align: right;
  direction: rtl;
  box-shadow: none !important;
}

.dark .voice-realtime-input {
  color: #94a3b8;
}

/* Loader area (replaces visualizer + input during analyzing) */
.voice-loader-area {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 90px;
}
.dark .voice-loader-area .iconify {
  color: #818cf8 !important;
}

/* Voice help [?] button */
.voice-help-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.voice-help-btn:hover,
.voice-help-btn:focus-visible {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.dark .voice-help-btn {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  color: #64748b;
}
.dark .voice-help-btn:hover,
.dark .voice-help-btn:focus-visible {
  background: rgba(255,255,255,0.1);
}

/* Voice help popover */
.voice-help-popover {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #64748b;
  white-space: pre-line;
}
.dark .voice-help-popover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: #94a3b8;
}

/* ── Photo-import results modal ────────────────────────────────────────────── */
.pi-panel { padding: 0; overflow: hidden; }
@media (max-width: 767px) {
  .pi-panel { max-height: 93dvh !important; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
}

.pi-header {
  display: flex;
  flex-direction: column;
  padding: 0 1.25rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}
.pi-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
}
@media (max-width: 639px) {
  .pi-header-row { padding-top: 0.5rem; }
}
.pi-title { 
  font-size: 1rem; 
  font-weight: 700; 
  color: #0f172a;
  letter-spacing: -0.2px;
}
.pi-close-btn {
  padding: 4px; color: #94a3b8; background: none; border: none;
  cursor: pointer; min-height: auto; display: flex; align-items: center;
  border-radius: 6px;
}
.pi-close-btn:hover,
.pi-close-btn:focus-visible { color: #475569; }

.pi-scroll {
  padding: 0.875rem 1.25rem;
  max-height: 48vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* ── Item row ── */
.pi-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  transition: background 0.15s, border-color 0.15s;
}
.pi-item:hover,
.pi-item:focus-visible { background: #f1f5ff; border-color: #c7d2fe; }

/* Custom checkbox — top-right corner */
.pi-check {
  width: 20px; height: 20px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 2px solid #cbd5e1;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  margin-left: auto;
  transition: background 0.15s, border-color 0.15s, color 0.1s;
  align-self: flex-start;
  margin-top: 2px;
}
.pi-check.checked { background: #6366f1; border-color: #6366f1; color: #fff; }
.pi-check:hover:not(.checked),
.pi-check:focus-visible:not(.checked) { border-color: #6366f1; }

/* Logo avatar in results list */
.pi-item-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  font-size: 13px;
}

/* Inline-editable text */
.pi-item-text { flex: 1; min-width: 0; }

input[type="text"].pi-edit-name,
input[type="text"].pi-edit-price {
  min-height: 24px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none;
}

.pi-edit-name {
  display: block;
  width: 100%;
  outline: none;
  font-size: 0.875rem; font-weight: 600; color: #0f172a;
  padding: 1px 3px; margin: 0 -3px;
  border-radius: 4px; line-height: 1.3;
  transition: background 0.12s, box-shadow 0.12s;
}
.pi-edit-name:focus { background: rgba(99,102,241,0.07) !important; box-shadow: 0 0 0 2px rgba(99,102,241,0.18); }

.pi-edit-meta {
  display: flex; align-items: center;
  margin-top: 2px; gap: 0;
  font-size: 0.75rem; color: #64748b;
}

input[type="text"].pi-edit-price {
  min-width: 5px !important;
  margin-right: 5px !important;
  width: 7px !important;
  border-radius: 3px;
}
.pi-edit-price {
  outline: none;
  font-size: 0.75rem; color: #64748b;
  padding: 0;
  font-variant-numeric: tabular-nums;
  transition: color 0.12s;
}
.pi-edit-price:focus { color: #4f46e5; outline: none; }
/* Empty price: show dotted underline hint */
.pi-price-empty {
  min-width: 21px !important;
  margin-right: 5px !important;
  border-bottom: 1px dotted #54585d !important;
  text-align: center;
}
.pi-edit-currency { color: #94a3b8; }
.pi-edit-sep { color: #cbd5e1; margin: 0 3px; }
.pi-edit-cycle {
  background: none; border: none; padding: 0;
  font-size: 0.75rem; color: #64748b; cursor: pointer;
  border-bottom: 1px dotted #cbd5e1; line-height: 1.2;
  transition: color 0.12s, border-color 0.12s;
}
.pi-edit-cycle:hover,
.pi-edit-cycle:focus-visible { color: #6366f1; border-bottom-color: #6366f1; }

.pi-edit-hint { font-size: 0.6875rem; color: #6366f1; margin-top: 4px; font-weight: 500; }
.pi-remaining { font-size: 0.6875rem; color: #94a3b8; margin-top: 1px; }

/* Footer */
.pi-footer {
  display: flex; gap: 0.625rem;
  padding: 0.875rem 1.25rem 1.25rem;
}
.pi-cancel-btn {
  flex: 1; padding: 0.75rem; border-radius: 0.75rem;
  border: 1px solid #fca5a5; background: transparent;
  font-size: 0.875rem; font-weight: 600; color: #ef4444; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.pi-cancel-btn:hover,
.pi-cancel-btn:focus-visible { background: #fff1f2; border-color: #f87171; }
.pi-confirm-btn {
  flex: 2; padding: 0.75rem; border-radius: 0.75rem;
  border: none; background: #6366f1;
  font-size: 0.875rem; font-weight: 700; color: #fff; cursor: pointer;
  line-height: 1.1;
  transition: background 0.15s;
}
.pi-confirm-btn:hover,
.pi-confirm-btn:focus-visible { background: #4f46e5; }

/* Dark mode */
.dark .pi-header { border-bottom-color: #334155; }
.dark .pi-title  { color: #f1f5f9; }
.dark .pi-close-btn { color: #64748b; }
.dark .pi-close-btn:hover,
.dark .pi-close-btn:focus-visible { color: #94a3b8; }

.dark .pi-item { background: #1e293b; border-color: #2d3f55; }
.dark .pi-item:hover,
.dark .pi-item:focus-visible { background: #1e3352; border-color: #4a6080; }

.dark .pi-check { border-color: #475569; }
.dark .pi-check.checked { background: #6366f1; border-color: #6366f1; }
.dark .pi-check:hover:not(.checked),
.dark .pi-check:focus-visible:not(.checked) { border-color: #818cf8; }

.dark .pi-edit-name { color: #f1f5f9; }
.dark .pi-edit-name:focus { background: rgba(99,102,241,0.15); }
.dark .pi-edit-price, .dark .pi-edit-currency, .dark .pi-edit-sep { color: #64748b; }
.dark .pi-edit-price:focus { color: #818cf8; }
.dark .pi-edit-cycle { color: #64748b; border-bottom-color: #475569; }
.dark .pi-edit-cycle:hover,
.dark .pi-edit-cycle:focus-visible { color: #818cf8; border-bottom-color: #818cf8; }

.dark .pi-edit-hint { color: #818cf8; }
.dark .pi-remaining { color: #475569; }
.dark .pi-cancel-btn { background: transparent; border-color: rgba(239,68,68,0.35); color: #f87171; }
.dark .pi-cancel-btn:hover,
.dark .pi-cancel-btn:focus-visible { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.55); }

/* ── Dropzone panels (photo + backup) ────────────────────────────────────── */
.import-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 10px;
  min-height: 140px;
  background: #fafbfc;
  border: 2px dashed #d1d5db;
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  gap: 8px;
}

.import-dropzone:hover,
.import-dropzone:focus-visible {
  border-color: #a5b4fc;
  background: #f5f3ff;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.08);
}

.import-dropzone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #9698ee;
  margin-bottom: 4px;
  transition: all 0.3s ease;
}

.import-dropzone:hover .import-dropzone-icon,
.import-dropzone:focus-visible .import-dropzone-icon {
  background: #6583e51a;
  border: 1px dashed #7c7feea1;
  color: #7c7fee;
  box-shadow: inset 0px 0px 10px #5877eb50, 0px 0px 10px #5877eb50;
  animation: rotate-cw 2s linear infinite;
}
.import-dropzone:hover .iconify,
.import-dropzone:focus-visible .iconify {
  animation: rotate-ccw 2s linear infinite;
}

@keyframes rotate-cw {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes rotate-ccw {
  from { transform: rotate(0deg) scale(0.9); }
  to { transform: rotate(-360deg) scale(0.9); }
}

.import-dropzone:active {
  transform: scale(0.98);
}


.import-dropzone-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.3;
}

.import-dropzone-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.4;
  max-width: 200px;
}

/* Dark mode dropzones */
.dark .import-dropzone {
  background: #0f172a;
  border-color: #334155;
}
.dark .import-dropzone:hover,
.dark .import-dropzone:focus-visible {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.1);
}
.dark .import-dropzone-icon {
  background: #1e293b;
  border-color: #2c384c;
  color: #a0abb9;
}
.dark .import-dropzone:hover .import-dropzone-icon,
.dark .import-dropzone:focus-visible .import-dropzone-icon {
  background: #172947;
  border-color: #4f46e5;
  color: #818cf8;
}
.dark .import-dropzone-title {
  color: #e2e8f0;
}
.dark .import-dropzone-hint {
  color: #475569;
}

/* Drag-over state for new dropzones */
.import-dropzone.drag-over {
  border-color: #6366f1 !important;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%) !important;
  box-shadow:
    0 0 0 3px rgba(99, 102, 241, 0.12),
    0 4px 16px rgba(99, 102, 241, 0.12) !important;
  animation: dragOverGlow 1.4s ease-in-out infinite;
}
.import-dropzone.drag-over .import-dropzone-icon {
  border-color: #6366f1 !important;
  background: #e0e7ff !important;
  color: #4f46e5 !important;
  animation: dragIconBounce 0.7s ease-in-out infinite alternate;
}
.import-dropzone.drag-over .import-dropzone-title {
  color: #4f46e5 !important;
}
.dark .import-dropzone.drag-over {
  border-color: #818cf8 !important;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(129, 140, 248, 0.1) 100%) !important;
  animation: dragOverGlowDark 1.4s ease-in-out infinite;
}
.dark .import-dropzone.drag-over .import-dropzone-icon {
  border-color: #818cf8 !important;
  background: rgba(99, 102, 241, 0.25) !important;
  color: #a5b4fc !important;
}
.dark .import-dropzone.drag-over .import-dropzone-title {
  color: #a5b4fc !important;
}

/* ── Empty-state import row (desktop only) ───────────────────────────────── */
.empty-import-row {
  display: none; /* controlled by JS */
}
@media (max-width: 767px) {
  .empty-import-row { display: none !important; }
}

/* ── Segmented button group ────────────────────────────────────────────────── */
.segmented-group {
  display: flex;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.segmented-btn {
  flex-direction: column;
  gap: 3px !important;
  padding: 10px 8px 12px !important;
  background: linear-gradient(to bottom, #fafbfc, #f1f5f9);
  color: #64748b;
  border: none;
  border-right: 1px solid #e2e8f0;
  border-radius: 0;
  white-space: nowrap;
}
.segmented-btn .iconify {
  width: 20px !important;
  height: 20px !important;
  color: #9c9c9c;
  transition: color 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.segmented-btn span:not(.iconify) {
  font-size: 0.675rem;
  font-weight: 500;
  line-height: 1.1;
  color: #999797;
  transition: color 0.2s ease-in-out;
}
.segmented-btn:last-child {
  border-right: none;
}

.segmented-btn:hover,
.segmented-btn:focus-visible {
  background: linear-gradient(to bottom, #fff, #f8fafc);
}
.segmented-btn:hover .iconify,
.segmented-btn:focus-visible .iconify {
  color: #4f46e5;
  transform: scale(1.1);
}
.segmented-btn:hover span:not(.iconify),
.segmented-btn:focus-visible span:not(.iconify) {
  color: #4f46e5;
}

.segmented-btn:active {
  background: #eef2ff;
}

/* Dark mode */
.dark .segmented-group {
  width: 100%;
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.dark .segmented-btn {
  background: linear-gradient(to bottom, #1e293b, #0f172a);
  border-right-color: #334155;
}
.dark .segmented-btn .iconify {
  color: #9ca1ce;
}
.dark .segmented-btn span:not(.iconify) {
  color: #9ca1ce;
}

.dark .segmented-btn:hover,
.dark .segmented-btn:focus-visible {
  background: linear-gradient(to bottom, #334155, #1e293b);
}
.dark .segmented-btn:hover .iconify,
.dark .segmented-btn:focus-visible .iconify {
  color: #c4cbed;
}
.dark .segmented-btn:hover span:not(.iconify),
.dark .segmented-btn:focus-visible span:not(.iconify) {
  color: #c4cbed;
}

.dark .segmented-btn:active {
  background: rgba(99, 102, 241, 0.15);
}
.empty-import-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0;            /* hide any stray text */
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.empty-import-btn:hover,
.empty-import-btn:focus-visible {
  border-color: #c7d2fe;
  background: #f5f3ff;
  box-shadow: 0 2px 6px rgba(99,102,241,0.1);
}
.empty-import-btn .iconify { color: #6366f1; flex-shrink: 0; }
.empty-import-btn:hover .iconify,
.empty-import-btn:focus-visible .iconify { color: #4f46e5; }
.empty-import-btn .ei-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1;
  white-space: nowrap;
}
.empty-import-btn:hover .ei-label,
.empty-import-btn:focus-visible .ei-label { color: #4f46e5; }
.dark .empty-import-btn {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.dark .empty-import-btn:hover,
.dark .empty-import-btn:focus-visible {
  border-color: #6366f1;
  background: rgba(99,102,241,0.1);
}
.dark .empty-import-btn .iconify { color: #818cf8; }
.dark .empty-import-btn .ei-label { color: #94a3b8; }
.dark .empty-import-btn:hover .ei-label,
.dark .empty-import-btn:focus-visible .ei-label { color: #a5b4fc; }

/* Empty state drag-over highlight */
#empty-state.drag-over {
  border-color: #6366f1 !important;
  background: #f8faff !important;
}
.dark #empty-state.drag-over {
  border-color: #818cf8 !important;
  background: #1e1b4b !important;
}

/* ─── Standalone PWA: extra top margin for empty state ─────────────────────── */
@media (max-width: 767px) {
  #empty-state {
    margin-top: 0.5rem;
  }
}
@media (max-width: 767px) and (display-mode: standalone) {
  #empty-state {
    margin-top: 1rem;
  }
}

/* ─── Step 2 mobile bottom bar: allow text wrap ──────────────────────────── */
@media (max-width: 767px) {
  #s2-mob-bottom button {
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    min-height: 48px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PWA Install — banner + instruction modal
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Bottom banner ───────────────────────────────────────────────────── */
.pwa-banner {
  --ttY: 100%;
  --pb: 10px;
  --bottom: 0;
  --top: 0;
  position: fixed;
  top: var(--top, 0px);
  bottom: var(--bottom, 0px);
  left: 0;
  right: 0;
  z-index: 10;
  padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + var(--pb, 10px));
  transform: translateY(var(--ttY, 100%));
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.35s ease;
  pointer-events: none;
}

.pwa-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pwa-banner-inner {
  --w-max: 480px;
  --br: 16px;
  display: flex;
  align-items: center;
  max-width: var(--w-max, 480px);
  margin-left: auto;
  margin-right: auto;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  border-radius: var(--br, 16px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.35);
  color: #fff;
}

.pwa-banner-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.9;
}

.pwa-banner-text {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.pwa-banner-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.pwa-banner-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.pwa-banner-dismiss {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.pwa-banner-dismiss:hover {
  background: rgba(255, 255, 255, 0.3);
}


@media screen and (min-width: 768px) {
  .pwa-banner {
    --ttY: -100%;
    --top: 10px;
    bottom: auto;
  }
  .pwa-banner-inner {
    --w-max: 470px;
  }
}
@media screen and (min-width: 1400px) {
  .pwa-banner {
    --ttY: 100%;
    top: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
    right: auto;
  }
  .pwa-banner-inner {
    --w-max: 360px;
    margin-left: 4px;
  }
}

@media screen and (max-width: 767.98px) {
  .pwa-banner {
    --ttY: 100%;
    --bottom: calc(env(safe-area-inset-bottom, 0px) + 60px);
    --top: auto;
    --pb: 6px;
  }
  .pwa-banner-inner {
    --w-max: 390px;
  }
}

@media screen and (max-width: 474.98px) {
  .pwa-banner {
    --bottom: calc(env(safe-area-inset-bottom, 0px) + 67px);
  }
  .pwa-banner-inner {
    --w-max: 344px;
  }
}

@media screen and (max-width: 389.98px) {
  .pwa-banner {
    --bottom: calc(env(safe-area-inset-bottom, 0px) + 60px);
   }
  .pwa-banner-inner {
    --w-max: calc(100% - 8px);
    --br: 20px;
    flex-wrap: wrap;
    display: flex;
    padding: 16px 14px 14px;
    gap: 16px 8px;
  }
  .pwa-banner-text {
    min-width: calc(100% - 34px);
    font-size: 15px;
  }
  .pwa-banner-btn {
    width: calc(100% - 28px - 8px);
    border-radius: 99px;
  }
}

@media (max-width: 269.98px) {
  .pwa-banner-text {
    font-size: 13px;
  }
  .pwa-banner-inner {
    --br: 12px;
    padding: 10px 7px 7px;
    gap: 8px;
  }
}


/* ─── Instruction modal overlay ───────────────────────────────────────── */
.pwa-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, 0);
  backdrop-filter: blur(0px);
  overscroll-behavior: contain;
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

.pwa-overlay.open {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
}

@media (min-width: 640px) {
  .pwa-overlay {
    align-items: center;
    padding: 16px;
  }
}

/* ─── Modal card ──────────────────────────────────────────────────────── */
.pwa-modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.pwa-modal.open {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .pwa-modal {
    border-radius: 24px;
    transform: scale(0.95);
    opacity: 0;
    filter: blur(4px);
    transition: transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
  }

  .pwa-modal.open {
    transform: scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

.pwa-modal-header {
  display: flex;
  flex-direction: column;
  padding: 0 20px 12px;
}
.pwa-modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
}
@media (max-width: 639px) {
  .pwa-modal-header-row { padding-top: 4px; }
}

.pwa-modal-title {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.pwa-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f1f5f9;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.pwa-modal-close:hover {
  background: #e2e8f0;
  color: #64748b;
}

/* ─── Slides carousel (crossfade + shift) ─────────────────────────────── */
.pwa-slides {
  position: relative;
  overflow: hidden;
  height: 220px;
}

.pwa-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 28px 20px;
  box-sizing: border-box;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  filter: blur(5px);
  transform: translateX(7.5%);
  pointer-events: none;
}

.pwa-slide.active {
  opacity: 1;
  filter: blur(0px);
  transform: translateX(0);
  pointer-events: auto;
}

.pwa-slide.prev {
  opacity: 0;
  filter: blur(5px);
  transform: translateX(-7.5%);
}

.pwa-slide-step {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 16px;
}

.pwa-slide-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  margin-bottom: 20px;
}

.pwa-slide-icon {
  width: 32px;
  height: 32px;
  color: #6366f1;
}

.pwa-slide-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.3;
}

.pwa-slide-text {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

/* ─── Dots ────────────────────────────────────────────────────────────── */
.pwa-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 4px 0 16px;
}

.pwa-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e2e8f0;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.pwa-dot.active {
  background: #6366f1;
  transform: scale(1.2);
}

/* ─── Navigation footer ──────────────────────────────────────────────── */
.pwa-modal-footer {
  display: flex;
  justify-content: space-between;
  padding: 0 20px 20px;
  gap: 12px;
}

.pwa-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  flex: 1;
  border: none;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.pwa-nav-prev {
  background: #f1f5f9;
  color: #64748b;
}

.pwa-nav-prev:hover:not(:disabled) {
  background: #e2e8f0;
}

.pwa-nav-prev:disabled {
  opacity: 0.35;
  cursor: default;
}

.pwa-nav-next {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
}

.pwa-nav-next:hover {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
}

/* ─── Dark mode ───────────────────────────────────────────────────────── */

.dark .pwa-banner-inner {
  background: linear-gradient(135deg, #4338ca, #6366f1);
  box-shadow: 0 8px 32px rgba(67, 56, 202, 0.4);
}

.dark .pwa-modal {
  background: #1e293b;
  box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.4);
}

.dark .pwa-modal-title {
  color: #f1f5f9;
}

.dark .pwa-modal-close {
  background: #334155;
  color: #94a3b8;
}

.dark .pwa-modal-close:hover {
  background: #475569;
  color: #cbd5e1;
}

.dark .pwa-slide-step {
  color: #64748b;
}

.dark .pwa-slide-icon-wrap {
  background: linear-gradient(135deg, #312e81, #3730a3);
}

.dark .pwa-slide-icon {
  color: #a5b4fc;
}

.dark .pwa-slide-title {
  color: #f1f5f9;
}

.dark .pwa-slide-text {
  color: #94a3b8;
}

.dark .pwa-dot {
  background: #334155;
}

.dark .pwa-dot.active {
  background: #818cf8;
}

.dark .pwa-nav-prev {
  background: #334155;
  color: #94a3b8;
}

.dark .pwa-nav-prev:hover:not(:disabled) {
  background: #475569;
}

.dark #pwa-install-settings-btn .settings-action-btn {
  background: linear-gradient(to bottom, #1e293b, #1a2235) !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

.dark #pwa-install-settings-btn .settings-action-btn:hover {
  border-color: #475569 !important;
}

.dark #pwa-install-settings-btn .settings-action-btn .text-slate-400 {
  color: #64748b !important;
}

.dark #pwa-install-settings-btn .settings-action-btn .text-slate-300 {
  color: #475569 !important;
}

/* ── Category group headers in list ──────────────────────────────────────── */
.category-group-header {
  margin-top: 4px;
}
.dark .category-group-header span {
  color: #475569;
}

/* ── AI Insight strip — quiet, non-intrusive ────────────────────────────── */
.tips-insight-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: transparent;
}
.tips-insight-icon {
  width: 13px; height: 13px;
  flex-shrink: 0;
  color: #94a3b8;
  opacity: 0.7;
}
.tips-insight-text {
  flex: 1;
  font-size: 12px;
  line-height: 1.4;
  color: #94a3b8;
}
.tips-refresh-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: #cbd5e1;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  border-radius: 4px;
  display: flex; align-items: center;
}
.tips-insight-row:hover .tips-refresh-btn { opacity: 1; }
.tips-refresh-btn:hover { color: #6366f1; }
.tips-loading-icon {
  width: 13px; height: 13px;
  color: #cbd5e1;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.dark .tips-insight-row { border-color: rgba(100, 116, 139, 0.2); }
.dark .tips-insight-text { color: #475569; }
.dark .tips-insight-icon { color: #475569; }
.dark .tips-refresh-btn { color: #334155; }
.dark .tips-refresh-btn:hover { color: #818cf8; }

/* ── Calendar ────────────────────────────────────────────────────────────── */
.cal-nav-btn:hover {
  background: rgba(99,102,241,0.1) !important;
  color: #6366f1 !important;
}
#calendar-container { overflow: hidden; }
.cal-wrapper {
  padding: 8px 4px;
}

/* ── Category group toggle chip ─────────────────────────────────────────── */
.cat-group-chip.active {
  background: #eef2ff !important;
  color: #4f46e5 !important;
  border-color: #c7d2fe !important;
}
.dark .cat-group-chip.active {
  background: #1e1b4b !important;
  color: #818cf8 !important;
  border-color: #312e81 !important;
}
.sort-bar-divider {
  width: 1px;
  height: 20px;
  background: #e2e8f0;
  flex-shrink: 0;
  align-self: center;
  margin: 0 2px;
}
.dark .sort-bar-divider {
  background: #334155;
}


/* ── Import Methods Sheet ─────────────────────────────────────────────────── */
.import-method-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 12px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: inherit;
  width: 100%;
}
.import-method-btn:hover { background: #f1f5f9; border-color: #c7d2fe; }
.import-method-btn:active { transform: scale(0.97); }
.import-method-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.import-method-label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  line-height: 1.3;
}
.dark .import-method-btn { background: #1e293b; border-color: #334155; }
.dark .import-method-btn:hover { background: #273549; border-color: #4f46e5; }
.dark .import-method-label { color: #e2e8f0; }

/* ── Mobile Add FAB (long-press to open import sheet) ─────────────────────── */
.mob-add-fab {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.mob-add-fab:active { transform: scale(0.93); box-shadow: 0 2px 8px rgba(99,102,241,0.3); }
@media (max-width: 389.98px) {
  .mob-add-fab {
    width: 48px;
    height: 48px;
  }
}

/* Mobile bottom nav buttons (mic, text, camera, import) */
.mob-nav-btn {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(to bottom, #fafbfc, #f1f5f9);
  border: 1px solid #e2e8f0 !important;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mob-nav-btn:active { transform: scale(0.93); }
.dark .mob-nav-btn {
  background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

/* ── Viz mode toggle (Subscriptions / Categories) ────────────────────────── */
.viz-mode-toggle {
  background: linear-gradient(to bottom, #e2e8f0, #cbd5e1) !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.dark .viz-mode-toggle {
  background: linear-gradient(to bottom, #1e293b, #0f172a) !important;
  border: 1px solid #334155 !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

/* Sliding indicator */
.viz-mode-slider {
  position: absolute;
  top: 2px;
  height: calc(100% - 4px);
  border-radius: 0.5rem;
  background: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  pointer-events: none;
}
.dark .viz-mode-slider {
  background: linear-gradient(to bottom, #334155, #1e293b);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.viz-mode-btn {
  background: transparent !important;
  border: none;
  cursor: pointer;
  color: #64748b;
  font-family: inherit;
  transition: color 0.25s ease;
  position: relative;
}
.viz-mode-btn.active {
  color: #4f46e5;
}
.dark .viz-mode-btn { color: #64748b; }
.dark .viz-mode-btn.active { color: #a5b4fc; }

/* ── Presets browser "Add custom" tooltip ───────────────────────────────── */
.presets-add-tooltip {
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  white-space: nowrap;
  background: #1e293b;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 7px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
/* Show only on devices that support hover (mouse), not touch */
@media (hover: hover) {
  .group:hover .presets-add-tooltip { opacity: 1; }
}

/* ── Default screen setting buttons ─────────────────────────────────────── */
#default-screen-1-btn.active,
#default-screen-2-btn.active {
  background: white;
  color: #4f46e5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.dark #default-screen-1-btn.active,
.dark #default-screen-2-btn.active {
  background: #334155;
  color: #818cf8;
}

/* ── File import dropzone ─────────────────────────────────────────────────── */
#file-import-dropzone { cursor: pointer; }
#file-import-dropzone input { cursor: pointer; }

/* ── Icon Picker ─────────────────────────────────────────────────────────── */
.icon-tile {
  cursor: pointer;
  user-select: none;
}
/* No scale on hover — Iconify renders at a fixed pixel size, so scaling up just
   resamples it and the glyph goes soft. The tile background already reacts. */
#icon-picker-grid::-webkit-scrollbar { width: 4px; }
#icon-picker-grid::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

/* Icon picker: explicit theme-aware backgrounds (Tailwind CDN can't scan dynamic innerHTML) */
#icon-picker-panel .modal-content {
  background: #ffffff;
}
#icon-picker-panel .modal-content > .icon-picker-header {
  background: rgba(248, 250, 252, 0.8);
  border-color: #f1f5f9;
}
#icon-picker-panel .modal-content > .icon-picker-bottom {
  background: #ffffff;
  border-color: #f1f5f9;
}
.dark #icon-picker-panel .modal-content {
  background: #1e293b;
}
.dark #icon-picker-panel .modal-content > .icon-picker-header {
  background: rgba(30, 41, 59, 0.9);
  border-color: #334155;
}
.dark #icon-picker-panel .modal-content > .icon-picker-bottom {
  background: #1e293b;
  border-color: #334155;
}

/* When icon picker is open: push modal-panel into background */
#modal-panel .modal-content {
  transition: filter 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.32s ease;
}
body.icon-picker-open #modal-panel .modal-content.active {
  filter: blur(2px);
  transform: translateY(-5px) scale(0.95);
}

/* favicon-preview clickable hint */
.favicon-preview-btn {
  position: relative;
}
.favicon-preview-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  background: rgba(99,102,241,0);
  transition: background 0.15s;
}
.favicon-preview-btn:hover::after {
  background: rgba(99,102,241,0.08);
}

/* Share-statistics switch (Settings → Privacy) */
.stats-switch {
  position: relative;
  display: block;
  width: 40px;
  height: 24px;
  margin-top: 6px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.2s ease;
}
.stats-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.stats-toggle-row.on .stats-switch { background: #6366f1; }
.stats-toggle-row.on .stats-switch-knob { transform: translateX(16px); }
.dark .stats-switch { background: #475569; }
.dark .stats-toggle-row.on .stats-switch { background: #6366f1; }

/* ── Statistics notice — shown once, on first run ───────────────────────── */
/* Plain CSS on purpose: app/tailwind.css is a frozen build, so new utility
   classes would not exist in it. */
.stats-notice {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(140%);
  width: calc(100% - 32px);
  max-width: 440px;
  z-index: 9998;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12);
  opacity: 0;
  transition: transform 0.42s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.32s ease;
}
.stats-notice.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.stats-notice-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  color: #6366f1;
}
.stats-notice-body { flex: 1; min-width: 0; }
.stats-notice-text {
  font-size: 12.5px;
  line-height: 1.45;
  color: #475569;
  margin-bottom: 9px;
}
.stats-notice-actions { display: flex; gap: 8px; }
.stats-notice-btn {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.stats-notice-btn.primary { background: #6366f1; color: #fff; }
.stats-notice-btn.primary:hover { background: #4f46e5; }
.stats-notice-btn.ghost { background: transparent; color: #64748b; }
.stats-notice-btn.ghost:hover { background: rgba(148, 163, 184, 0.14); color: #334155; }

.dark .stats-notice {
  background: #1e293b;
  border-color: rgba(100, 116, 139, 0.3);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.dark .stats-notice-text { color: #cbd5e1; }
.dark .stats-notice-btn.ghost { color: #94a3b8; }
.dark .stats-notice-btn.ghost:hover { background: rgba(148, 163, 184, 0.16); color: #e2e8f0; }
