/*
 * GPL Schema Markup Generator — tool-only UI.
 * The layout follows GPL Markdown Viewer: one card (theme .gpl-tool__panel--card) with a
 * header, a toolbar, a two-pane workspace and a footer with stats pills and export
 * buttons. Shared chrome (tokens, .gpl-tool shell, heading, icon badge, action buttons,
 * .gpl-tag) lives in the gpl-child theme and is not duplicated here. Dark mode overrides
 * the shared --gpl-tool-* tokens on the root, as the Markdown Viewer does.
 */
.gplsmg-tool {
    /* Shared --gpl-tool-* tokens come from the theme; these are tool-only. */
    --gplsmg-text: #344056;
    --gplsmg-cell-line: #e6eaf0;
    --gplsmg-head-bg: rgba(55, 91, 215, 0.04);
    --gplsmg-code-bg: #f7f9fd;
    --gplsmg-code-text: #1f2937;
    --gplsmg-pill-bg: #f3f4f6;
    --gplsmg-pill-line: #e5e7eb;
    --gplsmg-input-bg: var(--mt-input__background-color, #fff);
    --gplsmg-amber: #d97706;
    --gplsmg-amber-soft: #fff8ec;
    --gplsmg-amber-line: #f5c78a;
    --gplsmg-control-radius: 8px;
    --gplsmg-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --gplsmg-pane-height: clamp(480px, 72vh, 820px);
    --gplsmg-code-size: 13px;
    margin: 0 0 24px;
    color: var(--gpl-tool-ink);
    line-height: 1.45;
}

/* —— Dark mode (scoped to the tool; toggled via data-theme) —— */
.gplsmg-tool[data-theme="dark"] {
    --gpl-tool-ink: #e6eaf2;
    --gpl-tool-label: #d1d7e2;
    --gplsmg-text: #c9d1dd;
    --gpl-tool-muted: #8b95a7;
    --gpl-tool-text-soft: #8b95a7;
    --gpl-tool-line: #2a3140;
    --gpl-tool-line-hover: #3a4354;
    --gpl-tool-card-line: #2a3140;
    --gpl-tool-divider: #2a3140;
    --gplsmg-cell-line: #2a3140;
    --gpl-tool-surface-hover: #252c39;
    --gplsmg-head-bg: rgba(123, 155, 255, 0.06);
    --gplsmg-code-bg: #141821;
    --gplsmg-code-text: #d7dde8;
    --gpl-tool-blue: #7b9bff;
    --gpl-tool-blue-bg: rgba(123, 155, 255, 0.08);
    --gpl-tool-blue-tint: rgba(123, 155, 255, 0.12);
    --gpl-tool-blue-line: rgba(123, 155, 255, 0.35);
    --gpl-tool-focus-ring: rgba(123, 155, 255, 0.35);
    --gpl-tool-red: #ff6b7a;
    --gpl-tool-red-soft: rgba(255, 107, 122, 0.12);
    --gpl-tool-red-line: rgba(255, 107, 122, 0.4);
    --gpl-tool-green: #3ddc97;
    --gpl-tool-green-soft: rgba(61, 220, 151, 0.12);
    --gpl-tool-green-line: rgba(61, 220, 151, 0.3);
    --gpl-tool-amber-text: #fbbf62;
    --gplsmg-amber: #fbbf62;
    --gplsmg-amber-soft: rgba(251, 191, 98, 0.1);
    --gplsmg-amber-line: rgba(251, 191, 98, 0.35);
    --gplsmg-pill-bg: #252c39;
    --gplsmg-pill-line: #3a4354;
    --gpl-tool-surface: #1e2430;
    --gplsmg-input-bg: #141821;
    color-scheme: dark;
}

/* Theme form controls follow the tool's colours in dark mode. */
.gplsmg-tool[data-theme="dark"] .gplsmg-fields input:not([type="checkbox"]):not([type="radio"]),
.gplsmg-tool[data-theme="dark"] .gplsmg-fields select,
.gplsmg-tool[data-theme="dark"] .gplsmg-fields textarea,
.gplsmg-tool[data-theme="dark"] .gplsmg-type-picker select,
.gplsmg-tool[data-theme="dark"] .gplsmg-url-field input {
    border-color: var(--gpl-tool-line);
    background-color: var(--gplsmg-input-bg);
    color: var(--gpl-tool-ink);
}

.gplsmg-tool[data-theme="dark"] .gplsmg-fields input::placeholder,
.gplsmg-tool[data-theme="dark"] .gplsmg-fields textarea::placeholder,
.gplsmg-tool[data-theme="dark"] .gplsmg-url-field input::placeholder {
    color: #6b7588;
}

.gplsmg-tool[data-theme="dark"] .gpl-tag--white {
    border-color: var(--gpl-tool-line);
    background: var(--gpl-tool-surface-hover);
    color: var(--gpl-tool-label);
}

.gplsmg-theme-light,
.gplsmg-tool[data-theme="dark"] .gplsmg-theme-dark {
    display: none;
}

.gplsmg-theme-dark,
.gplsmg-tool[data-theme="dark"] .gplsmg-theme-light {
    display: inline-flex;
}

.gplsmg-tool .gplsmg-svg {
    display: inline-block;
    flex-shrink: 0;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
}

/* Mode-specific parts */
.gplsmg-tool[data-mode="generate"] .gplsmg-only-validate,
.gplsmg-tool[data-mode="validate"] .gplsmg-only-generate {
    display: none !important;
}

/* Until the script has built the form, keep the panes empty-looking but sized. */
.gplsmg-tool:not(.is-ready) .gplsmg-workspace {
    visibility: hidden;
    animation: gplsmg-reveal 0s linear 3s forwards;
}

@keyframes gplsmg-reveal {
    to {
        visibility: visible;
    }
}

/* —— Panel (chrome is theme .gpl-tool__panel--card) —— */
.gplsmg-panel {
    display: flex;
    flex-direction: column;
}

/* —— Header: title left, URL field right (field follows .gmv-file-field) —— */
.gplsmg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
}

.gplsmg-header__actions {
    flex: 0 1 460px;
    min-width: 0;
    margin: 0;
}

.gplsmg-url-field {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    padding: 6px;
    border: 1px solid var(--gpl-tool-card-line);
    border-radius: var(--gpl-tool-radius);
    background: var(--gplsmg-input-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gplsmg-url-field:hover {
    border-color: var(--gpl-tool-line-hover);
}

.gplsmg-url-field:focus-within {
    border-color: var(--gpl-tool-blue);
    box-shadow: 0 0 0 3px var(--gpl-tool-focus-ring);
}

.gplsmg-url-field__icon {
    display: inline-flex;
    flex-shrink: 0;
    padding-left: 8px;
    color: var(--gpl-tool-muted);
    font-size: 16px;
}

.gplsmg-tool .gplsmg-url-field input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 38px;
    min-height: 0;
    margin: 0;
    padding: 0 4px;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--gpl-tool-ink);
    font-size: 14px;
}

.gplsmg-tool .gplsmg-url-field input:focus {
    outline: none;
}

.gplsmg-tool .gplsmg-url-field__btn {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    width: auto;
    min-width: 0;
    height: 38px;
    min-height: 38px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--gpl-tool-blue-line);
    border-radius: var(--gplsmg-control-radius);
    background: var(--gpl-tool-blue-tint);
    box-shadow: none;
    color: var(--gpl-tool-blue);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* !important: the theme paints every button:hover with the primary fill. */
.gplsmg-tool .gplsmg-url-field__btn:hover,
.gplsmg-tool .gplsmg-url-field__btn:focus-visible {
    border-color: var(--gpl-tool-blue) !important;
    background: var(--gpl-tool-blue) !important;
    color: #fff !important;
}

.gplsmg-tool .gplsmg-url-field__btn:focus-visible {
    outline: 3px solid var(--gpl-tool-focus-ring);
    outline-offset: 2px;
}

.gplsmg-tool .gplsmg-url-field__btn.is-busy {
    cursor: progress;
    opacity: 0.8;
}

.gplsmg-url-field__btn.is-busy .gplsmg-svg {
    animation: gplsmg-pulse 1s ease-in-out infinite;
}

@keyframes gplsmg-pulse {
    50% {
        opacity: 0.3;
    }
}

.gplsmg-tool .gplsmg-url-hint {
    margin: 6px 2px 0;
    color: var(--gpl-tool-muted);
    font-size: 12px;
    line-height: 1.35;
}

.gplsmg-button-icon {
    display: inline-flex;
    color: inherit;
    font-size: 0.95rem;
}

/* —— Toolbar (matches .gmv-bar) —— */
.gplsmg-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--gpl-tool-line);
    border-bottom: 0;
    border-radius: var(--gpl-tool-radius) var(--gpl-tool-radius) 0 0;
    background: var(--gpl-tool-surface);
}

.gplsmg-toolbar,
.gplsmg-viewbar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.gplsmg-toolbar {
    flex-wrap: wrap;
    gap: 10px 14px;
}

.gplsmg-viewbar {
    flex-shrink: 0;
    gap: 6px;
}

.gplsmg-segmented {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--gpl-tool-line);
    border-radius: var(--gplsmg-control-radius);
    background: var(--gpl-tool-surface);
}

/* Icon buttons (hover follows .dt-button, pressed follows .gpl-tag--blue) */
.gplsmg-tool .gplsmg-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 34px;
    min-width: 0;
    height: 34px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--gplsmg-control-radius);
    background: transparent;
    box-shadow: none;
    color: var(--gpl-tool-label);
    font: inherit;
    font-size: 16px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.gplsmg-tool .gplsmg-segmented .gplsmg-tool-btn {
    width: 30px;
    height: 28px;
    border-radius: 6px;
}

/* Text segments (Generate | Validate) */
.gplsmg-tool .gplsmg-segmented--text .gplsmg-tool-btn {
    width: auto;
    height: 30px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
}

.gplsmg-tool .gplsmg-segmented--text .gplsmg-svg {
    font-size: 15px;
}

.gplsmg-tool .gplsmg-tool-btn:hover {
    border-color: var(--gpl-tool-line-hover) !important;
    background: var(--gpl-tool-surface-hover) !important;
    box-shadow: none !important;
    color: var(--gpl-tool-ink) !important;
}

.gplsmg-tool .gplsmg-tool-btn[aria-pressed="true"] {
    border-color: var(--gpl-tool-blue-line) !important;
    background: var(--gpl-tool-blue-tint) !important;
    color: var(--gpl-tool-blue) !important;
}

.gplsmg-tool .gplsmg-tool-btn:focus-visible {
    outline: 3px solid var(--gpl-tool-focus-ring);
    outline-offset: 2px;
}

.gplsmg-fs-off,
.gplsmg-panel.is-fullscreen .gplsmg-fs-on {
    display: none;
}

.gplsmg-fs-on,
.gplsmg-panel.is-fullscreen .gplsmg-fs-off {
    display: inline-flex;
}

/* Schema type picker in the toolbar */
.gplsmg-type-picker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.gplsmg-tool .gplsmg-type-picker label {
    margin: 0;
    color: var(--gpl-tool-label);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.gplsmg-tool .gplsmg-type-picker select {
    width: 220px;
    max-width: 100%;
    height: 34px;
    min-height: 34px;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 14px;
    font-weight: 600;
}

/* —— Message (info follows .dapa-credit-usage, error follows .dapa-credit-shortfall--zero) —— */
.gplsmg-msg {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 0;
    padding: 10px 44px 10px 16px;
    position: relative;
    border: 1px solid var(--gpl-tool-card-line);
    border-bottom: 0;
    background: var(--gpl-tool-blue-bg);
    color: var(--gpl-tool-ink);
    font-size: 0.875rem;
    line-height: 1.35;
    text-align: start;
}

.gplsmg-msg.is-error {
    border-color: var(--gpl-tool-red-line);
    background: var(--gpl-tool-red-soft);
    color: var(--gpl-tool-red);
    font-weight: 600;
}

.gplsmg-tool .gplsmg-msg__close {
    position: absolute;
    top: 50%;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    min-width: 0;
    height: 26px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font-size: 13px;
    opacity: 0.7;
    transform: translateY(-50%);
    cursor: pointer;
}

.gplsmg-tool .gplsmg-msg__close:hover,
.gplsmg-tool .gplsmg-msg__close:focus-visible {
    background: var(--gpl-tool-surface-hover) !important;
    box-shadow: none !important;
    color: inherit !important;
    opacity: 1;
}

/* —— Workspace (50 / 50; shell follows .gmv-workspace) —— */
.gplsmg-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    height: var(--gplsmg-pane-height);
    overflow: hidden;
    border: 1px solid var(--gpl-tool-line);
    border-radius: 0 0 var(--gpl-tool-radius) var(--gpl-tool-radius);
    background: var(--gpl-tool-surface);
}

.gplsmg-workspace[data-view="left"],
.gplsmg-workspace[data-view="right"] {
    grid-template-columns: minmax(0, 1fr);
}

.gplsmg-workspace[data-view="left"] .gplsmg-pane--right,
.gplsmg-workspace[data-view="right"] .gplsmg-pane--left {
    display: none;
}

.gplsmg-pane {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.gplsmg-pane--left {
    border-right: 1px solid var(--gpl-tool-line);
}

.gplsmg-workspace[data-view="left"] .gplsmg-pane--left {
    border-right: 0;
}

.gplsmg-pane--code {
    background: var(--gplsmg-code-bg);
}

/* Pane heading (matches .gmv-pane__head) */
.gplsmg-pane__head {
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 10px;
    min-height: 40px;
    padding: 6px 16px;
    border-bottom: 1px solid var(--gplsmg-cell-line);
    background: var(--gplsmg-head-bg);
    color: var(--gpl-tool-label);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.gplsmg-pane__meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--gpl-tool-muted);
    font-size: 12px;
    font-weight: 500;
}

.gplsmg-pane__meta .gpl-tag {
    font-size: 12px;
}

.gplsmg-pane__options {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

/* The theme colours every label, and the text after a checked box, near-black. */
.gplsmg-tool .gplsmg-switch,
.gplsmg-tool .gplsmg-check,
.gplsmg-tool .gplsmg-duration-part,
.gplsmg-tool .gplsmg-switch input[type="checkbox"] + span,
.gplsmg-tool .gplsmg-check input[type="checkbox"] + span,
.gplsmg-tool .gplsmg-day input[type="checkbox"] + span {
    color: var(--gpl-tool-label);
}

.gplsmg-tool .gplsmg-switch input[type="checkbox"]:checked + span,
.gplsmg-tool .gplsmg-check input[type="checkbox"]:checked + span {
    color: var(--gpl-tool-ink);
}

/* —— Checkboxes ——
   The theme paints a 20px box (::before) and tick (::after) over every checkbox, which
   overflows a small input and touches its label. Inside the tool the input itself is the
   box and the tick is an SVG background, so it also renders in Firefox (which draws no
   pseudo-elements on inputs). */
.gplsmg-tool input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 18px;
    min-width: 18px;
    height: 18px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 1.5px solid var(--gpl-tool-line-hover);
    border-radius: 5px;
    background-color: var(--gplsmg-input-bg);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 12px 12px;
    box-shadow: none;
    vertical-align: middle;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.gplsmg-tool input[type="checkbox"]::before,
.gplsmg-tool input[type="checkbox"]::after {
    content: none;
    display: none;
}

.gplsmg-tool input[type="checkbox"]:hover {
    border-color: var(--gpl-tool-blue);
}

.gplsmg-tool input[type="checkbox"]:checked {
    border-color: var(--gpl-tool-blue);
    background-color: var(--gpl-tool-blue);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.3 5 8.7l4.5-5.2'/%3E%3C/svg%3E");
}

.gplsmg-tool input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--gpl-tool-focus-ring);
}

/* Output options in the JSON-LD pane heading */
.gplsmg-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.gplsmg-tool .gplsmg-switch input[type="checkbox"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    border-radius: 4px;
    background-size: 10px 10px;
}

.gplsmg-pane__body {
    position: relative;
    flex: 1;
    min-height: 0;
    padding: 16px;
    overflow: auto;
    overscroll-behavior: contain;
}

.gplsmg-pane__body:focus {
    outline: none;
}

/* —— Generated code (line numbers + read-only textarea) —— */
.gplsmg-code-frame {
    display: grid;
    flex: 1;
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 0;
}

.gplsmg-tool .gplsmg-line-numbers,
.gplsmg-tool textarea.gplsmg-code {
    margin: 0;
    font-family: var(--gplsmg-mono);
    font-size: var(--gplsmg-code-size);
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: normal;
    tab-size: 2;
}

.gplsmg-tool .gplsmg-line-numbers {
    min-width: 44px;
    padding: 14px 10px;
    overflow: hidden;
    border-right: 1px solid var(--gpl-tool-line);
    color: #9ca3af;
    text-align: right;
    user-select: none;
}

.gplsmg-tool .gplsmg-line-numbers span {
    display: block;
    height: calc(var(--gplsmg-code-size) * 1.7);
}

.gplsmg-tool textarea.gplsmg-code,
.gplsmg-tool textarea.gplsmg-input {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: 14px 16px;
    overflow: auto;
    border: 0 !important;
    border-radius: 0;
    background: transparent;
    box-shadow: none !important;
    color: var(--gplsmg-code-text);
    white-space: pre;
    resize: none;
}

.gplsmg-tool textarea.gplsmg-input {
    flex: 1;
    font: var(--gplsmg-code-size)/1.7 var(--gplsmg-mono);
}

.gplsmg-tool textarea.gplsmg-code:focus,
.gplsmg-tool textarea.gplsmg-input:focus {
    outline: none;
}

.gplsmg-tool textarea.gplsmg-input:focus {
    background: var(--gpl-tool-surface);
}

/* —— Live report strip above the code —— */
.gplsmg-report {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--gplsmg-cell-line);
    background: var(--gpl-tool-surface);
    color: var(--gpl-tool-ink);
    font-size: 13px;
    line-height: 1.4;
}

/* Status colour: a soft tint plus an accent rule on the left edge */
.gplsmg-report.is-idle {
    color: var(--gpl-tool-muted);
}

.gplsmg-report.is-idle > i {
    color: var(--gpl-tool-blue);
}

.gplsmg-report.is-success {
    background: var(--gpl-tool-green-soft);
    box-shadow: inset 3px 0 0 var(--gpl-tool-green);
}

.gplsmg-report.is-success > i {
    color: var(--gpl-tool-green);
}

.gplsmg-report.is-warning {
    background: var(--gplsmg-amber-soft);
    box-shadow: inset 3px 0 0 var(--gplsmg-amber);
}

.gplsmg-report.is-error {
    background: var(--gpl-tool-red-soft);
    box-shadow: inset 3px 0 0 var(--gpl-tool-red);
}

.gplsmg-report__details {
    flex: 1;
    min-width: 0;
}

.gplsmg-report__summary {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -4px -6px;
    padding: 4px 6px;
    border-radius: 6px;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.gplsmg-report__summary::-webkit-details-marker {
    display: none;
}

.gplsmg-report__summary:hover {
    background: rgba(127, 127, 127, 0.08);
}

.gplsmg-report__summary:focus {
    outline: none;
}

.gplsmg-report__summary:focus-visible {
    box-shadow: 0 0 0 3px var(--gpl-tool-focus-ring);
}

.gplsmg-report__summary > i {
    flex: 0 0 auto;
    font-size: 15px;
}

.gplsmg-report.is-error .gplsmg-report__summary > i {
    color: var(--gpl-tool-red);
}

.gplsmg-report.is-warning .gplsmg-report__summary > i {
    color: var(--gplsmg-amber);
}

.gplsmg-report__summary strong {
    font-weight: 600;
}

.gplsmg-report__count {
    color: var(--gpl-tool-text-soft);
    font-size: 12.5px;
}

/* Chevron (matches .gpl-tool__collapse-icon, smaller) */
.gplsmg-report__chev {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-left: auto;
    border: 1px solid var(--gpl-tool-line);
    border-radius: 6px;
    background: var(--gpl-tool-surface);
    color: var(--gpl-tool-label);
    font-size: 11px;
    transition: transform 0.15s ease;
}

.gplsmg-report__details[open] .gplsmg-report__chev {
    transform: rotate(180deg);
}

/* Issue list: a contained, scrollable card under the summary */
.gplsmg-tool .gplsmg-report__details .gplsmg-issues {
    gap: 0;
    max-height: 190px;
    margin: 10px 0 2px;
    padding: 4px 12px;
    overflow: auto;
    border: 1px solid var(--gpl-tool-card-line);
    border-radius: var(--gpl-tool-radius);
    background: var(--gpl-tool-surface);
}

.gplsmg-tool .gplsmg-report__details .gplsmg-issue {
    padding: 6px 0;
}

.gplsmg-tool .gplsmg-report__details .gplsmg-issue + .gplsmg-issue {
    border-top: 1px solid var(--gpl-tool-divider);
}

/* —— Issue lists (report strip and validator) —— */
.gplsmg-tool .gplsmg-issues {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    line-height: 1.45;
}

.gplsmg-tool .gplsmg-issue {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0;
}

.gplsmg-issue > i {
    flex: 0 0 auto;
    width: 14px;
    text-align: center;
}

.gplsmg-issue.is-error > i {
    color: var(--gpl-tool-red);
}

.gplsmg-issue.is-warning > i {
    color: var(--gplsmg-amber);
}

.gplsmg-issue.is-info > i {
    color: var(--gpl-tool-blue);
}

.gplsmg-tool .gplsmg-issue-link {
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--gpl-tool-ink);
    font: inherit;
    font-weight: 400;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
    text-decoration: underline;
    text-decoration-color: var(--gpl-tool-line-hover);
    text-underline-offset: 2px;
    cursor: pointer;
}

.gplsmg-tool .gplsmg-issue-link:hover,
.gplsmg-tool .gplsmg-issue-link:focus {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--gpl-tool-blue) !important;
}

.gplsmg-tool .gplsmg-issue-link:focus-visible {
    outline: 2px solid var(--gpl-tool-blue);
    outline-offset: 2px;
}

/* —— Type summary at the top of the form —— */
.gplsmg-type-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--gpl-tool-card-line);
    border-radius: var(--gpl-tool-radius);
    background: var(--gpl-tool-blue-bg);
}

.gplsmg-type-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gpl-tool-blue);
    color: #fff;
    font-size: 14px;
}

.gplsmg-type-text {
    min-width: 0;
}

.gplsmg-tool .gplsmg-type-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    margin: 0 0 2px;
    color: var(--gpl-tool-ink);
    font-size: 15px;
}

.gplsmg-tool .gplsmg-type-title strong {
    font-weight: 600;
}

.gplsmg-tool .gplsmg-type-code {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--gpl-tool-surface);
    color: var(--gpl-tool-label);
    font-family: var(--gplsmg-mono);
    font-size: 12px;
}

.gplsmg-tool .gplsmg-type-desc,
.gplsmg-tool .gplsmg-type-note {
    margin: 0;
    color: var(--gplsmg-text);
    font-size: 13px;
    line-height: 1.45;
}

.gplsmg-tool .gplsmg-type-note {
    margin-top: 6px;
    color: var(--gpl-tool-text-soft);
    font-size: 12.5px;
}

.gplsmg-tool .gplsmg-docs {
    color: var(--gpl-tool-blue);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.gplsmg-tool .gplsmg-docs:hover {
    text-decoration: none;
}

.gplsmg-docs i {
    margin-left: 4px;
    font-size: 10px;
}

.gplsmg-collapse-icon {
    font-size: 12px;
}

/* —— Form fields —— */
.gplsmg-form {
    display: block;
}

.gplsmg-tool .gplsmg-section {
    margin-bottom: 14px;
}

.gplsmg-tool .gplsmg-section:last-child {
    margin-bottom: 0;
}

.gplsmg-tool .gplsmg-section .gpl-tool__hint {
    margin-bottom: 0;
}

.gplsmg-tool .gplsmg-field .gpl-tool__label {
    align-items: baseline;
}

.gplsmg-label-side {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    margin-left: auto;
}

.gplsmg-tool .gpl-tool__label > .gplsmg-label-side {
    font-size: 0.8125rem;
}

.gplsmg-level.is-req {
    color: var(--gpl-tool-red);
    font-weight: 500;
}

.gplsmg-counter {
    font-variant-numeric: tabular-nums;
}

.gplsmg-counter.is-over {
    color: var(--gpl-tool-red);
    font-weight: 600;
}

.gplsmg-tool .gplsmg-field textarea {
    min-height: 0;
    line-height: 1.5;
}

.gplsmg-tool .gplsmg-field.has-error input:not([type="checkbox"]),
.gplsmg-tool .gplsmg-field.has-error select,
.gplsmg-tool .gplsmg-field.has-error textarea {
    border-color: var(--gpl-tool-red-line);
}

.gplsmg-tool .gplsmg-field.has-warning input:not([type="checkbox"]),
.gplsmg-tool .gplsmg-field.has-warning select,
.gplsmg-tool .gplsmg-field.has-warning textarea {
    border-color: var(--gplsmg-amber-line);
}

.gplsmg-tool .gplsmg-currency {
    text-transform: uppercase;
}

/* Field message: hidden until the script fills it (colours: shell error / note text). */
.gplsmg-fmsg.hide {
    display: none;
}

.gplsmg-tool .gplsmg-field .gpl-tool__field-note {
    color: var(--gplsmg-amber);
}

/* Date + optional time + time zone */
.gplsmg-datetime {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 8px;
}

.gplsmg-tool .gplsmg-datetime input,
.gplsmg-tool .gplsmg-datetime select {
    width: 100%;
    min-width: 0;
    margin: 0;
}

/* Hours / minutes / seconds */
.gplsmg-duration {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.gplsmg-duration-part {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--gpl-tool-text-soft);
    font-size: 0.875rem;
}

.gplsmg-tool .gplsmg-duration-part input {
    width: 88px;
    margin: 0;
}

/* Checkbox rows */
.gplsmg-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.gplsmg-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--gpl-tool-ink);
    font-size: 14px;
    cursor: pointer;
}

/* Day chips */
.gplsmg-days {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gplsmg-day {
    position: relative;
    margin: 0;
    cursor: pointer;
}

/* The chip is the visible control; the real checkbox stays focusable underneath. */
.gplsmg-tool .gplsmg-day input[type="checkbox"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.gplsmg-day span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 7px 10px;
    border: 1px solid var(--gpl-tool-line);
    border-radius: 6px;
    background: var(--gpl-tool-surface);
    color: var(--gpl-tool-label);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.gplsmg-day:hover span {
    border-color: var(--gpl-tool-line-hover);
}

.gplsmg-tool .gplsmg-day input[type="checkbox"]:checked + span {
    border-color: var(--gpl-tool-blue-line);
    background: var(--gpl-tool-blue-tint);
    color: var(--gpl-tool-blue);
}

.gplsmg-day input:focus-visible + span {
    outline: 3px solid var(--gpl-tool-focus-ring);
    outline-offset: 2px;
}

/* Repeatable single values (images, profiles, ingredients) */
.gplsmg-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gplsmg-list-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gplsmg-tool .gplsmg-list-row input {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.gplsmg-tool .gplsmg-add {
    align-self: flex-start;
    margin-top: 10px;
}

.gplsmg-add i {
    font-size: 11px;
}

/* Square icon button (remove, move) */
.gplsmg-tool .gplsmg-icon-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--gpl-tool-line);
    border-radius: var(--gplsmg-control-radius);
    background: var(--gpl-tool-surface);
    box-shadow: none;
    color: var(--gpl-tool-muted);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.gplsmg-tool .gplsmg-icon-btn:hover,
.gplsmg-tool .gplsmg-icon-btn:focus-visible {
    border-color: var(--gpl-tool-line-hover) !important;
    background: var(--gpl-tool-surface-hover) !important;
    box-shadow: none !important;
    color: var(--gpl-tool-ink) !important;
}

.gplsmg-tool .gplsmg-icon-btn--danger:hover,
.gplsmg-tool .gplsmg-icon-btn--danger:focus-visible {
    border-color: var(--gpl-tool-red-line) !important;
    background: var(--gpl-tool-red-soft) !important;
    color: var(--gpl-tool-red) !important;
}

.gplsmg-tool .gplsmg-icon-btn:focus-visible {
    outline: 3px solid var(--gpl-tool-focus-ring);
    outline-offset: 2px;
}

/* !important: the theme gives disabled buttons a solid grey fill. */
.gplsmg-tool .gplsmg-icon-btn:disabled {
    border-color: var(--gpl-tool-line) !important;
    background: var(--gpl-tool-surface) !important;
    color: var(--gpl-tool-muted) !important;
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.gplsmg-tool .gplsmg-icon-btn:disabled::before {
    display: none;
}

/* Repeatable groups (questions, steps, tickets, hours) */
.gplsmg-tool .gplsmg-group > .gpl-tool__label {
    margin-bottom: 0.75em;
}

/* The section title already names a group that is alone in its section */
.gplsmg-tool .gplsmg-group > .gplsmg-group-legend--compact {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.gplsmg-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gplsmg-item {
    border: 1px solid var(--gpl-tool-card-line);
    border-radius: var(--gpl-tool-radius);
    background: var(--gpl-tool-surface);
}

.gplsmg-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 8px 6px 14px;
    border-bottom: 1px solid var(--gpl-tool-card-line);
    border-radius: var(--gpl-tool-radius) var(--gpl-tool-radius) 0 0;
    background: var(--gplsmg-head-bg);
}

.gplsmg-item-title {
    color: var(--gpl-tool-ink);
    font-size: 13px;
    font-weight: 700;
}

.gplsmg-item-tools {
    display: inline-flex;
    gap: 6px;
}

.gplsmg-tool .gplsmg-item-tools .gplsmg-icon-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    font-size: 12px;
}

.gplsmg-item-body {
    padding: 14px;
}

/* —— Validator report —— */
.gplsmg-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 100%;
    padding: 28px 20px;
    text-align: center;
}

.gplsmg-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: var(--gpl-tool-blue-bg);
    color: var(--gpl-tool-blue);
    font-size: 24px;
}

.gplsmg-empty strong {
    color: var(--gpl-tool-ink);
    font-size: 1rem;
    font-weight: 600;
}

.gplsmg-tool .gplsmg-empty p {
    max-width: 300px;
    margin: 0;
    color: var(--gpl-tool-text-soft);
    font-size: 0.875rem;
    line-height: 1.4;
}

.gplsmg-vresult {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gplsmg-source {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gplsmg-source .gpl-tag {
    gap: 6px;
}

.gplsmg-source .gplsmg-source-url {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gplsmg-vnotes:empty {
    display: none;
}

.gplsmg-tool .gplsmg-vnote {
    margin: 0 0 8px;
    padding: 9px 14px;
    border: 1px solid var(--gpl-tool-card-line);
    border-radius: var(--gpl-tool-radius);
    background: var(--gpl-tool-blue-bg);
    color: var(--gpl-tool-ink);
    font-size: 13px;
    line-height: 1.4;
}

.gplsmg-tool .gplsmg-vnote:last-child {
    margin-bottom: 0;
}

.gplsmg-vblocks {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gplsmg-vblock {
    border: 1px solid var(--gpl-tool-card-line);
    border-radius: var(--gpl-tool-radius);
    background: var(--gpl-tool-surface);
    overflow: hidden;
}

.gplsmg-vblock-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--gplsmg-cell-line);
    background: var(--gplsmg-head-bg);
    color: var(--gpl-tool-ink);
    font-size: 13px;
}

.gplsmg-vblock > .gplsmg-issues {
    padding: 12px 14px;
}

.gplsmg-vnode {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gpl-tool-divider);
}

.gplsmg-vnode-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.gplsmg-tool .gplsmg-vnode-head .gplsmg-edit {
    margin-left: auto;
}

.gplsmg-code-tag {
    font-family: var(--gplsmg-mono);
    font-size: 12px;
}

.gplsmg-tool .gplsmg-vok {
    margin: 0;
    color: var(--gpl-tool-green);
    font-size: 13px;
}

.gplsmg-codeview {
    padding: 10px 14px;
}

.gplsmg-codeview summary {
    color: var(--gpl-tool-blue);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.gplsmg-tool .gplsmg-pre {
    max-height: 340px;
    margin: 10px 0 0;
    padding: 12px 14px;
    overflow: auto;
    border: 1px solid var(--gpl-tool-line);
    border-radius: var(--gpl-tool-radius);
    background: var(--gplsmg-code-bg);
    color: var(--gplsmg-code-text);
    font-family: var(--gplsmg-mono);
    font-size: 12.5px;
    line-height: 1.6;
    white-space: pre;
}

.gplsmg-tool .gplsmg-text-button {
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--gpl-tool-blue) !important;
    font: inherit;
    font-weight: 600;
    line-height: inherit;
    letter-spacing: normal;
    text-decoration: underline;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
}

.gplsmg-tool .gplsmg-text-button:hover {
    text-decoration: none;
}

/* —— Footer (matches .gmv-footer) —— */
.gplsmg-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 1em;
}

/* Stats as pills (match .gmv-stats) */
.gplsmg-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.gplsmg-stats > span {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border: 1px solid var(--gplsmg-pill-line);
    border-radius: 3px;
    background: var(--gplsmg-pill-bg);
    color: var(--gpl-tool-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
}

.gplsmg-export {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

/* Export buttons: base, hover, focus, is-success and is-error are theme .gpl-tool__action-btn */
.gplsmg-tool a.gplsmg-action-btn {
    text-decoration: none;
}

.gplsmg-tool .gplsmg-action-btn--danger {
    color: var(--gpl-tool-red);
}

.gplsmg-tool .gplsmg-action-btn--danger:hover {
    border-color: var(--gpl-tool-red-line);
    background: var(--gpl-tool-red-soft);
    color: var(--gpl-tool-red);
}

.gplsmg-save-state {
    min-height: 1em;
    margin: 8px 0 0;
    color: var(--gpl-tool-muted);
    font-size: 12px;
}

.gplsmg-save-state.is-error {
    color: var(--gpl-tool-red);
}

/* —— Full screen —— */
.gplsmg-panel.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 100000;
    margin: 0;
    padding: 16px;
    overflow: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.gplsmg-panel.is-fullscreen .gplsmg-workspace {
    flex: 1;
    height: auto;
    min-height: 360px;
}

html.gplsmg-no-scroll,
html.gplsmg-no-scroll body {
    overflow: hidden !important;
}

/* —— Tablet —— */
@media (max-width: 1024px) {
    .gplsmg-bar {
        flex-wrap: wrap;
    }

    .gplsmg-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .gplsmg-export {
        justify-content: flex-start;
    }
}

/* —— Mobile: stack the two panes —— */
@media (max-width: 767px) {
    .gplsmg-tool {
        /* 16px stops iOS zooming into the code box on focus. */
        --gplsmg-code-size: 16px;
    }

    .gplsmg-panel {
        padding: 16px;
    }

    .gplsmg-panel.is-fullscreen {
        padding: 8px;
    }

    .gplsmg-header {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .gplsmg-header__actions {
        flex-basis: auto;
        width: 100%;
    }

    .gplsmg-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px;
    }

    .gplsmg-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .gplsmg-segmented--text {
        display: flex;
    }

    .gplsmg-tool .gplsmg-segmented--text .gplsmg-tool-btn {
        flex: 1;
        height: 36px;
    }

    .gplsmg-type-picker {
        width: 100%;
    }

    .gplsmg-tool .gplsmg-type-picker select {
        flex: 1;
        width: auto;
        height: 40px;
    }

    .gplsmg-viewbar {
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid var(--gpl-tool-line);
    }

    .gplsmg-tool .gplsmg-tool-btn {
        width: 38px;
        height: 38px;
    }

    .gplsmg-tool .gplsmg-segmented .gplsmg-tool-btn {
        width: 36px;
        height: 34px;
    }

    /* The form flows with the page; only the code pane keeps a fixed height. */
    .gplsmg-workspace,
    .gplsmg-panel.is-fullscreen .gplsmg-workspace {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .gplsmg-pane--left {
        border-right: 0;
    }

    .gplsmg-workspace[data-view="split"] .gplsmg-pane--left {
        border-bottom: 1px solid var(--gpl-tool-line);
    }

    .gplsmg-pane__body {
        flex: none;
        padding: 12px;
        overflow: visible;
    }

    .gplsmg-pane--code {
        height: 60vh;
        min-height: 320px;
    }

    .gplsmg-type-info {
        padding: 10px 12px;
    }

    /* Date on its own row; time and time zone share the next one. */
    .gplsmg-datetime {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .gplsmg-tool .gplsmg-datetime input[type="date"] {
        grid-column: 1 / -1;
    }

    .gplsmg-item-body {
        padding: 12px;
    }

    .gplsmg-day span {
        min-width: 42px;
    }

    .gplsmg-export {
        width: 100%;
    }

    .gplsmg-tool .gplsmg-action-btn {
        flex: 1 1 auto;
        min-height: 44px;
        padding: 7px 8px;
        white-space: nowrap;
    }
}

@media (max-width: 430px) {
    .gplsmg-tool .gplsmg-url-field__btn {
        padding: 0 10px;
    }

    .gplsmg-url-field__icon {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gplsmg-tool *,
    .gplsmg-tool *::before,
    .gplsmg-tool *::after {
        animation: none !important;
    }

    .gplsmg-tool:not(.is-ready) .gplsmg-workspace {
        animation: gplsmg-reveal 0s linear 3s forwards !important;
    }
}

@media print {
    .gplsmg-header,
    .gplsmg-bar,
    .gplsmg-footer,
    .gplsmg-save-state,
    .gplsmg-pane--left,
    .gplsmg-pane__head,
    .gplsmg-report {
        display: none !important;
    }

    .gplsmg-panel,
    .gplsmg-workspace {
        height: auto;
        padding: 0;
        border: 0;
    }

    .gplsmg-workspace {
        display: block;
    }
}
