/* Shared form controls — soft native selects (fallback) + HeyQuarry custom selects */

/* Fallback for unenhanced / .ui-raw native selects */
select:not([multiple]):not(.ui-raw):not(.hq-select-native) {
    -webkit-appearance: none !important;
    appearance: none !important;
    background-color: #f8f8f8 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") !important;
    background-position: right 0.75rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1rem 1rem !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 0.75rem !important;
    box-shadow: none !important;
    color: #111111 !important;
    font-size: 0.875rem !important;
    line-height: 1.25rem !important;
    min-height: 2.75rem;
    padding: 0.625rem 2.5rem 0.625rem 1rem !important;
}

/* —— HeyQuarry-style custom select —— */
.hq-select {
    position: relative;
    display: inline-block;
    min-width: 0;
    vertical-align: top;
}
.hq-select.hq-select--full {
    display: block;
    width: 100%;
}

.hq-select-trigger {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.625rem 1rem;
    border: 1px solid #e5e5e5;
    border-radius: 0.75rem;
    background: #f8f8f8;
    color: #111827;
    font-size: 0.875rem;
    line-height: 1.25rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.hq-select-trigger:hover {
    border-color: #d1d5db;
}
.hq-select-trigger:focus,
.hq-select-trigger.is-open {
    outline: none;
    border-color: #d1d5db;
    box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.12);
}
.hq-select-trigger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hq-select-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: #111827;
}

.hq-select-chevron {
    display: inline-flex;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}
.hq-select-chevron svg {
    width: 16px !important;
    height: 16px !important;
    display: block;
}
.hq-select-chevron.is-open {
    transform: rotate(180deg);
}

/* Portaled open panel (HeyQuarry dropdown-panel) */
.hq-dropdown-panel {
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
    overscroll-behavior: contain;
    padding: 0.75rem 0.375rem 0.75rem 0.75rem;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.hq-dropdown-panel.hq-scrollbar {
    overflow-y: auto;
}

.hq-dropdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.hq-dropdown-item {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25rem;
    text-align: left;
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}
.hq-dropdown-item:hover,
.hq-dropdown-item:focus {
    outline: none;
    background: #f5f5f5;
}
.hq-dropdown-item.is-active {
    background: #f4f4f5;
    color: #111827;
    font-weight: 600;
}

/* Thin modern scrollbar (no OS arrow buttons) */
.hq-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(107, 114, 128, 0.35) transparent;
}
.hq-scrollbar::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
.hq-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.hq-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(107, 114, 128, 0.28);
    border-radius: 9999px;
}
.hq-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(107, 114, 128, 0.45);
}
.hq-scrollbar::-webkit-scrollbar-button,
.hq-scrollbar::-webkit-scrollbar-corner {
    display: none;
    width: 0;
    height: 0;
}

.ui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    min-height: 2.75rem;
    padding: 0.625rem 1rem;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ui-btn-primary {
    background: #111111;
    color: #ffffff;
}
.ui-btn-primary:hover {
    background: #262626;
}
.ui-btn-secondary {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    color: #111111;
}
.ui-btn-secondary:hover {
    border-color: #d4d4d4;
    background: #fafafa;
}

input[type="date"],
input[type="text"].ui-input,
input[type="email"].ui-input,
input[type="search"].ui-input {
    background-color: #f8f8f8;
    border: 1px solid #e5e5e5;
    border-radius: 0.75rem;
    box-shadow: none;
    color: #111111;
    font-size: 0.875rem;
    line-height: 1.25rem;
    min-height: 2.75rem;
    padding: 0.625rem 1rem;
}
input[type="date"]:focus {
    outline: none;
    border-color: #d4d4d4;
    box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.12);
}

/* Partner tier metallic palette (slight sheen, not chrome) */
:root {
    --tier-bronze: #B87333;
    --tier-bronze-hi: #D4A06A;
    --tier-bronze-lo: #8C5524;
    --tier-bronze-text: #3F2410;

    --tier-silver: #A8ADB7;
    --tier-silver-hi: #D0D4DB;
    --tier-silver-lo: #7E858F;
    --tier-silver-text: #2A2E35;

    --tier-gold: #C9A227;
    --tier-gold-hi: #E6C85A;
    --tier-gold-lo: #9A7A14;
    --tier-gold-text: #3D3008;

    --tier-elite: #6500ff;
    --tier-elite-hi: #8B3DFF;
    --tier-elite-lo: #4B00C4;
    --tier-elite-text: #ffffff;

    --tier-gray: #E5E5E5;
    --tier-gray-hi: #F5F5F5;
    --tier-gray-lo: #D4D4D4;
    --tier-gray-text: #404040;
}

.tier-badge,
.tier-swatch {
    background-image: linear-gradient(
        145deg,
        var(--tier-fill-hi) 0%,
        var(--tier-fill) 48%,
        var(--tier-fill-lo) 100%
    );
    color: var(--tier-fill-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.tier-badge {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    border-radius: 4px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25rem;
}

.tier-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
}

.tier-badge-bronze,
.tier-swatch-bronze {
    --tier-fill: var(--tier-bronze);
    --tier-fill-hi: var(--tier-bronze-hi);
    --tier-fill-lo: var(--tier-bronze-lo);
    --tier-fill-text: var(--tier-bronze-text);
}

.tier-badge-silver,
.tier-swatch-silver {
    --tier-fill: var(--tier-silver);
    --tier-fill-hi: var(--tier-silver-hi);
    --tier-fill-lo: var(--tier-silver-lo);
    --tier-fill-text: var(--tier-silver-text);
}

.tier-badge-gold,
.tier-swatch-gold {
    --tier-fill: var(--tier-gold);
    --tier-fill-hi: var(--tier-gold-hi);
    --tier-fill-lo: var(--tier-gold-lo);
    --tier-fill-text: var(--tier-gold-text);
}

.tier-badge-elite,
.tier-swatch-elite {
    --tier-fill: var(--tier-elite);
    --tier-fill-hi: var(--tier-elite-hi);
    --tier-fill-lo: var(--tier-elite-lo);
    --tier-fill-text: var(--tier-elite-text);
}

.tier-badge-gray,
.tier-swatch-gray {
    --tier-fill: var(--tier-gray);
    --tier-fill-hi: var(--tier-gray-hi);
    --tier-fill-lo: var(--tier-gray-lo);
    --tier-fill-text: var(--tier-gray-text);
}

/* Soft KPI card icons (pale grey squircle + charcoal line icon) */
.kpi-icon {
    position: absolute;
    top: 1.25rem;
    left: 1rem;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 2.5rem !important;
    height: 2.5rem !important;
    padding: 0 !important;
    border-radius: 0.75rem !important;
    background: #f3f4f6 !important;
    box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.06);
    color: #262626 !important;
}
@media (min-width: 640px) {
    .kpi-icon {
        left: 1.5rem;
    }
}
.kpi-icon svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
    max-width: 1.25rem !important;
    max-height: 1.25rem !important;
    color: #262626 !important;
    stroke: currentColor !important;
    fill: none !important;
    flex-shrink: 0;
    display: block !important;
}
