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

.mc-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);
}

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

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

.mc-result {
    gap: 22px;
}

.mc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: var(--space-5);
}

.mc-paste,
.mc-side {
    min-width: 0;
}

.mc-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.mc-textarea.zv-input {
    min-height: 232px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

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

.mc-check-btn {
    align-self: flex-start;
}

/* Drop zone: a big target for a dropped or chosen .eml file. */
.mc-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 150px;
    padding: var(--space-5);
    border: 2px dashed var(--line-control);
    border-radius: var(--radius-md);
    background: var(--surface-field);
    text-align: center;
    cursor: pointer;
}

.mc-drop:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.mc-drop[data-dragging] {
    border-style: solid;
    border-color: var(--accent);
    background: var(--accent-soft);
}

.mc-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.mc-drop-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.mc-drop-icon .icon {
    width: 24px;
    height: 24px;
}

.mc-drop-words {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.mc-drop-title {
    font-size: 16px;
    font-weight: 700;
}

.mc-drop-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.mc-drop-over,
.mc-drop[data-dragging] .mc-drop-idle {
    display: none;
}

.mc-drop[data-dragging] .mc-drop-over {
    display: inline;
}

/* How to find the source, per mail program. */
.mc-how {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.mc-how-title {
    font-size: 15px;
    font-weight: 700;
}

.mc-how .zv-chip {
    font-size: 14px;
}

.mc-steps {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.mc-how-note {
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.mc-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;
}

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

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

.mc-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;
}

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

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

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

.mc-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). */
.mc-verdict {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px var(--space-5);
    border-radius: var(--radius-md);
}

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

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

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

.mc-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;
}

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

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

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

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

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

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

/* Who sent the email: label and value side by side, stacked on a phone. */
.mc-rows,
.mc-links,
.mc-box {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-field);
}

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

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

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

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

/* The domain: the part of the address that decides who sent it. */
.mc-row mark {
    font-weight: 700;
    color: var(--ink);
    background: var(--accent-soft);
    border-radius: 4px;
    padding: 0 3px;
}

.mc-row mark.mc-bad,
.mc-bad {
    font-weight: 700;
    color: var(--danger);
    background: none;
    padding: 0;
}

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

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

.mc-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;
}

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

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

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

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

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

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

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

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

.mc-more {
    font-size: 14px;
}

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

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

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

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

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

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

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

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

.mc-soon {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-full);
    background: var(--surface-sunken);
    color: var(--ink-muted);
    font-size: 13px;
    font-weight: 600;
}

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

    .mc-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: the email on the left, the analysis on the right. ---- */
.mc-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;
}

.mc-work {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

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

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

.mc-pane {
    flex: 1 1 auto;
    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;
}

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

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

.mc-pane-head .zv-btn {
    margin-left: auto;
    white-space: nowrap;
    min-height: 32px;
    padding: 0 var(--space-3);
    font-size: 13px;
}

/* The email: the box takes the room there is, the file, the steps and the examples stand under it. If the window is
   too low for all of it, the pane's body scrolls, never the page. */
.mc-pane-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mc-pane-text {
    flex: 1 1 0;
    min-height: 160px;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 14px;
    border: 0;
    border-radius: 0;
    resize: none;
    background: var(--surface-raised);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    overflow: auto;
}

.mc-pane-text:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

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

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

.mc-pane-keys {
    margin-left: auto;
    flex: 0 0 auto;
    white-space: nowrap;
}

.mc-pane-more {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: 14px;
    border-top: 1px solid var(--line);
    background: var(--surface-sunken);
}

.mc-tool-work .mc-error {
    padding: 10px var(--space-3);
    font-size: 14px;
}

/* The file: one row instead of the start page's big square. */
.mc-tool-work .mc-drop {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-3);
    min-height: 0;
    padding: var(--space-3) 14px;
    text-align: left;
}

.mc-tool-work .mc-drop-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
}

.mc-tool-work .mc-drop-icon .icon {
    width: 20px;
    height: 20px;
}

.mc-tool-work .mc-drop-words {
    align-items: flex-start;
    gap: 2px;
}

.mc-tool-work .mc-drop-title {
    font-size: 14px;
}

.mc-tool-work .mc-drop-text {
    font-size: 13px;
}

/* How to find the source, folded away until it is wanted. */
.mc-how-menu.mc-how {
    gap: 0;
    padding: 0;
    background: var(--surface-raised);
}

.mc-how-menu > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-height: 40px;
    padding: 0 14px;
    font-size: 14px;
    cursor: pointer;
    list-style: none;
}

.mc-how-menu > summary::-webkit-details-marker {
    display: none;
}

.mc-how-menu > summary .icon {
    width: 18px;
    height: 18px;
    transition: transform .15s;
}

.mc-how-menu[open] > summary .icon {
    transform: rotate(180deg);
}

.mc-how-menu > summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: var(--radius-md);
}

.mc-how-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: 0 14px 14px;
}

.mc-tool-work .mc-examples {
    font-size: 13px;
}

.mc-tool-work .mc-example {
    min-height: 32px;
    padding: 0 var(--space-3);
    font-size: 13px;
}

/* The analysis: the start page's result in a pane that scrolls on its own. */
.mc-pane-output {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    padding: 18px;
}

.mc-pane-output:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.mc-pane-empty {
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.mc-tool-work .mc-result {
    gap: 18px;
}

.mc-tool-work .mc-verdict {
    padding: 14px var(--space-4);
}

.mc-tool-work .mc-verdict-text strong {
    font-size: 18px;
}

.mc-tool-work .mc-result-grid {
    gap: 18px;
}

.mc-tool-work .mc-row {
    grid-template-columns: 120px 1fr;
}

.mc-tool-work .mc-btn.zv-btn {
    min-height: 40px;
    font-size: 14px;
}

/* SecureShare under the analysis, as one line (the start page's CTABand). */
.mc-pane-promo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 40px;
    box-sizing: border-box;
    padding: var(--space-1) 14px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    line-height: 18px;
}

.mc-pane-promo .zv-app-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    flex: 0 0 auto;
}

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

.mc-pane-promo-text {
    min-width: 0;
    color: var(--ink);
}

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

/* Under 720 px: two tabs, The email and Analysis, each step one pane, and the check button fixed at the bottom, 48 px
   high. What the status bar says is in the more menu (Design: AppHeader.md "Smalt"). Each step is the bottom row
   (zv-tool-safe-bottom): its own bottom padding is in --zv-tool-safe-pad, and the installed app adds the home
   indicator's inset to it. From 720 px the status bar takes the inset, so the steps have none. */
.mc-work-step.zv-tool-safe-bottom {
    padding-bottom: 0;
}

@media (max-width: 719.98px) {
    .mc-tool-work {
        padding: 0;
    }

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

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

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

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

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

    .mc-work-step {
        flex: 1 1 auto;
        position: relative;
        padding: var(--space-2);
        --zv-tool-safe-pad: var(--space-2);
    }

    .mc-work-step.zv-tool-safe-bottom {
        padding-bottom: calc(var(--zv-tool-safe-pad) + var(--zv-safe-bottom));
    }

    .mc-work-step[data-mc-work-step="email"] {
        --zv-tool-safe-pad: 64px;
    }

    /* The check button: in the pane'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. */
    .mc-pane-head .mc-check-btn.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;
    }

    .mc-pane-keys {
        display: none;
    }

    .mc-pane-text {
        font-size: 14px;
        padding: var(--space-3);
    }

    .mc-pane-output {
        padding: var(--space-3);
    }

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

/* The keyboard shortcuts (js/mc-work.js). */
.mc-shortcuts {
    box-sizing: border-box;
    width: min(460px, calc(100vw - 2 * var(--space-4)));
    max-height: calc(100dvh - 2 * var(--space-4));
    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);
}

.mc-shortcuts::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

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

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

.mc-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. */
.mc-shortcuts-list > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1) var(--space-4);
}

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

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

.mc-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);
}

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

@media (prefers-reduced-motion: reduce) {
    .mc-how-menu > summary .icon {
        transition: none;
    }
}
