/* ─────────────────────────────────────────────────────────────────────────
   Theme Configuration: CSS Variables & Global Styles
   ────────────────────────────────────────────────────────────────────────── */

:root {
    /* Success */
    --color-success-600: #16A34A;
    --color-success-700: #15803D;
    
    /* Error */
    --color-error-600: #DC2626;
    --color-error-700: #B91C1C;
    
    /* Warning */
    --color-warning-600: #EAB308;
    --color-warning-700: #CA8A04;
    
    /* Info */
    --color-info-600: #0EA5E9;
    --color-info-700: #0284C7;
    
    /* Dark / Sidebar */
    --color-dark-900: #0F172A;
    --color-dark-800: #111827;
    --color-dark-700: #334155;
    
    /* Light / Background */
    --color-light-50: #F9FAFB;
    --color-light-100: #F3F4F6;
    --color-white: #FFFFFF;
    
    /* Text */
    --color-text-900: #111827;
    --color-text-700: #374151;
    --color-text-500: #6B7280;
    --color-text-100: #F3F4F6;
    
    /* Border */
    --color-border-200: #E5E7EB;
    --color-border-300: #D1D5DB;
    
    /* Shared application surfaces */
    --app-bg: #F8FAFC;
    --app-surface: #FFFFFF;
    --app-surface-raised: #FFFFFF;
    --app-surface-muted: #F1F5F9;
    --app-border: #E2E8F0;
    --app-border-strong: #CBD5E1;
    --app-text: #0F172A;
    --app-text-muted: #64748B;
    --app-brand: #0D9488;
    --app-brand-strong: #0F766E;

    /* Legacy aliases now resolve to the application brand. */
    --color-accent-indigo: #0D9488;
    --color-accent-purple: #9333EA;

    /* ── Form sizing ── (change here → updates every form in the app) */
    --form-font-size:    0.9375rem;   /* input / select text  (15px) */
    --form-label-size:   0.8125rem;   /* field label text     (13px) */
    --form-input-height: 2.4rem;      /* input / select height       */
    --form-section-label-size: 0.75rem; /* section heading size (12px) */
}

/* ─────────────────────────────────────────────────────────────────────────
   Global Styles
   ────────────────────────────────────────────────────────────────────────── */

body {
    background-color: var(--app-bg);
    color: var(--app-text);
    font-family: 'Outfit', sans-serif;
}

html {
    color-scheme: light;
}

html.dark {
    color-scheme: dark;
    --app-bg: #0F172A;
    --app-surface: #111827;
    --app-surface-raised: #1E293B;
    --app-surface-muted: #172333;
    --app-border: #334155;
    --app-border-strong: #475569;
    --app-text: #F8FAFC;
    --app-text-muted: #94A3B8;
    --app-brand: #2DD4BF;
    --app-brand-strong: #14B8A6;
}

/* One shared control is injected by theme.js so every application screen has
   the same light/dark switch, including screens without a panel header. */
.ims-theme-toggle {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 100000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 9999px;
    color: #334155;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.ims-theme-toggle:hover {
    border-color: #0d9488;
    color: #0f766e;
}

.ims-theme-toggle-glyph {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.ims-theme-toggle-glyph[hidden] {
    display: none;
}

html.dark .ims-theme-toggle {
    border-color: rgba(148, 163, 184, 0.38);
    color: #d1fae5;
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

html.dark .ims-theme-toggle:hover {
    border-color: #2dd4bf;
    color: #99f6e4;
}

.ims-theme-toggle--nav {
    position: static;
    z-index: auto;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-radius: 9999px;
    box-shadow: none;
}

html.dark .ims-theme-toggle--nav {
    box-shadow: none;
}

/* Shared selector bounds apply to admin, superadmin, public, and onboarding
   layouts. The results list remains the only scroll region. */
.erp-selector-results {
    width: max-content !important;
    min-width: 100%;
    max-width: min(28rem, calc(100vw - 1rem));
    max-height: min(12rem, calc(100vh - 8rem)) !important;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.erp-selector-results--compact {
    max-height: 10rem !important;
}

.erp-selector-panel {
    box-sizing: border-box;
    min-width: 0;
}

/* The fixed panel owns width; do not cap its list or reserve an empty
   scrollbar column when the options fit without scrolling. */
.erp-selector-panel .erp-selector-results {
    width: 100% !important;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
    scrollbar-gutter: auto;
}

.erp-selector-panel .erp-selector-search,
.erp-selector-panel .erp-selector-search input,
.erp-selector-panel .erp-selector-results > li,
.erp-selector-panel .erp-selector-results > li > [role="option"] {
    width: 100%;
    box-sizing: border-box;
}

/* Keep trigger alignment owned by the selector even when a caller supplies
   display or spacing utilities in button_class. */
.erp-select-trigger {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
}

.erp-select-trigger[data-compact="true"] {
    gap: 0.25rem !important;
}

/* Domain-specific inline popups keep their existing search behavior while
   allowing compact controls to fit on narrow viewports. */
.erp-selector-inline-panel {
    box-sizing: border-box;
    max-width: min(24rem, calc(100vw - 1rem));
}

.erp-selector-inline-panel[data-selector-min-width="320"] {
    min-width: min(20rem, calc(100vw - 1rem));
}

.erp-selector-inline-panel[data-selector-min-width="280"] {
    min-width: min(17.5rem, calc(100vw - 1rem));
}

.erp-selector-inline-panel[data-selector-min-width="150"] {
    min-width: min(9.375rem, calc(100vw - 1rem));
}

.erp-selector-inline-panel .erp-selector-results {
    width: 100% !important;
    min-width: 0;
}

html.dark body,
.dark body {
    background-color: var(--app-bg);
    color: var(--app-text);
}

/* ─────────────────────────────────────────────────────────────────────────
   Tailwind Brand Color Overrides
   Use these classes instead of default Tailwind colors for brand consistency
   ────────────────────────────────────────────────────────────────────────── */

.bg-brand-500 { 
    background-color: var(--color-accent-indigo) !important; 
}

.hover\:bg-brand-600:hover { 
    background-color: #4338ca !important; 
}

.text-brand-500 { 
    color: var(--color-accent-indigo) !important; 
}

.border-brand-500 { 
    border-color: var(--color-accent-indigo) !important; 
}

/* ─────────────────────────────────────────────────────────────────────────
   Utility: Hide Scrollbar
   ────────────────────────────────────────────────────────────────────────── */

.hide-scrollbar::-webkit-scrollbar { 
    display: none; 
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ─────────────────────────────────────────────────────────────────────────
   Flatpickr: right-aligned range picker
   ──────────────────────────────────────────────────────────────────────────
   The pickers are initialised with `static: true`, so flatpickr drops the
   calendar inside a `.flatpickr-wrapper` (position: relative) and anchors it
   with `left: 0`. The calendar is ~308px wide while the wrapper is only as
   wide as the input (~206px), so a picker sitting on the right of a toolbar
   pushes the calendar past the right edge of the viewport: the last weekday
   columns get clipped, and the overflow makes the page grow/shrink a
   horizontal scrollbar, which reads as flicker.

   Inputs opt in with data-class="flatpickr-right" (flatpickr copies that onto
   the calendar in its onReady hook). Anchoring the RIGHT edge to the wrapper
   makes the calendar open leftward — it stays on screen and nothing overflows.
   Pickers without the class keep flatpickr's default left alignment.

   Right-alignment holds at every breakpoint: the picker stays at the right of
   its toolbar as the layout stacks, so anchoring to the wrapper's right edge
   keeps the calendar on screen on phones as well as wide monitors.
   ────────────────────────────────────────────────────────────────────────── */

.flatpickr-calendar.flatpickr-right,
.flatpickr-calendar.static.flatpickr-right {
    left: auto !important;
    right: 0 !important;
}

/* Ensure flatpickr calendar scales cleanly and never exceeds viewport or card container */
.flatpickr-calendar {
    max-width: calc(100vw - 24px) !important;
    border-radius: 1rem !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}

/* Flatpickr ships with a light palette and is used by shared date-picker
   partials as well as individual forms. Keep every calendar readable in the
   active application theme. */
html.dark .flatpickr-calendar {
    color: #e2e8f0 !important;
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 18px 45px rgba(2, 6, 23, .42) !important;
}

html.dark .flatpickr-calendar.arrowTop:before,
html.dark .flatpickr-calendar.arrowTop:after {
    border-bottom-color: #1e293b !important;
}

html.dark .flatpickr-calendar.arrowBottom:before,
html.dark .flatpickr-calendar.arrowBottom:after {
    border-top-color: #1e293b !important;
}

html.dark .flatpickr-months .flatpickr-month,
html.dark .flatpickr-current-month,
html.dark .flatpickr-current-month .flatpickr-monthDropdown-months,
html.dark .flatpickr-current-month input.cur-year {
    color: #f8fafc !important;
    fill: #f8fafc !important;
}

html.dark .flatpickr-current-month .flatpickr-monthDropdown-months,
html.dark .flatpickr-current-month input.cur-year {
    background: transparent !important;
}

html.dark .flatpickr-months .flatpickr-prev-month,
html.dark .flatpickr-months .flatpickr-next-month {
    color: #cbd5e1 !important;
    fill: #cbd5e1 !important;
}

html.dark .flatpickr-months .flatpickr-prev-month:hover,
html.dark .flatpickr-months .flatpickr-next-month:hover {
    color: #5eead4 !important;
    fill: #5eead4 !important;
}

html.dark .flatpickr-weekdays,
html.dark span.flatpickr-weekday {
    color: #94a3b8 !important;
    background: #1e293b !important;
}

html.dark .flatpickr-day {
    color: #e2e8f0 !important;
    border-color: transparent !important;
}

html.dark .flatpickr-day.prevMonthDay,
html.dark .flatpickr-day.nextMonthDay,
html.dark .flatpickr-day.flatpickr-disabled {
    color: #64748b !important;
}

html.dark .flatpickr-day:hover,
html.dark .flatpickr-day:focus {
    color: #f8fafc !important;
    background: #334155 !important;
    border-color: #475569 !important;
}

html.dark .flatpickr-day.today {
    border-color: #2dd4bf !important;
}

html.dark .flatpickr-day.inRange {
    color: #dbeafe !important;
    background: rgba(59, 130, 246, .22) !important;
    border-color: transparent !important;
    box-shadow: -5px 0 0 rgba(59, 130, 246, .22), 5px 0 0 rgba(59, 130, 246, .22) !important;
}

html.dark .flatpickr-day.selected,
html.dark .flatpickr-day.startRange,
html.dark .flatpickr-day.endRange,
html.dark .flatpickr-day.selected.inRange,
html.dark .flatpickr-day.startRange.inRange,
html.dark .flatpickr-day.endRange.inRange {
    color: #ffffff !important;
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    box-shadow: none !important;
}

html.dark .flatpickr-day.selected:hover,
html.dark .flatpickr-day.startRange:hover,
html.dark .flatpickr-day.endRange:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
}

html.dark .flatpickr-time {
    border-top-color: #334155 !important;
    background: #1e293b !important;
}

html.dark .flatpickr-time input,
html.dark .flatpickr-time .flatpickr-am-pm,
html.dark .flatpickr-time .flatpickr-time-separator {
    color: #e2e8f0 !important;
}

html.dark .flatpickr-time input:hover,
html.dark .flatpickr-time .flatpickr-am-pm:hover {
    background: #334155 !important;
}

@media (max-width: 640px) {
    .flatpickr-calendar.flatpickr-right,
    .flatpickr-calendar.static.flatpickr-right {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
    }
}

/* Shared Admin/Superadmin notification dropdown sizing. Keep this explicit
   because the panel is rendered from a shared template and must stay usable
   even when Tailwind's arbitrary width utilities are not rebuilt. */
.notification-dropdown-panel {
    box-sizing: border-box;
    width: 360px;
    max-width: calc(100vw - 24px);
    max-height: min(36rem, calc(100vh - 5.5rem));
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 45px -20px rgba(15, 23, 42, 0.35), 0 8px 18px -12px rgba(15, 118, 110, 0.2);
}

.notification-dropdown-list {
    max-height: min(28rem, calc(100vh - 11rem));
    scrollbar-gutter: stable;
}

.notification-dropdown-item:hover {
    background-color: rgba(240, 253, 250, 0.75);
}

.notification-dropdown-item-unread {
    background-color: rgba(240, 253, 250, 0.68);
}

.notification-dropdown-item-unread:hover {
    background-color: rgba(204, 251, 241, 0.7);
}

/* The unread-row accent must not bring the light mint surface into dark
   panels. Keep it distinct without washing out the notification text. */
html.dark .notification-dropdown-item:hover {
    background-color: rgba(51, 65, 85, 0.72);
}

html.dark .notification-dropdown-item-unread {
    background-color: rgba(13, 148, 136, 0.16);
}

html.dark .notification-dropdown-item-unread:hover {
    background-color: rgba(20, 184, 166, 0.24);
}

html.dark .notification-dropdown-list {
    scrollbar-color: #64748b #1e293b;
}

.notification-severity-info {
    border-left-color: rgb(148 163 184 / 0.7);
}

.notification-severity-success {
    border-left-color: rgb(16 185 129 / 0.75);
}

.notification-severity-warning {
    border-left-color: rgb(245 158 11 / 0.8);
}

.notification-severity-critical {
    border-left-color: rgb(244 63 94 / 0.8);
}

@media (prefers-reduced-motion: reduce) {
    .notification-dropdown-panel *,
    .notification-dropdown-panel {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

@media (max-width: 640px) {
    .erp-selector-results {
        max-height: min(12rem, calc(100vh - 7rem)) !important;
    }

    .notification-dropdown-panel {
        position: fixed;
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        margin-top: 0;
    }

    .notification-center-filter-fields {
        flex-basis: 100%;
        width: 100%;
    }

    .notification-center-filter-fields select,
    .notification-center-filter-search {
        flex: 1 1 100%;
        min-width: 0 !important;
    }
}

/* flatpickr injects this wrapper around the input and leaves it inline-block,
   so it shrink-wraps and the input's `w-full` resolves against a box narrower
   than the field's own container — the date text then gets clipped mid-word
   ("Aug 1, 2026 to Aug 10, 20…"). Making the wrapper a full-width block lets
   the input fill the space its container actually offers. */
.flatpickr-wrapper {
    display: block;
    width: 100%;
}

/* Let the Dashboard date field size itself from its readonly display value. */
[data-date-range-picker][data-compact-width="true"] .dashboard-date-range-input {
    field-sizing: content;
    width: fit-content;
    max-width: calc(100vw - 2rem);
}

/* ─────────────────────────────────────────────────────────────────────────
   Document line-item row - desktop layout (lg >= 1024px)
   Shared by the items_table.html partial (sales/purchase invoices, orders,
   estimates) and the inline rows in credit_note.html,
   purchase_debit_note_form.html and recurring_form.html.

   Below lg the Tailwind classes on the same element (grid-cols-1 /
   md:grid-cols-12 + md:col-span-*) keep the phone and tablet arrangements;
   this block only takes over from 1024px up. The grid-column reset is marked
   important because Tailwind's responsive col-span utilities may be emitted
   after this file in some builds.

   Every column is a fixed share of the row so all forms line up the same
   way; Product / Service takes whatever is left, which keeps the row at
   exactly 100%.

      .doc-line-grid      S.no | Product | Base Unit | Unit | Selling Qty | Inv Qty | Rate | Discount | Tax | Tax Amount | Amount | Actions
      (no HSN/SAC column)  4%     1fr        7.5%       9.5%    7%           6%        10.5%  7.5%       8.5%  6.5%         12%       3%

      .doc-line-grid--hsn S.no | Product | HSN/SAC | Base Unit | Unit | Selling Qty | Inv Qty | Rate | Discount | Tax | Tax Amount | Amount | Actions
      (India GST forms)    4%     1fr        7%       7%         9.5%    7%           6%        10.5%  8%         8.5%  6.5%         11%       3%

   Inv Qty is Selling Qty converted to the product's base/stock unit (its own
   conversion factor already folds in the base unit's own factor of 1 — see
   unitConversionFactor() in document_calc_engine.html); Tax Amount is the
   line's computed tax for whichever rule(s)/custom tax is selected. Both are
   read-only displays, so they carry no input chrome and can stay narrow.

   Discount, Amount and Actions carry pixel floors so the value + %/currency
   selector, a long formatted total and the two icon buttons stay usable on
   narrower desktops; Product absorbs the difference. Cells are spaced by
   0.25rem side padding (8px between cells, the same rhythm as the gap-2 used
   on smaller screens).

   The breakpoint is 768px (Tailwind's own `md`), matching items_table.html's
   equivalent .doc-table-grid, which has run unconditionally from `md` with no
   separate tablet zone of its own. This block used to start at 1024px, which
   left a 768–1023px gap where the row fell back to plain `md:grid-cols-12` +
   per-field `col-span-*` utilities that never summed to a clean 12 — cells
   wrapped across several ragged rows instead of staying on one line. Lowering
   the floor to 768px closes that gap; see the per-document templates (credit
   note, debit note, recurring invoice) for the matching removal of their
   "tablet-only" action buttons and the Actions column's now-unconditional
   visibility, both of which existed only to paper over that gap.
   ────────────────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
    .doc-line-grid {
        display: grid;
        gap: 0;
        align-items: flex-end;
        grid-template-columns:
            4%                     /* S.no */
            minmax(0, 1fr)        /* Product / Service */
            7.5%                  /* Base Unit */
            9.5%                  /* Unit */
            7%                    /* Selling Qty */
            6%                    /* Inv Qty */
            10.5%                 /* Rate */
            minmax(6rem, 7.5%)    /* Discount */
            8.5%                  /* Tax */
            6.5%                  /* Tax Amount */
            minmax(7.5rem, 12%)  /* Amount */
            minmax(3.75rem, 3%);  /* Actions */
    }
    .doc-line-grid--hsn {
        grid-template-columns:
            4%                     /* S.no */
            minmax(0, 1fr)        /* Product / Service */
            7%                    /* HSN/SAC */
            7%                    /* Base Unit */
            9.5%                  /* Unit */
            7%                    /* Selling Qty */
            6%                    /* Inv Qty */
            10.5%                 /* Rate */
            minmax(6rem, 8%)      /* Discount */
            8.5%                  /* Tax */
            6.5%                  /* Tax Amount */
            minmax(7.5rem, 11%)  /* Amount */
            minmax(3.75rem, 3%);  /* Actions */
    }
    .doc-line-grid > * {
        grid-column: auto / span 1 !important;
        min-width: 0;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    .doc-line-grid > *:first-child {
        padding-left: 0;
    }
    .doc-line-grid > *:last-child {
        padding-right: 0;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .doc-line-grid,
    .doc-line-grid--hsn,
    .doc-line-grid.doc-line-grid--purchase-debit {
        grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    }
    .doc-line-grid > * {
        grid-column: auto / span 2 !important;
    }
    .doc-line-grid > :first-child {
        grid-column: auto / span 1 !important;
    }
    .doc-line-grid > :nth-child(2) {
        grid-column: auto / span 11 !important;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
   Product Form: Purchase / Selling Units Grid Table Layout
   ────────────────────────────────────────────────────────────────────────── */
.unit-grid-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.4fr) minmax(95px, 1fr) minmax(105px, 1.05fr) minmax(105px, 1.05fr) minmax(75px, 0.55fr) minmax(65px, 0.45fr);
  gap: 0.5rem;
  align-items: center;
}
@media (max-width: 767px) {
  .unit-grid-header {
    display: none !important;
  }
  .unit-grid-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    align-items: stretch !important;
  }
  .unit-mobile-label {
    display: block !important;
  }
}
@media (min-width: 768px) {
  .unit-grid-header {
    display: grid !important;
  }
  .unit-mobile-label {
    display: none !important;
  }
}

/* Toggle Switch for Default Unit */
.unit-toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.unit-toggle-switch input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
  opacity: 0;
}
.unit-toggle-slider {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  background-color: #cbd5e1;
  border-radius: 9999px;
  transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.dark .unit-toggle-slider {
  background-color: #4b5563;
}
.unit-toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.unit-toggle-switch input[type="checkbox"]:checked + .unit-toggle-slider {
  background-color: #2563eb;
}
.unit-toggle-switch input[type="checkbox"]:checked + .unit-toggle-slider::after {
  transform: translateX(16px);
}
.unit-toggle-switch:hover .unit-toggle-slider {
  filter: brightness(0.95);
}
.unit-toggle-switch input[type="checkbox"]:focus-visible + .unit-toggle-slider {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Shared teleported selectors must keep their option surface and option text
   in the same color system as the page that opened them. */
html.dark .erp-selector-results {
  border-color: #374151 !important;
  background-color: #111827 !important;
  color: #e5e7eb !important;
}

/* Autocomplete lists use clickable div rows instead of role=option buttons. */
html.dark .erp-selector-results > div {
  border-color: #1f2937 !important;
  background-color: transparent !important;
  color: #e5e7eb !important;
}

html.dark .erp-selector-results > div:hover,
html.dark .erp-selector-results > div:focus-within {
  background-color: #1f2937 !important;
  color: #f8fafc !important;
}

html.dark .erp-selector-panel {
  border-color: #374151 !important;
  background: #111827 !important;
  color: #e5e7eb;
}

html.dark .erp-selector-panel [role="option"] {
  color: #e5e7eb !important;
  background-color: transparent !important;
}

html.dark .erp-selector-panel [role="option"][aria-selected="true"] {
  color: #ffffff !important;
  background-color: #0d9488 !important;
}

html.dark .erp-selector-panel [role="option"]:hover,
html.dark .erp-selector-panel [role="option"]:focus-visible {
  color: #f8fafc !important;
  background-color: #1f2937 !important;
}

html.dark .erp-selector-panel [role="option"][disabled],
html.dark .erp-selector-panel [role="option"][aria-disabled="true"] {
  color: #64748b !important;
  background-color: #1f2937 !important;
}

html.dark .erp-selector-panel .erp-selector-search {
  border-color: #1f2937 !important;
  background: #111827 !important;
}

html.dark .erp-selector-panel .erp-selector-search input {
  border-color: #4b5563 !important;
  color: #f8fafc !important;
  background: #1f2937 !important;
}

/* Header and domain dropdowns use the same option-row contract without the
   shared [role="option"] attribute. */
html.dark .erp-dropdown-panel {
  border-color: #374151 !important;
  color: #e5e7eb !important;
  background: #111827 !important;
}

html.dark .erp-dropdown-panel .erp-dropdown-link {
  color: #e5e7eb !important;
  background-color: transparent !important;
}

html.dark .erp-dropdown-panel .erp-dropdown-link:hover,
html.dark .erp-dropdown-panel .erp-dropdown-link:focus-visible {
  color: #ffffff !important;
  background-color: #1f2937 !important;
}

html.dark .erp-dropdown-panel .erp-dropdown-link.font-semibold {
  color: #ffffff !important;
  background-color: #0d9488 !important;
}

html.dark .erp-dropdown-panel .erp-dropdown-link .bg-teal-50 {
  color: #99f6e4 !important;
  background-color: rgba(20, 184, 166, .2) !important;
}

html.dark .error-page .bg-white,
html.dark .auth-csrf-page .card {
  border-color: #374151 !important;
  color: #e5e7eb;
  background: #1f2937 !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .32) !important;
}

html.dark .error-page .text-gray-800,
html.dark .auth-csrf-page h1 {
  color: #f8fafc !important;
}

html.dark .error-page .text-gray-700,
html.dark .error-page .text-gray-600,
html.dark .error-page .text-gray-500,
html.dark .auth-csrf-page p {
  color: #cbd5e1 !important;
}

html.dark .error-page .bg-gray-200 {
  color: #e5e7eb !important;
  background: #374151 !important;
}

html.dark .error-page .border-t {
  border-color: #475569 !important;
}

html.dark .auth-csrf-page {
  background: #111827 !important;
}

html.dark .auth-csrf-page .icon-wrap {
  background: rgba(146, 64, 14, .35) !important;
}

html.dark .auth-csrf-page .btn {
  background: #0d9488 !important;
}

html.dark .auth-csrf-page .note {
  color: #94a3b8 !important;
}

/* Password-reset pages have a two-column shell outside auth-portal.css. Keep
   the workspace background dark as well as the inner card. */
html.dark .password-reset-page {
  color: #e2e8f0 !important;
  background: var(--app-bg) !important;
}

html.dark .password-reset-page .password-reset-workspace {
  background: var(--app-bg) !important;
}

html.dark .password-reset-page .password-reset-workspace > div {
  border-color: var(--app-border) !important;
  background: var(--app-surface) !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, .32) !important;
}

/* Photo panel: swap the bright blue overlay for the app's slate, as on the login page. */
html.dark .password-reset-page .bg-gradient-to-tr {
  background-image: linear-gradient(to top right, rgba(15, 23, 42, .96), rgba(17, 24, 39, .93), rgba(30, 41, 59, .86)) !important;
}

html.dark .password-reset-page .text-blue-300 {
  color: #5eead4 !important;
}

html.dark .password-reset-page .password-reset-workspace .bg-blue-50 {
  background: rgba(45, 212, 191, .12) !important;
  color: #5eead4 !important;
}

html.dark .password-reset-page .password-reset-workspace input {
  border-color: var(--app-border) !important;
  background: var(--app-bg) !important;
}
