/* v1.0.16: guided setup, learning and first-use polish. No external assets. */
:root { --ux-muted: #596781; --ux-accent: #6100ec; --ux-tint: #f5f1ff; }
.app-body .small, .app-body small { font-size: 13px; }
.app-body .muted { color: var(--ux-muted); }
.app-body .sidebar { overflow-y: auto; }
.app-body .nav-item { min-height: 43px; }
.ux-global-help { min-height: 40px; white-space: nowrap; }
.setup-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; align-items: start; max-width: 1130px; }
.setup-layout > aside { position: sticky; top: 24px; }
.setup-steps { display: flex; flex-direction: column; gap: 9px; }
.setup-step { display: flex; text-align: left; align-items: center; gap: 12px; padding: 15px 12px; border: 1px solid transparent; border-radius: 13px; color: var(--ux-muted); background: transparent; font-weight: 600; min-height: 64px; }
.setup-step small { display: block; margin-top: 2px; font-weight: 400; font-size: 12px; }
.setup-step.current { background: #fff; border-color: #d7c8ff; color: var(--ux-accent); box-shadow: 0 5px 20px #3c178b07; }
.setup-step-number { display: grid; place-items: center; background: #eaedf5; color: #62718c; height: 32px; width: 32px; flex-shrink: 0; border-radius: 50%; }
.setup-step.current .setup-step-number { background: var(--ux-accent); color: #fff; }
.setup-step.complete:not(.current) .setup-step-number { color: #167560; background: #e4f5ef; }
.setup-progress-label { padding: 20px 12px; display: grid; gap: 8px; color: var(--ux-muted); font-size: 13px; }
.setup-progress-label progress { width: 100%; height: 5px; border: 0; border-radius: 10px; overflow: hidden; accent-color: var(--ux-accent); }
.setup-progress-label progress::-webkit-progress-bar { background: #e3e5f0; }
.setup-progress-label progress::-webkit-progress-value { background: var(--ux-accent); }
.setup-progress-label progress::-moz-progress-bar { background: var(--ux-accent); }
.setup-content { padding: 28px; margin: 0; min-width: 0; }
.setup-lead { font-weight: 650; font-size: 20px; color: #202e4c; margin: 0 0 10px; letter-spacing: -.35px; }
.setup-content > p:not(.setup-lead) { max-width: 72ch; color: var(--ux-muted); }
.setup-content label { color: #35435e; }
.setup-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.setup-actions .button:last-child { margin-left: auto; }
.setup-actions .button { min-height: 44px; }
.setup-provider-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; margin: 22px 0; }
.setup-provider { padding: 22px; border: 1px solid #e4e7f2; border-radius: 14px; display: flex; flex-direction: column; align-items: flex-start; }
.setup-provider h3 { font-size: 16px; margin: 15px 0 7px; }
.setup-provider p { font-size: 13px; color: var(--ux-muted); }
.setup-provider > .button { margin-top: auto; text-align: center; white-space: normal; width: 100%; min-height: 46px; }
.setup-warning { color: #905620 !important; font-size: 13px; margin: 12px 0 0; }
.setup-mailbox { display: flex; gap: 13px; align-items: flex-start; flex-wrap: wrap; padding: 18px; border: 1px solid #e2e6f1; border-radius: 14px; margin: 18px 0 12px; }
.setup-mailbox.selected { border-color: #cbb8f6; background: #fcfaff; }
.setup-mailbox .grow { min-width: 150px; overflow-wrap: anywhere; }
.setup-mailbox small { display: block; color: var(--ux-muted); margin-top: 4px; }
.setup-mailbox .actions { flex-basis: 100%; justify-content: flex-end; flex-wrap: wrap; }
.setup-mailbox .actions button { min-height: 42px; }
.setup-ready, .setup-readiness-row { display: flex; gap: 12px; padding: 14px 0; align-items: flex-start; }
.setup-ready > .icon { color: #138366; flex-shrink: 0; margin-top: 3px; }
.setup-ready p, .setup-readiness-row p { color: var(--ux-muted); font-size: 13px; margin: 5px 0 0; line-height: 1.65; }
.setup-readiness-row + .setup-readiness-row { border-top: 1px solid var(--line); }
.setup-readiness-row .status-circle { flex-shrink: 0; width: 12px; height: 12px; margin-top: 6px; background: #fff7e8; border: 1px solid #d3aa6d; }
.setup-readiness-row .button { flex-shrink: 0; }
.setup-content .form-grid { margin-top: 22px; }
.setup-sport-status { display: flex; flex-wrap: wrap; gap: 10px; margin: 15px 0 22px; align-items: center; }
.setup-correction { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; }
.setup-sender { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin: 18px 0; }
.setup-sender strong { overflow-wrap: anywhere; }
.setup-done > .circle-icon { margin-bottom: 20px; }
.setup-done h2 { font-size: 23px; }
.setup-done .actions { flex-wrap: wrap; }
.ux-details { border-top: 1px solid var(--line); padding: 17px 0; margin: 6px 0 0; }
.ux-details > summary { color: #394766; font-weight: 600; cursor: pointer; min-height: 27px; line-height: 1.7; list-style-position: inside; }
.ux-details > summary::marker { color: #8b6ace; font-size: 11px; }
.ux-details > summary:focus-visible { outline: 3px solid #a67ef3; outline-offset: 6px; border-radius: 3px; }
.ux-details[open] > summary { margin-bottom: 18px; color: #571ec3; }
.ux-details label { margin-bottom: 16px; }
.ux-details > p:last-child { margin-bottom: 0; }
.ux-details p { color: var(--ux-muted); }
.ux-details .button { min-height: 38px; }
.setup-welcome { max-width: 1020px; padding: 38px 42px; background: linear-gradient(130deg, #fff 60%, #f4f1ff); border: 1px solid #e1def5; border-radius: 22px; }
.setup-welcome h1 { font-size: clamp(30px, 3.2vw, 43px); line-height: 1.14; max-width: 650px; margin: 17px 0 22px; }
.setup-intro { font-size: 16px; max-width: 620px; line-height: 1.8; color: var(--ux-muted); }
.setup-welcome > .actions { margin: 27px 0 34px; }
.setup-welcome-steps .setup-steps { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.setup-welcome-steps .setup-step { flex-direction: column; align-items: flex-start; padding: 18px; background: #fff; border-color: #ebe6f6; }
.setup-welcome-steps .setup-step.current { color: #35425f; box-shadow: none; }
.setup-promise { margin-top: 24px; display: flex; align-items: center; gap: 12px; color: var(--ux-muted); font-size: 13px; }
.setup-promise .icon { flex-shrink: 0; color: #8755d5; }
.ux-home-main { display: flex; gap: 36px; align-items: center; justify-content: space-between; padding: 30px 34px; background: linear-gradient(120deg, #fff, #f8f5ff); border: 1px solid #e4dff6; border-radius: 20px; margin-bottom: 24px; }
.ux-home-main h1 { font-size: 30px; max-width: 650px; }
.ux-home-main p { max-width: 62ch; color: var(--ux-muted); margin-bottom: 22px; }
.ux-home-main .actions { flex-wrap: wrap; }
.ux-home-progress { min-width: 180px; display: grid; justify-items: center; gap: 7px; border-left: 1px solid #e6e0f4; padding: 12px 0 12px 30px; text-align: center; }
.ux-home-progress > strong { font-size: 19px; }
.ux-home-progress > span:not(.circle-icon) { font-size: 12px; color: var(--ux-muted); }
.ux-home-progress .circle-icon { margin-bottom: 8px; }
.ux-home-stats .stat-card { padding: 18px 20px; }
.ux-home-stats .stat-value { font-size: 30px; margin: 6px 0 0; }
.ux-home-panels { align-items: start; }
.ux-home-panels .panel { height: auto; }
.ux-empty-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 0; }
.ux-empty-row .grow { min-width: 175px; }
.ux-empty-row p { margin: 5px 0 0; color: var(--ux-muted); font-size: 13px; max-width: 48ch; }
.ux-home-panels .panel-heading .button { white-space: nowrap; }
.ux-email-preview { border: 1px solid #e1e6f0; border-radius: 13px; background: #fbfcff; margin: 18px 0 24px; padding: 22px; overflow-wrap: anywhere; }
.ux-email-preview header { border-bottom: 1px solid #e3e8f1; padding-bottom: 15px; margin-bottom: 17px; }
.ux-email-preview h3 { font-size: 15px; line-height: 1.6; margin: 0; }
.ux-email-preview pre { font: inherit; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; color: #35425a; }
.ux-email-preview > p { margin: 20px 0 0; }
.writing-preview { background: #fff; border-left: 3px solid #a284e3; }
.compose-steps { display: flex; gap: 18px; flex-wrap: wrap; padding: 0 0 22px; margin-top: -8px; color: var(--ux-muted); font-size: 13px; }
.compose-steps span { display: flex; align-items: center; gap: 7px; padding: 6px 0; }
.compose-steps .current { color: var(--ux-accent); font-weight: 650; }
.compose-steps .complete .icon { color: #148269; width: 16px; }
.compose-panel .personalization-box { margin: 22px 0; }
.compose-panel .form-stack > fieldset { min-width: 0; }
.compose-panel #draft-save-status { text-align: right; }
.compose-save-note { color: var(--ux-muted); margin-top: 14px; }
#compose-save-error:not(:empty), #email-setup-feedback:not(:empty) { padding: 16px; border-radius: 10px; border: 1px solid #efbac5; background: #fff5f7; }
.message-list-panel .message-more { min-height: 44px; min-width: 44px; }
.message-record-detail { font-size: 11px !important; }
.message-list-panel .data-table td:nth-child(4) small { max-width: 180px; }
.ux-guide { display: flex; align-items: flex-start; gap: 18px; border: 1px solid #c9b6f2; background: #f6f1ff; border-radius: 16px; padding: 22px 24px; margin-bottom: 26px; position: relative; }
.ux-guide h2 { margin-bottom: 8px; font-size: 20px; }
.ux-guide p { margin-bottom: 12px; font-size: 14px; line-height: 1.7; color: #535d79; max-width: 78ch; }
.ux-guide .eyebrow { color: #7152a0; margin-bottom: 7px; }
.guide-mark { height: 36px; width: 36px; flex-shrink: 0; color: #7343c2; background: #e9ddff; border-radius: 10px; display: grid; place-items: center; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-self: center; max-width: 200px; }
.guide-actions .button { min-height: 40px; }
.guide-dots { display: flex; gap: 6px; }
.guide-dots > span { height: 4px; width: 22px; border-radius: 2px; background: #ded3ef; }
.guide-dots > span.current { background: var(--ux-accent); }
.guide-dots > span.done { background: #b59cd9; }
.ux-guide-target { outline: 2px solid #b09bdc; outline-offset: 5px; scroll-margin-top: 25px; }
.help-topics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 30px; align-items: start; }
.learn-message,.learn-research,.learn-review { max-width: 1000px; }
.learn-fit { padding: 24px; border: 1px solid #e4dcf4; border-radius: 14px; background: #fcfaff; margin-bottom: 16px; }
.learn-fit h3 { font-size: 17px; }
.learn-fit p { color: var(--ux-muted); font-size: 14px; }
.learn-checks { display: grid; gap: 12px; margin-bottom: 24px; }
.learn-checks .check-label { padding: 8px 0; }
@media (max-width:1100px) {
    .setup-layout { grid-template-columns: 200px minmax(0,1fr); gap: 18px; }
    .setup-provider-grid { grid-template-columns: 1fr; }
    .setup-provider { display: grid; grid-template-columns: 38px minmax(0,1fr); column-gap: 15px; }
    .setup-provider h3 { margin: 4px 0 8px; }
    .setup-provider p, .setup-provider > .button { grid-column: 2; }
    .setup-welcome-steps .setup-steps { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .ux-home-progress { min-width: 150px; padding-left: 22px; }
    .ux-home-main { gap: 24px; }
}
@media (max-width:800px) {
    .setup-layout { grid-template-columns: 1fr; }
    .setup-layout > aside { position: static; }
    .setup-layout .setup-steps { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }
    .setup-layout .setup-step { flex-direction: column; padding: 10px 6px; gap: 8px; text-align: center; font-size: 12px; }
    .setup-layout .setup-step small { display: none; }
    .setup-layout > aside > p { display: none; }
    .setup-layout .setup-progress-label { padding: 9px 3px 2px; }
    .setup-content { padding: 23px; }
    .ux-home-main h1 { font-size: 27px; }
    .ux-home-progress { display: none; }
    .ux-guide { flex-wrap: wrap; padding: 19px; }
    .ux-guide .grow { flex-basis: calc(100% - 60px); }
    .guide-actions { max-width: none; width: 100%; padding-left: 54px; }
    .help-topics { grid-template-columns: 1fr; }
}
@media (max-width:680px) {
    .app-body .workspace { padding-bottom: 28px; }
    .topbar .top-right > .small, .topbar .top-right > .live-dot { display: none; }
    .ux-global-help { padding: 8px; font-size: 12px; }
    .setup-content { padding: 21px 17px; }
    .setup-welcome { padding: 27px 22px; }
    .setup-welcome h1 { font-size: 32px; }
    .setup-welcome-steps .setup-step { padding: 13px; min-width: 0; font-size: 12px; }
    .setup-promise { align-items: flex-start; }
    .setup-provider-grid { gap: 12px; }
    .setup-provider { padding: 18px; }
    .setup-mailbox { padding: 15px; gap: 10px; }
    .setup-mailbox .actions { justify-content: stretch; }
    .setup-mailbox .actions .button { flex: 1 1 auto; }
    .setup-readiness-row { flex-wrap: wrap; }
    .setup-readiness-row .grow { flex-basis: calc(100% - 32px); }
    .setup-readiness-row > .button { margin-left: 24px; }
    .setup-content .form-grid { grid-template-columns: 1fr; }
    .ux-home-main { padding: 25px 21px; }
    .ux-home-main h1 { font-size: 27px; }
    .ux-home-main .actions .button { flex: 1 1 auto; }
    .ux-home-stats .stat-card { padding: 16px; }
    .ux-home-stats .stat-card .row-between { gap: 10px; }
    .ux-home-stats .stat-card .row-between > span:first-child { font-size: 12px; }
    .ux-home-stats .stat-value { font-size: 25px; }
    .ux-home-panels .panel-heading { align-items: flex-start; gap: 10px; }
    .ux-empty-row > .button { width: 100%; }
    .compose-steps { gap: 8px 16px; font-size: 12px; padding-bottom: 15px; }
    .compose-panel .panel-heading { align-items: flex-start; }
    .ux-email-preview { padding: 18px 15px; }
    .ux-email-preview pre { font-size: 14px; }
    .workspace[data-page="compose"] { padding-bottom: 115px; }
    .workspace[data-page="compose"] > .page-heading > .actions { position: fixed; bottom: calc(64px + env(safe-area-inset-bottom)); left: 0; right: 0; z-index: 25; padding: 10px 16px; background: #fffffffa; border-top: 1px solid #e1e6f0; box-shadow: 0 -3px 14px #27335408; justify-content: center; display: flex; gap: 10px; }
    .workspace[data-page="compose"] > .page-heading > .actions .button { flex: 1 1 45%; min-height: 44px; }
    .workspace[data-page="compose"] > .page-heading > .actions [data-action="nav"] { display: none; }
    .ux-keyboard .workspace[data-page="compose"] > .page-heading > .actions { position: static; box-shadow: none; padding: 12px 0 0; margin-top: 8px; }
    .ux-guide { gap: 12px; padding: 17px; }
    .ux-guide h2 { font-size: 18px; }
    .ux-guide .eyebrow { font-size: 9px; letter-spacing: 1.2px; }
    .ux-guide p { font-size: 13px; }
    .guide-mark { width: 30px; height: 30px; }
    .guide-actions { padding-left: 0; }
    .guide-actions .button { flex: 1; }
    /* One semantic table, card layout on mobile. No duplicated selection controls. */
    .message-list-panel .table-wrap { overflow: visible; }
    .message-list-panel .data-table { display: block; min-width: 0; width: 100%; border: 0; }
    .message-list-panel .data-table thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
    .message-list-panel .data-table tbody { display: grid; gap: 15px; }
    .message-list-panel .data-table tbody tr { position: relative; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #e3e7f0; border-radius: 14px; padding: 17px; background: #fff; gap: 12px 16px; }
    .message-list-panel .data-table tbody td { display: block; border: 0; width: auto; min-width: 0; max-width: none; padding: 0; overflow-wrap: anywhere; white-space: normal; }
    .message-list-panel .data-table td:first-child { position: absolute; top: 11px; right: 11px; display: grid; place-items: center; width: 36px; height: 36px; }
    .message-list-panel .data-table td:nth-child(2) { grid-column: 1 / -1; padding-right: 35px; }
    .message-list-panel .data-table td:nth-child(3) { grid-column: 1 / -1; max-width: none; }
    .message-list-panel .data-table td:nth-child(4), .message-list-panel .data-table td:nth-child(5) { min-width: 0; }
    .message-list-panel .data-table td:nth-child(5)::before { content: 'Updated'; display: block; color: var(--ux-muted); font-size: 11px; margin-bottom: 4px; }
    .message-list-panel .data-table td:last-child { grid-column: 1 / -1; border-top: 1px solid #eff1f7; padding-top: 12px; }
    .message-list-panel .message-row-actions { justify-content: space-between; }
    .message-list-panel .message-row-actions > .button:first-child { flex: 1; min-height: 44px; }
    .message-list-panel input[type="checkbox"] { width: 24px; height: 24px; }
    .message-toolbar { margin: 10px 0 16px; }
    .message-toolbar .actions { gap: 8px; }
    .message-toolbar .button { min-height: 44px; }
    .message-list-panel .data-table small { margin-top: 5px; font-size: 12px; }
    .message-list-panel .message-record-detail { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .ux-guide, .ux-guide-target, .setup-step { transition: none !important; scroll-behavior: auto !important; }
}

/* v1.0.18: full-site, non-modal walkthrough; no fixed overlay hides the page. */
.tour-expanded.ux-guide { display: block; background: #faf7ff; padding: 22px 24px 18px; }
.guide-heading { display: flex; gap: 16px; align-items: flex-start; }
.guide-heading .grow { min-width: 0; }
.guide-heading > .badge { white-space: nowrap; margin-top: 2px; }
.guide-heading h2:focus { outline: none; }
.guide-lessons { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 14px 0 12px; align-items: start; }
.guide-lesson { min-width: 0; background: #fff; border: 1px solid #e1d7f1; border-radius: 10px; padding: 0 13px; }
.guide-lesson summary { cursor: pointer; font-size: 13px; font-weight: 650; color: #352850; padding: 13px 0; min-height: 46px; }
.guide-lesson p { margin: 0 0 8px; font-size: 13px; }
.guide-lesson .text-button { margin: 0 0 10px; min-height: 40px; font-size: 12px; }
.guide-safety { font-size: 12px !important; color: #5d526e !important; margin: 6px 0 14px !important; max-width: none !important; }
.guide-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; align-items: flex-start; padding-top: 12px; border-top: 1px solid #e7def2; }
.guide-footer .guide-actions { max-width: none; padding-left: 0; align-self: flex-start; flex-shrink: 0; }
.guide-footer .guide-actions .button { min-height: 44px; }
.guide-sections { flex: 1; min-width: 220px; }
.guide-sections > summary { font-size: 13px; font-weight: 650; cursor: pointer; padding: 12px 0; color: #493763; }
.guide-sections > summary span { margin-left: 8px; font-size: 12px; font-weight: 400; color: #696071; }
.tour-outline { list-style: none; counter-reset: none; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; padding: 0; margin: 8px 0 4px; }
.tour-outline li { min-width: 0; margin: 0; padding: 0; }
.tour-section { display: flex; gap: 12px; align-items: center; text-align: left; background: #fff; border: 1px solid #e1d9ef; border-radius: 10px; width: 100%; min-height: 65px; padding: 11px 13px; cursor: pointer; color: #21344e; font: inherit; }
.tour-section:hover { background: #f8f4ff; border-color: #b7a1d8; }
.tour-section.current { border-color: #794ec3; background: #f5efff; }
.tour-number { flex-shrink: 0; width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; color: #6b42af; background: #f0eafa; font-size: 12px; font-weight: 700; }
.tour-section strong { font-size: 13px; line-height: 1.5; display: block; }
.tour-section small { color: #647087; font-size: 11px; display: block; margin-top: 3px; }
.tour-section > .icon { flex-shrink: 0; width: 15px; }
.tour-section .grow { min-width: 0; overflow-wrap: anywhere; }
.guide-feedback:empty { display: none; }
.guide-feedback { margin-top: 12px; color: #514762; font-size: 13px; }
.tour-return { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #f6f0ff; border: 1px solid #dfd1f0; border-radius: 12px; padding: 15px 20px; margin-bottom: 24px; }
.tour-return strong { font-size: 14px; }
.tour-return p { font-size: 13px; color: #655676; margin: 5px 0 0; }
.tour-section:focus-visible,.guide-lesson summary:focus-visible,.guide-sections summary:focus-visible { outline: 3px solid #875ace; outline-offset: 3px; }
.profile-save-status { margin: 6px 0 0; }
@media (max-width:1000px) {
    .guide-lessons { grid-template-columns: 1fr; gap: 7px; }
    .guide-heading > .badge { display: none; }
    .guide-sections .tour-outline { grid-template-columns: 1fr; }
}
@media (max-width:600px) {
    .tour-expanded.ux-guide { padding: 16px; }
    .guide-heading { gap: 10px; }
    .guide-heading h2 { line-height: 1.35; }
    .guide-heading .eyebrow { display: block; }
    .guide-footer { flex-direction: column-reverse; gap: 8px; }
    .guide-footer .guide-actions { width: 100%; }
    .guide-footer .guide-actions .button { padding: 10px 12px; }
    .guide-sections { width: 100%; min-width: 0; }
    .tour-outline { grid-template-columns: 1fr; }
    .tour-return { padding: 14px; }
    .tour-return .actions { width: 100%; }
    .tour-return .actions .button { min-height: 44px; }
    .ux-guide-target { outline-offset: 2px; }
}
.guide-backlink { margin: 8px 0 12px; }
.guide-backlink .button { min-height: 44px; }

/* v1.0.19: keep lesson-specific navigation readable without crowding account controls. */
.topbar.practice-header .top-left { min-width: 0; flex: 1; }
.topbar.practice-header .top-right,
.topbar.practice-header .menu-toggle { flex-shrink: 0; }
.topbar.practice-header #breadcrumbs { overflow-wrap: anywhere; line-height: 1.45; }
@media (max-width: 480px) {
    .topbar.practice-header { height: auto; min-height: 62px; flex-wrap: wrap; row-gap: 6px; padding-top: 10px; padding-bottom: 10px; }
    .topbar.practice-header .top-left { flex-basis: 100%; }
    .topbar.practice-header .top-right { margin-left: auto; }
}
