.sa-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.5rem 1rem 3rem;
}

.sa-page--tool {
    max-width: 1160px;
    padding-top: 1rem;
}

.sa-page--memory {
    --sa-warm-ink: #3a2a24;
    --sa-warm-text: #5c463c;
    --sa-warm-primary: #8d5a3b;
    --sa-warm-primary-dark: #6b3e26;
    --sa-warm-line: #ead8cc;
    --sa-warm-cream: #fffaf6;
    --sa-warm-panel: #fffdfb;
    max-width: min(1160px, calc(100% - clamp(2rem, 8vw, 8rem)));
    min-height: 35rem;
    padding-top: 1.8rem;
    color: var(--sa-warm-text);
}

.sa-memory-hero {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.25rem;
    min-height: 8.8rem;
    margin-bottom: 1.2rem;
    padding: 1.15rem 1.35rem;
    overflow: hidden;
    border: 1px solid var(--sa-warm-line);
    border-radius: 14px;
    background:
        linear-gradient(90deg, rgba(255, 253, 249, 0.98) 0%, rgba(255, 253, 249, 0.86) 58%, rgba(255, 243, 234, 0.76) 100%),
        url("../img/background.png") right center / min(24rem, 32vw) auto no-repeat;
    box-shadow: 0 16px 34px rgba(61, 42, 34, 0.07);
}

.sa-memory-hero__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.9rem;
    height: 4.9rem;
    border: 1px solid rgba(141, 90, 59, 0.22);
    border-radius: 16px;
    background: #fff3ea;
    color: var(--sa-warm-primary-dark);
    box-shadow: inset 0 0 0 0.45rem rgba(141, 90, 59, 0.06);
}

.sa-memory-hero__svg {
    width: 2.35rem;
    height: 2.35rem;
    stroke-width: 1.9;
}

.sa-memory-hero__copy {
    min-width: 0;
}

.sa-memory-hero h1 {
    margin: 0.05rem 0 0.25rem;
    color: var(--sa-warm-ink);
    font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    font-size: clamp(2.2rem, 3vw, 3.15rem);
    font-weight: 650;
    line-height: 1.02;
}

.sa-memory-hero p:not(.sa-eyebrow) {
    margin: 0;
    color: var(--sa-warm-text);
    font-size: 1.08rem;
    font-weight: 750;
    line-height: 1.45;
}

.sa-memory-card {
    border-color: var(--sa-warm-line);
    background: var(--sa-warm-panel);
    box-shadow: 0 18px 42px rgba(61, 42, 34, 0.075);
}

.sa-memory-card__head {
    padding: 1.25rem 1.35rem 1.05rem;
    border-bottom: 1px solid rgba(234, 216, 204, 0.9);
    background: rgba(255, 250, 246, 0.78);
}

.sa-memory-card__head h2 {
    margin: 0.18rem 0 0;
    color: var(--sa-warm-ink);
    font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    font-size: clamp(2.6rem, 3.38vw, 3.315rem);
    font-weight: 650;
}

.sa-memory-card__head .sa-panel-kicker {
    font-size: 1.092rem;
}

.sa-memory-card__head p {
    max-width: 760px;
    margin: 0.35rem 0 0;
    color: var(--sa-warm-text);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.45;
}

.sa-page--memory .sa-form {
    padding: 1.25rem 1.35rem 1.35rem;
}

.sa-page--memory .sa-form label {
    color: var(--sa-warm-ink);
    font-size: 1.3rem;
    font-weight: 900;
}

.sa-page--memory .sa-form textarea {
    min-height: 9.2rem;
    margin-top: 0.45rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--sa-warm-line);
    border-radius: 10px;
    background: #fffdf9;
    color: var(--sa-warm-ink);
    font-size: 1.339rem;
    font-weight: 650;
    line-height: 1.5;
    box-shadow: inset 0 1px 0 rgba(61, 42, 34, 0.02);
}

.sa-page--memory .sa-form textarea:focus {
    border-color: rgba(141, 90, 59, 0.62);
    box-shadow: 0 0 0 3px rgba(141, 90, 59, 0.08);
}

.sa-page--memory .sa-memory {
    display: grid;
    gap: 0.35rem;
    margin: 1.15rem 1.35rem 0;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(76, 125, 86, 0.22);
    border-radius: 10px;
    background: #f2f7ef;
    color: #425f45;
}

.sa-page--memory .sa-memory span {
    color: #3f734b;
    font-size: 1.014rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.sa-page--memory .sa-memory p {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.45;
}

.sa-memory-actions {
    margin-top: 1rem;
}

.sa-memory-actions .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-width: 11.5rem;
    min-height: 3.5rem;
    margin: 0;
    border: 1px solid var(--sa-warm-primary);
    border-radius: 8px;
    background: var(--sa-warm-primary);
    color: #fffdf9;
    font-size: 1.235rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 12px 24px rgba(141, 90, 59, 0.18);
}

.sa-memory-actions .button:hover,
.sa-memory-actions .button:focus {
    border-color: var(--sa-warm-primary-dark);
    background: var(--sa-warm-primary-dark);
    color: #fffdf9;
}

.sa-memory-actions .button-outline {
    background: #fffdf9;
    color: var(--sa-warm-primary-dark);
    box-shadow: none;
}

.sa-memory-actions .button-outline:hover,
.sa-memory-actions .button-outline:focus {
    background: #fff3ea;
    color: var(--sa-warm-primary-dark);
}

.sa-page--memory .sa-memory-card .sa-result-meta {
    font-size: 1.118rem;
}

.sa-page--memory .sa-memory-card .sa-result-body {
    font-size: 1.3rem;
}

.sa-action-icon {
    width: 1.43rem;
    height: 1.43rem;
    stroke-width: 2.2;
}

.sa-page--course-assistant {
    --sa-warm-ink: #3d2a22;
    --sa-warm-text: #5c463c;
    --sa-warm-primary: #8d5a3b;
    --sa-warm-primary-dark: #6b3e26;
    --sa-warm-line: #ead8cc;
    --sa-warm-cream: #fffaf6;
    --sa-warm-soft: #f7efe8;
    --sa-warm-panel: #fffdfb;
    position: relative;
    padding-top: 1.45rem;
    color: var(--sa-warm-text);
}

.sa-page--course-assistant::before,
.sa-page--course-assistant::after {
    content: "";
    position: fixed;
    z-index: -1;
    width: 16rem;
    height: 26rem;
    pointer-events: none;
    opacity: 0.2;
    background:
        radial-gradient(ellipse at 45% 18%, rgba(173, 106, 70, 0.22) 0 8%, transparent 9%),
        linear-gradient(32deg, transparent 45%, rgba(173, 106, 70, 0.32) 46% 48%, transparent 49%);
    filter: blur(0.2px);
}

.sa-page--course-assistant::before {
    right: 0.5rem;
    top: 14rem;
    transform: rotate(-8deg);
}

.sa-page--course-assistant::after {
    left: -4rem;
    bottom: 0;
    transform: rotate(172deg);
}

html.sa-hide-debug-ui iframe[src*="debug-kit"],
html.sa-hide-debug-ui #debug-kit-toolbar,
html.sa-hide-debug-ui .debug-kit-toolbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
}

.sa-course-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(7rem, 9rem);
    align-items: center;
    gap: 0.9rem;
    min-height: 5.8rem;
    margin: 0 0 1rem;
    padding: 0.75rem 0.9rem 0.75rem 1.05rem;
    border: 1px solid var(--sa-warm-line);
    border-radius: 14px;
    background: rgba(255, 253, 249, 0.96);
    box-shadow: 0 14px 34px rgba(61, 42, 34, 0.07);
    overflow: hidden;
}

.sa-course-hero h1 {
    margin: 0.08rem 0 0.28rem;
    color: #3a2a24;
    font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    font-size: clamp(2.05rem, 3.1vw, 2.65rem);
    font-weight: 600;
    line-height: 1.02;
}

.sa-course-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--sa-warm-text);
    font-size: 0.98rem;
    font-weight: 750;
    line-height: 1.38;
}

.sa-course-hero__image-wrap {
    align-self: stretch;
    min-height: 5.2rem;
    overflow: hidden;
    border-radius: 12px;
}

.sa-course-hero__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.sa-course-hero__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 4.8rem;
    height: 4.8rem;
    border: 1px solid rgba(141, 90, 59, 0.28);
    border-radius: 50%;
    background: #fff3ea;
    color: var(--sa-warm-primary-dark);
    box-shadow: inset 0 0 0 0.48rem rgba(141, 90, 59, 0.08);
}

.sa-course-hero__badge span {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.sa-page--tool .sa-panel {
    border-color: #c0d9da;
    background: #fffdfb;
}

.sa-page--course-assistant.sa-page--tool .sa-panel,
.sa-page--course-assistant .sa-panel.is-active {
    border-color: var(--sa-warm-line);
    background: var(--sa-warm-panel);
    box-shadow: 0 16px 34px rgba(61, 42, 34, 0.07);
}

.sa-page--course-assistant .sa-tool-shell {
    grid-template-columns: minmax(0, 1fr);
}

.sa-assistant-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(24rem, 28rem);
    gap: 1.2rem;
    align-items: start;
}

.sa-assistant-layout--single {
    grid-template-columns: minmax(0, 1fr);
}

.sa-assistant-main {
    min-width: 0;
}

.sa-assistant-sidebar {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.sa-tool-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18.5rem;
    align-items: start;
    gap: 1.15rem;
}

.sa-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid #ead8cc;
}

.sa-eyebrow,
.sa-panel-kicker {
    margin: 0;
    color: #8d5a3b;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sa-head h1 {
    margin: 0.12rem 0 0;
    color: #3a2a24;
    font-size: 3.5rem;
    line-height: 1.05;
}

.sa-status {
    display: inline-flex;
    align-items: center;
    min-height: 2.35rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid #ead8cc;
    border-radius: 999px;
    background: #ffffff;
    color: #3a2a24;
    font-weight: 800;
}

.sa-status--live {
    border-color: #8fc7b2;
    background: #eef9f4;
    color: #22634e;
}

.sa-status--fallback {
    border-color: #e4c081;
    background: #fff7e6;
    color: #7b5516;
}

.sa-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.sa-panel {
    min-width: 0;
    padding: 1rem;
    border: 1px solid #ead8cc;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(61, 42, 34, 0.06);
}

.sa-panel--tool {
    overflow: hidden;
    padding: 0;
    border-radius: 14px;
}

.sa-panel.is-active {
    border-color: #ead8cc;
    box-shadow: 0 16px 34px rgba(61, 42, 34, 0.08);
}

.sa-assistant-intro {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
    padding: 1.2rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(141, 90, 59, 0.18);
    background:
        linear-gradient(135deg, rgba(255, 243, 234, 0.98) 0%, rgba(255, 250, 246, 0.98) 100%);
}

.sa-chat-header {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--sa-warm-line, rgba(141, 90, 59, 0.18));
    background: #fffdfb;
}

.sa-chat-header h2 {
    margin: 0.1rem 0 0;
    color: var(--sa-warm-ink, #3a2a24);
    font-size: 1.45rem;
    line-height: 1.2;
}

.sa-ai-avatar,
.sa-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-weight: 900;
}

.sa-ai-avatar {
    width: 3.35rem;
    height: 3.35rem;
    border: 1px solid rgba(141, 90, 59, 0.22);
    border-radius: 50%;
    background: #8d5a3b;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(61, 42, 34, 0.16);
}

.sa-page--course-assistant .sa-ai-avatar {
    border-color: rgba(141, 90, 59, 0.28);
    background: var(--sa-warm-primary-dark);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(141, 90, 59, 0.18);
}

.sa-user-avatar {
    min-width: 2.8rem;
    min-height: 2rem;
    padding: 0 0.58rem;
    border: 1px solid rgba(141, 90, 59, 0.22);
    border-radius: 8px;
    background: #fff3ea;
    color: #6b3e26;
    font-size: 0.86rem;
}

.sa-page--course-assistant .sa-user-avatar {
    border-color: rgba(141, 90, 59, 0.25);
    background: #fff3ea;
    color: var(--sa-warm-primary-dark);
}

.sa-panel-head {
    margin-bottom: 0;
}

.sa-panel h2 {
    margin: 0.15rem 0 0;
    color: #3a2a24;
    font-size: 2rem;
    line-height: 1.2;
}

.sa-page--course-assistant .sa-chat-header h2 {
    margin: 0.1rem 0 0;
    color: var(--sa-warm-ink);
    font-size: 1.45rem;
}

.sa-panel-head p {
    max-width: 760px;
    margin: 0.32rem 0 0;
    color: #516168;
    font-size: 1.08rem;
    line-height: 1.45;
}

.sa-page--course-assistant .sa-eyebrow,
.sa-page--course-assistant .sa-panel-kicker,
.sa-page--course-assistant .sa-booking-option dt,
.sa-page--course-assistant .sa-structured-row h3,
.sa-page--course-assistant .sa-saved-preference span,
.sa-page--course-assistant .sa-preference-summary span {
    color: var(--sa-warm-primary-dark);
}

.sa-side-stack {
    display: grid;
    gap: 1rem;
}

.sa-preference-panel {
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid #ead8cc;
    border-radius: 8px;
    background: #fffaf6;
    box-shadow: 0 8px 22px rgba(61, 42, 34, 0.06);
}

.sa-preference-panel h2 {
    margin: -0.5rem 0 0;
    color: #3a2a24;
    font-size: 1.25rem;
    line-height: 1.2;
}

.sa-preference-summary {
    display: grid;
    gap: 0.25rem;
    padding: 0.75rem;
    border-left: 4px solid #8d5a3b;
    border-radius: 8px;
    background: #fff3ea;
    color: #3a2a24;
}

.sa-preference-summary span {
    color: #8d5a3b;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sa-preference-summary p,
.sa-preference-empty {
    margin: 0;
    color: #5c463c;
    line-height: 1.45;
}

.sa-preference-button {
    width: 100%;
    margin: 0;
    text-align: center;
}

.sa-side-card {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
    border: 1px solid #ead8cc;
    border-radius: 8px;
    background: #fffaf6;
    box-shadow: 0 8px 22px rgba(61, 42, 34, 0.06);
}

.sa-shortcut-list {
    display: grid;
    gap: 0.45rem;
}

.sa-shortcut-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 2.8rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(141, 90, 59, 0.18);
    border-radius: 8px;
    background: #ffffff;
    color: #3a2a24;
    font-weight: 850;
    text-decoration: none;
}

.sa-shortcut-list a::after {
    content: "";
    width: 0.48rem;
    height: 0.48rem;
    border-right: 2px solid #8d5a3b;
    border-bottom: 2px solid #8d5a3b;
    transform: rotate(-45deg);
}

.sa-shortcut-list a:hover,
.sa-shortcut-list a:focus {
    border-color: rgba(141, 90, 59, 0.34);
    background: #fff3ea;
    color: #6b3e26;
    text-decoration: none;
}

.sa-page--course-assistant .sa-preference-panel,
.sa-page--course-assistant .sa-side-card {
    border-color: var(--sa-warm-line);
    background: var(--sa-warm-cream);
    box-shadow: 0 8px 22px rgba(61, 42, 34, 0.07);
}

.sa-page--course-assistant .sa-preference-summary {
    border-left-color: var(--sa-warm-primary);
    background: #fff3ea;
}

.sa-page--course-assistant .sa-preference-button {
    border-color: var(--sa-warm-primary);
    color: var(--sa-warm-primary-dark);
}

.sa-page--course-assistant .sa-shortcut-list a {
    border-color: rgba(141, 90, 59, 0.2);
    color: var(--sa-warm-ink);
}

.sa-page--course-assistant .sa-shortcut-list a::after {
    border-color: var(--sa-warm-primary);
}

.sa-page--course-assistant .sa-shortcut-list a:hover,
.sa-page--course-assistant .sa-shortcut-list a:focus {
    border-color: rgba(141, 90, 59, 0.42);
    background: #fff3ea;
    color: var(--sa-warm-primary-dark);
}

.sa-assistant-support-card {
    position: relative;
    display: block;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--sa-warm-line);
    border-radius: 8px;
    background: var(--sa-warm-cream);
    box-shadow: 0 10px 24px rgba(61, 42, 34, 0.07);
}

.sa-assistant-support-card__content {
    display: grid;
    gap: 0.7rem;
    padding-right: 2.4rem;
    min-width: 0;
}

.sa-assistant-support-card h2 {
    margin: 0;
    color: var(--sa-warm-ink);
    font-size: 1.25rem;
    line-height: 1.2;
}

.sa-assistant-support-card__summary {
    margin: 0;
    color: var(--sa-warm-text);
    font-size: 1.02rem;
    line-height: 1.5;
}

.sa-assistant-support-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.sa-assistant-support-card__icon {
    position: absolute;
    top: 1.2rem;
    right: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--sa-warm-ink);
    border-radius: 4px;
    box-shadow: 0.36rem -0.36rem 0 -0.12rem var(--sa-warm-cream), 0.36rem -0.36rem 0 0 var(--sa-warm-ink);
}

.sa-helper-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.85rem;
    align-items: center;
}

.sa-helper-links span {
    width: 100%;
    color: var(--sa-warm-primary-dark);
    font-size: 0.86rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sa-helper-links a {
    color: var(--sa-warm-primary-dark);
    font-weight: 850;
    text-decoration: none;
}

.sa-helper-links a:hover,
.sa-helper-links a:focus {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.sa-form {
    margin: 0;
    padding: 1rem 1.25rem 1.25rem;
}

.sa-chat-form {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 0.8rem 1.25rem;
    border-top: 1px solid rgba(234, 216, 204, 0.9);
    background: rgba(255, 250, 246, 0.98);
    box-shadow: 0 -10px 22px rgba(61, 42, 34, 0.06);
}

.sa-form label {
    color: #5c463c;
    font-weight: 800;
}

.sa-form textarea {
    min-height: 9rem;
    border-color: #cbd5dc;
    border-radius: 8px;
    resize: vertical;
    background: #ffffff;
    color: #3a2a24;
    font-size: 1.12rem;
    line-height: 1.5;
}

.sa-form textarea:focus {
    border-color: #8d5a3b;
}

.sa-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.sa-prompt-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    margin-top: 0.8rem;
}

.sa-prompt-chip {
    display: grid;
    gap: 0.22rem;
    min-height: 4.9rem;
    padding: 0.78rem;
    border: 1px solid rgba(141, 90, 59, 0.2);
    border-radius: 8px;
    background: #fffaf6;
    color: #3a2a24;
    font: inherit;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(61, 42, 34, 0.045);
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.sa-prompt-chip span {
    color: #8d5a3b;
    font-size: 0.86rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sa-prompt-chip small {
    color: #5c463c;
    font-size: 0.98rem;
    font-weight: 750;
    line-height: 1.35;
    text-transform: none;
    white-space: normal;
}

.sa-prompt-chip:hover,
.sa-prompt-chip:focus {
    border-color: rgba(141, 90, 59, 0.42);
    background: #fff3ea;
    transform: translateY(-1px);
}

.sa-prompt-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.78rem;
}

.sa-prompt-pill {
    display: inline-flex;
    align-items: center;
    min-height: 2.35rem;
    padding: 0.36rem 0.78rem;
    border: 1px solid rgba(141, 90, 59, 0.25);
    border-radius: 999px;
    background: #fffaf6;
    color: var(--sa-warm-primary-dark, #6b3e26);
    font-size: 0.9rem;
    font-weight: 850;
    line-height: 1.1;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.sa-prompt-pill:hover,
.sa-prompt-pill:focus {
    border-color: rgba(141, 90, 59, 0.45);
    background: #fff3ea;
    color: var(--sa-warm-primary-dark, #6b3e26);
}

.sa-sidebar-card {
    display: grid;
    gap: 0.85rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--sa-warm-line);
    border-radius: 12px;
    background: rgba(255, 253, 249, 0.96);
    box-shadow: 0 12px 28px rgba(61, 42, 34, 0.055);
}

.sa-sidebar-card__title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.sa-sidebar-card__icon,
.sa-sidebar-link-icon,
.sa-help-list__icon {
    flex: 0 0 auto;
    width: 1.35rem;
    height: 1.35rem;
    color: var(--sa-warm-primary-dark);
    stroke-width: 2;
}

.sa-help-list > li:first-child .sa-help-list__icon {
    width: 2.7rem;
    height: 2.7rem;
}

.sa-sidebar-card h2 {
    margin: 0;
    color: var(--sa-warm-ink);
    font-size: 0.92rem;
    font-weight: 900;
    letter-spacing: 0.07em;
    line-height: 1.2;
    text-transform: uppercase;
}

.sa-sidebar-card p {
    margin: 0;
    color: var(--sa-warm-text);
    font-size: 0.96rem;
    line-height: 1.45;
}

.sa-preference-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.sa-preference-tags span {
    display: inline-flex;
    align-items: center;
    min-height: 2.15rem;
    padding: 0.32rem 0.72rem;
    border-radius: 999px;
    background: #fff1e7;
    color: var(--sa-warm-primary-dark);
    font-size: 0.86rem;
    font-weight: 850;
}

.sa-preference-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 3.55rem;
    padding: 0.65rem 1rem;
    border: 1px solid var(--sa-warm-primary);
    border-radius: 8px;
    background: #fffdfb;
    color: var(--sa-warm-primary-dark);
    font-weight: 900;
    text-decoration: none;
}

.sa-preference-button:hover,
.sa-preference-button:focus {
    background: #fff3ea;
    color: var(--sa-warm-primary-dark);
    text-decoration: none;
}

.sa-sidebar-list {
    display: grid;
}

.sa-sidebar-list a {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 3.35rem;
    padding: 0.55rem 1.6rem 0.55rem 0;
    border-bottom: 1px solid rgba(234, 216, 204, 0.82);
    color: var(--sa-warm-ink);
    font-size: 1rem;
    font-weight: 850;
    text-decoration: none;
}

.sa-sidebar-list a::after {
    content: "";
    position: absolute;
    right: 0.25rem;
    width: 0.48rem;
    height: 0.48rem;
    border-right: 2px solid #9a7666;
    border-bottom: 2px solid #9a7666;
    transform: rotate(-45deg);
}

.sa-sidebar-list a:hover,
.sa-sidebar-list a:focus {
    color: var(--sa-warm-primary-dark);
    text-decoration: none;
}

.sa-help-list {
    display: grid;
    gap: 0.72rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sa-help-list li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    color: var(--sa-warm-text);
    font-size: 0.96rem;
    font-weight: 750;
    line-height: 1.35;
}

.sa-chat-window {
    display: grid;
    align-content: start;
    gap: 1.25rem;
    min-height: 37rem;
    max-height: 52rem;
    overflow-y: auto;
    padding: 1.35rem 1.6rem;
    background: rgba(255, 253, 249, 0.94);
}

.sa-message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    min-width: 0;
}

.sa-message--user {
    justify-content: flex-end;
}

.sa-message-card {
    max-width: min(100%, 46rem);
    padding: 1rem 1.1rem;
    border: 1px solid rgba(141, 90, 59, 0.18);
    border-radius: 10px;
    background: #ffffff;
    color: var(--sa-warm-text, #5c463c);
    box-shadow: 0 5px 16px rgba(61, 42, 34, 0.06);
}

.sa-chat-divider {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: #a99184;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

.sa-chat-divider::before,
.sa-chat-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(234, 216, 204, 0.9);
}

.sa-message--user .sa-message-card {
    border-color: var(--sa-warm-primary, #8d5a3b);
    background: var(--sa-warm-primary, #8d5a3b);
    color: #ffffff;
    font-weight: 750;
}

.sa-message-card p {
    margin: 0;
    line-height: 1.5;
}

.sa-message-card--result {
    width: min(100%, 50rem);
    padding: 0;
    overflow: hidden;
}

.sa-message-card--result .sa-result {
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.sa-page--course-assistant .sa-result {
    border-color: var(--sa-warm-line);
    background: #fffdfb;
}

.sa-page--course-assistant .sa-result--live,
.sa-page--course-assistant .sa-result--fallback {
    border-color: var(--sa-warm-line);
    background: #fffdfb;
}

.sa-page--course-assistant .sa-result-meta {
    background: #fff3ea;
    color: var(--sa-warm-primary-dark);
}

.sa-page--course-assistant .sa-match-note {
    background: #fff8f1;
    color: var(--sa-warm-primary-dark);
}

.sa-chat-input {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.6rem;
    align-items: center;
    padding: 0.42rem 0.42rem 0.42rem 1rem;
    border: 1px solid rgba(141, 90, 59, 0.28);
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(61, 42, 34, 0.08);
}

.sa-chat-input__icon {
    width: 1.35rem;
    height: 1.35rem;
    color: var(--sa-warm-primary);
    stroke-width: 2.1;
}

.sa-chat-input .input {
    margin: 0;
}

.sa-chat-input input {
    min-height: 3.25rem;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--sa-warm-ink, #3a2a24);
    font-size: 1.08rem;
    box-shadow: none;
}

.sa-chat-input input:focus {
    border: 0;
    box-shadow: none;
}

.sa-chat-input .button {
    min-width: 8.2rem;
    min-height: 3.25rem;
    margin: 0;
    border-color: var(--sa-warm-primary, #8d5a3b);
    border-radius: 999px;
    background: var(--sa-warm-primary, #8d5a3b);
    color: #ffffff;
    font-size: 0.98rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    box-shadow: 0 8px 18px rgba(141, 90, 59, 0.28);
}

.sa-chat-input .button:hover,
.sa-chat-input .button:focus {
    border-color: var(--sa-warm-primary-dark, #6b3e26);
    background: var(--sa-warm-primary-dark, #6b3e26);
}

.sa-result {
    margin-top: 1rem;
    overflow: hidden;
    border: 1px solid #ead8cc;
    border-radius: 8px;
    background: #fffaf6;
}

.sa-result--live {
    border-color: #d8b9a5;
    background: #fffaf6;
}

.sa-result--fallback {
    border-color: #e4c081;
    background: #fffaf0;
}

.sa-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(141, 90, 59, 0.12);
    color: #5c463c;
    font-size: 0.86rem;
    font-weight: 850;
}

.sa-result-body {
    padding: 0.75rem;
    color: #3a2a24;
}

.sa-structured {
    display: grid;
    gap: 0.7rem;
    padding: 0.75rem;
}

.sa-structured-row {
    padding-bottom: 0.7rem;
    border-bottom: 1px solid rgba(141, 90, 59, 0.12);
}

.sa-structured-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.sa-structured-row h3 {
    margin: 0 0 0.25rem;
    color: #8d5a3b;
    font-size: 0.92rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sa-structured-value {
    color: #3a2a24;
}

.sa-result-body p,
.sa-structured-value p,
.sa-memory p {
    margin-bottom: 0.7rem;
    line-height: 1.55;
}

.sa-result-body p:last-child,
.sa-structured-value p:last-child,
.sa-memory p:last-child {
    margin-bottom: 0;
}

.sa-memory {
    margin-bottom: 0.85rem;
    padding: 0.75rem;
    border: 1px solid #ead8cc;
    border-radius: 8px;
    background: #fffaf6;
    color: #3a2a24;
}

.sa-saved-preference {
    display: grid;
    gap: 0.2rem;
    margin-bottom: 0.9rem;
    padding: 0.72rem 0.85rem;
    border-left: 4px solid #8d5a3b;
    border-radius: 8px;
    background: #fff3ea;
    color: #3a2a24;
}

.sa-saved-preference span {
    color: #8d5a3b;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sa-saved-preference p {
    margin: 0;
    line-height: 1.45;
}

.sa-locked {
    padding: 0.85rem;
    border: 1px solid #ead8cc;
    border-radius: 8px;
    background: #fffaf6;
    color: #5c463c;
}

.sa-locked strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #3a2a24;
    font-weight: 850;
}

.sa-locked p {
    margin: 0;
    line-height: 1.5;
}

.sa-empty-match {
    padding: 0.85rem;
    color: #7b5516;
    font-weight: 850;
}

.sa-match-note {
    padding: 0.8rem 0.85rem;
    border-bottom: 1px solid rgba(141, 90, 59, 0.12);
    background: #fff3ea;
    color: #6b3e26;
    font-weight: 800;
}

.sa-match-note--warning {
    background: #fff7e6;
    color: #7b5516;
}

.sa-booking-options {
    display: grid;
    gap: 0.8rem;
    padding: 0.75rem;
}

.sa-booking-option {
    padding: 0.8rem;
    border: 1px solid rgba(141, 90, 59, 0.18);
    border-radius: 8px;
    background: #ffffff;
}

.sa-booking-option h3 {
    margin: 0 0 0.55rem;
    color: #3a2a24;
    font-size: 1.25rem;
}

.sa-booking-option dl {
    display: grid;
    gap: 0.45rem;
    margin: 0 0 0.75rem;
}

.sa-booking-option dl div {
    display: grid;
    grid-template-columns: minmax(7rem, 0.32fr) minmax(0, 1fr);
    gap: 0.65rem;
}

.sa-booking-option dt {
    color: #8d5a3b;
    font-size: 0.88rem;
    font-weight: 850;
}

.sa-booking-option dd {
    margin: 0;
    color: #3a2a24;
}

.sa-show-more-wrap {
    display: flex;
    justify-content: center;
    padding: 0 0.75rem 0.9rem;
}

.sa-show-more-button {
    min-width: 14rem;
}

@media (max-width: 860px) {
    .sa-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .sa-head h1 {
        font-size: 2.5rem;
    }

    .sa-grid {
        grid-template-columns: 1fr;
    }

    .sa-tool-shell {
        grid-template-columns: 1fr;
    }

    .sa-assistant-layout {
        grid-template-columns: 1fr;
    }

    .sa-course-hero {
        align-items: flex-start;
        grid-template-columns: 1fr;
    }

    .sa-page--memory {
        max-width: min(100% - 2rem, 720px);
    }

    .sa-memory-hero {
        align-items: flex-start;
        grid-template-columns: auto minmax(0, 1fr);
        background:
            linear-gradient(90deg, rgba(255, 253, 249, 0.98) 0%, rgba(255, 253, 249, 0.9) 100%),
            url("../img/background.png") right bottom / 17rem auto no-repeat;
    }

    .sa-memory-hero .sa-status {
        grid-column: 1 / -1;
        justify-self: flex-start;
    }

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

    .sa-booking-option dl div {
        grid-template-columns: 1fr;
        gap: 0.12rem;
    }
}

@media (max-width: 560px) {
    .sa-page--memory {
        max-width: calc(100% - 1rem);
        padding-top: 1rem;
    }

    .sa-memory-hero {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        padding: 1rem;
    }

    .sa-memory-hero__icon {
        width: 4rem;
        height: 4rem;
    }

    .sa-memory-hero h1 {
        font-size: 2.45rem;
    }

    .sa-memory-card__head,
    .sa-page--memory .sa-form {
        padding-inline: 1rem;
    }

    .sa-memory-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .sa-memory-actions .button {
        width: 100%;
    }

    .sa-course-hero {
        padding: 1.2rem;
    }

    .sa-course-hero h1 {
        font-size: 2.25rem;
    }

    .sa-course-hero__image-wrap {
        min-height: 8rem;
    }

    .sa-assistant-intro {
        grid-template-columns: 1fr;
    }

    .sa-prompt-grid {
        grid-template-columns: 1fr;
    }

    .sa-chat-input {
        grid-template-columns: 1fr;
        padding: 0.7rem;
        border-radius: 16px;
    }

    .sa-chat-input__icon {
        display: none;
    }

    .sa-chat-input .button {
        width: 100%;
    }

    .sa-assistant-support-card {
        display: block;
    }

    .sa-assistant-support-card__content {
        padding-right: 0;
    }

    .sa-assistant-support-card__icon {
        display: none;
    }
}
