/* ========================================
   Alat Google Review QR Code, /qr-code-review-google/
   Dimuat selepas v2.css. SEMUA warna UI dari token v2.css.
   Pengecualian tunggal, palet poster (artifak cetak). Nilai warnanya ditetapkan oleh qr-tool.js
   sebagai --qt-sw, --qt-paper, --qt-white, --qt-ink, dan hanya dipakai pada lakaran gaya dan swatch.
   ======================================== */

/* Atribut hidden mesti menang atas display dari v2.css (.field ialah grid) */
.qt-hero [hidden], .qt-poster [hidden], .qt-wa [hidden] { display: none !important; }

/* ---------- Hero dan grid alat ---------- */
.qt-hero { padding-top: 16px; padding-bottom: 40px; }
@media (min-width: 960px) { .qt-hero { padding-top: 36px; padding-bottom: 64px; } }
.qt-hero h1 {
    margin-top: 6px; font-size: clamp(1.8rem, 1rem + 3.2vw, 2.9rem);
    letter-spacing: -0.025em; line-height: 1.08; font-stretch: 106%; max-width: 22ch;
}
.qt-lead { margin-top: 8px; color: var(--text-soft); font-size: 1.02rem; max-width: 60ch; }
@media (min-width: 960px) { .qt-lead { font-size: 1.1rem; margin-top: 12px; } }

.qt-grid { display: grid; gap: 14px; margin-top: 16px; }
/* Telefon, susunan ikut keutamaan, input kemudian QR kemudian panduan. Lajur dibuka dengan display contents. */
@media (max-width: 899px) {
    .qt-grid > .qt-col { display: contents; }
    .qt-input-card { order: 1; }
    .qt-qr-card { order: 2; }
    .qt-howto { order: 3; }
    .qt-hero .crumbs { display: none; }
    .qt-hero h1 { margin-top: 0; }
}
@media (min-width: 900px) {
    .qt-grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr); gap: 28px; margin-top: 28px; align-items: start; }
    .qt-grid > .qt-col:last-child { position: sticky; top: 84px; }
}
.qt-col { display: grid; gap: 16px; align-content: start; min-width: 0; }

.qt-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 18px; box-shadow: var(--shadow-1); min-width: 0;
}
@media (min-width: 600px) { .qt-card { padding: 24px; } }

.qt-step { display: flex; align-items: center; gap: 12px; }
.qt-num {
    flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: var(--brand); color: var(--on-brand); font-weight: 800; font-size: 1rem;
    box-shadow: 0 0 0 5px var(--brand-soft);
}
.qt-h, section .qt-h { font-size: 1.22rem; letter-spacing: -0.01em; font-stretch: 104%; max-width: none; line-height: 1.2; }
.qt-poster .qt-h, .qt-wa .qt-h { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
.qt-sub { margin-top: 10px; color: var(--text-soft); max-width: 60ch; }

/* ---------- Input ---------- */
.qt-seg {
    display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 14px; padding: 4px;
    border: 0; border-radius: 999px; background: var(--bg-alt); min-width: 0;
}
.qt-seg label { position: relative; display: block; }
.qt-seg input, .qt-style input, .qt-swatch input {
    position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none;
}
.qt-seg span {
    display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 18px;
    border-radius: 999px; font-weight: 700; font-size: .95rem; color: var(--text-soft); cursor: pointer;
    transition: background-color .2s var(--ease-out), color .2s var(--ease-out);
}
.qt-seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.qt-seg input:focus-visible + span,
.qt-style input:focus-visible ~ .qt-style-thumb,
.qt-swatch input:focus-visible + .qt-swatch-dot { outline: 3px solid var(--brand); outline-offset: 3px; }

.qt-field { margin-top: 12px; }
.qt-field input { font-size: 1rem; }
.qt-field input[data-tone="ok"] { border-color: var(--brand); }
.qt-field input[aria-invalid="true"] { border-color: var(--bad); }
.qt-select {
    width: 100%; min-height: 52px; padding: 12px 40px 12px 16px; border-radius: 12px;
    border: 1.5px solid var(--line-strong); background-color: var(--surface); color: var(--text);
    font: inherit; font-size: 1rem; cursor: pointer; appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%), linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
    background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%;
    background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
.qt-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.qt-select-sm { width: auto; min-height: 48px; }

.qt-msg { margin-top: 12px; display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: .95rem; line-height: 1.5; }
.qt-msg:empty { display: none; }
.qt-msg svg { width: 22px; height: 22px; margin-top: 1px; }
.qt-msg p + p { margin-top: 4px; }
.qt-msg[data-tone="ok"] { color: var(--text); }
.qt-msg[data-tone="ok"] svg { color: var(--brand-text); }
.qt-msg[data-tone="warn"] { color: var(--text); padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border-left: 4px solid var(--star); grid-template-columns: 22px 1fr; }
.qt-msg[data-tone="warn"] svg { color: var(--star); }
.qt-msg[data-tone="bad"] { color: var(--bad); font-weight: 600; }
.qt-msg[data-tone="bad"] svg { color: var(--bad); }
.qt-msg strong { font-weight: 800; }

.qt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 14px; }
.qt-btn-line {
    background: transparent; color: var(--brand-text); border: 1.5px solid var(--line-strong); box-shadow: none;
}
.qt-btn-line:hover { border-color: var(--brand); background: var(--brand-soft); }
.qt-btn-line[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.qt-card .btn[disabled], .qt-poster .btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.qt-private { margin-top: 10px; font-size: .88rem; color: var(--text-soft); text-align: center; }
.qt-private svg { display: inline-block; width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; }

/* ---------- Panduan dapatkan link ---------- */
.qt-howto { padding-block: 4px; }
.qt-howto summary {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    min-height: 52px; padding-block: 10px; cursor: pointer; list-style: none;
    font-weight: 800; font-size: 1.05rem;
}
.qt-howto summary::-webkit-details-marker { display: none; }
.qt-howto summary::after {
    content: "+"; flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
    background: var(--bg-alt); color: var(--brand-text); font-size: 1.25rem; transition: transform .25s var(--ease-out);
}
.qt-howto[open] summary::after { transform: rotate(45deg); }
.qt-howto[open] { padding-bottom: 18px; }
.qt-howto p { margin-top: 12px; color: var(--text-soft); font-size: .96rem; }
.qt-howto a { color: var(--brand-text); font-weight: 700; }
.qt-howto-steps { margin-top: 6px; display: grid; gap: 12px; counter-reset: qs; }
.qt-howto-steps li { position: relative; padding-left: 40px; counter-increment: qs; font-size: .98rem; }
.qt-howto-steps li::before {
    content: counter(qs); position: absolute; left: 0; top: -1px; width: 28px; height: 28px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 800; font-size: .88rem; background: var(--brand-soft); color: var(--brand-text);
}
.qt-howto-steps strong { color: var(--text); }
.qt-src { font-size: .86rem !important; }
.qt-src a { font-weight: 600; color: var(--text-soft); }

/* ---------- Kad QR ---------- */
.qt-qr-stage {
    position: relative; margin: 12px auto 0; width: min(100%, 244px); aspect-ratio: 1;
    display: grid; place-items: center; border-radius: var(--radius); background: var(--surface-2);
    border: 1px dashed var(--line-strong); overflow: hidden;
}
@media (min-width: 900px) { .qt-qr-stage { width: min(100%, 300px); margin-top: 16px; } }
.qt-qr-card[data-state="ready"] .qt-qr-stage { border-style: solid; border-color: var(--line); background: var(--surface-2); padding: 12px; }
.qt-qr { width: 100%; height: auto; border-radius: 10px; image-rendering: pixelated; box-shadow: var(--shadow-1); }
.qt-empty { display: grid; justify-items: center; gap: 6px; padding: 10px 14px; text-align: center; }
.qt-empty p { font-size: .9rem; color: var(--text-soft); max-width: 26ch; }
.qt-empty-art { width: 100%; max-width: 230px; height: auto; }
.qt-e-table { fill: none; stroke: var(--line-strong); stroke-width: 3; stroke-linecap: round; }
.qt-e-stand { fill: var(--brand-soft); }
.qt-e-paper { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.qt-e-stars { color: var(--star); }
.qt-e-qrbox { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 4 3; }
.qt-e-finder rect { fill: var(--line-strong); }
.qt-e-line { fill: var(--skeleton); }
.qt-e-phone-body { fill: var(--device); }
.qt-e-phone-screen { fill: var(--map-land); }
.qt-e-scan { fill: none; stroke: var(--brand); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.qt-e-beam { stroke: var(--pin); stroke-width: 2.5; stroke-linecap: round; }
@media (prefers-reduced-motion: no-preference) {
    .qt-e-beam { animation: qt-beam 2.2s var(--ease-out) infinite alternate; }
    .qt-qr-card[data-state="ready"] .qt-qr { animation: qt-pop .45s var(--ease-out) both; }
}
@keyframes qt-beam { from { transform: translateY(-24px); } to { transform: translateY(24px); } }
@keyframes qt-pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

.qt-qr-url {
    margin-top: 12px; text-align: center; font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: .82rem; color: var(--text-soft); word-break: break-all; line-height: 1.45;
}
#qt-dl-qr { margin-top: 14px; }
.qt-test { margin-top: 10px; }

/* ---------- Poster ---------- */
.qt-poster { background: var(--bg-alt); border-block: 1px solid var(--line); padding-block: 48px; }
@media (min-width: 900px) { .qt-poster { padding-block: 72px; } }
.qt-poster-grid { display: grid; gap: 20px; grid-template-areas: "intro" "fig" "form"; }
.qt-poster-intro { grid-area: intro; }
.qt-poster-fig { grid-area: fig; margin: 0; }
.qt-poster-form { grid-area: form; min-width: 0; }
@media (min-width: 900px) {
    .qt-poster-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); grid-template-areas: "intro fig" "form fig"; column-gap: 48px; row-gap: 8px; align-items: start; }
    .qt-poster-fig { position: sticky; top: 84px; }
}
.qt-poster-stage {
    display: grid; place-items: center; padding: 18px; border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--line);
}
.qt-poster-canvas {
    width: 100%; max-width: 340px; height: auto; aspect-ratio: 874 / 1240; border-radius: 4px;
    box-shadow: 0 1px 2px rgb(var(--shadow-rgb) / 0.12), 0 18px 36px -12px rgb(var(--shadow-rgb) / 0.35);
}
@media (min-width: 900px) { .qt-poster-canvas { max-width: 100%; } }
.qt-poster-fig figcaption { margin-top: 10px; font-size: .86rem; color: var(--text-soft); text-align: center; }

.qt-fs { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.qt-fs legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.qt-styles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qt-style {
    position: relative; display: grid; justify-items: center; gap: 4px; padding: 12px 6px 10px;
    border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; text-align: center;
    transition: border-color .15s var(--ease-out), background-color .15s var(--ease-out);
}
.qt-style:hover { border-color: var(--line-strong); }
.qt-style:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.qt-style-name { font-weight: 800; font-size: .95rem; }
.qt-style-desc { display: none; font-size: .8rem; color: var(--text-soft); line-height: 1.3; }
@media (min-width: 600px) { .qt-style-desc { display: block; } }
.qt-style-thumb {
    position: relative; display: block; width: 42px; height: 59px; border-radius: 4px; overflow: hidden;
    background: var(--qt-paper, var(--surface)); box-shadow: 0 0 0 1px var(--line-strong);
}
.qt-style-thumb i { position: absolute; left: 0; right: 0; top: 0; height: 36%; background: var(--qt-sw, var(--brand)); }
.qt-style-thumb b { position: absolute; left: 29%; top: 45%; width: 42%; height: 30%; border-radius: 2px; background: var(--qt-ink, var(--text)); }
.qt-thumb-penuh { background: var(--qt-sw, var(--brand)); }
.qt-thumb-penuh i { display: none; }
.qt-thumb-penuh b { background: var(--qt-white, var(--surface)); }
.qt-thumb-minimal { background: var(--qt-white, var(--surface)); box-shadow: inset 0 0 0 3px var(--qt-sw, var(--brand)), 0 0 0 1px var(--line-strong); }
.qt-thumb-minimal i { display: none; }

.qt-swatches { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.qt-swatch { position: relative; display: grid; justify-items: center; gap: 4px; min-width: 52px; padding: 4px 2px; cursor: pointer; }
.qt-swatch-dot {
    display: block; width: 40px; height: 40px; border-radius: 50%; background: var(--line-strong);
    box-shadow: 0 0 0 1.5px var(--line-strong);
    transition: transform .15s var(--ease-out);
}
.qt-swatch input:checked + .qt-swatch-dot { outline: 3px solid var(--brand); outline-offset: 3px; transform: scale(.92); }
.qt-swatch-name { font-size: .82rem; font-weight: 600; color: var(--text-soft); }
.qt-swatch input:checked ~ .qt-swatch-name { color: var(--text); font-weight: 800; }

.qt-check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 14px; cursor: pointer; font-size: .95rem; }
.qt-check input { width: 20px; height: 20px; flex: none; accent-color: var(--brand); }

.qt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.qt-print-row { display: flex; gap: 8px; }
.qt-note { margin-top: 10px; font-size: .9rem; color: var(--text-soft); }
.qt-note:empty { display: none; }

/* ---------- Skrip WhatsApp ---------- */
.qt-wa { padding-block: 48px; }
@media (min-width: 900px) { .qt-wa { padding-block: 72px; } }
.qt-wa-list { display: grid; gap: 14px; margin-top: 24px; }
@media (min-width: 900px) { .qt-wa-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
.qt-wa-card {
    display: flex; flex-direction: column; min-width: 0; padding: 18px; border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.qt-wa-card h3 { font-size: 1.08rem; letter-spacing: -0.005em; }
.qt-wa-when { margin-top: 4px; font-size: .9rem; color: var(--text-soft); }
.qt-wa-text {
    flex: 1; margin-top: 12px; padding: 14px; border-radius: 12px 12px 12px 4px; background: var(--brand-soft);
    white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; line-height: 1.55; color: var(--text);
}
.qt-copy { margin-top: 12px; align-self: flex-start; }
.qt-copy[data-done] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

/* ---------- CTA lembut selepas QR dijana ---------- */
.qt-cta {
    display: grid; gap: 16px; margin-top: 32px; padding: 22px 20px; border-radius: var(--radius-lg);
    background: var(--surface); border: 1.5px solid var(--brand); box-shadow: var(--shadow-2);
}
.qt-cta[hidden] { display: none; }
.qt-cta h2 { font-size: clamp(1.2rem, 1rem + 1vw, 1.5rem); max-width: 32ch; letter-spacing: -0.01em; }
.qt-cta p { margin-top: 6px; color: var(--text-soft); font-size: 1.02rem; }
.qt-cta-btns { display: flex; flex-wrap: wrap; gap: 10px; }
@media (min-width: 900px) { .qt-cta { grid-template-columns: 1fr auto; align-items: center; padding: 26px 30px; } }

/* ---------- Artikel bawah alat ---------- */
.qt-article { padding-top: 56px; }
@media (min-width: 900px) { .qt-article { padding-top: 88px; } }

/* ---------- Cetak poster ---------- */
.qt-print-sheet { display: none; }
@media print {
    html.qt-printing body > *:not(.qt-print-sheet) { display: none !important; }
    html.qt-printing .qt-print-sheet { display: block !important; }
    html.qt-printing .qt-print-sheet img { display: block; width: 100%; height: 100vh; object-fit: contain; }
    html.qt-printing, html.qt-printing body { background: none !important; }
}
