/*
 * The tool card from the mockup (Tool/SendTool.razor and js/sc-tool.js), built on the design system's tokens and zv-
 * components. Token names only, never colour values.
 */

.sc-tool {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    box-shadow: var(--shadow-md);
}

.sc-tool button:disabled {
    cursor: default;
}

.sc-form,
.sc-result {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sc-result {
    gap: 22px;
}

.sc-paste {
    min-width: 0;
}

.sc-textarea.zv-input {
    min-height: 300px;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
}

.sc-btn.zv-btn {
    min-height: 50px;
    padding: 0 22px;
    font-size: 16px;
}

.sc-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.sc-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.sc-shot-btn:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sc-shot-btn.zv-btn {
    position: relative;
    gap: var(--space-2);
    cursor: pointer;
}

.sc-tool[data-sc-waiting] .sc-shot-btn {
    opacity: .6;
    cursor: default;
}

/* Text recognition: what is downloaded and how far it has come; a status, not an error. */
.sc-status {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
}

.sc-status .icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    color: var(--ink-muted);
}

/* The text with what was found marked: as the email will read, line breaks kept. */
.sc-text {
    margin: 0;
    padding: 14px var(--space-4);
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-field);
    font: inherit;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sc-text mark {
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 600;
}

.sc-text mark.sc-mark-danger { background: var(--danger-soft); color: var(--danger); }
.sc-text mark.sc-mark-warning { background: var(--warning-soft); color: var(--warning); }

.sc-copy.zv-btn {
    gap: var(--space-2);
}

.sc-copy[data-copied] {
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--success);
}

.sc-error {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px var(--space-4);
    border-radius: var(--radius-md);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 15px;
    line-height: 1.5;
}

.sc-error .icon {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.sc-examples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px;
    color: var(--ink-muted);
}

.sc-example {
    font: inherit;
    display: flex;
    align-items: center;
    min-height: var(--touch-min);
    padding: 0 14px;
    border: 1px solid var(--line-control);
    border-radius: var(--radius-full);
    background: var(--surface-field);
    color: var(--ink);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.sc-example:not(:disabled):hover {
    border-color: var(--ink-muted);
}

.sc-note {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.sc-note .icon {
    margin-top: 3px;
}

.sc-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

/* Verdict: the worst finding decides the colour (status colours only mean ok, warning and danger). */
.sc-verdict {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px var(--space-5);
    border-radius: var(--radius-md);
}

.sc-verdict:focus {
    outline: none;
}

.sc-verdict:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sc-verdict-ok { background: var(--success-soft); color: var(--success); }
.sc-verdict-warning { background: var(--warning-soft); color: var(--warning); }
.sc-verdict-danger { background: var(--danger-soft); color: var(--danger); }

.sc-verdict-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 2px solid currentColor;
}

.sc-verdict-icon .icon {
    width: 22px;
    height: 22px;
}

.sc-verdict-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: 15px;
    line-height: 1.5;
}

.sc-verdict-text strong {
    font-size: 21px;
    line-height: 1.3;
}

.sc-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
    gap: var(--space-5);
    align-items: start;
}

.sc-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.sc-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

/* To, Cc, Subject and Attachments: label and value side by side, stacked on a phone. */
.sc-rows,
.sc-box {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-field);
}

.sc-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: var(--space-1) 14px;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--line);
}

.sc-row:last-child {
    border-bottom: none;
}

.sc-row dt {
    font-size: 14px;
    color: var(--ink-muted);
}

.sc-row dd {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.sc-row dd.sc-warn {
    font-weight: 600;
    color: var(--warning);
}

.sc-muted {
    color: var(--ink-muted);
}

.sc-box {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-field);
}

.sc-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: var(--space-1) 14px;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--line);
}

.sc-row:last-child {
    border-bottom: none;
}

.sc-row dt {
    font-size: 14px;
    color: var(--ink-muted);
}

.sc-row dd {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.sc-row dd.sc-warn {
    font-weight: 600;
    color: var(--warning);
}

.sc-muted {
    color: var(--ink-muted);
}

.sc-auths {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.sc-auth {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-full);
    font-size: 14px;
}

.sc-auth-ok { background: var(--success-soft); color: var(--success); }
.sc-auth-warning { background: var(--warning-soft); color: var(--warning); }
.sc-auth-danger { background: var(--danger-soft); color: var(--danger); }
.sc-auth-none { background: var(--surface-sunken); color: var(--ink-muted); }

.sc-links {
    list-style: none;
    padding: 0;
}

.sc-links li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--line);
}

.sc-links li:last-child {
    border-bottom: none;
}

.sc-link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: 14px;
    line-height: 1.5;
}

.sc-link-host {
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.sc-link-url {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink-muted);
    overflow-wrap: anywhere;
}

.sc-box {
    padding: 14px var(--space-4);
    font-size: 15px;
    line-height: 1.5;
}

.sc-findings {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sc-findings li > span:last-child,
.sc-verdict-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.sc-findings li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 15px;
    line-height: 1.5;
}

.sc-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-top: 7px;
    border-radius: var(--radius-full);
}

.sc-dot-ok { background: var(--success); }
.sc-dot-warning { background: var(--warning); }
.sc-dot-danger { background: var(--danger); }

/* Promo: another Zavanto app, with its AppIcon (design: one suggestion in the flow). */
.sc-promo.zv-promo {
    gap: 14px;
    padding: var(--space-4) 18px;
    background: var(--surface-field);
}

.sc-promo-text {
    flex: 1 1 240px;
    font-size: 15px;
    line-height: 1.5;
}

.sc-promo .zv-btn {
    font-size: 15px;
}

@media (max-width: 600px) {
    .sc-tool {
        padding: var(--space-5);
    }

    .sc-row {
        grid-template-columns: 1fr;
    }
}

/* ---- The work mode (/arbeta, /work): a tool, not a page. The tool fills Zavanto/Design's zv-tool-main, and only its
   panes scroll. ---- */
.sc-tool-work {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: var(--space-3);
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

/* Two panes side by side: the email and the findings. */
.sc-work-panes {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.sc-work-steps {
    display: none;
}

.sc-work-step {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.sc-work-step > .sc-pane {
    flex: 1 1 0;
}

.sc-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.sc-mode-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.sc-pane-head {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    min-height: 48px;
    padding: var(--space-2) 14px;
    border-bottom: 1px solid var(--line);
}

.sc-pane-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.sc-pane-count {
    font-size: 12px;
    line-height: 16px;
    color: var(--ink-muted);
}

.sc-pane-head .zv-btn {
    white-space: nowrap;
    min-height: 32px;
    padding: 0 var(--space-3);
    font-size: 13px;
    gap: 6px;
}

.sc-pane-head .zv-btn:first-of-type {
    margin-left: auto;
}

.sc-pane-head .zv-btn .icon {
    width: 16px;
    height: 16px;
}

.sc-pane-text,
.sc-pane-body {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    margin: 0;
    padding: 14px;
    border: 0;
    border-radius: 0;
    font: inherit;
    font-size: 14px;
    line-height: 1.6;
    overflow: auto;
}

.sc-pane-text {
    resize: none;
    background: var(--surface-raised);
    color: var(--ink);
}

.sc-pane-text::placeholder {
    color: var(--ink-muted);
}

.sc-pane-text:focus-visible,
.sc-pane-body:focus-visible,
.sc-shot-drop:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.sc-pane-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    background: var(--surface-sunken);
}

.sc-pane-empty {
    color: var(--ink-muted);
}

/* The result in the pane: the same parts as on the start page, a little more compact. */
.sc-tool-work .sc-verdict {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
}

.sc-tool-work .sc-verdict-icon {
    width: 32px;
    height: 32px;
}

.sc-tool-work .sc-verdict-icon .icon {
    width: 18px;
    height: 18px;
}

.sc-tool-work .sc-verdict-text {
    font-size: 14px;
}

.sc-tool-work .sc-verdict-text strong {
    font-size: 17px;
}

.sc-tool-work .sc-findings li,
.sc-tool-work .sc-row dd {
    font-size: 14px;
}

.sc-tool-work .sc-row {
    grid-template-columns: 90px 1fr;
    padding: var(--space-2) var(--space-3);
}

.sc-tool-work .sc-text {
    max-height: none;
    overflow: visible;
    font-size: 14px;
}

.sc-tool-work .sc-note {
    font-size: 13px;
}

.sc-changed {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    font-size: 13px;
    line-height: 18px;
}

.sc-changed .icon {
    margin-top: 1px;
}

.sc-pane-body .sc-actions .zv-btn {
    min-height: 36px;
    font-size: 14px;
}

/* A status (the text recognition) or an error, between the field and the foot. */
.sc-pane-status {
    flex: 0 0 auto;
    margin: 0;
    border-radius: 0;
    border-width: 1px 0 0;
    padding: var(--space-2) 14px;
    font-size: 13px;
}

.sc-pane-status .icon {
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

.sc-pane-foot {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    min-height: 40px;
    padding: var(--space-1) 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    line-height: 16px;
    color: var(--ink-muted);
}

.sc-pane-foot.sc-examples .sc-example {
    min-height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

/* The Screenshot mode: paste or choose, in the middle of the pane. */
.sc-shot-drop {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin: var(--space-3);
    padding: var(--space-5);
    border: 2px dashed var(--line-control);
    border-radius: var(--radius-md);
    text-align: center;
}

.sc-shot-drop > .icon {
    width: 32px;
    height: 32px;
    color: var(--ink-muted);
}

.sc-shot-empty {
    font-size: 15px;
    line-height: 1.5;
    max-width: 32em;
}

.sc-shot-hint {
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-muted);
    max-width: 36em;
}

/* A suggestion as one line under the findings. */
.sc-pane-promo .zv-app-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    flex: 0 0 auto;
}

.sc-pane-promo .zv-app-icon .icon {
    width: 13px;
    height: 13px;
}

.sc-pane-promo-text {
    min-width: 0;
    flex: 1 1 12em;
    color: var(--ink);
}

.sc-pane-promo a {
    margin-left: auto;
    font-weight: 600;
    color: var(--accent-ink);
    white-space: nowrap;
}

.sc-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--surface-sunken);
    color: var(--ink);
    font-size: 12px;
}

/* From 720 px the status bar is at the bottom and keeps clear of the home indicator (Design's zv-tool-status), so
   the steps, the bottom row under 720 px, get no padding of their own. */
@media (min-width: 720px) {
    .sc-work-step.zv-tool-safe-bottom {
        padding-bottom: 0;
    }
}

/* Under 720 px: the panes Text and Findings as tabs under the header, and the check button fixed at the bottom,
   48 px high. Each step is the bottom row (zv-tool-safe-bottom): its own bottom padding is --zv-tool-safe-pad, and
   Design adds the home indicator's inset in the installed app (AppHeader.md "Installerad app"). No status line here:
   what the status bar says is in the menu. */
@media (max-width: 719.98px) {
    .sc-tool-work {
        padding: 0;
    }

    .sc-work-panes {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .sc-work-steps {
        flex: 0 0 auto;
        display: flex;
        background: var(--surface-raised);
        border-bottom: 1px solid var(--line);
    }

    .sc-work-steps [role="tab"] {
        flex: 1 1 0;
        font: inherit;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
        height: 44px;
        border: 0;
        border-bottom: 3px solid transparent;
        background: transparent;
        color: var(--ink-muted);
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
    }

    .sc-work-steps [role="tab"][aria-selected="true"] {
        color: var(--ink);
        border-bottom-color: var(--accent);
    }

    .sc-work-steps [role="tab"][aria-selected="true"] .sc-tab-count {
        background: var(--accent);
        color: var(--on-accent);
    }

    .sc-work-steps [role="tab"]:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: -2px;
    }

    .sc-work-step {
        flex: 1 1 auto;
        position: relative;
        gap: var(--space-2);
        padding-top: var(--space-2);
        padding-left: var(--space-2);
        padding-right: var(--space-2);
        --zv-tool-safe-pad: var(--space-2);
    }

    .sc-work-step[data-sc-work-step="text"]:has(.sc-mode-panel[data-sc-mode-panel="text"]:not([hidden])) {
        --zv-tool-safe-pad: 68px;
    }

    /* The check button: in the email's header from 720 px, fixed at the step's bottom here. Its containing block is
       the step, so the pane does not clip it. */
    .sc-pane-head .sc-pane-check.zv-btn {
        position: absolute;
        left: var(--space-2);
        right: var(--space-2);
        bottom: calc(var(--space-2) + var(--zv-safe-bottom));
        width: auto;
        min-height: 48px;
        margin: 0;
        border-radius: 10px;
        font-size: 15px;
    }

    .sc-pane-text,
    .sc-pane-body {
        font-size: 15px;
        line-height: 1.5;
        padding: var(--space-3);
    }

    .sc-tool-work .sc-row {
        grid-template-columns: 1fr;
    }
}

/* The keyboard shortcuts (js/sc-work.js). */
.sc-shortcuts {
    width: min(460px, calc(100vw - 2 * var(--space-4)));
    max-height: calc(100dvh - 2 * var(--space-4) - var(--zv-safe-top) - var(--zv-safe-bottom));
    padding: var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    color: var(--ink);
    box-shadow: var(--shadow-md);
}

.sc-shortcuts::backdrop {
    background: color-mix(in srgb, var(--brand-black) 50%, transparent);
}

.sc-shortcuts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.sc-shortcuts-head h3 {
    margin: 0;
    font-size: 18px;
}

.sc-shortcuts-list {
    margin: 0 0 var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* What the shortcut does, then its keys; on a narrow screen the keys go under it. */
.sc-shortcuts-list > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1) var(--space-4);
}

.sc-shortcuts-list dt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    font-size: 13px;
    color: var(--ink-muted);
}

.sc-shortcuts-list dd {
    order: -1;
    flex: 1 1 12em;
    margin: 0;
}

.sc-shortcuts kbd {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 6px;
    border: 1px solid var(--line-control);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    color: var(--ink);
}

.sc-shortcuts-note {
    margin: 0 0 var(--space-2);
    font-size: 14px;
    color: var(--ink-muted);
}
