/* AMPOLSHOP V9.3 — final contrast layer and Graphite hardening. */

:root[data-theme="graphite"] {
    --theme-text: #f3f7f9;
    --theme-muted: #c5d0d7;
    --theme-faint: #9eacb6;
    --theme-accent-text: #b3ebce;
}

/* Accent utilities are foreground colors. Do not reuse the darker gradient token. */
html[data-theme] body.ampol-app [class*="text-emerald-"] {
    color: var(--theme-accent-text) !important;
}

html[data-theme] body.ampol-app :is(
    .btn-secondary:hover,
    .btn-ghost:hover,
    .copy-chip,
    .ampol-desktop-nav a.is-active,
    .mobile-app-nav > a.is-active,
    .ampol-section-head > a,
    .ampol-theme-current b,
    .ampol-check-state,
    .ampol-eye-button,
    .ampol-quick-order-drawer__head p,
    .ampol-quick-item__title small,
    .ampol-quick-data button
) {
    color: var(--theme-accent-text) !important;
}

/* Graphite must be a consistently dark surface with explicit readable foregrounds. */
:root[data-theme="graphite"] body.ampol-app,
:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui {
    color: #f3f7f9 !important;
    color-scheme: dark;
}

:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui :is(
    .premium-panel,
    .glass-panel,
    .metric-card,
    .admin-surface,
    .admin-order-row,
    .ticket-row
) {
    color: #f3f7f9 !important;
    border-color: rgba(214, 228, 238, .15) !important;
    background: linear-gradient(150deg, #202832, #1a222b) !important;
}

:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui :is(
    .premium-panel,
    .glass-panel,
    .metric-card,
    .admin-surface,
    .admin-order-row,
    .ticket-row
) :is(
    h1,h2,h3,h4,h5,h6,b,strong,
    .text-white,.text-slate-900,.text-slate-800,.text-slate-700,
    .text-gray-900,.text-gray-800,.text-gray-700,
    .text-zinc-900,.text-zinc-800,.text-zinc-700,.text-zinc-100,.text-zinc-200
) {
    color: #f3f7f9 !important;
    -webkit-text-fill-color: #f3f7f9 !important;
    text-shadow: none !important;
}

:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui :is(
    .text-slate-600,.text-slate-500,.text-slate-400,
    .text-gray-600,.text-gray-500,.text-gray-400,
    .text-zinc-300,.text-zinc-400,.text-zinc-500,.text-zinc-600
) {
    color: #c5d0d7 !important;
    -webkit-text-fill-color: #c5d0d7 !important;
    text-shadow: none !important;
}

:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui [class*="text-emerald-"],
:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui nav a[class*="text-emerald-"],
:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui a:hover[class*="hover:text-emerald-"] {
    color: #b3ebce !important;
    -webkit-text-fill-color: #b3ebce !important;
}

:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui nav a:not([class*="text-emerald-"]) {
    color: #c5d0d7 !important;
    -webkit-text-fill-color: #c5d0d7 !important;
}

:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui :is(
    [class~="bg-white"],[class~="bg-white/5"],[class~="bg-white/10"],[class~="bg-white/15"],
    [class~="bg-white/[.02]"],[class~="bg-white/[.025]"],[class~="bg-white/[.03]"],
    [class~="bg-white/[.035]"],[class~="bg-white/[.04]"],[class~="bg-white/[.05]"],
    [class~="bg-slate-50"],[class~="bg-gray-50"],
    [class~="bg-emerald-50"],[class~="bg-emerald-50/40"],[class~="bg-emerald-50/50"],
    [class~="bg-emerald-50/60"],[class~="bg-emerald-50/70"],[class~="bg-emerald-50/90"],
    [class~="bg-[#eef8f3]"],[class~="bg-[#edf7f2]"],[class~="bg-[#f3f8f5]"]
):not(.btn-primary):not(.status-pill) {
    color: #f3f7f9 !important;
    border-color: rgba(214, 228, 238, .15) !important;
    background: #252e38 !important;
}

:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui .admin-table th {
    color: #c5d0d7 !important;
    background: #252e38 !important;
}

:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui .admin-table td {
    color: #f3f7f9 !important;
    background: transparent !important;
}

:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui :is(input,select,textarea,option) {
    color: #f3f7f9 !important;
    -webkit-text-fill-color: #f3f7f9 !important;
    border-color: rgba(214, 228, 238, .17) !important;
    background-color: #202832 !important;
}

:root[data-theme="graphite"] body.ampol-app .ampol-admin-ui :is(input,textarea)::placeholder {
    color: #9eacb6 !important;
    -webkit-text-fill-color: #9eacb6 !important;
    opacity: 1 !important;
}

/* Preserve semantic foreground colors after the broad Graphite rules. */
:root[data-theme="graphite"] body.ampol-app .status-green { color: #9be4be !important; -webkit-text-fill-color: #9be4be !important; }
:root[data-theme="graphite"] body.ampol-app .status-yellow { color: #fcd66d !important; -webkit-text-fill-color: #fcd66d !important; }
:root[data-theme="graphite"] body.ampol-app .status-red { color: #fda4af !important; -webkit-text-fill-color: #fda4af !important; }
:root[data-theme="graphite"] body.ampol-app .status-blue { color: #8ed8ff !important; -webkit-text-fill-color: #8ed8ff !important; }
:root[data-theme="graphite"] body.ampol-app .status-purple { color: #d8b4fe !important; -webkit-text-fill-color: #d8b4fe !important; }
