/* Compact store cards sized for the Ghost client's embedded panel. */
:root {
    color-scheme: dark;
    --bg: #0e1117; --card: #171c25; --line: #2b3341;
    --text: #eef2f9; --muted: #9ba7b9; --accent: #8aafff;
    --button: #467aee; --button-hover: #5a8bfd; --badge: #202837; --danger: #ff9292;
}
html[data-mode="light"] {
    color-scheme: light;
    --bg: #f6f8fc; --card: #ffffff; --line: #dce2ec;
    --text: #202a3c; --muted: #647187; --accent: #315fc4;
    --button: #356bdc; --button-hover: #2558c6; --badge: #eff3fa; --danger: #ba3039;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0 auto; max-width: 100%; padding: 18px 20px 24px;
    background: var(--bg); color: var(--text);
    font: 13px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.gs-header { margin-bottom: 18px; }
.gs-heading {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; min-height: 32px;
}
.gs-heading-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
h1 { margin: 0; font-size: 20px; line-height: 1.4; letter-spacing: -.4px; font-weight: 650; }
.gs-count { min-width: 24px; padding: 1px 7px; border-radius: 5px; background: var(--badge); color: var(--muted); font-size: 10px; text-align: center; }

/* Filter tabs and search control */
.gs-controls {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto;
}
.gs-filters {
    display: inline-flex; align-items: center;
    background: var(--card); border: 1px solid var(--line); border-radius: 7px;
    padding: 2px; gap: 2px;
}
.gs-filter-btn {
    background: transparent; border: none; color: var(--muted);
    padding: 3px 10px; font: 500 11px/16px "Segoe UI", system-ui, sans-serif;
    border-radius: 5px; cursor: pointer; transition: color 120ms ease, background 120ms ease;
    white-space: nowrap;
}
.gs-filter-btn:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
html[data-mode="light"] .gs-filter-btn:hover { background: rgba(0, 0, 0, .04); }
.gs-filter-btn.is-active { background: var(--badge); color: var(--text); font-weight: 600; }

.gs-search-wrap {
    position: relative; display: flex; align-items: center;
    min-width: 170px; max-width: 240px;
}
.gs-search-icon {
    position: absolute; left: 8px; color: var(--muted); pointer-events: none;
}
.gs-search-input {
    width: 100%; height: 28px; padding: 4px 24px 4px 26px;
    background: var(--card); border: 1px solid var(--line); border-radius: 7px;
    color: var(--text); font: 12px/16px "Segoe UI", system-ui, sans-serif;
    outline: none; transition: border-color 150ms ease;
}
.gs-search-input:focus { border-color: var(--accent); }
.gs-search-input::placeholder { color: var(--muted); opacity: .8; }
.gs-search-clear {
    position: absolute; right: 6px; background: transparent; border: none;
    color: var(--muted); font-size: 15px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.gs-search-clear:hover { color: var(--text); }

.gs-notice {
    margin: 12px 0 0; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 12px;
}
.gs-catalog {
    list-style: none; margin: 0; padding: 0; display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: 12px; align-items: stretch;
}
.gs-card {
    min-width: 0; display: flex; flex-direction: column; padding: 14px;
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    transition: border-color 150ms ease;
}
.gs-card:hover { border-color: var(--accent); }
.gs-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.gs-icon { display: block; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 9px; object-fit: contain; }
.gs-version { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gs-name {
    margin: 0; font-size: 14px; font-weight: 600; line-height: 20px; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.gs-desc {
    min-height: 54px; margin: 8px 0 14px; color: var(--muted); font-size: 12px; line-height: 18px; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.gs-status { margin: 0 0 10px; color: var(--accent); font-size: 11px; line-height: 16px; }
.gs-status.is-expired { color: var(--danger); }
.gs-card-notice { margin: 0 0 10px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.gs-card-notice.is-error { color: var(--danger); }

/* Uniform Plan / Pricing slot for every card (Scheme B) */
.gs-plan {
    margin: 0 0 12px; padding: 8px 10px;
    background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 8px;
    display: flex; flex-direction: column; justify-content: space-between;
    height: 68px; min-height: 68px; box-sizing: border-box;
}
html[data-mode="light"] .gs-plan {
    background: rgba(0, 0, 0, .02);
}
.gs-plan-head {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    font-size: 11px; line-height: 14px; margin-bottom: 5px;
}
.gs-plan-title { color: var(--muted); font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.gs-plan-hint { color: var(--accent); font-size: 11px; font-weight: 600; }
.gs-plan-badge {
    padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600;
    background: var(--badge); color: var(--accent);
}
.gs-plan-tiers {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
}
.gs-buy-tier {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 3px 2px; border: 1px solid var(--line); border-radius: 5px;
    background: var(--card); color: var(--text); text-decoration: none;
    font-family: inherit; font-size: inherit; cursor: pointer; outline: none;
    transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
    text-align: center; min-width: 0;
}
.gs-buy-tier:hover {
    border-color: var(--accent); background: rgba(138, 175, 255, .08);
}
.gs-buy-tier.is-active,
.gs-buy-tier.is-selected {
    border-color: var(--button);
    background: rgba(138, 175, 255, .12);
    box-shadow: 0 0 0 1px var(--button);
}
.gs-tier-name {
    font-size: 9px; line-height: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.gs-tier-price {
    font-size: 11px; line-height: 14px; font-weight: 700; color: var(--text); white-space: nowrap;
}
.gs-buy-tier.is-active .gs-tier-price,
.gs-buy-tier.is-selected .gs-tier-price {
    color: var(--accent);
}
.gs-plan-free-info {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; line-height: 16px; color: var(--muted);
    padding: 4px 0;
}
.gs-plan-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    background: rgba(70, 122, 238, .15); color: var(--accent);
    font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.gs-plan-text {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.gs-card-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.gs-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.gs-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    min-height: 30px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px;
    background: transparent; color: var(--text); font: 600 11px/1.5 "Segoe UI", system-ui, sans-serif;
    cursor: pointer; transition: background 150ms ease, border-color 150ms ease; text-decoration: none;
}
.gs-btn.is-primary { border-color: var(--button); background: var(--button); color: #ffffff; }
.gs-btn.is-primary:hover:not(:disabled) { background: var(--button-hover); border-color: var(--button-hover); }
.gs-btn[data-action="install"]::before { content: "\2193"; font-size: 14px; line-height: 1; font-weight: 400; }
.gs-btn:disabled { opacity: .55; cursor: default; }

.gs-btn-activate {
    border-color: var(--line); background: transparent; color: var(--muted);
}
.gs-btn-activate:hover:not(:disabled) {
    border-color: var(--accent); color: var(--text);
}

.gs-link { margin-left: auto; color: var(--muted); font-size: 11px; text-decoration: none; white-space: nowrap; }
.gs-link::after { content: "\2197"; padding-left: 4px; font-size: 12px; }
.gs-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
:is(.gs-btn, .gs-link):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.gs-empty { padding: 24px 0; color: var(--muted); text-align: center; font-size: 13px; }

/* Modal dialog for license activation */
.gs-modal-backdrop {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, .65); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 16px;
}
.gs-modal-dialog {
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    width: 100%; max-width: 440px; box-shadow: 0 16px 36px rgba(0, 0, 0, .45);
    display: flex; flex-direction: column; overflow: hidden;
}
.gs-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.gs-modal-title { margin: 0; font-size: 15px; font-weight: 600; }
.gs-modal-close {
    background: transparent; border: none; color: var(--muted);
    font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.gs-modal-close:hover { color: var(--text); }
.gs-modal-body {
    padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
}
.gs-modal-plugin-name {
    margin: 0 0 2px; font-weight: 600; color: var(--accent); font-size: 13px;
}
.gs-modal-label { font-size: 12px; color: var(--muted); }
.gs-license-textarea {
    width: 100%; font-family: Consolas, monospace; font-size: 11px; line-height: 1.4;
    background: var(--bg); color: var(--text); border: 1px solid var(--line);
    border-radius: 6px; padding: 8px; resize: vertical; box-sizing: border-box; outline: none;
}
.gs-license-textarea:focus { border-color: var(--accent); }
.gs-modal-error { margin: 2px 0 0; font-size: 11px; color: var(--danger); }
.gs-modal-footer {
    padding: 12px 18px; border-top: 1px solid var(--line);
    display: flex; justify-content: flex-end; gap: 8px; background: var(--badge);
}
.gs-btn-secondary {
    background: transparent; border: 1px solid var(--line); color: var(--muted);
}
.gs-btn-secondary:hover { color: var(--text); border-color: var(--text); }
.gs-btn-primary {
    background: var(--button); color: #ffffff; border: 1px solid var(--button);
}
.gs-btn-primary:hover:not(:disabled) { background: var(--button-hover); border-color: var(--button-hover); }

@media (max-width: 640px) {
    body { padding: 14px 14px 20px; }
    .gs-header { margin-bottom: 14px; }
    .gs-heading {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 8px 10px;
        align-items: center;
        min-height: 0;
    }
    .gs-heading-left {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
    .gs-heading-left h1 {
        font-size: 18px;
    }
    .gs-controls {
        display: contents;
    }
    .gs-filters {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
        justify-self: end;
        margin-left: auto;
    }
    .gs-search-wrap {
        grid-column: 1 / 3;
        grid-row: 2 / 3;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .gs-search-input {
        height: 28px;
        font-size: 12px;
    }
}
@media (max-width: 480px) {
    .gs-btn[data-action="install"]::before, .gs-link::after { display: none; }
}
@media (max-width: 339px) {
    body { padding: 10px; }
    .gs-heading-left h1 { font-size: 16px; }
    .gs-filter-btn { padding: 2px 7px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { .gs-card, .gs-btn, .gs-buy-tier { transition: none; } }
