/* Tailwind CSS via CDN - Simple styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   BUTTON SYSTEM (Global, consistent)
   --------------------------------------------
   Many pages use Tailwind-like utility classes (bg-indigo-600, bg-gray-200, etc).
   These rules normalize sizing, radius, typography, and focus states for all
   <button> and <a> elements that visually behave like buttons.
   ============================================ */

/* Base button style (opt-in via .btn) */
:where(button, a).btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.05s, box-shadow 0.15s;
}

:where(button, a).btn:active {
    transform: scale(0.98);
}

:where(button, a).btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

:where(button, a).btn:disabled,
:where(button, a).btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* Variants */
:where(button, a).btn-primary {
    background: #4f46e5; /* indigo-600 */
    color: #ffffff;
}
:where(button, a).btn-primary:hover {
    background: #4338ca; /* indigo-700 */
}

:where(button, a).btn-secondary {
    background: #e5e7eb; /* gray-200 */
    color: #374151;      /* gray-700 */
    border-color: #d1d5db; /* gray-300 */
}
:where(button, a).btn-secondary:hover {
    background: #d1d5db; /* gray-300 */
}

:where(button, a).btn-danger {
    background: #dc2626; /* red-600 */
    color: #ffffff;
}
:where(button, a).btn-danger:hover {
    background: #b91c1c; /* red-700 */
}

:where(button, a).btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: 0.5rem;
}

/* Auto-normalize common "button-like" utility combos across the app
   (keeps existing markup working without migrating every page to .btn). */
:where(button, a).bg-indigo-600,
:where(button, a).bg-gray-200,
:where(button, a).bg-red-600,
:where(button, a).bg-green-600 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.05s, box-shadow 0.15s;
}

:where(button, a).bg-indigo-600:active,
:where(button, a).bg-gray-200:active,
:where(button, a).bg-red-600:active,
:where(button, a).bg-green-600:active {
    transform: scale(0.98);
}

:where(button, a).bg-indigo-600:focus-visible,
:where(button, a).bg-gray-200:focus-visible,
:where(button, a).bg-red-600:focus-visible,
:where(button, a).bg-green-600:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

:where(button, a).bg-indigo-600:disabled,
:where(button, a).bg-gray-200:disabled,
:where(button, a).bg-red-600:disabled,
:where(button, a).bg-green-600:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* Keep "Add" buttons aligned with global sizing */
.add-item-btn {
    font-weight: 600;
    border-radius: 0.5rem;
}

/* Utility Classes */
.min-h-screen {
    min-height: 100vh;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.w-full {
    width: 100%;
}

.max-w-md {
    max-width: 28rem;
}

.bg-gradient-to-br {
    background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}

.from-gray-50 {
    --tw-gradient-from: #f9fafb;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(249, 250, 251, 0));
}

.to-gray-100 {
    --tw-gradient-to: #f3f4f6;
}

.bg-white {
    background-color: #ffffff;
}

.rounded-2xl {
    border-radius: 1rem;
}

.shadow-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.p-8 {
    padding: 2rem;
}

.space-y-6 > * + * {
    margin-top: 1.5rem;
}

.space-y-5 > * + * {
    margin-top: 1.25rem;
}

.border {
    border-width: 1px;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

.text-center {
    text-align: center;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.w-32 {
    width: 8rem;
}

.h-32 {
    height: 8rem;
}

.bg-indigo-600 {
    background-color: #4f46e5;
}

.rounded-full {
    border-radius: 9999px;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.text-white {
    color: #ffffff;
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.font-bold {
    font-weight: 700;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.font-semibold {
    font-weight: 600;
}

.text-gray-900 {
    color: #111827;
}

.mt-2 {
    margin-top: 0.5rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-gray-600 {
    color: #4b5563;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.border-gray-300 {
    border-color: #d1d5db;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.placeholder-gray-500::placeholder {
    color: #6b7280;
}

.focus\:outline-none:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.focus\:ring-2:focus {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.5);
}

.focus\:ring-indigo-500:focus {
    --tw-ring-color: #6366f1;
}

.focus\:border-transparent:focus {
    border-color: transparent;
}

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.hover\:bg-indigo-700:hover {
    background-color: #4338ca;
}

.focus\:ring-offset-2:focus {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(79, 70, 229, 0.5);
}

.transform {
    transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.hover\:scale-\[1\.02\]:hover {
    --tw-scale-x: 1.02;
    --tw-scale-y: 1.02;
}

.active\:scale-\[0\.98\]:active {
    --tw-scale-x: 0.98;
    --tw-scale-y: 0.98;
}

.disabled\:cursor-not-allowed:disabled {
    cursor: not-allowed;
}

.disabled\:bg-indigo-400:disabled {
    background-color: #818cf8;
}

.disabled\:transform-none:disabled {
    transform: none;
}

.pt-4 {
    padding-top: 1rem;
}

.font-medium {
    font-weight: 500;
}

.text-indigo-600 {
    color: #4f46e5;
}

.hover\:text-indigo-500:hover {
    color: #6366f1;
}

.mt-6 {
    margin-top: 1.5rem;
}

.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-gray-500 {
    color: #6b7280;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.hidden {
    display: none !important;
}

/* Modal overlay */
#uploadModal,
#addShowModal,
.modal-overlay-high {
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 9999;
}

.modal-overlay-high:not(.hidden) {
    display: flex !important;
    position: fixed !important;
    inset: 0 !important;
    padding-top: 5rem;
    z-index: 10000 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    overflow-y: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modern Modal Container */
.modal-overlay-high > div {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: white !important;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 42rem;
    width: calc(100% - 2rem);
    max-height: 90vh;
    overflow-y: auto;
    margin: 0 auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Header */
.modal-overlay-high .flex.items-center.justify-between {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-overlay-high h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.modal-overlay-high button[aria-label="Close modal"] {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay-high button[aria-label="Close modal"]:hover {
    background: #f3f4f6;
    color: #111827;
}

/* Modal Form Styling */
.modal-overlay-high form {
    padding: 1.5rem;
}

.modal-overlay-high form > div {
    margin-bottom: 1.25rem;
}

.modal-overlay-high form > div:last-of-type {
    margin-bottom: 0;
}

.modal-overlay-high label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.modal-overlay-high input[type="text"],
.modal-overlay-high input[type="email"],
.modal-overlay-high input[type="tel"],
.modal-overlay-high input[type="date"],
.modal-overlay-high input[type="time"],
.modal-overlay-high input[type="number"],
.modal-overlay-high input[type="url"],
.modal-overlay-high input[type="file"],
.modal-overlay-high select,
.modal-overlay-high textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #111827;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-family: inherit;
}

/* Make <select> controls look consistent across browsers (custom chevron) */
.modal-overlay-high select,
.map-control-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    background-size: 1rem 1rem;
    padding-right: 2.5rem; /* space for chevron */
    cursor: pointer;
    /* Inline SVG chevron (stroke matches gray-500) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

/* Hide default arrow in old IE/Edge */
.modal-overlay-high select::-ms-expand,
.map-control-select::-ms-expand {
    display: none;
}

.modal-overlay-high input:focus,
.modal-overlay-high select:focus,
.modal-overlay-high textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Map control select focus styling to match forms */
.map-control-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modal-overlay-high input::placeholder,
.modal-overlay-high textarea::placeholder {
    color: #9ca3af;
}

.modal-overlay-high textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-overlay-high .grid.grid-cols-2 {
    gap: 1rem;
}

/* Modal Footer */
.modal-overlay-high .flex.justify-end.space-x-3 {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 1.5rem;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
}

.modal-overlay-high button[type="button"]:not([aria-label]),
.modal-overlay-high button[type="submit"] {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-overlay-high button.bg-gray-200 {
    background: #f3f4f6;
    color: #374151;
}

.modal-overlay-high button.bg-gray-200:hover {
    background: #e5e7eb;
}

.modal-overlay-high button.bg-indigo-600 {
    background: #6366f1;
    color: white;
}

.modal-overlay-high button.bg-indigo-600:hover {
    background: #4f46e5;
}

.modal-overlay-high button.bg-indigo-600:active {
    transform: scale(0.98);
}

/* =========================================================
   Generic modal primitives (used across pages)
   ========================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    z-index: 1000;
}

.modal-panel {
    width: min(900px, 100%);
    max-height: 85vh;
    overflow: auto;
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    border: 1px solid #e5e7eb;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: #111827;
}

.modal-close {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    border-radius: 0.5rem;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
}
.modal-close:hover { background: #f3f4f6; }

.modal-body { padding: 1rem 1.25rem; }

.notice {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #111827;
    font-weight: 600;
}
.notice.error { background:#fef2f2; border-color:#fecaca; color:#991b1b; }
.notice.success { background:#ecfdf5; border-color:#a7f3d0; color:#065f46; }

/* Simple dropdown panel for search/typeahead */
.product-search-results {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.product-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.15s;
}
.product-result-item:hover { background: #f3f4f6; }
.product-result-item:last-child { border-bottom: none; }

/* Improved Add Button Styling */
.add-item-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6366f1;
    background: #f0f4ff;
    border: 1px solid #c7d2fe;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
    width: 100%;
    justify-content: center;
}

.add-item-btn:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
    color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
}

.add-item-btn:active {
    transform: translateY(0);
}

.add-item-btn svg {
    width: 1rem;
    height: 1rem;
}

/* Rating slider styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 0.25rem;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 1.25rem;
    height: 1.25rem;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#uploadModal:not(.hidden),
#addShowModal:not(.hidden) {
    display: flex;
}

.bg-red-50 {
    background-color: #fef2f2;
}

.border-red-200 {
    border-color: #fecaca;
}

.text-red-700 {
    color: #b91c1c;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.ml-3 {
    margin-left: 0.75rem;
}

.mr-3 {
    margin-right: 0.75rem;
}

.h-5 {
    height: 1.25rem;
}

.w-5 {
    width: 1.25rem;
}

.opacity-25 {
    opacity: 0.25;
}

.opacity-75 {
    opacity: 0.75;
}

.stroke-current {
    stroke: currentColor;
}

.stroke-width-4 {
    stroke-width: 4;
}

.fill-current {
    fill: currentColor;
}

/* Additional styles for dashboard and bids */
.max-w-2xl {
    max-width: 42rem;
}

.max-w-7xl {
    max-width: 80rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.gap-3 {
    gap: 0.75rem;
}

.gap-6 {
    gap: 1.5rem;
}

.w-4 {
    width: 1rem;
}

.h-4 {
    height: 1rem;
}

.map-container {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.map-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.map-controls {
    display: flex;
    gap: 0.5rem;
}

.map-control-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.map-control-select {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.map-control-select:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.map-control-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.map-control-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.map-control-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.map-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.legend-container {
    flex: 0 0 auto;
    margin-right: 1rem;
}

.legend-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.5rem;
}

.legend-gradient {
    flex: 1;
    height: 20px;
    border-radius: 4px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

#map {
    width: 100%;
    height: 600px;
    background: #f9fafb;
    border-radius: 6px;
    overflow: hidden;
}

.custom-marker {
    background: transparent;
    border: none;
}

.custom-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Shared tooltip style (used by delivery heatmap + trade show map) */
.state-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 1000;
    display: none;
}
.state-tooltip strong {
    display: block;
    margin-bottom: 0.25rem;
}

/* Territory Health: D3/TopoJSON map container helpers */
.territory-geo-map {
    width: 100%;
    /* Keep a consistent, not-too-tall map so the US doesn't appear "pushed down" on load.
       (The D3 projection centers within the container; if the container is huge, the map
       will look like it starts several inches too low.) */
    height: clamp(440px, 45vw, 760px);
    background: #f9fafb;
    border-radius: 8px;
    overflow: hidden;
    position: relative; /* keeps tooltip positioning sane */
}

@media (max-width: 640px) {
    .territory-geo-map {
        height: 420px;
    }
}

.max-h-\[90vh\] {
    max-height: 90vh;
}

.shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.border-b {
    border-bottom-width: 1px;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

.text-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.font-extrabold {
    font-weight: 800;
}

.text-yellow-600 {
    color: #d97706;
}

.text-green-600 {
    color: #16a34a;
}

.flex-wrap {
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.space-x-4 > * + * {
    margin-left: 1rem;
}

.space-y-4 > * + * {
    margin-top: 1rem;
}

.hover\:bg-gray-50:hover {
    background-color: #f9fafb;
}

.hover\:text-indigo-800:hover {
    color: #5b21b6;
}

.inline-block {
    display: inline-block;
}

.bg-gray-500 {
    background-color: #6b7280;
}

.bg-blue-500 {
    background-color: #3b82f6;
}

.bg-yellow-500 {
    background-color: #eab308;
}

.bg-purple-500 {
    background-color: #a855f7;
}

.bg-green-500 {
    background-color: #22c55e;
}

.bg-red-500 {
    background-color: #ef4444;
}

.bg-gray-400 {
    background-color: #9ca3af;
}

.bg-gray-600 {
    background-color: #4b5563;
}

.bg-emerald-500 {
    background-color: #10b981;
}

.text-white {
    color: #ffffff;
}

.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.font-semibold {
    font-weight: 600;
}

.rounded {
    border-radius: 0.25rem;
}

.block {
    display: block;
}

.text-red-500 {
    color: #ef4444;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-700 {
    color: #374151;
}

.text-gray-900 {
    color: #111827;
}

.text-gray-600 {
    color: #4b5563;
}

.text-indigo-600 {
    color: #4f46e5;
}

.hover\:text-indigo-600:hover {
    color: #4f46e5;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.p-4 {
    padding: 1rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.font-medium {
    font-weight: 500;
}

.rounded-md {
    border-radius: 0.375rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.bg-white {
    background-color: #ffffff;
}

.border {
    border-width: 1px;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

.border-gray-300 {
    border-color: #d1d5db;
}

.border-transparent {
    border-color: transparent;
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.placeholder-gray-400::placeholder {
    color: #9ca3af;
}

.focus\:outline-none:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.focus\:ring-indigo-500:focus {
    --tw-ring-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}

.focus\:border-indigo-500:focus {
    border-color: #6366f1;
}

.focus\:ring-2:focus {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}

.focus\:ring-offset-2:focus {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(99, 102, 241, 0.5);
}

.group:hover .group-hover\:text-indigo-500 {
    color: #6366f1;
}

.disabled\:opacity-50:disabled {
    opacity: 0.5;
}

.disabled\:cursor-not-allowed:disabled {
    cursor: not-allowed;
}

.justify-between {
    justify-content: space-between;
}

.items-start {
    align-items: flex-start;
}

.items-center {
    align-items: center;
}

.text-right {
    text-align: right;
}

.h-16 {
    height: 4rem;
}

.h-12 {
    height: 3rem;
}

.w-12 {
    width: 3rem;
}

.text-green-500 {
    color: #22c55e;
}

.max-w-md {
    max-width: 28rem;
}

.w-full {
    width: 100%;
}

.space-y-8 > * + * {
    margin-top: 2rem;
}

.space-y-6 > * + * {
    margin-top: 1.5rem;
}

.bg-blue-50 {
    background-color: #eff6ff;
}

.bg-indigo-100 {
    background-color: #e0e7ff;
}

.bg-green-50 {
    background-color: #f0fdf4;
}

.bg-emerald-100 {
    background-color: #d1fae5;
}

.bg-red-50 {
    background-color: #fef2f2;
}

.text-red-700 {
    color: #b91c1c;
}

.bg-yellow-600 {
    background-color: #d97706;
}

.hover\:bg-yellow-700:hover {
    background-color: #b45309;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
}

.whitespace-nowrap {
    white-space: nowrap;
}

.bg-gray-50 {
    background-color: #f9fafb;
}

.divide-y > * + * {
    border-top-width: 1px;
}

.divide-gray-200 > * + * {
    border-color: #e5e7eb;
}

.uppercase {
    text-transform: uppercase;
}

.tracking-wider {
    letter-spacing: 0.05em;
}

.overflow-x-auto {
    overflow-x: auto;
}

.overflow-hidden {
    overflow: hidden;
}

.ml-2 {
    margin-left: 0.5rem;
}

.hover\:bg-gray-300:hover {
    background-color: #d1d5db;
}

.hover\:text-indigo-900:hover {
    color: #312e81;
}

/* Tab styles */
.tab-btn {
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #374151;
}

.tab-content {
    display: block;
}

/* Modern Detail Page Navigation - Replaces tabs */
.detail-page-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.detail-nav-sidebar {
    position: sticky;
    top: 2rem;
    width: 240px;
    flex-shrink: 0;
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.detail-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    position: relative;
}

.detail-nav-item:hover {
    background: #f3f4f6;
    color: #374151;
}

.detail-nav-item.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.detail-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #2563eb;
    border-radius: 0 2px 2px 0;
}

.detail-nav-item svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.detail-content-area {
    flex: 1;
    min-width: 0;
}

.detail-section {
    scroll-margin-top: 2rem;
    margin-bottom: 3rem;
}

.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.detail-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.detail-section-title svg {
    width: 1.5rem;
    height: 1.5rem;
    color: #2563eb;
}

.detail-section-action {
    padding: 0.5rem 1rem;
    background: #2563eb;
    color: white;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.detail-section-action:hover {
    background: #1d4ed8;
}

@media (max-width: 1024px) {
    .detail-page-container {
        flex-direction: column;
    }
    
    .detail-nav-sidebar {
        position: relative;
        top: 0;
        width: 100%;
        max-height: none;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .detail-nav-item {
        flex-shrink: 0;
        white-space: nowrap;
        margin-bottom: 0;
    }
    
    .detail-nav-item.active::before {
        display: none;
    }
    
    .detail-nav-item.active {
        border-bottom: 2px solid #2563eb;
        background: #eff6ff;
    }
}

.whitespace-pre-wrap {
    white-space: pre-wrap;
}

.text-green-700 {
    color: #15803d;
}

.bg-green-50 {
    background-color: #f0fdf4;
}

.border-green-200 {
    border-color: #bbf7d0;
}

/* Additional form styles */
input[type="date"],
input[type="number"],
input[type="url"],
textarea {
    font-family: inherit;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Modal styles */
.fixed {
    position: fixed;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.bg-opacity-50 {
    background-color: rgba(0, 0, 0, 0.5);
}

.bg-gray-600 {
    background-color: #4b5563;
}

.overflow-y-auto {
    overflow-y: auto;
}

.z-50 {
    z-index: 50;
}

.top-20 {
    top: 5rem;
}

.w-96 {
    width: 24rem;
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.rounded-md {
    border-radius: 0.375rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.block {
    display: block;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.rows-3 {
    rows: 3;
}

.space-x-3 > * + * {
    margin-left: 0.75rem;
}

.hover\:bg-gray-300:hover {
    background-color: #d1d5db;
}

.disabled\:bg-indigo-400:disabled {
    background-color: #818cf8;
}

.disabled\:cursor-not-allowed:disabled {
    cursor: not-allowed;
}

/* Sidebar Styles - Dark theme like Black Elm Coffee */
.sidebar {
    width: 16rem;
    height: 100vh;
    background-color: #111827;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #1f2937;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-logo {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #1f2937;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.sidebar-logo-image {
    width: 120px;
    height: auto;
    margin-bottom: 0.75rem;
}

.sidebar-logo-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}

.sidebar-logo-subtitle {
    font-size: 0.7rem;
    color: #6b7280;
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.05em;
}
    padding: 0.25rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.sidebar-refresh-btn:hover {
    color: #d1d5db;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem;
    overflow-y: auto;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #d1d5db;
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.sidebar-nav-item:hover {
    background-color: #374151;
    color: #ffffff;
}

.sidebar-nav-item.active {
    background-color: #1f2937;
    color: #ffffff;
}

.sidebar-nav-icon {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
}

/* Accordion Sections */
.sidebar-section {
    margin-bottom: 0.25rem;
}

.sidebar-section-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-section-header > * {
    pointer-events: none;
}

.sidebar-section-header:hover {
    color: #9ca3af;
}

.sidebar-section-header.active {
    color: #e5e7eb;
}

.sidebar-section-icon {
    flex-shrink: 0;
    width: 0.875rem;
    height: 0.875rem;
    opacity: 0.7;
    pointer-events: none;
}

.sidebar-section-chevron {
    margin-left: auto;
    flex-shrink: 0;
    width: 0.75rem;
    height: 0.75rem;
    pointer-events: none;
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.sidebar-section-header.active .sidebar-section-chevron {
    transform: rotate(180deg);
}

.sidebar-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    padding-left: 0;
}

.sidebar-section-content.active {
    max-height: 500px;
}

.sidebar-nav-subitem {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #d1d5db;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 0.125rem;
}

.sidebar-nav-subitem:hover {
    background-color: #374151;
    color: #ffffff;
}

.sidebar-nav-subitem.active {
    background-color: #1f2937;
    color: #ffffff;
    border-left: 3px solid #3b82f6;
}

.sidebar-user {
    padding: 1rem;
    border-top: 1px solid #1f2937;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.sidebar-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background-color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: #9ca3af;
}

.sidebar-signout-btn {
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #d1d5db;
    background-color: transparent;
    border: none;
    text-align: left;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-signout-btn:hover {
    background-color: #374151;
    color: #ffffff;
}

/* Top Navigation Styles */
.topnav {
    height: 4rem;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: fixed;
    top: 0;
    left: 16rem;
    right: 0;
    z-index: 999;
}

.topnav-search {
    flex: 1;
    max-width: 32rem;
    position: relative;
}

.topnav-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: auto;
}

.topnav-search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.topnav-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}

.topnav-search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    overflow: hidden;
    z-index: 2000;
}

.topnav-search-dropdown.hidden {
    display: none;
}

.topnav-search-dropdown-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.topnav-search-dropdown-item {
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.topnav-search-dropdown-item:hover {
    background: #f9fafb;
}

.topnav-search-dropdown-item:last-child {
    border-bottom: none;
}

.topnav-search-dropdown-title {
    font-weight: 600;
    color: #111827;
    font-size: 0.875rem;
}

.topnav-search-dropdown-subtitle {
    color: #6b7280;
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

.topnav-search-dropdown-badge {
    font-size: 0.7rem;
    color: #4b5563;
    background: #eef2ff;
    border: 1px solid #e0e7ff;
    border-radius: 9999px;
    padding: 0.15rem 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
}

.topnav-search-dropdown-footer {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: #4f46e5;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    cursor: pointer;
}

.topnav-search-dropdown-footer:hover {
    background: #f9fafb;
}

.topnav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topnav-action-btn {
    position: relative;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.topnav-action-btn:hover {
    color: #4b5563;
}

.topnav-notification-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 0.5rem;
    height: 0.5rem;
    background-color: #ef4444;
    border-radius: 9999px;
}

.topnav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1rem;
    border-left: 1px solid #e5e7eb;
}

.topnav-user-info {
    text-align: right;
}

.topnav-user-initials {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
}

.topnav-user-name {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Notifications Dropdown */
.notifications-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 16px;
    width: 400px;
    max-width: calc(100vw - 32px);
    max-height: 600px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notifications-dropdown.hidden {
    display: none;
}

.notifications-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notifications-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.notifications-mark-all-read {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.notifications-mark-all-read:hover {
    background-color: #f3f4f6;
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
}

.notifications-empty {
    padding: 48px 24px;
    text-align: center;
    color: #6b7280;
}

.notifications-empty svg {
    margin: 0 auto 16px;
    color: #9ca3af;
}

.notifications-empty p {
    margin: 0;
    font-size: 14px;
}

.notification-item {
    display: flex;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    gap: 12px;
}

.notification-item:hover {
    background-color: #f9fafb;
}

.notification-item.read {
    opacity: 0.7;
}

.notification-item.priority-urgent {
    border-left: 3px solid #dc2626;
}

.notification-item.priority-high {
    border-left: 3px solid #ef4444;
}

.notification-item.priority-medium {
    border-left: 3px solid #f59e0b;
}

.notification-item.priority-low {
    border-left: 3px solid #3b82f6;
}

.notification-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.notification-item.priority-urgent .notification-icon {
    background-color: #fee2e2;
    color: #dc2626;
}

.notification-item.priority-high .notification-icon {
    background-color: #fee2e2;
    color: #ef4444;
}

.notification-item.priority-medium .notification-icon {
    background-color: #fef3c7;
    color: #f59e0b;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 12px;
    color: #9ca3af;
}

.notification-unread-dot {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #2563eb;
}

.notifications-footer {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.notifications-footer a {
    color: #2563eb;
    font-size: 14px;
    text-decoration: none;
}

.notifications-footer a:hover {
    text-decoration: underline;
}

.topnav-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background-color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
}

/* Main content area adjustment */
.main-content {
    margin-left: 16rem;
    margin-top: 4rem;
    padding: 1.5rem;
    min-height: calc(100vh - 4rem);
    background-color: #f9fafb;
}

/* ============================================
   STANDARDIZED DESIGN SYSTEM
   ============================================ */

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.5rem 0;
}

.page-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

/* Card Styles */
.card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.25rem 0;
}

.card-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* Grid Layouts */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 1024px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* KPI Cards */
.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
}

.kpi-label {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Button Styles */
.btn-primary,
.btn-secondary,
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

/* Ensure buttons work as links */
a.btn-primary,
a.btn-secondary,
a.btn-outline {
    display: inline-flex;
}

.btn-primary {
    background-color: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
}

.btn-primary:hover {
    background-color: #4338ca;
    border-color: #4338ca;
    color: #ffffff;
}

.btn-primary:active {
    background-color: #3730a3;
    transform: scale(0.98);
}

.btn-secondary {
    background-color: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
}

.btn-secondary:active {
    background-color: #f3f4f6;
    transform: scale(0.98);
}

.btn-outline {
    background-color: transparent;
    color: #4f46e5;
    border-color: #4f46e5;
}

.btn-outline:hover {
    background-color: #4f46e5;
    color: #ffffff;
}

.btn-outline:active {
    background-color: #4338ca;
    transform: scale(0.98);
}

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.data-table thead {
    background-color: #f9fafb;
}

.data-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    border-top: 1px solid #e5e7eb;
}

.data-table thead th:first-child {
    border-left: 1px solid #e5e7eb;
    border-top-left-radius: 0.5rem;
}

.data-table thead th:last-child {
    border-right: 1px solid #e5e7eb;
    border-top-right-radius: 0.5rem;
}

.data-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.15s;
    background-color: #ffffff;
}

.data-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.data-table tbody tr:hover {
    background-color: #eff6ff;
}

.data-table tbody tr:nth-child(even):hover {
    background-color: #eff6ff;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 0.5rem;
}

.data-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 0.5rem;
}

.data-table tbody td {
    padding: 1rem;
    color: #374151;
    border-left: 1px solid transparent;
    border-right: 1px solid transparent;
}

.data-table tbody tr:hover td {
    border-left-color: #e5e7eb;
    border-right-color: #e5e7eb;
}

.data-table tbody tr:first-child td {
    border-top: 1px solid #e5e7eb;
}

/* Table Wrapper */
.table-wrapper {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #ffffff;
}

/* Clickable Rows */
.customer-row,
.clickable-row {
    cursor: pointer;
}

.customer-row:hover,
.clickable-row:hover {
    background-color: #eff6ff !important;
}

.customer-row:hover td,
.clickable-row:hover td {
    border-left-color: #bfdbfe;
    border-right-color: #bfdbfe;
}

/* Yearly Stats Bars */
.yearly-stat-bar {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.yearly-stat-bar:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.yearly-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.yearly-stat-label {
    font-weight: 500;
    color: #111827;
}

.yearly-stat-value {
    color: #6b7280;
}

.yearly-stat-progress {
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    height: 0.5rem;
}

.yearly-stat-progress-fill {
    height: 100%;
    background-color: #3b82f6;
    transition: width 0.3s ease;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #6b7280;
}

.empty-state p {
    margin: 0;
    font-size: 0.875rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.bg-gray-500 { background-color: #6b7280; color: #ffffff; }
.status-badge.bg-blue-500 { background-color: #3b82f6; color: #ffffff; }
.status-badge.bg-yellow-500 { background-color: #eab308; color: #ffffff; }
.status-badge.bg-purple-500 { background-color: #a855f7; color: #ffffff; }
.status-badge.bg-green-500 { background-color: #22c55e; color: #ffffff; }
.status-badge.bg-red-500 { background-color: #ef4444; color: #ffffff; }
.status-badge.bg-gray-400 { background-color: #9ca3af; color: #ffffff; }
.status-badge.bg-gray-600 { background-color: #4b5563; color: #ffffff; }
.status-badge.bg-emerald-500 { background-color: #10b981; color: #ffffff; }

/* Accordion Styles */
.accordion-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #3b82f6;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.accordion-toggle:hover {
    color: #2563eb;
}

.accordion-icon {
    transition: transform 0.2s;
    font-size: 0.75rem;
}

.accordion-toggle[aria-expanded="true"] .accordion-icon {
    transform: rotate(90deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.accordion-content.expanded {
    max-height: 2000px;
}

.accordion-inner {
    padding: 1rem;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.customer-list-item {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background-color 0.15s;
}

.customer-list-item:hover {
    background-color: #f3f4f6;
}

.customer-list-item:last-child {
    border-bottom: none;
}

.customer-list-name {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.customer-list-details {
    font-size: 0.875rem;
    color: #6b7280;
}

.customer-list-details a {
    color: #3b82f6;
    text-decoration: none;
}

.customer-list-details a:hover {
    text-decoration: underline;
}

/* Loading States */
.loading-state {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Small, emoji-free spinner used in buttons */
.spinner {
    display: inline-block;
    width: 0.95em;
    height: 0.95em;
    border-radius: 999px;
    border: 2px solid rgba(107, 114, 128, 0.25);
    border-top-color: rgba(107, 114, 128, 0.9);
    animation: spinner-rotate 0.8s linear infinite;
}

.btn-primary .spinner {
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: rgba(255, 255, 255, 0.95);
}

@keyframes spinner-rotate {
    to { transform: rotate(360deg); }
}

/* ============================================
   Collections UI (readability)
   ============================================ */

.collections-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.collections-toolbar-left,
.collections-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.collections-view-label {
    color: #6b7280;
    font-size: 0.875rem;
}

.collections-legend {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: #6b7280;
    font-size: 0.875rem;
}

.collections-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    font-size: 0.75rem;
    line-height: 1.1rem;
    white-space: nowrap;
}

.collections-chip-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.collections-sort-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.collections-table-wrap {
    overflow: auto;
}

.collections-org-row {
    cursor: pointer;
    background: #f9fafb;
}

.collections-org-cell {
    padding: 0.75rem;
}

.collections-org-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: start;
}

.collections-org-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.collections-caret {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

.collections-org-name {
    font-weight: 700;
    color: #111827;
}

.collections-org-count {
    color: #6b7280;
    font-size: 0.875rem;
}

.collections-org-ap {
    color: #6b7280;
    font-size: 0.75rem;
}

.collections-org-right {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.collections-org-metrics {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 0.75rem;
    color: #374151;
    font-size: 0.875rem;
}

.collections-org-metrics strong {
    font-weight: 700;
}

@media (max-width: 840px) {
    .collections-org-header {
        grid-template-columns: 1fr;
    }
    .collections-org-right {
        justify-content: flex-start;
    }
    .collections-org-metrics {
        grid-template-columns: repeat(2, auto);
    }
}
