:root {
    color-scheme: light;
    --bg: #f4efe6;
    --bg-accent: #dce8dd;
    --bg-glow-a: rgba(15, 118, 110, 0.12);
    --bg-glow-b: rgba(202, 138, 4, 0.14);
    --surface: rgba(255, 252, 247, 0.88);
    --surface-strong: #fffaf3;
    --ink: #1d312c;
    --muted: #5b6f68;
    --brand: #0f766e;
    --brand-deep: #0b4f4b;
    --banner-accent: #0f766e;
    --banner-glow: rgba(15, 118, 110, 0.18);
    --banner-bg-a: rgba(255, 250, 243, 0.98);
    --banner-bg-b: rgba(240, 253, 250, 0.9);
    --stroke: rgba(29, 49, 44, 0.12);
    --shadow: 0 22px 50px rgba(43, 58, 46, 0.12);
    --radius: 28px;
    font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

:root[data-theme="basic"] {
    --bg: #f4efe6;
    --bg-accent: #dce8dd;
    --bg-glow-a: rgba(15, 118, 110, 0.12);
    --bg-glow-b: rgba(202, 138, 4, 0.14);
    --surface: rgba(255, 252, 247, 0.88);
    --surface-strong: #fffaf3;
    --ink: #1d312c;
    --muted: #5b6f68;
    --brand: #0f766e;
    --brand-deep: #0b4f4b;
    --banner-accent: #0f766e;
    --banner-glow: rgba(15, 118, 110, 0.18);
    --banner-bg-a: rgba(255, 250, 243, 0.98);
    --banner-bg-b: rgba(240, 253, 250, 0.9);
    --stroke: rgba(29, 49, 44, 0.12);
    --shadow: 0 22px 50px rgba(43, 58, 46, 0.12);
}

:root[data-theme="golf-lesson"] {
    --bg: #edf6e9;
    --bg-accent: #d8ead9;
    --bg-glow-a: rgba(57, 122, 47, 0.16);
    --bg-glow-b: rgba(214, 164, 74, 0.14);
    --surface: rgba(251, 255, 249, 0.9);
    --surface-strong: #f7fdf4;
    --ink: #17321d;
    --muted: #4e6a53;
    --brand: #2d7a3b;
    --brand-deep: #1f5a2a;
    --banner-accent: #2d7a3b;
    --banner-glow: rgba(45, 122, 59, 0.24);
    --banner-bg-a: rgba(248, 255, 245, 0.96);
    --banner-bg-b: rgba(231, 246, 229, 0.9);
    --stroke: rgba(23, 50, 29, 0.14);
    --shadow: 0 22px 50px rgba(36, 77, 40, 0.14);
}

:root[data-theme="fishing-guide"] {
    --bg: #e8f2f5;
    --bg-accent: #d2e5db;
    --bg-glow-a: rgba(21, 103, 122, 0.17);
    --bg-glow-b: rgba(84, 132, 99, 0.14);
    --surface: rgba(247, 253, 255, 0.9);
    --surface-strong: #f3fbfc;
    --ink: #17363c;
    --muted: #4f6b72;
    --brand: #15677a;
    --brand-deep: #0d4957;
    --banner-accent: #15677a;
    --banner-glow: rgba(21, 103, 122, 0.24);
    --banner-bg-a: rgba(242, 252, 255, 0.96);
    --banner-bg-b: rgba(221, 240, 245, 0.9);
    --stroke: rgba(23, 54, 60, 0.15);
    --shadow: 0 22px 50px rgba(23, 73, 87, 0.16);
}

:root[data-theme="piano-lesson"] {
    --bg: #f2eef6;
    --bg-accent: #ddd7e8;
    --bg-glow-a: rgba(58, 45, 88, 0.16);
    --bg-glow-b: rgba(171, 146, 106, 0.13);
    --surface: rgba(252, 250, 255, 0.9);
    --surface-strong: #f9f6ff;
    --ink: #251f36;
    --muted: #635a78;
    --brand: #4f3d78;
    --brand-deep: #362856;
    --banner-accent: #4f3d78;
    --banner-glow: rgba(79, 61, 120, 0.26);
    --banner-bg-a: rgba(251, 247, 255, 0.96);
    --banner-bg-b: rgba(236, 227, 248, 0.9);
    --stroke: rgba(37, 31, 54, 0.15);
    --shadow: 0 22px 50px rgba(39, 32, 58, 0.16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top left, var(--bg-glow-a), transparent 30%),
        radial-gradient(circle at bottom right, var(--bg-glow-b), transparent 35%),
        linear-gradient(160deg, var(--bg), var(--bg-accent));
    color: var(--ink);
}

html,
body {
    overflow-x: hidden;
}

button,
input,
textarea,
select {
    font: inherit;
}

.app-shell {
    max-width: 1040px;
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.app-footer {
    margin-top: auto;
    padding: 24px 0 8px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-muted, #9ca3af);
}

.titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    position: relative;
    z-index: 50;
}

.titlebar-brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.titlebar-logo {
    display: block;
    height: clamp(32px, 6vw, 48px);
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 10px;
}

.titlebar-brand {
    margin: 0;
    font-size: clamp(1.45rem, 3.8vw, 2.35rem);
    letter-spacing: 0.22em;
    font-weight: 800;
    text-align: left;
}

.titlebar-mark {
    display: none;
    height: clamp(32px, 6vw, 48px);
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 10px;
}

.titlebar-mark.titlebar-mark--wide {
    display: none;
}

.titlebar-mark.titlebar-mark--extra {
    display: none;
}

@media (min-width: 600px) {
    .titlebar-mark {
        display: block;
    }
}

@media (min-width: 900px) {
    .titlebar-mark--wide {
        display: block;
    }
}

@media (min-width: 1120px) {
    .titlebar-mark--extra {
        display: block;
    }
}

.title-icon-button {
    width: 48px;
    height: 48px;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    background: rgba(255, 250, 243, 0.92);
    color: var(--ink);
    box-shadow: var(--shadow);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
}

.title-icon-button:hover {
    background: white;
}



.main-menu {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: rgba(255, 250, 243, 0.98);
    box-shadow: var(--shadow);
    animation: menu-in 170ms ease;
    z-index: 999;
    margin-top: 8px;
}

.main-menu[hidden] {
    display: none;
}

.main-menu-header {
    display: grid;
    gap: 4px;
}

.main-menu-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.main-menu-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.main-menu-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.main-menu-card {
    width: 100%;
    border: 1px solid color-mix(in srgb, var(--brand) 14%, var(--stroke));
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.74);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    display: grid;
    gap: 10px;
    grid-template-columns: 34px 1fr;
    align-items: flex-start;
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.main-menu-card:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--brand) 38%, var(--stroke));
    box-shadow: 0 10px 20px rgba(15, 118, 110, 0.12);
}

.main-menu-card:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.main-menu-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--brand) 17%, white);
    color: var(--brand-deep);
    display: grid;
    place-items: center;
}

.main-menu-card-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.main-menu-card-title {
    font-weight: 700;
    line-height: 1.2;
}

.main-menu-card-description {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.3;
}

.main-menu-submenu {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0 0 0 10px;
    border-left: 2px solid color-mix(in srgb, var(--brand) 24%, var(--stroke));
}

.main-menu-submenu[hidden] {
    display: none;
}

.current-lesson-banner {
    margin: 0 0 8px;
    padding: 12px 14px 12px 18px;
    border-radius: 14px;
    border: none;
    border-left: 7px solid rgba(255, 255, 255, 0.45);
    background:
        radial-gradient(circle at 88% 15%, rgba(255, 255, 255, 0.18), transparent 40%),
        linear-gradient(135deg, var(--banner-accent), color-mix(in srgb, var(--banner-accent) 72%, #000));
    box-shadow:
        0 6px 28px color-mix(in srgb, var(--banner-accent) 55%, transparent),
        0 2px 8px color-mix(in srgb, var(--banner-accent) 35%, transparent);
    color: #fff;
}

.current-lesson-banner-primary,
.current-lesson-banner-secondary {
    line-height: 1.35;
}

.current-lesson-banner-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.current-lesson-banner-primary {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.current-lesson-edit-button {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.current-lesson-edit-button:hover {
    background: rgba(255, 255, 255, 0.32);
}

.current-lesson-edit-button i {
    font-size: 0.9rem;
}

.current-lesson-banner-secondary {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
}

.banner-call-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
    opacity: 0.75;
    text-decoration: none;
    vertical-align: middle;
}

.banner-call-icon:hover {
    opacity: 1;
    color: var(--accent, #4a90e2);
}

.lesson-workflow-nav {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
}

.lesson-workflow-nav[hidden] {
    display: none;
}

.workflow-pill {
    padding: 10px 16px;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    background: rgba(255, 250, 243, 0.92);
    color: var(--ink);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease;
}

.workflow-pill:hover {
    transform: translateY(-1px);
    background: white;
}

.home-shell {
    display: grid;
    gap: 16px;
}

.home-pill-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-items: center;
    width: 100%;
}

.panel-top-nav {
    padding: 16px 0 0 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--stroke);
    padding-bottom: 16px;
}

.panel-top-nav--flush {
    padding-top: 0;
}

.home-pill-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 250, 243, 0.9);
    color: var(--ink);
    cursor: pointer;
    min-width: 0;
    transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.home-pill-button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-pill-button:hover {
    transform: translateY(-1px);
    background: #fff;
}

.home-pill-button.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.home-panel[hidden] {
    display: none;
}

.directory-shell {
    width: 100%;
}

.directory-card {
    position: relative;
    gap: 16px;
    padding-bottom: 72px;
}

.directory-add-button {
    position: static;
    margin-left: auto;
    margin-top: 6px;
}

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

.contact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--stroke);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
}

.contact-row-copy {
    min-width: 0;
}

.contact-row-name {
    margin: 0;
    font-weight: 700;
    color: var(--ink);
}

.contact-row-meta {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    word-break: break-word;
}

.contact-row-edit {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.contact-edit-panel {
    width: min(100%, 620px);
}

.contact-danger-row {
    display: flex;
    justify-content: flex-end;
}

.contact-delete-button {
    padding: 6px 10px;
    font-size: 0.78rem;
    gap: 6px;
}

.contact-portal-invite {
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.78);
    display: grid;
    gap: 8px;
}

.contact-portal-invite-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.contact-portal-invite-header .recording-kicker {
    margin: 0;
}

.contact-portal-invite-status {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.contact-portal-invite-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.contact-portal-invite-revoke {
    padding: 6px 10px;
    font-size: 0.78rem;
}

.contact-edit-history {
    display: grid;
    gap: 8px;
}

.contact-edit-lessons {
    display: grid;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}

.contact-edit-lesson-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--stroke);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}

.contact-edit-lesson-item:hover {
    border-color: rgba(15, 118, 110, 0.3);
    background: #fff;
}

.contact-edit-lesson-title {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-edit-lesson-date {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--muted);
}

.playbook-shell {
    width: 100%;
    display: grid;
    gap: 16px;
}

.playbook-card {
    gap: 16px;
}

.playbook-toolbar {
    display: grid;
    gap: 10px;
}

.playbook-add-field {
    margin: 0;
}

.playbook-add-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
}

.playbook-chapter-list {
    display: grid;
    gap: 10px;
}

.chapter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--stroke);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.chapter-row:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.28);
    background: #fff;
}

.chapter-row-title {
    font-weight: 700;
}

.chapter-row-meta {
    color: var(--muted);
    font-size: 0.9rem;
}

/* ── Playbook chapter panel ──────────────────────────────────────────────── */

.playbook-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.playbook-chapter-view {
    flex: 1;
}

.playbook-chapter-edit-toggle {
    position: absolute;
    top: 14px;
    left: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    background: rgba(255, 250, 243, 0.92);
    color: var(--muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.playbook-chapter-edit-toggle:hover {
    background: #fff;
    color: var(--ink);
}

.playbook-chapter-editor {
    flex: 1;
    width: 100%;
    min-height: 300px;
    padding: 12px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    box-sizing: border-box;
}

.playbook-chapter-edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.playbook-prompt-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--stroke);
}

.playbook-prompt-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    background: rgba(255, 250, 243, 0.9);
    color: var(--ink);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    font-family: inherit;
    transition: border-color 0.15s;
}

.playbook-prompt-input:focus {
    outline: none;
    border-color: var(--brand);
}

.playbook-prompt-submit {
    width: 40px;
    height: 40px;
    border: 1px solid var(--brand);
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.playbook-prompt-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.playbook-prompt-submit:hover:not(:disabled) {
    opacity: 0.85;
}

@media (max-width: 720px) {
    .playbook-add-row {
        grid-template-columns: 1fr;
    }
}

.loading-shell {
    flex: 1;
    min-height: clamp(280px, 50vh, 520px);
    display: grid;
    place-items: center;
    padding: 20px;
}

.loading-card {
    width: min(420px, 100%);
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 30px 24px;
    border: 1px solid var(--stroke);
    border-radius: calc(var(--radius) - 6px);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.theme-spinner {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 4px solid color-mix(in srgb, var(--brand) 25%, transparent);
    border-top-color: var(--brand-deep);
    animation: theme-spin 900ms linear infinite;
}

.loading-title {
    margin: 4px 0 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ink);
}

.loading-message {
    margin: 0;
    text-align: center;
    color: var(--muted);
}

.dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: stretch;
}

@media (min-width: 768px) {
    .dashboard {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .dashboard {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.nav-card,
.stub-card {
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: var(--surface);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}

.nav-card {
    min-height: 240px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
    text-align: left;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.nav-card:hover {
    transform: translateY(-4px);
    border-color: rgba(15, 118, 110, 0.35);
    background: var(--surface-strong);
}

.nav-card strong {
    font-size: 1.5rem;
    line-height: 1.05;
    margin-bottom: 12px;
}

.nav-card span {
    color: var(--muted);
    max-width: 20ch;
}

.stub-card {
    padding: 28px;
    max-width: 720px;
}

.calendar-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
}

.calendar-toolbar {
    display: flex;
    justify-content: flex-end;
}

.calendar-view-toggle {
    display: flex;
    gap: 0;
    border: 1px solid var(--stroke);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-strong);
}

.calendar-view-pill {
    padding: 6px 13px;
    font-size: 0.82rem;
    font-weight: 500;
    border: 0;
    border-right: 1px solid var(--stroke);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: background 120ms;
}

.calendar-view-pill:last-child {
    border-right: 0;
}

.calendar-view-pill:hover {
    background: rgba(15, 118, 110, 0.08);
}

.calendar-view-pill.is-active {
    background: var(--brand);
    color: #fff;
}

.calendar-card {
    flex: 1;
    height: 100%;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
    padding: 18px;
    overflow: hidden;
}

.calendar-card-wrap {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 0;
    min-height: 420px;
}

.calendar-card-wrap .calendar-card {
    min-width: 0;
    width: 100%;
}

.calendar-add-lesson-button {
    position: absolute;
    right: 18px;
    bottom: 50px;
    min-width: 45px;
    height: 45px;
    padding: 0 16px 0 14px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--brand), var(--brand-deep));
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 18px 30px color-mix(in srgb, var(--brand) 28%, transparent);
    cursor: pointer;
    z-index: 5;
    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.calendar-add-lesson-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 36px color-mix(in srgb, var(--brand) 34%, transparent);
}

.calendar-add-lesson-button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--brand) 24%, white);
    outline-offset: 3px;
}

.calendar-add-lesson-button i {
    font-size: 0.95rem;
}

.calendar-add-lesson-label {
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

@media (max-width: 720px) {

    .calendar-add-lesson-button,
    .directory-add-button {
        position: fixed;
        right: 18px;
        bottom: max(50px, env(safe-area-inset-bottom));
        z-index: 40;
    }
}

#appointment-calendar {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.calendar-error {
    margin: 0;
    padding: 16px;
    border: 1px solid rgba(180, 35, 24, 0.26);
    border-radius: 14px;
    background: #fff1ef;
    color: #b42318;
}

#appointment-calendar .fc-list {
    border-radius: 16px;
    overflow: hidden;
}

#appointment-calendar .fc-list-event:hover td {
    background: rgba(15, 118, 110, 0.08);
}

#appointment-calendar .fc-list-event {
    position: relative;
}

#appointment-calendar .fc-list-table {
    width: 100%;
    table-layout: fixed;
}

#appointment-calendar .fc-list-event-time {
    width: 1%;
    white-space: nowrap;
    line-height: 1.25;
    vertical-align: top;
    padding-right: 16px;
}

#appointment-calendar .fc-list-event-title {
    width: auto;
    min-width: 0;
    vertical-align: top;
    white-space: nowrap;
}

#appointment-calendar .fc-list-day th {
    position: static !important;
}

#appointment-calendar .fc-list-day-cushion {
    background: rgba(15, 118, 110, 0.1);
}

#appointment-calendar .fc-list-event-title {
    position: relative;
    padding-right: 40px;
}

#appointment-calendar .fc-list-event-title>a {
    display: block;
    width: 100%;
    min-width: 0;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#appointment-calendar .fc-list-event-graphic {
    display: none !important;
}

.calendar-event-open-button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--stroke);
    border-radius: 8px;
    background: rgba(255, 250, 243, 0.92);
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    margin: 0;
}

.calendar-event-open-button:hover {
    background: white;
}

.calendar-event-content {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event-detail-line {
    word-break: break-word;
}

.calendar-event-phone-link {
    color: inherit;
}

.calendar-event-buttons {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
}

.calendar-sent-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
}

#appointment-calendar .fc-list-event-time .calendar-sent-indicator,
#appointment-calendar .fc-list-event-time .calendar-sent-indicator i {
    color: var(--brand) !important;
}

.calendar-sent-indicator i {
    font-size: 0.85rem;
    opacity: 0.9;
}

#appointment-calendar .fc-view-harness,
#appointment-calendar .fc-scroller-harness,
#appointment-calendar .fc-scroller {
    min-height: 0;
}

#appointment-calendar .fc-toolbar-title {
    font-size: 1.5rem;
}

#appointment-calendar .fc-button-primary {
    background-color: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

#appointment-calendar .fc .fc-button {
    padding: 0.35em 0.58em;
    font-size: 0.82rem;
}

#appointment-calendar .fc-button-primary:hover {
    background-color: var(--brand-deep);
    border-color: var(--brand-deep);
}

#appointment-calendar .fc-button-primary:focus {
    background-color: var(--brand-deep);
    border-color: var(--brand-deep);
}

#appointment-calendar .fc-button-primary.fc-button-active {
    background-color: var(--brand-deep);
    border-color: var(--brand-deep);
}

.recording-shell {
    width: 100%;
}

.recording-card {
    display: grid;
    gap: 22px;
    padding: 28px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.recording-card.recording-card-has-loaded {
    border-color: color-mix(in srgb, var(--brand) 38%, var(--stroke));
    box-shadow: 0 24px 56px color-mix(in srgb, var(--brand) 18%, transparent);
}

.recording-loaded-banner {
    display: block;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--brand) 38%, var(--stroke));
    border-radius: 14px;
    background: color-mix(in srgb, var(--brand) 8%, white);
}

.recording-loaded-summary {
    margin: 0;
    font-weight: 700;
    color: var(--ink);
    word-break: break-word;
}

.current-lesson-card {
    display: grid;
    gap: 6px;
    padding: 18px 20px;
    border: 1px solid var(--stroke);
    border-radius: 20px;
    background: rgba(255, 250, 243, 0.92);
}

.current-lesson-card.is-empty {
    color: var(--muted);
}

.current-lesson-card p {
    margin: 0;
}

.current-lesson-title {
    font-size: 1.15rem;
}

.current-lesson-meta {
    color: var(--muted);
}

.recording-header {
    display: grid;
    gap: 10px;
}

.recording-kicker {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.76rem;
    color: var(--muted);
}

.recording-state-row {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
}

.recording-led {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #d92d20;
    box-shadow: 0 0 0 7px rgba(217, 45, 32, 0.12);
}

.recording-timer {
    margin: 0;
    font-size: clamp(2.6rem, 8vw, 5.5rem);
    line-height: 0.92;
    letter-spacing: -0.06em;
}

.recording-primary-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.record-button,
.pause-record-button,
.stop-record-button,
.transport-icon-button {
    border: 1px solid var(--stroke);
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.record-button:hover,
.pause-record-button:hover,
.stop-record-button:hover,
.transport-icon-button:hover {
    transform: translateY(-1px);
}

.record-button:disabled,
.pause-record-button:disabled,
.stop-record-button:disabled,
.transport-icon-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.record-button {
    min-width: 90px;
    min-height: 90px;
    padding: 16px;
    border-color: #b42318;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #ff695e, #d92d20 68%);
    color: white;
    font-size: 1rem;
    box-shadow: 0 14px 28px rgba(217, 45, 32, 0.22);
}

.pause-record-button {
    min-width: 90px;
    min-height: 90px;
    padding: 16px;
    border-color: rgba(29, 49, 44, 0.12);
    border-radius: 24px;
    background: rgba(255, 250, 243, 0.92);
    color: var(--ink);
    font-size: 1rem;
    box-shadow: var(--shadow);
}

.stop-record-button {
    min-width: 90px;
    min-height: 90px;
    padding: 16px;
    border-color: rgba(180, 35, 24, 0.28);
    border-radius: 24px;
    background: linear-gradient(180deg, #fff4f2, #ffe2dd);
    color: #b42318;
    font-size: 1rem;
    box-shadow: 0 14px 28px rgba(180, 35, 24, 0.12);
}

.playhead-panel {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 18px;
    border: 1px solid var(--stroke);
    border-radius: 24px;
    background: rgba(255, 250, 243, 0.92);
}

.recording-secondary-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.transport-icon-button {
    width: 90px;
    height: 90px;
    display: grid;
    place-items: center;
    padding: 16px;
    background: white;
    color: var(--ink);
    font-size: 1.8rem;
    box-shadow: var(--shadow);
}

.pause-record-button i,
.stop-record-button i,
.transport-icon-button i {
    font-size: 1.8rem;
    line-height: 1;
}

.playhead-slider-row {
    min-width: 0;
    flex: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.playhead-slider {
    width: 100%;
    accent-color: var(--brand);
}

.playhead-time {
    min-width: 44px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 0.92rem;
}

.save-recording-button {
    flex-shrink: 0;
    white-space: nowrap;
}

.recording-transcript-button {
    margin: 0;
}

.recording-card audio {
    width: 100%;
}

.summary-shell {
    width: 100%;
}

.lesson-editor-workspace {
    display: grid;
    gap: 18px;
}

.summary-card,
.summary-dialog {
    display: grid;
    gap: 20px;
    padding: 28px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.summary-card {
    gap: 14px;
    padding: 18px;
}

.summary-card .panel-copy {
    gap: 6px;
}

.summary-card .panel-copy h2 {
    font-size: clamp(1.55rem, 4.2vw, 2rem);
    line-height: 1.08;
}

.summary-card .panel-copy p {
    font-size: 0.98rem;
}

.summary-file-name {
    margin: 0;
    font-weight: 600;
    color: var(--ink);
}

.summary-progress-wrap {
    display: grid;
    gap: 8px;
}

.summary-progress-wrap[hidden] {
    display: none;
}

.summary-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.86rem;
    color: var(--muted);
}

.summary-progress {
    width: 100%;
    height: 10px;
}

.summary-system-options {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--stroke);
    border-radius: 14px;
    background: rgba(255, 250, 243, 0.88);
}

.summary-system-option {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 0.95rem;
}

.summary-system-meta {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--stroke);
    border-radius: 14px;
    background: rgba(255, 250, 243, 0.88);
}

.settings-divider {
    width: 100%;
    margin: 0.75rem 0;
    border: 0;
    border-top: 2px solid color-mix(in srgb, var(--brand) 24%, var(--stroke));
    opacity: 0.9;
}

.summary-triggered-from {
    margin: 0;
    color: var(--ink);
    font-size: 0.95rem;
}

.summary-prompt-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ink);
}

.summary-prompt-text {
    margin: 10px 0 0;
    padding: 12px;
    border: 1px solid var(--stroke);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    white-space: pre-wrap;
    max-height: 240px;
    overflow: auto;
}

.summary-doc-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border: 1.5px solid rgba(15, 118, 110, 0.22);
    border-radius: 14px;
    background: white;
    text-align: left;
}

.summary-doc-info {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.summary-doc-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.summary-doc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    font-size: 1.35rem;
    color: rgba(15, 118, 110, 0.7);
}

.summary-doc-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--ink);
    display: block;
}

.summary-doc-sub {
    font-size: 0.82rem;
    color: var(--muted);
    display: block;
    margin-top: 2px;
}

@media (max-width: 700px) {
    .summary-doc-indicator {
        flex-direction: column;
        align-items: stretch;
    }

    .summary-doc-actions {
        width: 100%;
    }

    .summary-doc-actions .primary-action,
    .summary-doc-actions .secondary-action {
        flex: 1;
    }
}

.summary-panel {
    width: 100%;
    margin-top: 16px;
}

.summary-panel[hidden] {
    display: none;
}

.summary-panel-inner {
    position: relative;
    width: 100%;
    max-width: none;
    border: 1px solid var(--stroke);
    background: var(--surface-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    min-height: clamp(320px, 70vh, 980px);
}

.summary-panel-close,
.email-panel-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--stroke);
    background: rgba(255, 250, 243, 0.92);
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.summary-panel-close:hover,
.email-panel-close:hover {
    background: #fff;
    color: var(--ink);
    border-color: rgba(15, 118, 110, 0.3);
}

.summary-panel-body {
    line-height: 1.7;
    color: var(--ink);
}

.summary-panel-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.summary-send-custom-wrap {
    display: grid;
    gap: 8px;
}

.summary-panel-body h1,
.summary-panel-body h2,
.summary-panel-body h3,
.summary-panel-body h4 {
    margin: 1.4em 0 0.5em;
    font-weight: 700;
    line-height: 1.25;
}

.summary-panel-body h1 {
    font-size: 1.5rem;
}

.summary-panel-body h2 {
    font-size: 1.25rem;
}

.summary-panel-body h3 {
    font-size: 1.05rem;
}

.summary-panel-body p {
    margin: 0.6em 0;
}

.summary-panel-body ul,
.summary-panel-body ol {
    margin: 0.6em 0;
    padding-left: 1.5em;
}

.summary-panel-body li {
    margin: 0.25em 0;
}

.summary-panel-body strong {
    font-weight: 700;
}

.summary-panel-body em {
    font-style: italic;
}

.summary-panel-body s {
    text-decoration: line-through;
    color: var(--muted);
}

.summary-panel-body code {
    font-family: ui-monospace, monospace;
    font-size: 0.88em;
    background: rgba(15, 118, 110, 0.08);
    border-radius: 4px;
    padding: 0.1em 0.35em;
}

.summary-panel-body pre {
    background: rgba(15, 118, 110, 0.06);
    border-radius: 10px;
    padding: 16px 18px;
    overflow-x: auto;
    margin: 1em 0;
}

.summary-panel-body pre code {
    background: none;
    padding: 0;
    font-size: 0.9em;
}

.summary-panel-body hr {
    border: none;
    border-top: 1px solid var(--stroke);
    margin: 1.5em 0;
}

.summary-info-box {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--stroke);
    border-radius: 8px;
    overflow: hidden;
    margin: 0 0 1.4em;
    font-size: 0.92rem;
}

.summary-info-box tbody tr {
    border-bottom: 1px solid var(--stroke);
}

.summary-info-box tbody tr:last-child {
    border-bottom: none;
}

.summary-info-label {
    padding: 7px 12px;
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
    width: 1%;
    background: rgba(15, 118, 110, 0.04);
}

.summary-info-value {
    padding: 7px 12px;
    color: var(--ink);
}

.summary-info-value a {
    color: var(--accent);
    text-decoration: none;
}

.summary-info-value a:hover {
    text-decoration: underline;
}

.summary-info-divider {
    border: none;
    border-top: 1px solid var(--stroke);
    margin: 1.5em 0 1.2em;
}

.settings-menu-grid {
    display: grid;
    gap: 14px;
}

.settings-menu-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    padding: 18px 20px;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.settings-menu-card:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.28);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.settings-menu-title {
    font-size: 1rem;
    font-weight: 700;
}

.settings-menu-description {
    color: var(--muted);
    line-height: 1.55;
}

.settings-subscreen-actions {
    margin-bottom: 16px;
}

.upload-media-card {
    gap: 14px;
}

.add-media-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    display: grid;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--stroke);
    border-radius: 14px;
    background: rgba(255, 250, 243, 0.98);
    box-shadow: var(--shadow);
    z-index: 50;
    animation: menu-in 140ms ease;
}

.add-media-menu[hidden] {
    display: none;
}

.add-media-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 100ms;
}

.add-media-menu-item:hover {
    background: rgba(15, 118, 110, 0.1);
}

.add-media-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--brand);
    flex-shrink: 0;
}

.upload-media-list {
    display: grid;
    gap: 10px;
}

.upload-media-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content 100px;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.upload-media-header-main {
    justify-self: start;
}

.upload-media-header-include {
    justify-self: center;
    white-space: nowrap;
}

.upload-media-header-actions {
    display: block;
    width: 100px;
}

.upload-media-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content 100px;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--stroke);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
}

.upload-media-details {
    min-width: 0;
}

.upload-media-include-toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.upload-media-include-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
    cursor: pointer;
}

.upload-media-actions {
    display: grid;
    grid-template-columns: 44px 44px;
    gap: 12px;
    justify-content: end;
    width: 100px;
}

.upload-media-name {
    margin: 0;
    font-weight: 600;
    color: var(--ink);
    word-break: break-word;
}

.upload-media-meta {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.upload-media-delete {
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    display: grid;
    place-items: center;
}

.upload-media-delete-icon {
    width: 18px;
    height: 18px;
}

.upload-media-transcript {
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    display: grid;
    place-items: center;
}

.upload-media-transcript svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 720px) {
    .upload-media-header {
        grid-template-columns: minmax(0, 1fr) max-content 100px;
        padding: 0 4px;
    }

    .upload-media-header-include {
        justify-self: center;
    }
}

.upload-recorder-panel {
    width: min(100%, 560px);
}

#upload-audio-recorder-elapsed {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--ink);
}

#upload-audio-recorder-preview {
    width: 100%;
}

.send-link-shell {
    position: relative;
    width: 100%;
}

.send-link-card {
    display: grid;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.edit-lesson-card {
    gap: 14px;
    padding: 16px 18px;
}

.edit-lesson-card.is-collapsed {
    padding: 8px;
    border: none;
    background: transparent;
    box-shadow: none;
}

.lesson-editor-body {
    display: grid;
    gap: 12px;
}

.lesson-editor-body[hidden] {
    display: none;
}

.lesson-collapsed-summary {
    margin: 0;
}

.lesson-collapsed-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lesson-collapsed-close {
    position: static;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.lesson-collapsed-close:hover {
    background: rgba(255, 255, 255, 0.32);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.45);
}

.panel-copy {
    display: grid;
    gap: 10px;
}

.panel-copy-with-close {
    position: relative;
    min-height: 30px;
    padding-right: 40px;
}

.panel-copy h2,
.email-panel h3 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    line-height: 1;
}

.panel-copy p,
.email-empty-state {
    margin: 0;
    color: var(--muted);
}

.panel-guide {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(180, 120, 0, 0.3);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 244, 163, 0.98), rgba(255, 224, 102, 0.94));
    box-shadow: 0 16px 30px rgba(184, 134, 11, 0.18);
}

.panel-guide-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.panel-guide-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8a5a00;
}

.panel-guide-message {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #4f3600;
    white-space: pre-line;
}

.panel-guide-dismiss {
    flex-shrink: 0;
    border-color: rgba(138, 90, 0, 0.28);
    background: rgba(255, 250, 231, 0.92);
    color: #5f4200;
}

.panel-guide-dismiss:hover {
    background: rgba(255, 246, 207, 0.98);
}

.email-panel-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(84px, 14vh, 120px) 24px 24px;
    background: rgba(29, 49, 44, 0.3);
    backdrop-filter: blur(8px);
    z-index: 30;
}

.lesson-dialog-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(84px, 14vh, 120px) 24px 24px;
    background: rgba(29, 49, 44, 0.3);
    backdrop-filter: blur(8px);
    z-index: 35;
}

.lesson-dialog-overlay.is-open {
    display: flex;
}

.lesson-dialog {
    width: min(100%, 620px);
    display: grid;
    gap: 18px;
    padding: 26px;
    border: 1px solid var(--stroke);
    border-radius: 26px;
    background: rgba(255, 250, 243, 0.98);
    box-shadow: 0 28px 70px rgba(29, 49, 44, 0.22);
}

.lesson-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.lesson-form {
    display: grid;
    gap: 10px;
}

.lesson-field {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 4px;
    align-items: center;
    font-weight: 600;
    font-size: 0.8rem;
}

.lesson-field>span,
.lesson-field>label {
    margin: 0;
    font-size: 0.8rem;
}

.lesson-field.location-field {
    align-items: start;
}

.lesson-field.location-field>label {
    align-self: center;
}

.lesson-field.location-field .location-row,
.lesson-field.location-field .field-help {
    grid-column: 2;
}

.location-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.field-help {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 400;
}

.email-panel-overlay.is-open {
    display: flex;
}

#location-settings-overlay {
    z-index: 40;
}

#summary-send-overlay {
    z-index: 70;
}

.email-panel {
    position: relative;
    width: min(100%, 620px);
    display: grid;
    gap: 18px;
    padding: 26px;
    border: 1px solid var(--stroke);
    border-radius: 26px;
    background: rgba(255, 250, 243, 0.98);
    box-shadow: 0 28px 70px rgba(29, 49, 44, 0.22);
}

.email-panel-header {
    padding-right: 40px;
}

.contact-delete-button {
    font-size: 0.75rem;
    margin-top: 4px;
}

.email-panel-label {
    font-weight: 600;
}

.email-input {
    width: 100%;
    padding: 8px 9px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 12px;
    background: white;
    font-size: 0.8rem;
    color: var(--ink);
}

.email-input:focus {
    outline: 2px solid rgba(15, 118, 110, 0.2);
    border-color: rgba(15, 118, 110, 0.38);
}

.email-search-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.95rem;
}

.email-suggestions {
    display: grid;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
}

.email-suggestion {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: rgba(255, 250, 243, 0.92);
    text-align: left;
    color: var(--ink);
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.email-suggestion:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.35);
    background: white;
}

.location-settings-panel {
    position: relative;
    width: min(100%, 620px);
    max-height: min(90vh, 720px);
    overflow-y: auto;
    display: grid;
    gap: 18px;
    padding: 26px;
    border: 1px solid var(--stroke);
    border-radius: 26px;
    background: rgba(255, 250, 243, 0.98);
    box-shadow: 0 28px 70px rgba(29, 49, 44, 0.22);
}

.location-settings-form {
    display: grid;
    gap: 14px;
}

.location-settings-list {
    display: grid;
    gap: 10px;
}

.location-settings-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: rgba(255, 250, 243, 0.92);
}

.location-settings-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-action {
    padding: 10px 14px;
}

.stub-card p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 1.05rem;
}

.cal-integration-list {
    display: grid;
    gap: 12px;
}

.cal-integration-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--stroke);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
}

.cal-integration-info {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.cal-integration-name {
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cal-integration-status {
    font-size: 0.82rem;
    color: var(--muted);
}

.cal-integration-action {
    flex-shrink: 0;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.settings-utility-actions {
    margin-top: 18px;
}

.primary-action,
.secondary-action,
.danger-action {
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    cursor: pointer;
    font-size: 0.8rem;
}

.edit-lesson-card .action-buttons {
    display: flex;
    gap: 8px;
}

.edit-lesson-card .action-buttons .primary-action {
    margin-left: auto;
}

.primary-action {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}

.secondary-action {
    background: transparent;
    color: var(--ink);
}

.danger-action {
    background: #fff1ef;
    border-color: rgba(217, 45, 32, 0.26);
    color: #b42318;
}

.danger-action:hover {
    background: #ffe2dd;
}

.action-with-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, white 55%, transparent);
    border-top-color: white;
    display: none;
    animation: theme-spin 900ms linear infinite;
}

.action-with-spinner.is-loading .button-spinner {
    display: inline-block;
}

.action-with-spinner.is-loading .button-label {
    opacity: 0.92;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(11, 79, 75, 0.92);
    color: white;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
    transform-origin: center;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes theme-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes menu-in {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.nav-card {
    min-height: 180px;
}

@media (max-width: 560px) {
    .app-shell {
        padding: 8px;
    }

    .titlebar {
        margin-bottom: 12px;
    }

    .stub-card,
    .nav-card {
        padding: 20px;
        border-radius: 22px;
    }

    .recording-card {
        padding: 20px;
        border-radius: 22px;
    }

    .send-link-card,
    .email-panel,
    .lesson-dialog,
    .location-settings-panel {
        padding: 20px;
        border-radius: 22px;
    }

    .email-input {
        border-radius: 10px;
    }

    .lesson-field {
        gap: 4px;
    }

    .send-link-card .lesson-form {
        gap: 8px;
    }

    .send-link-card .lesson-field {
        grid-template-columns: 84px minmax(0, 1fr);
        gap: 6px;
        align-items: center;
    }

    .send-link-card .location-row {
        gap: 6px;
    }

    .send-link-card .location-row .secondary-action,
    .send-link-card .primary-action,
    .send-link-card .secondary-action,
    .send-link-card .danger-action {
        padding: 8px 10px;
        border-radius: 10px;
    }

    .send-link-card .action-buttons {
        gap: 6px;
    }

    .send-link-card .field-help {
        font-size: 0.8rem;
    }

    .lesson-dialog-overlay {
        padding: 6px;
    }

    .lesson-dialog {
        width: 100%;
        max-height: calc(100vh - 12px);
        overflow-y: auto;
        padding: 12px;
        gap: 10px;
        border-radius: 16px;
    }

    .lesson-form {
        gap: 8px;
    }

    .lesson-field {
        gap: 6px;
    }

    .lesson-dialog .location-row {
        gap: 8px;
    }

    .lesson-dialog .location-row .secondary-action {
        border-radius: 10px;
    }

    .lesson-dialog .action-buttons {
        gap: 8px;
    }

    .lesson-dialog .primary-action,
    .lesson-dialog .secondary-action,
    .lesson-dialog .danger-action {
        border-radius: 10px;
    }

    .lesson-dialog .field-help {
        font-size: 0.84rem;
    }

    .lesson-dialog .lesson-field {
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 8px;
        align-items: center;
    }

    .summary-card,
    .summary-dialog {
        padding: 14px;
        border-radius: 16px;
    }

    .summary-card {
        gap: 10px;
    }

    .summary-card .panel-copy h2 {
        font-size: 1.85rem;
    }

    .summary-card .panel-copy p,
    .summary-status,
    .summary-progress-meta {
        font-size: 0.9rem;
    }

    .recording-primary-controls {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: clamp(8px, 2.2vw, 12px);
        align-items: stretch;
    }

    .record-button,
    .pause-record-button,
    .stop-record-button,
    .transport-icon-button {
        min-width: 0;
        min-height: 0;
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        padding: clamp(6px, 1.8vw, 10px);
        font-size: clamp(0.8rem, 3.2vw, 1rem);
        display: grid;
        place-items: center;
    }

    .transport-icon-button {
        font-size: clamp(1.15rem, 5vw, 1.5rem);
    }

    .pause-record-button i,
    .stop-record-button i,
    .transport-icon-button i {
        font-size: clamp(1.15rem, 5vw, 1.5rem);
    }

    .playhead-panel {
        grid-auto-flow: row;
        display: grid;
    }

    .playhead-slider-row {
        width: 100%;
    }

    .email-panel-header,
    .email-search-meta {
        grid-auto-flow: row;
        display: grid;
        justify-content: stretch;
    }

}

@media (max-width: 420px) {}

/* Profile Page Styles */
.profile-section {
    margin: 1.5rem 0;
}

.profile-account-form {
    display: grid;
    gap: 14px;
}

.profile-account-form .action-buttons {
    align-items: center;
}

.profile-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--stroke);
}

.profile-item:last-child {
    border-bottom: none;
}

.profile-label {
    font-weight: 600;
    color: var(--ink);
}

.profile-value {
    color: var(--muted);
    text-align: right;
}

.profile-referral-code {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.profile-code-display {
    font-family: "Courier New", monospace;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-align: center;
    background: var(--surface-strong);
    border: 2px solid var(--brand);
}

.profile-code-display:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--bg-glow-a);
}

.profile-referral-text {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.5;
    margin-top: 0.5rem;
}

/* Subscription page */
.sub-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: rgba(29, 49, 44, 0.09);
    color: var(--muted);
}

.sub-status-active {
    background: rgba(15, 118, 110, 0.14);
    color: var(--brand-deep);
}

.sub-status-trialing {
    background: rgba(202, 138, 4, 0.14);
    color: #92400e;
}

.sub-status-past_due,
.sub-status-canceled {
    background: rgba(217, 45, 32, 0.12);
    color: #b42318;
}

.sub-status-paid {
    background: rgba(15, 118, 110, 0.14);
    color: var(--brand-deep);
}

.sub-status-failed {
    background: rgba(217, 45, 32, 0.12);
    color: #b42318;
}

.sub-card-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: var(--surface-strong);
    margin-bottom: 4px;
}

.sub-card-chip {
    flex-shrink: 0;
}

.sub-card-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sub-card-name {
    font-weight: 600;
    color: var(--ink);
}

.sub-card-exp {
    font-size: 0.85rem;
    color: var(--muted);
}

.sub-card-form-wrap {
    margin-top: 14px;
    padding: 18px;
    border: 1px solid var(--stroke);
    border-radius: 18px;
    background: var(--surface-strong);
}

.sub-card-form {
    display: grid;
    gap: 14px;
}

.sub-card-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .sub-card-form-row {
        grid-template-columns: 1fr;
    }
}

.auth-pricing-section,
.auth-referral-section {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: var(--surface-strong);
    border-radius: calc(var(--radius) / 2);
    border: 1px solid var(--stroke);
}

.auth-pricing-text,
.auth-referral-text {
    margin: 0.35rem 0;
    color: var(--ink);
    line-height: 1.5;
    font-size: 0.95rem;
}

.auth-pricing-text:first-child,
.auth-referral-text:first-child {
    margin-top: 0;
}

.auth-pricing-text strong,
.auth-referral-text strong {
    color: var(--brand);
    font-weight: 600;
}

.auth-screen .send-link-card {
    gap: 10px;
    padding: 12px 16px;
}

.auth-screen .panel-copy {
    gap: 6px;
}

.auth-screen .panel-copy h2 {
    font-size: 1.25rem;
    line-height: 1.2;
}

.auth-screen .panel-copy p,
.auth-screen .email-empty-state,
.auth-screen .summary-system-option,
.auth-screen .auth-link-button,
.auth-screen .auth-pricing-text,
.auth-screen .auth-referral-text {
    font-size: 0.9rem;
}

.auth-screen .recording-kicker {
    margin: 0;
}

.auth-screen .lesson-field {
    margin: 0;
}

.auth-screen #auth-referral-code-status {
    grid-column: 2;
    margin-top: 0;
}

.auth-screen .email-input {
    border-radius: 12px;
}

.auth-screen .summary-system-option {
    margin: 0;
    gap: 6px;
}

.auth-screen .settings-divider {
    margin: 0;
}

.auth-screen .auth-pricing-section,
.auth-screen .auth-referral-section {
    margin: 8px 0 4px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.auth-screen .auth-pricing-text,
.auth-screen .auth-referral-text {
    margin: 6px 0;
    line-height: 1.5;
}

.auth-screen .auth-navigation,
.auth-screen .action-buttons {
    margin: 0;
    gap: 6px;
}

.auth-screen .primary-action,
.auth-screen .secondary-action {
    border-radius: 12px;
}

.auth-navigation {
    text-align: center;
    margin-bottom: 1rem;
}

.auth-link-button {
    background: none;
    border: none;
    color: var(--brand);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0;
    transition: color 120ms;
}

.auth-link-button:hover {
    color: var(--brand-deep);
}

.field-validation-message {
    display: block;
    font-size: 0.85rem;
    margin-top: 4px;
    transition: color 200ms, opacity 200ms;
    opacity: 0.8;
}

.field-validation-message.validating {
    color: var(--muted);
}

.field-validation-message.valid {
    color: #2d7a3b;
}

.field-validation-message.invalid {
    color: #b42318;
}

@media (max-width: 640px) {
    .panel-guide {
        display: grid;
    }

    .panel-guide-dismiss {
        width: 100%;
    }
}

/* Record Button and Inline Audio Recorder */
.upload-record-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    height: auto;
    min-width: 44px;
    padding: 9px 12px;
    background: #dc2626;
    border: 1px solid #dc2626;
    border-radius: 12px;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.upload-record-btn:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.upload-record-btn:active {
    background: #7f1d1d;
    border-color: #7f1d1d;
}

.upload-record-btn i {
    font-size: 1rem;
}

.media-controls-toolbar {
    align-items: center;
}

.upload-audio-recorder-inline {
    margin-top: 12px;
    padding: 12px;
    background: var(--card-background);
    border: 1px solid var(--stroke);
    border-radius: 8px;
}

.recorder-inline-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.recorder-close-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--muted);
    padding: 2px 4px;
    line-height: 1;
    border-radius: 4px;
}

.recorder-close-btn:hover {
    color: var(--text);
    background: var(--hover-bg);
}

.recorder-status-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.recorder-status-group p {
    margin: 0;
}

.recorder-elapsed {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    min-width: 48px;
}

.recorder-viz-canvas {
    display: block;
    width: 100%;
    height: 48px;
    margin-bottom: 10px;
    border-radius: 6px;
    background: transparent;
}

.recorder-controls {
    gap: 8px;
}

/* Dialog Overlay and Content */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.dialog-content {
    background: var(--surface-strong);
    border-radius: 12px;
    padding: 24px;
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.2s ease-out;
    border: 1px solid var(--stroke);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (min-width: 600px) {
    .dialog-content {
        width: auto;
        min-width: 320px;
        max-width: 500px;
    }
}

.dialog-title {
    margin: 0 0 12px 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
}

.dialog-message {
    margin: 0 0 20px 0;
    font-size: 1rem;
    color: var(--ink);
    line-height: 1.5;
}

.dialog-input {
    width: 100%;
    padding: 10px 12px;
    margin: 0 0 20px 0;
    font-size: 1rem;
    border: 1px solid var(--stroke);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    box-sizing: border-box;
    font-family: inherit;
}

.dialog-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--bg-glow-a);
}

.dialog-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}