/* =========================================================
   ToolZen Hub
   JWT Decoder

   Only what the shared tool styles do not already provide: the
   token box, the always-visible "not verified" notice, the status
   and error panel and the result cards. Buttons, focus and
   headings come from the shared layer. Loaded after
   calculator-responsive.css.

   Decoded, unreadable and empty are told in words, never by
   colour alone, and nothing is styled as "valid" or "trusted":
   a decoded token is only text. Nothing animates.

   Everything that came from a token wraps (overflow-wrap:
   anywhere), so a very long value never widens the page. One
   column on a phone; from 900px the cards sit in two columns.
========================================================= */

.jw-workspace [hidden] {

    display: none !important;

}

.jw-workspace {

    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;

}

.jw-pane {

    display: flex;
    flex-direction: column;

    min-width: 0;

}

.jw-pane__head {

    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;

    margin-bottom: 8px;

}

.jw-label {

    color: var(--color-ink);

    font-size: 15px;
    font-weight: 700;

}

.jw-meta {

    color: #475467;

    font-size: 13px;
    font-variant-numeric: tabular-nums;

}

.jw-text {

    display: block;

    width: 100%;
    min-height: 150px;

    padding: 12px 14px;

    border: 1px solid #d0d5dd;
    border-radius: 12px;

    background: #ffffff;

    color: var(--color-ink);

    font-family:
        ui-monospace, SFMono-Regular, Menlo, Consolas,
        "Liberation Mono", monospace;
    font-size: 14px;
    line-height: 1.55;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
    resize: vertical;

}

.jw-text:focus-visible {

    outline: 3px solid var(--color-action-green);
    outline-offset: 2px;

}

.jw-hint {

    margin: 8px 0 0;

    color: #475467;

    font-size: 14px;

}

.jw-link {

    padding: 0;

    border: 0;
    background: none;

    color: var(--color-action-green);

    font: inherit;
    font-weight: 600;
    text-decoration: underline;

    cursor: pointer;

}

.jw-link:focus-visible {

    outline: 3px solid var(--color-action-green);
    outline-offset: 2px;

}

/* buttons: Decode is the main action */

.jw-actions {

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;

}

.jw-button {

    min-width: 0;
    min-height: 48px;

    font-size: 16px;

}

#jw-decode {

    grid-column: 1 / -1;

}

.jw-keys {

    grid-column: 1 / -1;

    margin: 2px 0 0;

    color: #475467;

    font-size: 13px;
    line-height: 1.7;
    text-align: center;

}

.jw-keys kbd {

    padding: 1px 6px;

    border: 1px solid #d0d5dd;
    border-radius: 6px;

    background: #f9fafb;

    color: var(--color-ink);

    font: inherit;
    font-size: 12px;
    font-weight: 600;

}

/* the standing reminder: neutral, never green, never a verdict */

.jw-notice {

    margin: 0;
    padding: 12px 14px;

    border: 1px solid #fedf89;
    border-left-width: 6px;
    border-radius: 10px;

    background: #fffcf5;

    color: #4e3a05;

    font-size: 14px;
    line-height: 1.55;

    overflow-wrap: anywhere;

}

/* status and error */

.jw-result {

    min-width: 0;

}

.jw-status {

    margin: 0;
    padding: 10px 14px;

    border: 1px solid var(--color-slate-200);
    border-left-width: 6px;
    border-radius: 10px;

    background: #f9fafb;

    color: #344054;

    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;

    overflow-wrap: anywhere;

}

.jw-workspace[data-state="invalid"] .jw-status {

    border-color: #b42318;

    background: #fef3f2;

    color: #912018;

}

.jw-stale {

    margin: 8px 0 0;

    color: #475467;

    font-size: 13px;

}

.jw-error {

    margin-top: 12px;
    padding: 14px;

    border: 1px solid #fda29b;
    border-radius: 12px;

    background: #ffffff;

}

.jw-error p {

    margin: 0;

}

.jw-error__title {

    color: #912018;

    font-size: 16px;
    font-weight: 700;

}

.jw-error__message {

    margin-top: 6px !important;

    color: var(--color-ink);

    font-size: 15px;
    line-height: 1.55;

    overflow-wrap: anywhere;

}

.jw-error__where {

    margin-top: 6px !important;

    color: #475467;

    font-size: 14px;
    font-variant-numeric: tabular-nums;

}

.jw-error__context {

    max-width: 100%;
    margin: 10px 0 0;
    padding: 10px 12px;

    border-radius: 8px;

    background: #f9fafb;

    color: var(--color-ink);

    font-family:
        ui-monospace, SFMono-Regular, Menlo, Consolas,
        "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.5;

    white-space: pre-wrap;
    overflow-wrap: anywhere;

}

.jw-error__context:focus-visible,
.jw-pre:focus-visible,
.jw-results__heading:focus-visible {

    outline: 3px solid var(--color-action-green);
    outline-offset: 2px;

}

.jw-notes {

    margin: 12px 0 0;
    padding: 10px 14px 10px 32px;

    border: 1px solid var(--color-slate-200);
    border-radius: 10px;

    background: #ffffff;

    color: #344054;

    font-size: 14px;
    line-height: 1.55;

    overflow-wrap: anywhere;

}

/* the decoded cards */

.jw-results {

    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;

    min-width: 0;

}

.jw-results__heading {

    margin: 0;

    font-size: 20px;

}

.jw-card {

    min-width: 0;
    padding: 14px;

    border: 1px solid var(--color-slate-200);
    border-radius: 12px;

    background: #ffffff;

}

.jw-card--quiet {

    background: #f9fafb;

}

.jw-card h3 {

    margin: 0 0 10px;

    font-size: 16px;

}

.jw-card__head {

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;

    margin-bottom: 10px;

}

.jw-card__head h3 {

    margin: 0;

}

.jw-copy {

    min-width: 0;
    min-height: 44px;

    font-size: 15px;

}

.jw-pre {

    max-width: 100%;
    max-height: 26rem;
    margin: 0;
    padding: 10px 12px;

    border-radius: 8px;

    background: #f9fafb;

    color: var(--color-ink);

    font-family:
        ui-monospace, SFMono-Regular, Menlo, Consolas,
        "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.5;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-y: auto;

}

.jw-list {

    display: grid;
    gap: 10px;

    margin: 0;

}

.jw-card .jw-pre + .jw-list {

    margin-top: 12px;

}

.jw-row {

    min-width: 0;

}

.jw-row dt {

    color: #344054;

    font-size: 13px;
    font-weight: 700;

    overflow-wrap: anywhere;

}

.jw-row dd {

    margin: 2px 0 0;

    color: var(--color-ink);

    font-size: 15px;
    line-height: 1.5;

    overflow-wrap: anywhere;

}

.jw-time + .jw-time {

    margin-top: 14px;
    padding-top: 14px;

    border-top: 1px solid var(--color-slate-200);

}

.jw-time h4 {

    margin: 0 0 8px;

    font-size: 15px;

}

.jw-time-notes {

    margin: 12px 0 0;
    padding-left: 20px;

    color: #475467;

    font-size: 13px;
    line-height: 1.55;

    overflow-wrap: anywhere;

}

.jw-muted {

    margin: 0;

    color: #475467;

    font-size: 14px;
    line-height: 1.55;

    overflow-wrap: anywhere;

}

.jw-untrusted {

    margin: 0;

    color: #475467;

    font-size: 13px;
    line-height: 1.55;

}

.jw-sr-only {

    position: absolute;

    width: 1px;
    height: 1px;

    margin: -1px;
    padding: 0;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;

}

/* a phone: 16px text so the browser does not zoom the page when the box is focused */

@media (max-width: 640px) {

    .jw-text {

        font-size: 16px;

    }

}

/* wider screens: buttons in one row; header and payload side by side */

@media (min-width: 640px) {

    .jw-actions {

        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));

    }

    #jw-decode {

        grid-column: auto;

    }

}

@media (min-width: 900px) {

    .jw-results {

        grid-template-columns: repeat(2, minmax(0, 1fr));

    }

    .jw-results__heading,
    .jw-untrusted {

        grid-column: 1 / -1;

    }

}
