/*
 * einvoicing.pk — page-scoped styles for /tools/invoice-verification/.
 *
 * Loaded only by the invoice verification tool and its authority guide pages.
 * Refit to the Compliance Register world (D3): squared marks, hairline rules,
 * register labels, no pills, no resting shadows. It consumes the tokens and
 * base classes from /public/tools/tools.css.
 */

/* ---------- Notice and privacy note ---------- */

.iv-notice {
    margin-bottom: var(--space-5);
}

.iv-notice p + p {
    margin-top: 0.5rem;
}

.iv-privacy {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--rule);
    font-size: var(--fs-sm);
    color: var(--ink-2);
}

.iv-privacy span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.iv-privacy strong {
    color: var(--ink);
}

/* ---------- Authority chooser ---------- */

/* Scoped past `.st-content ul`, which would otherwise add bullets and indent. */
.st-content .iv-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    gap: var(--space-3);
    margin: var(--space-4) 0 0;
    padding: 0;
    list-style: none;
}

.iv-choice {
    display: block;
    height: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    transition: border-color var(--dur-2) ease, color var(--dur-2) ease;
}

.iv-choice:hover {
    border-color: var(--accent);
    color: var(--accent-ink);
}

.iv-choice.is-active,
.iv-choice[aria-current='true'] {
    border-color: var(--accent-ink);
    box-shadow: inset 0 0 0 1px var(--accent-ink);
}

.iv-choice__name {
    display: block;
    font-weight: 600;
    line-height: 1.3;
}

.iv-choice__scope {
    display: block;
    margin-top: 0.3rem;
    font-size: var(--fs-xs);
    color: var(--ink-2);
}

/* ---------- Authority panels ---------- */

.iv-panel {
    margin-top: var(--space-7);
    padding-top: var(--space-5);
    border-top: 1px solid var(--rule);
}

.iv-panel h2 {
    font-size: var(--fs-h2);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.iv-panel h3 {
    margin-top: var(--space-5);
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-2);
}

.iv-panel > * + * {
    margin-top: 1rem;
}

.iv-panel ul,
.iv-panel ol {
    padding-left: 1.4rem;
}

.iv-panel li + li {
    margin-top: 0.35rem;
}

.iv-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: var(--space-3);
}

.iv-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-xs);
    background: var(--paper-soft);
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--ink-2);
}

.iv-badge--attention {
    border-color: rgba(200, 80, 47, 0.45);
    background: rgba(200, 80, 47, 0.06);
    color: var(--danger-ink);
}

/* ---------- Official action ---------- */

.iv-official {
    margin-top: var(--space-4);
    padding: 1rem 1.1rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--paper-soft);
}

.iv-official p {
    max-width: 68ch;
}

.iv-official p + p {
    margin-top: 0.45rem;
}

.iv-host {
    font-size: 0.9em;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    word-break: break-all;
}

.iv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.iv-inline-note {
    font-size: var(--fs-xs);
    color: var(--ink-2);
}

/* Authored pages put prose links inside .st-content, whose `a { color }` rule
   outweighs the single-class button rules. Restore the intended button text
   colours for anchors inside these blocks only. */

.iv-official a.st-btn--primary,
.iv-actions a.st-btn--primary,
.iv-row-buttons a.st-btn--primary {
    color: var(--c-white);
}

.iv-official a.st-btn--ghost,
.iv-actions a.st-btn--ghost,
.iv-row-buttons a.st-btn--ghost {
    color: var(--ink);
}

/* ---------- Local scratch field and QR stage ---------- */

.iv-workbench {
    display: grid;
    gap: var(--space-5);
    margin-top: var(--space-4);
}

.iv-scratch {
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--paper-soft);
}

.iv-scratch .st-input {
    max-width: 26rem;
}

.iv-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem;
}

.iv-row .st-field {
    flex: 1 1 16rem;
}

.iv-row-buttons {
    display: flex;
    gap: 0.6rem;
}

.iv-scratch-status,
.iv-status {
    margin-top: 0.6rem;
    max-width: 68ch;
    font-size: var(--fs-sm);
    color: var(--ink-2);
}

.iv-error {
    margin-top: 0.6rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(200, 80, 47, 0.4);
    border-radius: var(--radius-sm);
    background: rgba(200, 80, 47, 0.07);
    color: var(--danger-ink);
    font-size: var(--fs-sm);
}

.iv-qr {
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
}

.iv-file-input {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.iv-qr-stage {
    margin-top: var(--space-3);
    max-width: 34rem;
}

.iv-qr-stage video,
.iv-qr-stage canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    background: var(--c-slate-deep);
}

.iv-qr canvas {
    display: none;
}

.iv-output {
    margin-top: var(--space-3);
    padding: 0.9rem 1rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--paper);
}

.iv-decoded-text {
    margin: 0;
    max-height: 14rem;
    overflow: auto;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--c-slate-deep);
    color: var(--c-white);
    font-size: var(--fs-sm);
    white-space: pre-wrap;
    word-break: break-word;
}

.iv-decoded-host {
    margin-top: 0.55rem;
    font-size: var(--fs-sm);
    color: var(--ink-2);
    word-break: break-all;
}

.iv-decoded-note {
    margin-top: 0.55rem;
    font-size: var(--fs-sm);
    color: var(--ink-2);
}

/* ---------- Static outcome help (ruled rows) ---------- */

.iv-outcomes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
    gap: 0 var(--space-5);
    margin-top: var(--space-5);
}

.iv-outcome {
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
}

.iv-outcome h3 {
    margin-top: 0;
    font-size: var(--fs-h3);
    font-weight: 600;
}

.iv-outcome p {
    margin-top: 0.4rem;
    font-size: var(--fs-sm);
    color: var(--ink-2);
}

@media (max-width: 30rem) {
    .iv-actions .st-btn,
    .iv-row-buttons .st-btn {
        width: 100%;
    }
}

/* Selection and optional QR actions share one open workspace. */
.iv-notice { padding: 0; background: transparent; font-weight: 400; font-size: .9375rem; color: var(--ink-2); }
.iv-privacy { border: 0; background: transparent; padding: 0; }
.st-content .iv-choices { padding: 0; list-style: none; gap: .75rem; }
.st-content .iv-choices li { max-width: none; margin: 0; }
.iv-choice { height: 100%; min-height: 5.5rem; padding: 1rem 1.25rem; border-radius: var(--radius); }
.iv-choice__scope { font-size: .8125rem; line-height: 1.5; }
.iv-panel { border: 0; background: var(--paper-soft); padding: clamp(1.25rem,3vw,2rem); border-radius: var(--radius); }
.iv-panel .st-callout, .iv-official, .iv-scratch, .iv-qr, .iv-output { border: 0; background: transparent; padding-inline: 0; }
.iv-panel .st-callout { padding: 0; }
.iv-scratch, .iv-qr { padding-block: 1.25rem; }
.iv-workbench { gap: 0; }
.iv-output { padding-block: 1rem; }
.iv-row-buttons { flex-wrap: wrap; }
.st-content .iv-outcome { padding-top: 0; border: 0; }
@media (min-width: 56rem) {
    .iv-workbench { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 2.5rem; }
}
.st-content .iv-choices { grid-template-columns: repeat(3,minmax(0,1fr)); }
@media (max-width: 40rem) { .st-content .iv-choices { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 23rem) { .iv-choice { padding: .9rem; } }
.iv-more { margin-top: 1.5rem; }
.iv-more summary { cursor: pointer; padding-block: .75rem; font-weight: 600; color: var(--accent-ink); }
.iv-more p, .iv-more .st-table-wrap { margin-top: .75rem; }
.iv-panel .iv-more h3 { text-transform: none; letter-spacing: 0; font-size: 1rem; }
