:root {
    --tg-white: #fff;
    --tg-grey: #E7E7E8;
    --tg-grey2: #ebebeb;
    --tg-dark-grey: #231F20;
    --tg-green: #D8E18F;

    --abc-base: var(--tg-green);
    --abc-base-soft: #edf0cb;
    --abc-base-pale: #f5f6e8;
    --abc-forest: var(--tg-dark-grey);
    --abc-ink: var(--tg-dark-grey);
    --abc-muted: #6b6b6b;
    --abc-bg: var(--tg-grey);
    --abc-panel: var(--tg-white);
    --abc-line: var(--tg-grey2);
    --abc-shadow: 0 18px 45px rgba(35, 31, 32, 0.10);
    --abc-ui-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --abc-display-font: "Fraunces", Georgia, serif;
}

body {
    background: var(--tg-grey);
    color: var(--abc-ink);
    font-family: var(--abc-ui-font);
    font-size: 16px;
    letter-spacing: 0;
}

h1,
h2,
h3,
.navbar-brand {
    color: var(--abc-forest);
}

h1,
.display-5 {
    font-family: var(--abc-display-font);
    letter-spacing: 0;
}

.lead {
    font-weight: 500;
}

.app-shell {
    min-height: 100vh;
}

@media (min-width: 1200px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1100px;
    }
}

.topbar {
    border-bottom: 1px solid var(--abc-line);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
}

.hero-brand .navbar-brand {
    color: #fff;
}

.hero-brand .btn-outline-light {
    --bs-btn-color: #fff;
    --bs-btn-border-color: rgba(255, 255, 255, 0.64);
    --bs-btn-hover-color: var(--tg-dark-grey);
    --bs-btn-hover-bg: var(--tg-green);
    --bs-btn-hover-border-color: var(--tg-green);
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--tg-dark-grey);
    color: #fff;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(35, 31, 32, 0.22);
}

.brand-mark img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: block;
}

.btn-dark {
    --bs-btn-bg: var(--tg-dark-grey);
    --bs-btn-border-color: var(--tg-dark-grey);
    --bs-btn-hover-bg: #3a3536;
    --bs-btn-hover-border-color: #3a3536;
}

.btn-outline-dark,
.btn-outline-secondary {
    --bs-btn-color: var(--tg-dark-grey);
    --bs-btn-border-color: #b5b5b5;
    --bs-btn-hover-bg: var(--tg-dark-grey);
    --bs-btn-hover-border-color: var(--tg-dark-grey);
    --bs-btn-hover-color: #fff;
}

.hero {
    padding: 58px 0 40px;
    background: var(--tg-green);
    color: var(--tg-dark-grey);
    border-bottom: none;
}

.hero h1,
.hero .display-5 {
    color: var(--tg-dark-grey);
    max-width: 14ch;
}

.hero .lead {
    color: rgba(35, 31, 32, 0.7);
    max-width: 48rem;
}

.hero .badge {
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.88) !important;
    color: var(--tg-dark-grey) !important;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.hero-notice {
    display: inline-block;
    padding: 0.55rem 0.75rem;
    border: 1px solid rgba(35, 31, 32, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.4);
    color: var(--tg-dark-grey);
}

.search-panel {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--abc-line);
    border-radius: 8px;
    box-shadow: var(--abc-shadow);
}

.smart-search {
    margin-top: -2.25rem;
    position: relative;
    z-index: 2;
}

.smart-search-header h2 {
    font-family: var(--abc-display-font);
}

.smart-tabs {
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.35rem;
    border: 1px solid var(--abc-line);
    border-radius: 8px;
    background: var(--tg-grey2);
}

.smart-tab {
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tg-dark-grey);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 0.85rem;
    font-weight: 700;
    transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.smart-tab:hover,
.smart-tab.is-active {
    background: #fff;
    box-shadow: 0 8px 20px rgba(35, 31, 32, 0.10);
}

.smart-tab.is-active {
    transform: translateY(-1px);
}

.smart-tab [data-lucide] {
    width: 18px;
    height: 18px;
}

.smart-search-box {
    border: 1px solid var(--abc-line);
    border-radius: 8px;
    background:
        radial-gradient(circle at 92% 8%, rgba(216, 225, 143, 0.3), transparent 10rem),
        #fff;
    padding: 1rem;
}

.smart-input-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid #c8c8c8;
    border-radius: 8px;
    background: #fff;
    padding: 0 0.9rem;
}

.smart-input-row:focus-within {
    border-color: var(--tg-dark-grey);
    box-shadow: 0 0 0 0.22rem rgba(216, 225, 143, 0.5);
}

.smart-input-row [data-lucide] {
    color: var(--tg-dark-grey);
}

.smart-input-row .form-control {
    border: 0;
    box-shadow: none;
    padding-left: 0;
}

/* Undertrykker Bootstraps indre fokus-ring — ydre wrapper (.smart-input-row:focus-within) håndterer den */
.smart-input-row .form-control:focus {
    box-shadow: none;
    outline: 0;
}

.smart-question {
    min-height: 112px;
}

.form-label {
    color: var(--tg-dark-grey);
}

.form-control,
.form-select {
    border-color: #c8c8c8;
    color: var(--abc-ink);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--tg-dark-grey);
    box-shadow: 0 0 0 0.22rem rgba(216, 225, 143, 0.5);
}

.input-group-text {
    border-color: #c8c8c8;
    color: var(--tg-dark-grey);
}

.drop-zone {
    min-height: 132px;
    display: grid;
    place-items: center;
    align-content: center;
    border: 1px dashed #b0b0b0;
    border-radius: 8px;
    background: linear-gradient(180deg, var(--tg-grey2), #fff);
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.drop-zone [data-lucide="camera"] {
    width: 34px;
    height: 34px;
    color: var(--tg-dark-grey);
}

.drop-zone:hover,
.drop-zone.is-dragging {
    border-color: var(--tg-dark-grey);
    background: var(--abc-base-soft);
    box-shadow: 0 12px 28px rgba(35, 31, 32, 0.10);
    transform: translateY(-1px);
}

.result-card,
.admin-panel,
.fraction-card {
    border: 1px solid var(--abc-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 28px rgba(35, 31, 32, 0.06);
}

.result-card {
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.result-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(35, 31, 32, 0.10);
}

.result-card-primary {
    border-color: #c5cc78;
    background: linear-gradient(180deg, #ffffff 0%, var(--abc-base-pale) 100%);
    box-shadow: 0 18px 44px rgba(35, 31, 32, 0.10);
}

.category-chip,
.home-possible,
.relevance-stars {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
}

.category-chip {
    padding: 0.45rem 0.72rem;
    background: var(--abc-base-soft);
    color: var(--tg-dark-grey);
    border: 1px solid #cbd47b;
}

.home-possible {
    padding: 0.42rem 0.65rem;
    color: var(--abc-muted);
    background: #f7f7f7;
    border: 1px solid var(--abc-line);
}

.home-possible [data-lucide] {
    width: 13px;
    height: 13px;
}

.relevance-stars {
    color: #867200;
    white-space: nowrap;
}

.relevance-stars small {
    color: var(--abc-muted);
    font-weight: 700;
}

.sort-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.sort-box {
    border: 1px solid var(--abc-line);
    border-radius: 8px;
    background: #fff;
    padding: 0.85rem;
    min-height: 92px;
}

.sort-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--abc-muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.sort-label [data-lucide] {
    width: 14px;
    height: 14px;
}

.sort-value {
    font-weight: 750;
    color: var(--tg-dark-grey);
    line-height: 1.3;
}

.result-description {
    color: var(--abc-ink);
    line-height: 1.55;
}

.fraction-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.muted {
    color: var(--abc-muted);
}

.icon-btn {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    box-shadow: 0 8px 20px rgba(35, 31, 32, 0.12);
}

.fraction-icon-wrap {
    width: 52px;
    height: 52px;
    display: inline-grid;
    place-items: center;
}

.fraction-pictogram {
    width: 52px;
    height: 52px;
    object-fit: contain;
    display: block;
}

.fraction-dot-lg {
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

/* Result card — ny datastruktur */
.result-pik-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    min-width: 56px;
}

/* Fraktionspiktogram — "selve fraktionen" (Madaffald, Plast, Papir …)
   Viser hvilken beholder/container affaldet tilhører */
.result-pik-fraction {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    border: 1.5px solid transparent;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.result-pictogram {
    width: 52px;
    height: 52px;
    object-fit: contain;
    display: block;
}

/* MST item-piktogrammer — "primær MST-fraktion" (specifikke underkategorier)
   Viser det mere præcise affaldstype-piktogram fra MST */
.result-pictogram-item {
    width: 40px;
    height: 40px;
    opacity: 0.72;
}

.result-location {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.result-location-alt {
    font-size: 0.85rem;
    opacity: 0.7;
}

.result-loc-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--tg-dark-grey);
}

.result-behandling {
    color: var(--abc-muted);
    margin-top: 0.75rem;
    line-height: 1.5;
}

.result-co2 {
    color: #3A7D44;
    margin-top: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.3rem;
}

.result-co2-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    margin-top: 2px;
}

.result-kommunal {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    margin-top: 0.75rem;
    color: var(--abc-muted);
    background: var(--abc-base-pale);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
}

.result-info-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--abc-muted);
}

.min-w-0 {
    min-width: 0;
}

.help-panel {
    position: sticky;
    top: 88px;
}

.help-icon {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    background: var(--abc-base-soft);
    color: var(--tg-dark-grey);
}

.preview-img {
    max-height: 190px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--abc-line);
    background: #fff;
}

.badge.text-bg-warning {
    background: var(--tg-green) !important;
    color: var(--tg-dark-grey) !important;
}

.text-warning {
    color: #7a8020 !important;
}

.table td,
.table th {
    vertical-align: middle;
}

.table {
    --bs-table-hover-bg: var(--abc-base-pale);
}

.alert-success {
    --bs-alert-bg: var(--abc-base-soft);
    --bs-alert-border-color: #c8ce80;
    --bs-alert-color: var(--tg-dark-grey);
}

.alert-warning {
    --bs-alert-bg: #fff6d8;
    --bs-alert-border-color: #f1d487;
    --bs-alert-color: #5c4310;
}

.ask-answer {
    border-left: 4px solid var(--tg-green);
    background: var(--abc-base-pale);
    border-radius: 8px;
    padding: 1rem;
    white-space: pre-wrap;
}

.seo-index {
    border-top: 1px solid var(--abc-line);
    padding-top: 1.5rem;
}

.seo-index-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
}

.seo-index-item {
    font-size: 0.78rem;
    color: var(--abc-muted);
    text-decoration: none;
}

.seo-index-item:hover {
    color: var(--tg-dark-grey);
    text-decoration: underline;
}

.seo-index-name::after {
    content: ' →';
    opacity: 0.5;
}

.seo-index-fraction {
    font-style: italic;
}

.site-footer {
    color: var(--abc-muted);
    text-align: center;
    opacity: 0.86;
}

.site-footer a {
    color: var(--tg-dark-grey);
    font-weight: 700;
}

.loading-status {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--tg-dark-grey);
    font-weight: 700;
}

.loading-spinner {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    border: 3px solid rgba(35, 31, 32, 0.15);
    border-top-color: var(--tg-dark-grey);
    animation: abc-spin 780ms linear infinite;
}

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

@keyframes abc-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    animation: abc-fade-in 220ms ease both;
}

.skeleton-card {
    border: 1px solid var(--abc-line);
    border-radius: 8px;
    background: #fff;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.skeleton-line {
    border-radius: 4px;
    background: linear-gradient(90deg, var(--tg-grey2) 25%, #f0f0f0 50%, var(--tg-grey2) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.2s ease infinite;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.share-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--abc-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    transition: color 160ms ease;
}

.share-btn:hover {
    color: var(--tg-dark-grey);
}

.result-card:nth-child(2) { animation-delay: 60ms; }
.result-card:nth-child(3) { animation-delay: 120ms; }
.result-card:nth-child(4) { animation-delay: 180ms; }

.search-clear-btn {
    background: none;
    border: none;
    padding: 0 0.5rem;
    color: var(--abc-muted);
    cursor: pointer;
    line-height: 1;
    display: none;
}

.search-clear-btn:hover {
    color: var(--tg-dark-grey);
}

.search-clear-btn.is-visible {
    display: flex;
    align-items: center;
}

.help-toggle {
    display: none;
    width: 100%;
    background: none;
    border: 1px solid var(--abc-line);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--tg-dark-grey);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    margin-top: 1.5rem;
}

.help-toggle-panel {
    display: contents;
}

@media (max-width: 991.98px) {
    .help-panel {
        position: static;
    }

    .help-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .help-toggle-panel.is-collapsed {
        display: none;
    }
}

/* category-chip as link */
a.category-chip {
    text-decoration: none;
    transition: background 140ms, border-color 140ms;
}

a.category-chip:hover {
    background: var(--abc-base-soft);
    border-color: #a8b45a;
}

/* Fraktion listing page */
.fraktion-hero-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
}

.fraktion-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--abc-line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(35, 31, 32, 0.06);
}

.fraktion-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--abc-line);
    color: var(--abc-ink);
    text-decoration: none;
    transition: background 120ms;
}

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

.fraktion-list-item:hover {
    background: var(--abc-base-pale);
}

.fraktion-list-title {
    font-weight: 500;
}

.fraktion-list-arrow {
    width: 16px;
    height: 16px;
    color: var(--abc-muted);
    flex-shrink: 0;
}

/* Fraction icons in result cards */
.fraction-chip-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
}

.sort-pik {
    width: 36px;
    height: 36px;
    object-fit: contain;
    display: block;
    margin-bottom: 0.35rem;
}

/* Admin: small icon in table and next to selects */
.fraction-admin-table-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 0.3rem;
    flex-shrink: 0;
}

.fraction-admin-preview {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 6px;
    border: 1px solid var(--abc-line);
    background: #fff;
    padding: 2px;
}

/* Admin fractions grid */
.fraction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.fraction-card-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
}

.fraction-card-icon-placeholder {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border: 1px dashed var(--abc-line);
    border-radius: 8px;
    color: var(--abc-muted);
    flex-shrink: 0;
}

.fraction-card-icon-placeholder [data-lucide] {
    width: 20px;
    height: 20px;
}

/* Icon picker in fraction modal */
.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.icon-pick {
    cursor: pointer;
    border: 2px solid var(--abc-line);
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
    text-align: center;
    font-size: 0.68rem;
    transition: border-color 140ms, background 140ms;
    min-width: 64px;
}

.icon-pick:hover {
    border-color: #aaa;
    background: var(--abc-base-pale);
}

.icon-pick.is-selected {
    border-color: var(--tg-dark-grey);
    background: var(--abc-base-soft);
}

.icon-pick-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
    margin: 0 auto 0.2rem;
}

.icon-pick-none {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--abc-muted);
    margin: 0 auto 0.2rem;
}

.icon-pick-label {
    display: block;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--abc-muted);
}

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

    .hero {
        padding: 38px 0 28px;
    }

    .display-5 {
        font-size: 2.25rem;
    }

    .hero h1,
    .hero .display-5 {
        max-width: 100%;
    }

    .search-panel {
        margin-top: -0.5rem;
    }

    .smart-search {
        margin-top: -1rem;
    }

    .smart-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .smart-tab {
        justify-content: center;
        padding: 0.55rem 0.4rem;
    }

    .drop-zone {
        min-height: 150px;
    }
}
