/* Tomatoes – custom styles */
:root {
  --tomatoes-bg: #fff;
  --tomatoes-text: #000;
  --tomatoes-border: #000;
  --tomatoes-muted: #6b7280;
  --accent: #dc2626;
  --accent-hover: #b91c1c;
}
/* Theme/accent colors */
[data-accent="red"] { --accent: #dc2626; --accent-hover: #b91c1c; }
[data-accent="blue"] { --accent: #2563eb; --accent-hover: #1d4ed8; }
[data-accent="green"] { --accent: #16a34a; --accent-hover: #15803d; }
[data-accent="purple"] { --accent: #7c3aed; --accent-hover: #6d28d9; }
[data-accent="orange"] { --accent: #ea580c; --accent-hover: #c2410c; }
[data-accent="teal"] { --accent: #0d9488; --accent-hover: #0f766e; }
.text-accent { color: var(--accent) !important; }
.hover\:text-accent:hover { color: var(--accent) !important; }
.bg-accent { background-color: var(--accent) !important; }
.theme-dark .text-accent { color: var(--accent) !important; }
.theme-dark .hover\:text-accent:hover { color: var(--accent) !important; }

.theme-dark { background-color: #111 !important; color: #f3f4f6 !important; }
.theme-dark .border-black { border-color: #e5e7eb !important; }
.theme-dark .text-black { color: #f3f4f6 !important; }
.theme-dark .text-gray-500 { color: #9ca3af !important; }
.theme-dark .text-gray-400 { color: #6b7280 !important; }
.theme-dark .bg-white { background-color: #111 !important; }
.theme-dark .bg-gray-100 { background-color: #1f2937 !important; }
.theme-dark input, .theme-dark select { color: inherit; }
.theme-dark .hover\:text-gray-500:hover { color: #9ca3af !important; }
.theme-dark .hover\:text-accent:hover { color: var(--accent) !important; }
.theme-dark .hover\:bg-gray-100:hover { background-color: #374151 !important; }

::selection { background-color: #000; color: #fff; }
.theme-dark ::selection { background-color: #fff; color: #000; }
.intercepted-theme ::selection { background-color: #fff; color: #000; }

input::placeholder { color: #e5e7eb; }
.theme-dark input::placeholder { color: #6b7280; }
.intercepted-theme input::placeholder { color: #1f2937; }

.view { display: none; }
.view.active { display: flex; }

/* Sticky top/bottom bars – liquid glass (reference: backdrop blur + frost + shadows) */
.sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  overflow: hidden;
  border-radius: 0;
  background: hsl(0 0% 100% / 0.06);
  backdrop-filter: url(#glass-distort) blur(6px) saturate(1.2);
  -webkit-backdrop-filter: url(#glass-distort) blur(6px) saturate(1.2);
  box-shadow:
    0 0 1px 0 hsl(0 0% 0% / 0.06) inset,
    0 0 8px 2px hsl(0 0% 0% / 0.03) inset,
    0 2px 12px rgba(17, 17, 26, 0.04),
    0 4px 20px rgba(17, 17, 26, 0.03);
}
.theme-dark .sticky-bar,
.intercepted-theme .sticky-bar {
  background: hsl(0 0% 0% / 0.05);
  box-shadow:
    0 0 1px 0 hsl(0 0% 100% / 0.08) inset,
    0 0 8px 2px hsl(0 0% 100% / 0.04) inset,
    0 2px 12px rgba(0, 0, 0, 0.25),
    0 4px 20px rgba(0, 0, 0, 0.15);
}
.sticky-top {
  top: 0;
  padding-bottom: 0.75rem;
}
.sticky-bottom {
  bottom: 0;
  padding-top: 0.75rem;
  min-height: 64px;
}
.sticky-bar canvas {
  display: none;
}
.sticky-bar-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
}
.sticky-bottom-bar-left {
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  color: var(--tomatoes-muted, #6b7280);
  max-width: 20rem;
}
#sticky-bottom-bar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.theme-dark .sticky-bottom-bar-left,
.intercepted-theme .sticky-bottom-bar-left { color: #9ca3af; }
.sticky-bar-title {
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: -0.025em;
}
.sticky-bar-nav {
  display: flex;
  gap: 1rem;
}
.sticky-bar-nav.hidden {
  display: none;
}
.sticky-bar-btn {
  background: none;
  border: none;
  font: inherit;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  cursor: pointer;
  padding: 0;
}
.sticky-bar-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}
#sticky-bottom-bar-actions .sticky-bar-btn {
  font-size: 1rem;
}
@media (min-width: 640px) {
  #sticky-bottom-bar-actions .sticky-bar-btn {
    font-size: 1.25rem;
  }
}
.theme-dark .sticky-bar-title,
.theme-dark .sticky-bar-btn { color: #f3f4f6; }
.theme-dark .sticky-bar-btn:hover { color: var(--accent); }
.intercepted-theme .sticky-bar-title,
.intercepted-theme .sticky-bar-btn { color: #fff; }
.intercepted-theme .sticky-bar-btn:hover { color: var(--accent); }

/* View padding so content scrolls below/above sticky bars */
.view {
  padding-top: calc(56px + env(safe-area-inset-top, 0) + 1rem);
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0) + 1rem);
}

/* Background presets (wallpapers) */
.bg-preset-none { background-image: none !important; background-color: inherit; }
.bg-preset-sunset {
  background-image: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 50%, #c44569 100%) !important;
  background-size: cover !important; background-position: center !important; background-attachment: fixed !important;
}
.bg-preset-ocean {
  background-image: linear-gradient(160deg, #0ea5e9 0%, #06b6d4 40%, #0d9488 100%) !important;
  background-size: cover !important; background-position: center !important; background-attachment: fixed !important;
}
.bg-preset-forest {
  background-image: linear-gradient(180deg, #14532d 0%, #166534 30%, #22c55e 100%) !important;
  background-size: cover !important; background-position: center !important; background-attachment: fixed !important;
}
.bg-preset-lavender {
  background-image: linear-gradient(135deg, #e9d5ff 0%, #c084fc 50%, #a855f7 100%) !important;
  background-size: cover !important; background-position: center !important; background-attachment: fixed !important;
}
.bg-preset-slate {
  background-image: linear-gradient(180deg, #475569 0%, #64748b 50%, #94a3b8 100%) !important;
  background-size: cover !important; background-position: center !important; background-attachment: fixed !important;
}
.bg-preset-aurora {
  background-image: linear-gradient(160deg, #134e4a 0%, #0d9488 30%, #67e8f9 70%, #a5f3fc 100%) !important;
  background-size: cover !important; background-position: center !important; background-attachment: fixed !important;
}
.bg-preset-warm-sand {
  background-image: linear-gradient(180deg, #fef3c7 0%, #fde68a 40%, #f59e0b 100%) !important;
  background-size: cover !important; background-position: center !important; background-attachment: fixed !important;
}
.theme-dark.bg-preset-sunset,
.theme-dark.bg-preset-ocean,
.theme-dark.bg-preset-forest,
.theme-dark.bg-preset-lavender,
.theme-dark.bg-preset-slate,
.theme-dark.bg-preset-aurora,
.theme-dark.bg-preset-warm-sand {
  box-shadow: inset 0 0 0 100vmax rgba(0,0,0,0.35);
}

/* Restore session banner – below sticky top bar on mobile, liquid glass */
.restore-session-banner {
  margin-top: 0.5rem;
  background: hsl(45 90% 96% / 0.75);
  backdrop-filter: url(#glass-distort) blur(10px) saturate(1.2);
  -webkit-backdrop-filter: url(#glass-distort) blur(10px) saturate(1.2);
  border: 1px solid hsl(45 70% 85% / 0.8);
  box-shadow:
    0 0 1px 0 hsl(0 0% 0% / 0.06) inset,
    0 0 12px 4px hsl(0 0% 0% / 0.03) inset,
    0 4px 20px rgba(17, 17, 26, 0.08),
    0 8px 28px rgba(17, 17, 26, 0.06);
}
@media (max-width: 640px) {
  .restore-session-banner {
    margin-top: 4rem;
  }
}
.theme-dark .restore-session-banner {
  background: hsl(45 20% 18% / 0.8);
  border-color: hsl(45 25% 30% / 0.6);
  box-shadow:
    0 0 1px 0 hsl(0 0% 100% / 0.08) inset,
    0 0 12px 4px hsl(0 0% 100% / 0.04) inset,
    0 4px 20px rgba(0, 0, 0, 0.3),
    0 8px 28px rgba(0, 0, 0, 0.2);
}

/* Recent tasks dropdown – below input, liquid glass */
.recent-tasks-dropdown-glass {
  background: hsl(0 0% 100% / 0.08);
  backdrop-filter: url(#glass-distort) blur(8px) saturate(1.2);
  -webkit-backdrop-filter: url(#glass-distort) blur(8px) saturate(1.2);
  box-shadow:
    0 0 1px 0 hsl(0 0% 0% / 0.06) inset,
    0 4px 20px rgba(17, 17, 26, 0.08),
    0 8px 32px rgba(17, 17, 26, 0.06);
}
.recent-tasks-dropdown-glass button {
  background: transparent;
}
.recent-tasks-dropdown-glass button:hover {
  background: hsl(0 0% 0% / 0.04);
}
.theme-dark .recent-tasks-dropdown-glass {
  background: hsl(0 0% 0% / 0.25);
  border-color: rgba(255,255,255,0.12);
  box-shadow:
    0 0 1px 0 hsl(0 0% 100% / 0.08) inset,
    0 4px 20px rgba(0, 0, 0, 0.3),
    0 8px 32px rgba(0, 0, 0, 0.2);
}
.theme-dark .recent-tasks-dropdown-glass button:hover {
  background: hsl(0 0% 100% / 0.06);
}

/* Custom popup (replaces browser alert/confirm) – liquid glass */
.custom-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: hsl(0 0% 0% / 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.custom-popup-overlay.hidden {
  display: none;
}
.custom-popup {
  max-width: 24rem;
  width: 100%;
  padding: 1.5rem 1.5rem 1.25rem;
  border-radius: 16px;
  background: hsl(0 0% 100% / 0.12);
  backdrop-filter: url(#glass-distort) blur(16px) saturate(1.2);
  -webkit-backdrop-filter: url(#glass-distort) blur(16px) saturate(1.2);
  border: 1px solid hsl(0 0% 0% / 0.08);
  box-shadow:
    0 0 1px 0 hsl(0 0% 0% / 0.08) inset,
    0 0 12px 4px hsl(0 0% 0% / 0.04) inset,
    0 4px 24px rgba(17, 17, 26, 0.12),
    0 12px 40px rgba(17, 17, 26, 0.1),
    0 16px 56px rgba(17, 17, 26, 0.08);
}
.theme-dark .custom-popup {
  background: hsl(0 0% 0% / 0.35);
  border-color: hsl(0 0% 100% / 0.1);
  box-shadow:
    0 0 1px 0 hsl(0 0% 100% / 0.1) inset,
    0 0 12px 4px hsl(0 0% 100% / 0.05) inset,
    0 4px 24px rgba(0, 0, 0, 0.4),
    0 12px 40px rgba(0, 0, 0, 0.3),
    0 16px 56px rgba(0, 0, 0, 0.25);
}
.custom-popup-message {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  line-height: 1.4;
  color: var(--tomatoes-text, #000);
}
.custom-popup-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}
.custom-popup-buttons button {
  font: inherit;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  padding: 0.5rem 1rem;
  border: 2px solid var(--tomatoes-border, #000);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.custom-popup-buttons button:hover {
  background: var(--tomatoes-border, #000);
  color: var(--tomatoes-bg, #fff);
}
.custom-popup-buttons button.popup-primary {
  border-color: var(--accent);
  color: var(--accent);
}
.custom-popup-buttons button.popup-primary:hover {
  background: var(--accent);
  color: #fff;
}
.theme-dark .custom-popup-message { color: #f3f4f6; }
.theme-dark .custom-popup-buttons button { border-color: #e5e7eb; color: #f3f4f6; }
.theme-dark .custom-popup-buttons button:hover { background: #e5e7eb; color: #111; }
.theme-dark .custom-popup-buttons button.popup-primary { border-color: var(--accent); color: var(--accent); }
.theme-dark .custom-popup-buttons button.popup-primary:hover { background: var(--accent); color: #fff; }

/* Task input: use full width on small screens so placeholder "Enter task and press Start" is visible */
.task-input-wrap { min-width: 0; box-sizing: border-box; }
@media (max-width: 640px) {
  #view-intent .task-input-wrap {
    width: calc(100% + 1rem);
    max-width: none;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  #task-input { font-size: 1.5rem; } /* slightly smaller on very small screens so placeholder fits */
}

input[type="checkbox"].minimal {
    appearance: none;
    background-color: transparent;
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid black;
    display: grid;
    place-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.theme-dark input[type="checkbox"].minimal { border-color: #fff; }
input[type="checkbox"].minimal::before {
    content: "";
    width: 0.875rem;
    height: 0.875rem;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em black;
    background-color: black;
}
.theme-dark input[type="checkbox"].minimal::before { box-shadow: inset 1em 1em #fff; background-color: #fff; }
input[type="checkbox"].minimal:checked::before { transform: scale(1); }

input[type="number"].minimal-input {
    appearance: textfield;
    border: none;
    border-bottom: 2px solid black;
    background: transparent;
    outline: none;
    font-weight: bold;
    text-align: right;
    width: 4rem;
    border-radius: 0;
    padding: 0.25rem 0;
}
.theme-dark input[type="number"].minimal-input { border-bottom-color: #fff; }
input[type="number"].minimal-input::-webkit-outer-spin-button,
input[type="number"].minimal-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

select.minimal-select {
    appearance: none;
    border: none;
    border-bottom: 2px solid var(--accent);
    background: transparent;
    outline: none;
    font-weight: bold;
    text-transform: uppercase;
    padding: 0.5rem 1.5rem 0.5rem 0;
    border-radius: 0;
    cursor: pointer;
    color: inherit;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22currentColor%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.2rem top 50%;
    background-size: 0.65rem auto;
}
select.minimal-select { color: var(--accent); }
.theme-dark select.minimal-select { border-bottom-color: var(--accent); color: var(--accent); }

input[type="file"].minimal-file::file-selector-button {
    border: 2px solid black;
    background: transparent;
    padding: 0.5rem 1rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 1rem;
}
input[type="file"].minimal-file::file-selector-button:hover { background: black; color: white; }
.theme-dark input[type="file"].minimal-file::file-selector-button { border-color: #fff; color: #fff; }
.theme-dark input[type="file"].minimal-file::file-selector-button:hover { background: #fff; color: #000; }

@media (prefers-reduced-motion: reduce) {
    input[type="checkbox"].minimal::before { transition: none; }
}
