:root {
  --rf-red: #C41E3A;
  --rf-red-dark: #9e1830;
  --rf-ink: #374151;
  --rf-btn-border: #B8BDC4;
  --rf-bottom-bar-height: 56px;
  --tblr-primary: var(--rf-red);
  --tblr-primary-rgb: 196, 30, 58;
  --tblr-primary-lt-rgb: 249, 233, 235;
  --tblr-brand: var(--rf-red);
  --tblr-link-color: var(--rf-red-dark);
  --tblr-link-hover-color: var(--rf-red);
}

.navbar {
  --tblr-navbar-color: var(--rf-ink);
  --tblr-navbar-hover-color: var(--rf-red);
  --tblr-navbar-active-color: var(--rf-red);
}

.alert {
  --tblr-alert-color: var(--tblr-body-color);
}

.rf-wordmark {
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
}

.navbar-brand a,
.navbar-brand a:hover {
  color: inherit;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(var(--tblr-azure-rgb), 1);
}

.btn, .form-control, .form-select, .form-check-input {
  --tblr-focus-ring-color: color-mix(in oklab, var(--tblr-azure) 50%, transparent);
}

.form-control:focus, .form-select:focus, .form-check-input:focus-visible {
  border-color: var(--tblr-azure);
}

.ts-wrapper.form-select.focus, .ts-wrapper.form-control.focus {
  border-color: var(--tblr-azure);
  box-shadow: 0 0 0 0.25rem rgba(var(--tblr-azure-rgb), 0.25);
}

.ts-wrapper.focus .ts-control {
  box-shadow: none;
}

.form-control.input-validation-error:focus, .form-select.input-validation-error:focus {
  --tblr-focus-ring-color: color-mix(in oklab, var(--tblr-danger) 50%, transparent);
  border-color: var(--tblr-danger);
}

.rf-filter-active {
  border-color: var(--tblr-azure);
  background-color: var(--tblr-azure-lt);
}

html {
  position: relative;
  min-height: 100%;
}


/* Markdown content styling */
.markdown-content h1 {
  font-size: 1.75rem;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.markdown-content h2 {
  font-size: 1.5rem;
  margin-top: 0.875rem;
  margin-bottom: 0.625rem;
  font-weight: 600;
}

.markdown-content h3 {
  font-size: 1.25rem;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.markdown-content p {
  margin-bottom: 0.75rem;
}

.markdown-content ul, .markdown-content ol {
  margin-bottom: 0.75rem;
  padding-left: 2rem;
}

.markdown-content li {
  margin-bottom: 0.25rem;
}

.markdown-content code {
  background-color: #f4f4f4;
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

.markdown-content pre {
  background-color: #f4f4f4;
  padding: 1rem;
  border-radius: 5px;
  overflow-x: auto;
}

.markdown-content pre code {
  background-color: transparent;
  padding: 0;
}

.markdown-content blockquote {
  border-left: 4px solid #ddd;
  padding-left: 1rem;
  margin-left: 0;
  color: #666;
}

.markdown-content a {
  color: var(--rf-red-dark);
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content table {
  width: 100%;
  margin-bottom: 1rem;
  border-collapse: collapse;
}

.markdown-content table th,
.markdown-content table td {
  padding: 0.5rem;
  border: 1px solid #ddd;
}

.markdown-content table th {
  background-color: #f4f4f4;
  font-weight: 600;
}

.markdown-content hr {
  margin: 1.5rem 0;
  border: 0;
  border-top: 1px solid #ddd;
}

/* Custom badge colors for supplier categorization */
.bg-purple {
  background-color: #8b5cf6 !important;
  color: white !important;
}

/* Solid badge text contrast — Tabler is loaded @latest via CDN (_Layout.cshtml), so solid
   badge backgrounds can ship with dark text upstream. Mirrors the .bg-purple fix above. */
.badge.bg-red,
.badge.bg-yellow,
.badge.bg-orange,
.badge.bg-green {
  color: #fff !important;
}




/* ============================================
   GALLERY CARDS (see ui-conventions.md §5 Gallery Card Pattern)
   ============================================ */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.gallery-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--tblr-border-color);
    border-radius: 12px;
    background: var(--tblr-bg-surface);
    box-shadow: 0 1px 2px rgba(var(--tblr-body-color-rgb), 0.04);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

    .gallery-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(var(--tblr-body-color-rgb), 0.1);
    }

.gallery-card-link,
.gallery-card-link:hover {
    color: inherit;
    text-decoration: none;
}

.gallery-card-tasks {
    z-index: 2;
    color: inherit;
    text-decoration: none;
}

    .gallery-card .gallery-card-tasks:hover {
        color: var(--tblr-primary);
        text-decoration: underline;
    }

.gallery-card-photo {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--tblr-tertiary-bg);
}

    .gallery-card-photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.18s ease;
    }

    .gallery-card-photo-logo img {
        object-fit: contain;
        padding: 1rem;
    }

.gallery-card:hover .gallery-card-photo img {
    transform: scale(1.03);
}

.gallery-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tblr-secondary);
}

    .gallery-card-placeholder .icon {
        width: 3rem;
        height: 3rem;
        opacity: 0.5;
    }

.gallery-card-status {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: inline-flex;
    border-radius: var(--tblr-border-radius);
    background: var(--tblr-bg-surface);
    box-shadow: 0 1px 2px rgba(var(--tblr-body-color-rgb), 0.15);
}

.gallery-card-count {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    border-radius: var(--tblr-border-radius);
    background: var(--tblr-bg-surface);
    box-shadow: 0 1px 2px rgba(var(--tblr-body-color-rgb), 0.15);
}

.gallery-card-footer {
    border-top: 1px solid var(--tblr-border-color);
}


/* ============================================
   VIEW TABS (Notion-style)
   ============================================ */

.view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.view-tab {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: #666;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
}

    .view-tab:hover {
        background-color: #f0f0f0;
        color: #333;
    }

    .view-tab.active {
        background-color: #f0f0f0;
        color: #333;
        font-weight: 500;
    }


/* ============================================
   PAGE HEADER AND PAGE-LEVEL ACTIONS
   ============================================ */

.page-body {
    margin-top: 0;
    padding-top: var(--tblr-page-padding-y);
}

.rf-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.rf-page-header-heading {
    min-width: 0;
}

.rf-page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.rf-btn-outline {
    --tblr-btn-bg: var(--tblr-bg-surface);
    --tblr-btn-color: var(--tblr-body-color);
    --tblr-btn-border-color: var(--rf-btn-border);
    --tblr-btn-border-radius: 10px;
    --tblr-btn-font-size: 15px;
    --tblr-btn-font-weight: 500;
    --tblr-btn-hover-bg: var(--tblr-hover-bg);
    --tblr-btn-hover-border-color: var(--rf-btn-border);
    --tblr-btn-active-color: var(--tblr-body-color);
    --tblr-btn-active-bg: var(--tblr-hover-bg);
    --tblr-btn-active-border-color: var(--rf-btn-border);
    gap: 8px;
    height: 40px;
    padding: 0 16px;
}

    .rf-btn-outline:hover {
        text-decoration: none;
    }

    .rf-btn-outline .icon {
        width: 18px;
        min-width: 18px;
        height: 18px;
        margin: 0;
    }

.rf-btn-add,
.rf-btn-menu {
    padding-left: 12px;
}

    .rf-btn-add .icon,
    .rf-btn-menu .icon {
        color: var(--rf-red);
    }

@media (max-width: 767.98px) {
    .rf-btn-outline {
        height: 44px;
    }

    .rf-btn-square {
        width: 44px;
        min-width: 44px;
        padding: 0;
    }

        .rf-btn-square .icon {
            width: 22px;
            min-width: 22px;
            height: 22px;
        }

        .rf-btn-square .rf-btn-label,
        .rf-btn-square.dropdown-toggle::after {
            display: none;
        }
}


/* ============================================
   USER AVATARS
   ============================================ */

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

span.user-avatar {
    font-size: 0.75rem;
}


/* ============================================
   USER MENU DROPDOWN
   ============================================ */

#userMenuDropdown {
    cursor: pointer;
}

.dropdown-menu {
    min-width: 220px;
}

.dropdown-item i {
    width: 20px;
    margin-right: 8px;
}


/* ============================================
   MOBILE ADJUSTMENTS FOR DETAILS PAGES
   ============================================ */

/* Stack labels and values vertically on mobile */
@media (max-width: 767px) {
    dl.row dt,
    dl.row dd {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    dl.row dt,
    .col-form-label {
        font-size: 0.75rem;
        font-weight: 600;
        color: #6c757d;
        letter-spacing: 0.5px;
        margin-bottom: 0.25rem;
    }
    
    dl.row dd {
        margin-bottom: 1rem;
    }
}








.navbar,
.page-wrapper,
.rf-bottom-bar,
.rf-sheet {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.rf-avatar-trigger {
  align-items: center;
  justify-content: flex-end;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: none;
  border: 0;
}

.rf-bottom-bar {
  background: var(--tblr-bg-surface);
  border-top: 1px solid var(--tblr-border-color);
  padding-bottom: env(safe-area-inset-bottom);
}

.rf-bottom-bar-item {
  flex: 1 1 0;
  min-width: 0;
  min-height: calc(var(--rf-bottom-bar-height) - 1px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  padding: 0;
  background: none;
  border: 0;
  color: var(--rf-ink);
  font-size: 0.8rem;
  text-decoration: none;
}

.rf-bottom-bar-item:hover {
  color: var(--rf-ink);
  text-decoration: none;
}

.rf-bottom-bar-item.active {
  color: var(--rf-red);
  font-weight: 600;
  box-shadow: inset 0 2px 0 var(--rf-red);
}

.rf-sheet.offcanvas-bottom {
  height: auto;
  max-height: 85vh;
}

.rf-sheet .offcanvas-body {
  padding: 0 0 env(safe-area-inset-bottom);
}

.rf-sheet .offcanvas-header {
  padding-left: 1rem;
  padding-right: 1rem;
}

.rf-sheet-heading {
  margin: 0;
  padding: 0.5rem 1rem;
  background: var(--tblr-bg-surface-secondary);
  color: var(--rf-ink);
  font-weight: 700;
  border-top: 1px solid var(--tblr-border-color);
  border-bottom: 1px solid var(--tblr-border-color);
}

.rf-sheet-heading:first-child {
  border-top: 0;
}

.rf-sheet-divided {
  margin-top: 0.5rem;
  border-top: 1px solid var(--tblr-border-color);
  padding-top: 0.25rem;
}

.rf-sheet .list-group-item {
  border: 0;
}

.rf-sheet-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 1rem;
}

.rf-sheet .list-group-flush {
  padding-bottom: 0.25rem;
}

.rf-toast-container {
  top: 0;
  right: 0;
  z-index: 1090;
}

@media (max-width: 767px) {
  .rf-toast-container {
    top: auto;
    right: auto;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 382px;
  }

  .rf-toast-container.rf-toast-above-bar {
    bottom: calc(var(--rf-bottom-bar-height) + env(safe-area-inset-bottom));
  }

  .rf-toast-container .toast {
    width: 100%;
  }

  .rf-has-bottom-bar {
    padding-bottom: calc(var(--rf-bottom-bar-height) + env(safe-area-inset-bottom));
  }
}

.rf-row-edit-icon {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--tblr-secondary);
  opacity: 0;
  transition: opacity 0.15s;
}

.rf-inline-row:hover .rf-row-edit-icon,
.rf-inline-row:focus-visible .rf-row-edit-icon {
  opacity: 1;
}

@media (hover: none), (max-width: 767px) {
  .rf-row-edit-icon {
    opacity: 1;
  }
}
