/* Plain CSS that doesn't need Tailwind: Alpine cloak, library theming. */
[x-cloak] { display: none !important; }

/* Toasts (Notyf) in the app's look. */
.notyf__toast { border-radius: 14px !important; box-shadow: 0 12px 32px -8px rgba(0,0,0,.25) !important; padding: 0 14px !important; }
.notyf__wrapper { padding: 12px 4px !important; }
.notyf__message { font: 500 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; letter-spacing: -0.01em; }

/* Tom Select: match .sd-input and sit above sheets/modals. */
.ts-wrapper { width: 100%; }
.ts-wrapper .ts-control { min-height: 2.5rem; border-radius: .625rem; border: 1px solid var(--hairline, rgba(0,0,0,.08)); background: var(--surface-2, #fff); box-shadow: none; padding: .4rem .75rem; font-size: .9375rem; color: var(--label, #1d1d1f); display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.ts-wrapper.focus .ts-control { border-color: var(--blue, #0071e3); box-shadow: 0 0 0 4px rgba(0,113,227,.15); }
.ts-wrapper .ts-control > input { color: inherit; font-size: .9375rem; }
.ts-dropdown { border-radius: .875rem; border: 1px solid var(--hairline, rgba(0,0,0,.08)); box-shadow: 0 16px 40px -12px rgba(0,0,0,.22); overflow: hidden; z-index: 9999 !important; background: var(--surface, #fff); color: var(--label, #1d1d1f); }
.ts-dropdown .ts-dropdown-content { max-height: 260px; padding: .25rem; }
.ts-dropdown .option { border-radius: .5rem; padding: .45rem .65rem; font-size: .875rem; cursor: pointer; }
.ts-dropdown .active, .ts-dropdown .option:hover { background: var(--fill, rgba(118,118,128,.12)); color: inherit; }
.ts-dropdown .selected { font-weight: 600; color: var(--blue-text, #0071e3); }
.ts-wrapper.multi .ts-control > div { border-radius: 999px; background: var(--fill, rgba(118,118,128,.12)); color: inherit; padding: 2px 8px; font-size: .8125rem; }
.ts-wrapper .clear-button { margin-left: auto; opacity: .55; cursor: pointer; font-size: 1rem; padding: 0 .25rem; }
.ts-wrapper .clear-button:hover { opacity: 1; }
.dark .ts-wrapper .ts-control, .dark .ts-dropdown { border-color: rgba(255,255,255,.1); }
.dark .ts-control input { color: #f5f5f7; }

/* Built-in RichText Editor */
.sd-rte { border: 1px solid var(--hairline, rgba(0,0,0,.08)); border-radius: .75rem; background: var(--surface-2, #fff); overflow: hidden; }
.sd-rte-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; padding: .4rem .5rem; border-bottom: 1px solid var(--hairline, rgba(0,0,0,.08)); background: var(--fill, #f5f5f7); }
.sd-rte-btn { display: inline-flex; align-items: center; justify-content: center; height: 1.85rem; min-width: 1.85rem; padding: 0 .45rem; border-radius: .45rem; font-size: .8125rem; font-weight: 600; color: var(--label-2, #6e6e73); cursor: pointer; transition: background .12s, color .12s; }
.sd-rte-btn:hover { background: var(--surface, #fff); color: var(--label, #1d1d1f); }
.sd-rte-btn.is-on { background: var(--surface, #fff); color: var(--blue-text, #0071e3); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.sd-rte-body { min-height: 220px; max-height: 460px; overflow-y: auto; padding: .75rem .9rem; outline: none; font-size: .9375rem; line-height: 1.6; color: var(--label, #1d1d1f); }
.sd-rte-body:empty::before { content: attr(data-placeholder); color: var(--label-4, #aeaeb2); pointer-events: none; }
.sd-rte-body h2 { font-size: 1.25rem; font-weight: 700; margin: .75rem 0 .35rem; }
.sd-rte-body h3 { font-size: 1.05rem; font-weight: 600; margin: .65rem 0 .25rem; }
.sd-rte-body ul { list-style: disc; padding-left: 1.4rem; margin: .5rem 0; }
.sd-rte-body ol { list-style: decimal; padding-left: 1.4rem; margin: .5rem 0; }
.sd-rte-body blockquote { border-left: 3px solid var(--blue, #0071e3); padding-left: .75rem; color: var(--label-2, #6e6e73); margin: .5rem 0; }
.sd-rte-body a { color: var(--blue-text, #0071e3); text-decoration: underline; }

/* Loading bar for AJAX work. */
#sd-progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 100; background: linear-gradient(90deg, #ffe600, #0071e3); transform-origin: left; transform: scaleX(0); opacity: 0; transition: transform .4s cubic-bezier(.16,1,.3,1), opacity .3s; }
#sd-progress.on { opacity: 1; transform: scaleX(.7); transition-duration: 8s; }
#sd-progress.done { opacity: 0; transform: scaleX(1); transition-duration: .25s; }

/* Smooth page & card transitions matching Next.js motion */
@keyframes sd-page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: sd-page-in .22s cubic-bezier(0.22, 1, 0.36, 1) both; }
.sd-card { transition: box-shadow .18s ease, transform .18s cubic-bezier(0.22, 1, 0.36, 1); }

/* Apple-design perceived speed: zero 300ms tap delay + instant press feedback */
a, button, select, input, textarea, [role="button"], .sd-btn, .sd-chip {
  touch-action: manipulation;
}
.sd-btn:active:not(:disabled), .sd-chip:active:not(:disabled) {
  transform: scale(0.97);
}
.sd-table tbody tr:active {
  background-color: var(--fill, rgba(118,118,128,.1));
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Mobile scroll-aware tab bar & large title collapse (matching Next.js globals.css). */
@media (max-width: 1023px) {
  .mobile-tab-bar { transition: transform .22s cubic-bezier(.16,1,.3,1), opacity .18s ease; }
  html[data-scroll-dir="down"] .mobile-tab-bar { transform: translateY(100%); opacity: 0; pointer-events: none; }
}
@media (max-width: 639px) {
  .app-topbar .app-bar-title { opacity: 0; transition: opacity .15s ease; }
  html[data-title-collapsed] .app-topbar .app-bar-title { opacity: 1; }
  .app-largetitle { transition: opacity .15s ease; }
  html[data-title-collapsed] .app-largetitle { opacity: 0.15; }
}
