:root {
  color-scheme: dark;
}

.site-card {
  box-shadow: 0 18px 36px -28px rgba(0, 0, 0, 0.46);
}

.site-panel {
  box-shadow: 0 24px 52px -30px rgba(0, 0, 0, 0.58);
}

.site-cta {
  isolation: isolate;
  background-color: #0f172a;
  background-image: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.95) 52%, rgba(30, 41, 59, 0.92)), radial-gradient(circle at top left, rgba(37, 99, 235, 0.22), transparent 34%), radial-gradient(circle at 82% 18%, rgba(59, 130, 246, 0.16), transparent 28%);
  border: 1px solid rgba(96, 165, 250, 0.14);
  box-shadow: 0 30px 72px -42px rgba(15, 23, 42, 0.9), 0 18px 34px -26px rgba(0, 0, 0, 0.5);
}

.site-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 42%), linear-gradient(180deg, rgba(148, 163, 184, 0.08), transparent 36%), radial-gradient(circle at top right, rgba(96, 165, 250, 0.2), transparent 32%);
  pointer-events: none;
  z-index: 0;
}

.site-cta > * {
  position: relative;
  z-index: 1;
}

.portal-btn {
  appearance: none;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 600;
  justify-content: center;
  line-height: 1.25rem;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.portal-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.28);
}

.portal-btn-primary {
  background-color: #e2e8f0;
  border-color: #e2e8f0;
  color: #0f172a;
}

.portal-btn-primary:hover {
  background-color: #cbd5e1;
  color: #0f172a;
}

.portal-btn-secondary {
  background-color: transparent;
  border-color: #475569;
  color: #e2e8f0;
}

.portal-btn-secondary:hover {
  background-color: #1e293b;
  color: #f8fafc;
}

.portal-btn-danger {
  background-color: rgba(136, 19, 55, 0.2);
  border-color: rgba(159, 18, 57, 0.5);
  color: #fda4af;
}

.portal-btn-danger:hover {
  background-color: rgba(136, 19, 55, 0.32);
  color: #ffe4e6;
}

.portal-btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
}

.portal-btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.125rem;
}

.portal-btn-md {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.portal-btn-lg {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.portal-btn:disabled,
.portal-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}

.portal-shell select {
  appearance: none;
  background-color: rgb(15 23 42);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%2364758B' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 0.55rem center;
  background-repeat: no-repeat;
  background-size: 14px;
  border-color: #334155;
  border-radius: 0.5rem;
  color: #e2e8f0;
  font-size: 0.875rem;
  line-height: 1.2;
  padding-bottom: 0.45rem;
  padding-right: 2rem;
  padding-top: 0.45rem;
}

.portal-shell select:hover {
  border-color: #475569;
}

.portal-shell select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.24);
  outline: none;
}

.portal-shell .bg-white {
  background-color: rgb(15 23 42);
}

.portal-shell .bg-slate-50 {
  background-color: #1e293b;
}

.portal-shell .border-slate-200,
.portal-shell .divide-slate-200 > :not([hidden]) ~ :not([hidden]),
.portal-shell .divide-slate-100 > :not([hidden]) ~ :not([hidden]) {
  border-color: #334155;
}

.portal-shell .text-slate-900 {
  color: #f8fafc;
}

.portal-shell .text-slate-800,
.portal-shell .text-slate-700 {
  color: #e2e8f0;
}

.portal-shell .text-slate-600,
.portal-shell .text-slate-500 {
  color: #cbd5e1;
}

.portal-shell .text-slate-400 {
  color: #94a3b8;
}

.portal-shell .text-blue-700 {
  color: #dbeafe;
}

.portal-shell .text-rose-700 {
  color: #e2e8f0;
}

.portal-shell .text-blue-800,
.portal-shell .text-blue-900 {
  color: #bfdbfe;
}

.portal-shell .text-rose-800,
.portal-shell .text-rose-900 {
  color: #fda4af;
}

.portal-shell .bg-blue-100 {
  background-color: rgba(29, 78, 216, 0.28);
}

.portal-shell .bg-rose-100 {
  background-color: rgba(136, 19, 55, 0.35);
}

.portal-shell .text-amber-700,
.portal-shell .text-amber-800 {
  color: #fcd34d;
}

.portal-shell .bg-amber-100,
.portal-shell .bg-amber-50 {
  background-color: rgba(120, 53, 15, 0.35);
}

.portal-shell .text-emerald-700,
.portal-shell .text-emerald-800 {
  color: #6ee7b7;
}

.portal-shell .bg-emerald-100 {
  background-color: rgba(6, 78, 59, 0.35);
}

.portal-shell .hover\:bg-slate-100:hover {
  background-color: #1e293b;
}

.portal-shell .border-slate-300 {
  border-color: #475569;
}

.portal-shell .text-sky-800 {
  color: #e2e8f0;
}

.portal-shell .hover\:text-sky-700:hover {
  color: #7dd3fc;
}

.portal-shell .hover\:border-sky-300:hover {
  border-color: #38bdf8;
}

.portal-shell .bg-slate-200 {
  background-color: #334155;
}

.portal-shell .text-sky-700 {
  color: #e2e8f0;
}

.portal-shell .text-sky-900 {
  color: #f1f5f9;
}

.portal-shell .bg-sky-100 {
  background-color: rgba(7, 89, 133, 0.35);
}

.portal-shell .bg-blue-50 {
  background-color: rgba(37, 99, 235, 0.18);
}

.portal-shell .bg-rose-50 {
  background-color: rgba(136, 19, 55, 0.2);
}

.portal-shell .bg-emerald-50 {
  background-color: rgba(6, 78, 59, 0.2);
}

.portal-shell .border-blue-200 {
  border-color: rgba(96, 165, 250, 0.45);
}

.portal-shell .border-rose-200 {
  border-color: rgba(159, 18, 57, 0.5);
}

.portal-shell .border-emerald-200 {
  border-color: rgba(6, 95, 70, 0.5);
}

.portal-shell .hover\:text-blue-600:hover {
  color: #dbeafe;
}

.portal-shell .hover\:text-rose-600:hover {
  color: #f8fafc;
}

.portal-shell .border-sky-300 {
  border-color: #38bdf8;
}

.portal-shell .hover\:bg-sky-50:hover {
  background-color: rgba(7, 89, 133, 0.25);
}

.portal-shell .text-slate-700 {
  color: #e2e8f0;
}

.portal-shell input,
.portal-shell textarea,
.portal-shell select {
  background-color: rgb(15 23 42);
  border-color: #334155;
  color: #e2e8f0;
}

/* HTMX progress bar */
#htmx-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: #1d4ed8; /* blue-700 */
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.15s ease;
  border-radius: 0 2px 2px 0;
}

#htmx-progress.active {
  opacity: 1;
  animation: htmx-progress-slide 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

#htmx-progress.done {
  width: 100% !important;
  opacity: 0;
  animation: none;
  transition: width 0.1s ease, opacity 0.3s ease 0.1s;
}

@keyframes htmx-progress-slide {
  0%   { width: 0;    margin-left: 0; }
  40%  { width: 50%;  margin-left: 10%; }
  80%  { width: 30%;  margin-left: 70%; }
  100% { width: 0;    margin-left: 100%; }
}

/* Native dialog styling */
dialog {
  border: none;
  padding: 0;
  max-width: calc(100vw - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}

dialog::backdrop {
  background: rgb(2 6 23 / 0.45);
}

/* Conditional service form fields */
form:has(#billing_mode option[value="included_hours"]:checked) #included-hours-fields {
  display: grid !important;
}

form:has(#carryover_enabled:checked) #carryover-expiry-field {
  display: block !important;
}

/* Sidebar drawer — checkbox state machine */
/* Default: hamburger visible, close hidden */
#sidebar-open ~ header [data-icon="close"] { display: none; }

/* When open: show close icon, hide hamburger */
#sidebar-open:checked ~ header [data-icon="hamburger"] { display: none; }
#sidebar-open:checked ~ header [data-icon="close"] { display: block !important; }

/* Backdrop: hidden by default, shown when open (on mobile only) */
#sidebar-backdrop { display: none; }
@media (max-width: 1023px) {
  #sidebar-open:checked ~ #sidebar-backdrop { display: block; }
}

/* Drawer: open when checked */
#sidebar-open:checked ~ #sidebar-drawer { transform: translateX(0); }
