/**
 * Agrovaru — mudelite võrdlus ("Nutikas tabel").
 * Aktsendid järgivad tootelehe olemasolevat paletti: kollane #ffb900, tume #3c464b.
 */

.agrc {
    --agrc-accent: #ffb900;
    --agrc-dark:   #3c464b;
    --agrc-ink:    #1a1a1a;
    --agrc-muted:  #8b9296;
    --agrc-line:   #e8eaeb;
    --agrc-soft:   #f7f8f8;
    font-size: 14px;
    color: var(--agrc-ink);
}

/* JS võtab üle — serveripoolne tabel jääb ainult varuvariandiks */
.agrc.is-live .agrc-fallback { display: none; }

/* ── Tööriistariba ─────────────────────────────────────────────── */
.agrc-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    margin-bottom: 14px;
}
.agrc-chips { display: flex; flex-wrap: wrap; gap: 7px; flex: 1 1 auto; min-width: 0; }
.agrc-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 12px; border-radius: 20px; cursor: pointer;
    border: 1px solid var(--agrc-line); background: #fff;
    font: inherit; font-size: 13px; font-weight: 600; color: var(--agrc-dark);
    transition: border-color .15s, background .15s, color .15s;
}
.agrc-chip:hover { border-color: var(--agrc-accent); }
.agrc-chip.is-on { background: var(--agrc-dark); border-color: var(--agrc-dark); color: #fff; }
.agrc-chip.is-on::before { content: '✓'; font-size: 11px; color: var(--agrc-accent); }
.agrc-chip__kind { font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
                   text-transform: uppercase; opacity: .55; }

.agrc-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.agrc-toggle {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 13px; color: var(--agrc-dark); cursor: pointer; user-select: none;
}
.agrc-toggle input { accent-color: var(--agrc-accent); width: 15px; height: 15px; cursor: pointer; }

.agrc-add {
    font: inherit; font-size: 13px; padding: 7px 12px; cursor: pointer;
    border: 1px dashed #c9ced1; border-radius: 20px; background: #fff;
    color: var(--agrc-dark); max-width: 260px;
}
.agrc-add:hover { border-color: var(--agrc-accent); }

.agrc-empty { color: var(--agrc-muted); font-size: 13.5px; padding: 18px 0; }

/* ── Tabel ─────────────────────────────────────────────────────── */
.agrc-scroll { overflow-x: auto; border: 1px solid var(--agrc-line); border-radius: 10px; background: #fff; }
.agrc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.agrc-table th, .agrc-table td {
    padding: 10px 14px; text-align: left; border-bottom: 1px solid #f2f3f4; white-space: nowrap;
}
.agrc-table tbody tr:last-child td { border-bottom: none; }
.agrc-table thead th {
    background: var(--agrc-soft); font-weight: 700; color: var(--agrc-ink);
    border-bottom: 2px solid var(--agrc-line); position: sticky; top: 0; z-index: 2;
}
.agrc-labelcol {
    position: sticky; left: 0; z-index: 1; background: #fff;
    font-weight: 600; color: #5d6569; white-space: normal; min-width: 170px;
}
.agrc-table thead .agrc-labelcol { background: var(--agrc-soft); z-index: 3; }
.agrc-table tbody tr:hover td { background: #fcfcfa; }
.agrc-table tbody tr:hover .agrc-labelcol { background: #f7f7f4; }
.agrc-th-name { display: block; }
.agrc-th-sub  { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
                text-transform: uppercase; color: var(--agrc-muted); margin-top: 2px; }
.agrc-x {
    float: right; border: none; background: none; cursor: pointer; padding: 0 0 0 8px;
    color: #c2c7ca; font-size: 15px; line-height: 1;
}
.agrc-x:hover { color: #d63638; }

/* ── Avamisnupp mudelitabeli all ──────────────────────────────── */
.agrc-launch { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.agrc-open {
    display: inline-flex; align-items: center; gap: 9px;
    font: inherit; font-size: 14px; font-weight: 700;
    padding: 11px 20px; border-radius: 8px; cursor: pointer;
    background: #3c464b; color: #fff; border: none;
    transition: background .15s, transform .12s;
}
.agrc-open:hover { background: #2d373b; transform: translateY(-1px); }
.agrc-open__icon  { font-size: 16px; color: #ffb900; }
.agrc-open__count { background: #ffb900; color: #14181a; border-radius: 20px;
                    padding: 1px 9px; font-size: 12px; font-weight: 800; }
.agrc-launch__hint { font-size: 12.5px; color: #8b9296; }

/* ── Võrdlusaken (popup) ──────────────────────────────────────── */
.agrc-modal { position: fixed; inset: 0; z-index: 100000; display: flex;
              align-items: center; justify-content: center; padding: 24px; }
.agrc-modal[hidden] { display: none; }
.agrc-modal__backdrop { position: absolute; inset: 0; background: rgba(16,20,22,.62);
                        backdrop-filter: blur(2px); animation: agrc-fade .18s ease; }
.agrc-modal__dialog {
    position: relative; background: #fff; border-radius: 14px;
    width: 100%; max-width: 1140px; max-height: calc(100vh - 48px);
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 22px 70px rgba(0,0,0,.34); animation: agrc-pop .2s ease;
}
@keyframes agrc-fade { from { opacity: 0; } }
@keyframes agrc-pop  { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.agrc-modal__head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    padding: 16px 22px; border-bottom: 1px solid #e8eaeb; background: #f7f8f8; flex-shrink: 0;
}
.agrc-modal__head strong { display: block; font-size: 16px; color: #14181a; }
.agrc-modal__head span   { display: block; font-size: 12.5px; color: #8b9296; margin-top: 2px; }
.agrc-modal__close {
    background: none; border: none; cursor: pointer; font-size: 26px; line-height: 1;
    color: #9aa1a5; padding: 0 2px; flex-shrink: 0;
}
.agrc-modal__close:hover { color: #1a1a1a; }

.agrc-modal__body { padding: 18px 22px 24px; overflow-y: auto; flex: 1; }
/* Aknas ei pea tabel ise kerima — kerib aknasisu */
.agrc-modal__body .agrc-table thead th { top: -18px; }

body.agrc-locked { overflow: hidden; }

@media (max-width: 700px) {
    .agrc-modal { padding: 0; }
    .agrc-modal__dialog { max-width: none; max-height: 100vh; height: 100vh; border-radius: 0; }
    .agrc-modal__body { padding: 14px 14px 22px; }
    .agrc-open { width: 100%; justify-content: center; }
    .agrc-launch__hint { display: none; }
    .agrc-bar { gap: 8px; }
    .agrc-tools { width: 100%; }
    .agrc-add { max-width: 100%; width: 100%; }
}
