/**
 * Shy Guru Companion public app styles.
 * Package 3 adds the logged-in mobile app shell.
 */

.sgc-app-root {
    --sgc-bg: #f8f3ea;
    --sgc-surface: #ffffff;
    --sgc-surface-soft: #fffaf3;
    --sgc-text: #241f2c;
    --sgc-muted: #665f70;
    --sgc-border: rgba(36, 31, 44, 0.12);
    --sgc-purple: #4b2b68;
    --sgc-purple-dark: #321947;
    --sgc-gold: #d7a84f;
    --sgc-teal: #2f9c95;
    --sgc-soft-purple: rgba(75, 43, 104, 0.09);
    --sgc-soft-gold: rgba(215, 168, 79, 0.16);
    --sgc-soft-teal: rgba(47, 156, 149, 0.12);
    --sgc-shadow: 0 18px 45px rgba(36, 31, 44, 0.12);
    --sgc-radius-lg: 28px;
    --sgc-radius-md: 20px;
    box-sizing: border-box;
    width: min(1180px, 100%);
    min-height: 760px;
    margin: 0 auto;
    color: var(--sgc-text);
    font-family: inherit;
    background:
        radial-gradient(circle at 8% 0%, rgba(215, 168, 79, 0.24), transparent 34%),
        radial-gradient(circle at 100% 12%, rgba(47, 156, 149, 0.16), transparent 32%),
        linear-gradient(180deg, #fffaf2 0%, var(--sgc-bg) 62%, #ffffff 100%);
    border: 1px solid rgba(36, 31, 44, 0.08);
    border-radius: 32px;
    overflow: hidden;
    position: relative;
}

.sgc-app-root *,
.sgc-app-root *::before,
.sgc-app-root *::after {
    box-sizing: inherit;
}

.sgc-app-root button,
.sgc-app-root input,
.sgc-app-root textarea {
    font: inherit;
}

.sgc-page-has-app .entry-content,
.sgc-page-has-app .wp-block-post-content {
    overflow: visible;
}

.sgc-app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px clamp(18px, 4vw, 38px);
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid var(--sgc-border);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.sgc-brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sgc-brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--sgc-purple), #6e488c);
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.04em;
    box-shadow: 0 12px 26px rgba(75, 43, 104, 0.22);
}

.sgc-brand-mark-large {
    width: 62px;
    height: 62px;
    margin: 0 auto 16px;
    border-radius: 22px;
    font-size: 16px;
}

.sgc-eyebrow {
    margin: 0 0 5px;
    color: var(--sgc-purple);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sgc-app-topbar h1,
.sgc-section-heading h2,
.sgc-hero-card h2,
.sgc-chat-header-card h2,
.sgc-logged-out-card h1 {
    margin: 0;
    color: var(--sgc-text);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.sgc-app-topbar h1 {
    font-size: clamp(22px, 4vw, 30px);
}

.sgc-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sgc-plan-pill,
.sgc-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    border-radius: 999px;
    padding: 6px 11px;
    background: var(--sgc-soft-teal);
    color: #126b66;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.sgc-status-pill {
    background: var(--sgc-soft-gold);
    color: #775018;
}

.sgc-app-main {
    padding: clamp(16px, 4vw, 34px) clamp(14px, 4vw, 38px) 110px;
}

.sgc-screen {
    display: none;
    animation: sgcFadeIn 0.2s ease;
}

.sgc-screen.is-active {
    display: block;
}

@keyframes sgcFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.sgc-hero-card,
.sgc-card,
.sgc-action-card,
.sgc-tool-card,
.sgc-chat-header-card,
.sgc-progress-stat,
.sgc-logged-out-card {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--sgc-border);
    border-radius: var(--sgc-radius-lg);
    box-shadow: 0 12px 34px rgba(36, 31, 44, 0.07);
}

.sgc-hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 22px;
    padding: clamp(22px, 4vw, 36px);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 250, 243, 0.9)),
        radial-gradient(circle at right, rgba(75, 43, 104, 0.1), transparent 48%);
}

.sgc-hero-card h2,
.sgc-section-heading h2,
.sgc-chat-header-card h2 {
    font-size: clamp(28px, 5vw, 48px);
}

.sgc-hero-card p,
.sgc-section-heading p,
.sgc-chat-header-card p,
.sgc-card p,
.sgc-action-card p,
.sgc-tool-card p,
.sgc-logged-out-card p {
    color: var(--sgc-muted);
    line-height: 1.55;
}

.sgc-hero-card p,
.sgc-section-heading p,
.sgc-chat-header-card p {
    margin: 12px 0 0;
    font-size: 17px;
}

.sgc-usage-circle {
    width: 112px;
    height: 112px;
    display: grid;
    place-items: center;
    text-align: center;
    border-radius: 50%;
    background: var(--sgc-purple);
    color: #ffffff;
    box-shadow: 0 15px 30px rgba(75, 43, 104, 0.24);
}

.sgc-usage-circle strong {
    display: block;
    font-size: 34px;
    line-height: 1;
}

.sgc-usage-circle span {
    display: block;
    margin-top: -12px;
    font-size: 12px;
    font-weight: 700;
    opacity: 0.88;
}

.sgc-card {
    padding: clamp(18px, 3vw, 24px);
    margin-top: 16px;
}

.sgc-card h3,
.sgc-action-card h3,
.sgc-tool-card h3 {
    margin: 0;
    color: var(--sgc-text);
    font-size: 20px;
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.sgc-choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.sgc-choice-row button,
.sgc-guided-tiles button {
    border: 1px solid var(--sgc-border);
    background: #ffffff;
    color: var(--sgc-purple);
    border-radius: 999px;
    padding: 11px 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.sgc-choice-row button:hover,
.sgc-guided-tiles button:hover,
.sgc-choice-row button.is-selected {
    transform: translateY(-1px);
    border-color: rgba(75, 43, 104, 0.42);
    background: var(--sgc-soft-purple);
}

.sgc-inline-note,
.sgc-muted {
    color: var(--sgc-muted);
    font-size: 14px;
}

.sgc-today-grid,
.sgc-tool-grid,
.sgc-progress-grid,
.sgc-me-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.sgc-action-card,
.sgc-tool-card {
    padding: 22px;
}

.sgc-action-card-primary {
    background: linear-gradient(135deg, var(--sgc-purple), #6e488c);
    color: #ffffff;
}

.sgc-action-card-primary h3,
.sgc-action-card-primary p,
.sgc-action-card-primary .sgc-card-label {
    color: #ffffff;
}

.sgc-action-card-primary p {
    opacity: 0.88;
}

.sgc-card-label {
    margin: 0 0 10px;
    color: var(--sgc-purple);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.sgc-button,
.sgc-send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    text-decoration: none !important;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.sgc-button:hover,
.sgc-send-button:hover {
    transform: translateY(-1px);
}

.sgc-button-primary,
.sgc-send-button {
    background: var(--sgc-purple);
    color: #ffffff !important;
    box-shadow: 0 12px 26px rgba(75, 43, 104, 0.2);
}

.sgc-button-primary:hover,
.sgc-send-button:hover {
    background: var(--sgc-purple-dark);
    color: #ffffff !important;
}

.sgc-button-soft {
    background: var(--sgc-soft-purple);
    color: var(--sgc-purple) !important;
    border-color: rgba(75, 43, 104, 0.12);
}

.sgc-button-light {
    background: #ffffff;
    color: var(--sgc-purple) !important;
}

.sgc-button-ghost {
    background: transparent;
    color: var(--sgc-purple) !important;
    border-color: var(--sgc-border);
}

.sgc-stat-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.sgc-stat-strip div,
.sgc-progress-stat {
    text-align: center;
}

.sgc-stat-strip strong,
.sgc-progress-stat strong {
    display: block;
    color: var(--sgc-purple);
    font-size: 30px;
    line-height: 1;
}

.sgc-stat-strip span,
.sgc-progress-stat span {
    display: block;
    margin-top: 6px;
    color: var(--sgc-muted);
    font-size: 13px;
    font-weight: 800;
}

.sgc-section-heading {
    max-width: 760px;
    margin-bottom: 20px;
}

.sgc-chat-shell {
    display: grid;
    gap: 14px;
}

.sgc-chat-header-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding: clamp(20px, 4vw, 30px);
}

.sgc-chat-window {
    display: grid;
    gap: 12px;
    min-height: 380px;
    max-height: 560px;
    overflow: auto;
    padding: clamp(16px, 3vw, 22px);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--sgc-border);
    border-radius: var(--sgc-radius-lg);
}

.sgc-chat-bubble {
    width: fit-content;
    max-width: min(720px, 92%);
    padding: 14px 16px;
    border-radius: 20px;
    line-height: 1.5;
    box-shadow: 0 8px 20px rgba(36, 31, 44, 0.05);
}

.sgc-chat-bubble-guru {
    background: #ffffff;
    color: var(--sgc-text);
    border: 1px solid var(--sgc-border);
    border-top-left-radius: 8px;
}

.sgc-chat-bubble-user {
    justify-self: end;
    background: var(--sgc-purple);
    color: #ffffff;
    border-top-right-radius: 8px;
}

.sgc-guided-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-width: 760px;
}

.sgc-guided-tiles button {
    border-radius: 16px;
    text-align: left;
    padding: 14px;
}

.sgc-chat-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--sgc-border);
    border-radius: 24px;
    position: sticky;
    bottom: 86px;
    z-index: 4;
    box-shadow: 0 12px 30px rgba(36, 31, 44, 0.08);
}

.sgc-chat-input textarea {
    width: 100%;
    min-height: 52px;
    max-height: 140px;
    resize: vertical;
    border: 1px solid var(--sgc-border);
    border-radius: 18px;
    padding: 13px 14px;
    background: #ffffff;
    color: var(--sgc-text);
}

.sgc-tool-card {
    display: flex;
    flex-direction: column;
    min-height: 232px;
}

.sgc-tool-card p {
    flex: 1;
}

.sgc-tool-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--sgc-soft-gold);
    color: var(--sgc-purple);
    margin-bottom: 14px;
    font-weight: 900;
}

.sgc-progress-stat {
    padding: 24px;
}

.sgc-empty-state {
    text-align: left;
}

.sgc-me-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sgc-wide-card {
    grid-column: 1 / -1;
}

.sgc-safety-card {
    background: linear-gradient(135deg, rgba(75, 43, 104, 0.96), rgba(91, 58, 117, 0.96));
    color: #ffffff;
}

.sgc-safety-card h3,
.sgc-safety-card p {
    color: #ffffff;
}

.sgc-definition-list {
    margin: 0;
    display: grid;
    gap: 12px;
}

.sgc-definition-list div {
    display: grid;
    gap: 4px;
}

.sgc-definition-list dt {
    color: var(--sgc-muted);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sgc-definition-list dd {
    margin: 0;
    color: var(--sgc-text);
    font-weight: 800;
}

.sgc-bottom-nav {
    position: sticky;
    bottom: 0;
    z-index: 6;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 10px clamp(10px, 3vw, 22px) calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid var(--sgc-border);
    backdrop-filter: blur(18px);
}

.sgc-bottom-nav-item {
    min-height: 58px;
    border: 0;
    border-radius: 18px;
    background: transparent;
    color: var(--sgc-muted);
    display: grid;
    place-items: center;
    gap: 3px;
    cursor: pointer;
}

.sgc-bottom-nav-item span {
    font-size: 16px;
    line-height: 1;
}

.sgc-bottom-nav-item b {
    font-size: 11px;
    line-height: 1;
}

.sgc-bottom-nav-item.is-active,
.sgc-bottom-nav-item[aria-current="page"] {
    background: var(--sgc-soft-purple);
    color: var(--sgc-purple);
}

.sgc-logged-out-shell {
    min-height: 0;
    padding: clamp(20px, 5vw, 46px);
}

.sgc-logged-out-card {
    max-width: 780px;
    margin: 0 auto;
    padding: clamp(24px, 5vw, 44px);
    text-align: center;
}

.sgc-logged-out-card h1 {
    font-size: clamp(32px, 6vw, 54px);
}

.sgc-lead {
    max-width: 620px;
    margin: 16px auto 0;
    font-size: 18px;
}

.sgc-logged-out-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.sgc-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 28px;
    text-align: left;
}

.sgc-preview-mini-card {
    padding: 16px;
    border: 1px solid var(--sgc-border);
    border-radius: 18px;
    background: var(--sgc-surface-soft);
}

.sgc-preview-mini-card strong,
.sgc-preview-mini-card span {
    display: block;
}

.sgc-preview-mini-card strong {
    color: var(--sgc-purple);
    margin-bottom: 6px;
}

.sgc-preview-mini-card span {
    color: var(--sgc-muted);
    font-size: 14px;
    line-height: 1.45;
}

@media (max-width: 900px) {
    .sgc-app-root {
        border-radius: 24px;
    }

    .sgc-hero-card,
    .sgc-chat-header-card {
        grid-template-columns: 1fr;
    }

    .sgc-usage-circle {
        width: 94px;
        height: 94px;
    }

    .sgc-today-grid,
    .sgc-tool-grid,
    .sgc-progress-grid,
    .sgc-me-grid,
    .sgc-preview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .sgc-app-root {
        width: 100%;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .sgc-app-topbar {
        padding: 16px 14px;
    }

    .sgc-brand-mark {
        width: 40px;
        height: 40px;
        border-radius: 14px;
    }

    .sgc-app-main {
        padding: 14px 12px 100px;
    }

    .sgc-hero-card,
    .sgc-card,
    .sgc-action-card,
    .sgc-tool-card,
    .sgc-chat-header-card,
    .sgc-chat-window {
        border-radius: 22px;
    }

    .sgc-choice-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sgc-choice-row button,
    .sgc-guided-tiles button {
        border-radius: 14px;
        padding: 12px;
    }

    .sgc-guided-tiles {
        grid-template-columns: 1fr;
    }

    .sgc-stat-strip {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .sgc-chat-input {
        grid-template-columns: 1fr;
        bottom: 80px;
        border-radius: 20px;
    }

    .sgc-send-button {
        width: 100%;
    }

    .sgc-bottom-nav {
        gap: 3px;
        padding-left: 6px;
        padding-right: 6px;
    }

    .sgc-bottom-nav-item {
        min-height: 54px;
        border-radius: 14px;
    }

    .sgc-bottom-nav-item b {
        font-size: 10px;
    }

    .sgc-logged-out-actions {
        display: grid;
    }

    .sgc-logged-out-actions .sgc-button {
        width: 100%;
    }
}

/* Package 3 live chat additions */
.sgc-status-pill-live {
    background: rgba(47, 156, 149, 0.14);
    color: #1f6f69;
    border-color: rgba(47, 156, 149, 0.28);
}

.sgc-chat-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid rgba(36, 31, 44, 0.1);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--sgc-muted, #665f70);
    font-size: 13px;
    line-height: 1.35;
}

.sgc-chat-meta-row strong {
    color: var(--sgc-purple, #4b2b68);
}

.sgc-chat-error {
    border: 1px solid rgba(164, 42, 42, 0.24);
    background: rgba(164, 42, 42, 0.08);
    color: #7d2020;
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.45;
}

.sgc-chat-bubble-loading {
    opacity: 0.72;
    font-style: italic;
}

.sgc-chat-bubble-error {
    background: rgba(164, 42, 42, 0.08) !important;
    color: #7d2020 !important;
    border: 1px solid rgba(164, 42, 42, 0.2);
}

.sgc-chat-input textarea:disabled,
.sgc-send-button:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

@media (max-width: 520px) {
    .sgc-chat-meta-row {
        flex-direction: column;
        gap: 4px;
    }
}

/* Package 4 chat readability fixes */
.sgc-chat-bubble {
    white-space: normal;
    overflow-wrap: anywhere;
}

.sgc-chat-bubble .sgc-message-block + .sgc-message-block {
    margin-top: 12px;
}

.sgc-chat-bubble-guru .sgc-message-block:first-child {
    margin-top: 0;
}

.sgc-chat-bubble-guru strong {
    color: var(--sgc-purple);
    font-weight: 900;
}

.sgc-chat-bubble-loading {
    color: var(--sgc-muted);
    font-style: italic;
}

.sgc-chat-bubble-error {
    border-color: rgba(170, 54, 54, 0.25);
    background: rgba(170, 54, 54, 0.06);
    color: #7f1d1d;
}

/* Package 7 screenshot upload and guided tool starter */
.sgc-input-main {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.sgc-attachment-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 2px;
}

.sgc-attach-button,
.sgc-remove-attachment {
    min-height: 34px;
    border-radius: 999px;
    border: 1px solid var(--sgc-border);
    background: #ffffff;
    color: var(--sgc-purple);
    padding: 7px 11px;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.sgc-attach-button:hover,
.sgc-remove-attachment:hover {
    background: var(--sgc-soft-purple);
}

.sgc-attachment-label {
    color: var(--sgc-muted);
    font-size: 13px;
    line-height: 1.35;
}

.sgc-tool-starter {
    margin-top: 18px;
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 18px;
    padding: clamp(18px, 3vw, 26px);
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--sgc-border);
    border-radius: var(--sgc-radius-lg);
    box-shadow: var(--sgc-shadow);
}

.sgc-tool-starter[hidden] {
    display: none;
}

.sgc-tool-starter h3 {
    margin: 0;
    color: var(--sgc-text);
    font-size: clamp(24px, 4vw, 36px);
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.sgc-tool-starter-copy p:not(.sgc-eyebrow),
.sgc-tool-starter-form label,
.sgc-tool-starter-form textarea,
.sgc-tool-chip-row,
.sgc-tool-starter-actions {
    margin-top: 12px;
}

.sgc-tool-starter-copy p:not(.sgc-eyebrow) {
    color: var(--sgc-muted);
    line-height: 1.55;
}

.sgc-tool-starter-form label {
    display: block;
    color: var(--sgc-text);
    font-weight: 900;
    line-height: 1.35;
}

.sgc-tool-starter-form textarea {
    width: 100%;
    min-height: 128px;
    resize: vertical;
    border: 1px solid var(--sgc-border);
    border-radius: 18px;
    padding: 13px 14px;
    background: #ffffff;
    color: var(--sgc-text);
}

.sgc-tool-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sgc-tool-chip {
    border: 1px solid rgba(75, 43, 104, 0.18);
    border-radius: 999px;
    background: var(--sgc-soft-purple);
    color: var(--sgc-purple);
    padding: 8px 11px;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.sgc-tool-chip:hover {
    background: rgba(75, 43, 104, 0.14);
}

.sgc-tool-starter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 820px) {
    .sgc-tool-starter {
        grid-template-columns: 1fr;
    }
}

/* Package 8: chat history, saved scripts and message actions */
.sgc-chat-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.sgc-mini-button {
    appearance: none;
    border: 1px solid rgba(75, 43, 104, 0.18);
    border-radius: 999px;
    background: #ffffff;
    color: var(--sgc-purple, #4b2b68);
    padding: 8px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
}

.sgc-mini-button:hover,
.sgc-mini-button:focus {
    background: rgba(75, 43, 104, 0.08);
}

.sgc-danger-button,
.sgc-history-delete {
    color: #8b2331;
    border-color: rgba(139, 35, 49, 0.22);
}

.sgc-chat-history-panel {
    border: 1px solid rgba(36, 31, 44, 0.12);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.82);
    padding: 14px;
    margin: 12px 0;
    box-shadow: 0 14px 28px rgba(36, 31, 44, 0.07);
}

.sgc-history-panel-head,
.sgc-card-row-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.sgc-history-panel-head h3,
.sgc-card-row-head h3 {
    margin: 0;
}

.sgc-history-list,
.sgc-saved-script-list {
    display: grid;
    gap: 10px;
}

.sgc-history-item,
.sgc-saved-script-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(36, 31, 44, 0.1);
    border-radius: 18px;
    background: #ffffff;
    padding: 12px;
}

.sgc-history-open {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    text-align: left;
    cursor: pointer;
}

.sgc-history-open strong,
.sgc-saved-script-item h4 {
    display: block;
    margin: 0 0 4px;
    color: var(--sgc-text, #241f2c);
    font-size: 15px;
    line-height: 1.25;
}

.sgc-history-open span,
.sgc-script-type,
.sgc-saved-script-item p {
    display: block;
    color: var(--sgc-muted, #665f70);
    font-size: 12px;
    line-height: 1.35;
}

.sgc-history-delete {
    appearance: none;
    border: 1px solid rgba(139, 35, 49, 0.22);
    border-radius: 999px;
    background: #ffffff;
    padding: 7px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.sgc-chat-toast {
    margin: 10px 0;
    border-radius: 999px;
    background: rgba(47, 156, 149, 0.12);
    color: #1f6f6a;
    padding: 9px 13px;
    font-size: 13px;
    font-weight: 750;
}

.sgc-message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(36, 31, 44, 0.08);
}

.sgc-message-actions button {
    appearance: none;
    border: 1px solid rgba(75, 43, 104, 0.18);
    border-radius: 999px;
    background: #ffffff;
    color: var(--sgc-purple, #4b2b68);
    padding: 7px 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.sgc-message-actions button:hover,
.sgc-message-actions button:focus {
    background: rgba(75, 43, 104, 0.08);
}

.sgc-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(75, 43, 104, 0.1);
    color: var(--sgc-purple, #4b2b68);
    font-weight: 900;
}

.sgc-empty-mini {
    border: 1px dashed rgba(36, 31, 44, 0.2);
    border-radius: 18px;
    padding: 16px;
    color: var(--sgc-muted, #665f70);
    background: rgba(255, 255, 255, 0.66);
}

.sgc-saved-script-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.sgc-script-type {
    color: var(--sgc-purple, #4b2b68);
    font-weight: 800;
    margin-bottom: 4px;
}

@media (max-width: 760px) {
    .sgc-chat-header-actions {
        justify-content: flex-start;
    }

    .sgc-history-item,
    .sgc-saved-script-item {
        grid-template-columns: 1fr;
    }

    .sgc-saved-script-actions {
        justify-content: flex-start;
    }
}

/* Package 9 memory controls */
.sgc-memory-card {
    display: grid;
    gap: 18px;
}

.sgc-memory-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid rgba(75, 43, 104, 0.12);
    border-radius: 20px;
    padding: 16px;
    background: rgba(75, 43, 104, 0.045);
}

.sgc-memory-status-row strong {
    display: block;
    margin-bottom: 4px;
    color: var(--sgc-text, #241f2c);
}

.sgc-memory-add {
    display: grid;
    gap: 10px;
    border: 1px solid rgba(36, 31, 44, 0.12);
    border-radius: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.78);
}

.sgc-memory-add[hidden] {
    display: none !important;
}

.sgc-memory-add label {
    font-weight: 850;
    color: var(--sgc-text, #241f2c);
}

.sgc-memory-add textarea,
.sgc-memory-add select {
    width: 100%;
    border: 1px solid rgba(36, 31, 44, 0.14);
    border-radius: 16px;
    background: #ffffff;
    color: var(--sgc-text, #241f2c);
    font: inherit;
    padding: 12px 14px;
}

.sgc-memory-add textarea:focus,
.sgc-memory-add select:focus {
    outline: 3px solid rgba(75, 43, 104, 0.14);
    border-color: rgba(75, 43, 104, 0.42);
}

.sgc-memory-add-actions {
    display: grid;
    grid-template-columns: minmax(160px, 220px) auto;
    gap: 10px;
    align-items: center;
}

.sgc-memory-list {
    display: grid;
    gap: 10px;
}

.sgc-memory-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: start;
    border: 1px solid rgba(36, 31, 44, 0.1);
    border-radius: 18px;
    padding: 14px;
    background: #ffffff;
}

.sgc-memory-item p {
    margin: 4px 0 0;
    color: var(--sgc-text, #241f2c);
    line-height: 1.45;
}

.sgc-memory-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.sgc-danger-zone {
    border-top: 1px solid rgba(36, 31, 44, 0.1);
    padding-top: 14px;
}

.sgc-danger-button {
    color: #7f2433 !important;
}

@media (max-width: 760px) {
    .sgc-memory-status-row,
    .sgc-memory-item {
        grid-template-columns: 1fr;
        display: grid;
    }

    .sgc-memory-add-actions {
        grid-template-columns: 1fr;
    }

    .sgc-memory-actions {
        justify-content: flex-start;
    }
}

/* Package 10 progress tracking */
.sgc-progress-grid-expanded {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sgc-progress-add-card,
.sgc-progress-list-card {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.sgc-progress-add-card label {
    font-weight: 850;
    color: var(--sgc-text, #241f2c);
}

.sgc-progress-add-card textarea {
    width: 100%;
    border: 1px solid rgba(36, 31, 44, 0.14);
    border-radius: 16px;
    background: #ffffff;
    color: var(--sgc-text, #241f2c);
    font: inherit;
    line-height: 1.45;
    padding: 12px 14px;
    resize: vertical;
}

.sgc-progress-add-card textarea:focus {
    outline: 3px solid rgba(75, 43, 104, 0.14);
    border-color: rgba(75, 43, 104, 0.42);
}

.sgc-progress-add-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sgc-progress-list {
    display: grid;
    gap: 10px;
}

.sgc-progress-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 14px;
    border: 1px solid rgba(36, 31, 44, 0.1);
    border-radius: 18px;
    padding: 14px;
    background: #ffffff;
}

.sgc-progress-item h4 {
    margin: 5px 0 0;
    color: var(--sgc-text, #241f2c);
    font-size: 16px;
    line-height: 1.25;
}

.sgc-progress-item p {
    margin: 7px 0 0;
    color: var(--sgc-muted, #665f70);
    line-height: 1.45;
}

.sgc-progress-item small {
    display: inline-block;
    margin-top: 7px;
    color: var(--sgc-muted, #665f70);
    font-size: 12px;
}

@media (max-width: 760px) {
    .sgc-progress-grid-expanded {
        grid-template-columns: 1fr 1fr;
    }

    .sgc-progress-item {
        grid-template-columns: 1fr;
    }

    .sgc-progress-add-actions {
        display: grid;
    }
}

/* Package 11: plan permissions and upgrade states */
.sgc-tool-card-locked {
    opacity: 0.82;
    position: relative;
}

.sgc-tool-card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.sgc-lock-pill,
.sgc-plan-card .sgc-lock-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 800;
    color: var(--sgc-purple, #4b2b68);
    background: rgba(215, 168, 79, 0.18);
    border: 1px solid rgba(215, 168, 79, 0.36);
    white-space: nowrap;
}

.sgc-upgrade-callout {
    margin-top: 18px;
    padding: 18px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: linear-gradient(135deg, rgba(75, 43, 104, 0.09), rgba(215, 168, 79, 0.13));
    border: 1px solid rgba(75, 43, 104, 0.14);
}

.sgc-upgrade-callout p {
    margin: 6px 0 0;
}

.sgc-clean-list {
    margin: 12px 0 16px;
    padding-left: 18px;
    color: var(--sgc-muted, #665f70);
}

.sgc-clean-list li {
    margin: 6px 0;
}

.sgc-plan-card strong {
    color: var(--sgc-purple, #4b2b68);
}

@media (max-width: 640px) {
    .sgc-upgrade-callout {
        align-items: stretch;
        flex-direction: column;
    }
}
