body.notebook-shell {
    --font-ui: var(--font-body);
    --font-hand: 'Patrick Hand', 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', cursive;
    --grid-size: 32px;
    --sidebar-width: 280px;
    --header-height: 74px;
    --message-gutter: 48px;
    --avatar-space: 104px;
    --paper-shadow: 0 18px 42px rgba(17, 24, 39, 0.08);
    --paper-shadow-soft: 0 10px 24px rgba(17, 24, 39, 0.05);
    --ink-shadow: 0 6px 18px rgba(35, 59, 158, 0.12);
    --radius-soft: 16px;
    --radius-round: 24px;
    --transition-fast: 160ms ease;
    --transition-medium: 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="light"] body.notebook-shell,
body.notebook-shell[data-theme="light"] {
    --paper-bg: #fdfdfc;
    --paper-card: rgba(253, 253, 252, 0.88);
    --paper-card-strong: rgba(253, 253, 252, 0.94);
    --paper-card-soft: rgba(253, 253, 252, 0.72);
    --paper-edge: rgba(35, 59, 158, 0.12);
    --rule-line: #e4e7eb;
    --margin-line: transparent;
    --pen-blue: #233b9e;
    --pen-blue-dark: #1a2e7d;
    --pen-blue-soft: rgba(35, 59, 158, 0.08);
    --pen-red: #bd4747;
    --pen-green: #175f4b;
    --text-main: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;
    --theme-bg-primary: #fdfdfc;
    --theme-bg-secondary: #f8fafc;
    --theme-surface: rgba(253, 253, 252, 0.92);
    --theme-surface-light: rgba(253, 253, 252, 0.82);
    --theme-border: rgba(35, 59, 158, 0.16);
    --theme-border-strong: rgba(35, 59, 158, 0.36);
    --theme-text-primary: #111827;
    --theme-text-secondary: #374151;
    --theme-text-muted: #6b7280;
    --theme-chat-bg: transparent;
    --theme-message-bg: rgba(253, 253, 252, 0.12);
    --theme-assistant-bubble: rgba(253, 253, 252, 0.05);
    --theme-input-bg: rgba(253, 253, 252, 0.5);
    --theme-input-border: rgba(35, 59, 158, 0.24);
    --ff-primary: #233b9e;
    --ff-primary-dark: #1a2e7d;
    --ff-secondary: #4b63c5;
    --ff-secondary-dark: #233b9e;
    --ff-accent: #bd4747;
    --ff-accent-dark: #9c3333;
    --header-surface: rgba(253, 253, 252, 0.92);
    --border: rgba(35, 59, 158, 0.16);
    --surface: rgba(253, 253, 252, 0.96);
    --surface-light: rgba(253, 253, 252, 0.82);
    --text-primary: #111827;
    --text-muted: #6b7280;
    --logo-filter: none;
}

:root[data-theme="dark"] body.notebook-shell,
body.notebook-shell[data-theme="dark"] {
    --paper-bg: #11141b;
    --paper-card: rgba(22, 27, 36, 0.86);
    --paper-card-strong: rgba(28, 33, 44, 0.94);
    --paper-card-soft: rgba(18, 22, 30, 0.72);
    --paper-edge: rgba(126, 145, 223, 0.22);
    --rule-line: rgba(126, 145, 223, 0.12);
    --margin-line: rgba(192, 93, 93, 0.22);
    --pen-blue: #9cb3ff;
    --pen-blue-dark: #d2dcff;
    --pen-blue-soft: rgba(156, 179, 255, 0.12);
    --pen-red: #e48b8b;
    --pen-green: #84d0b7;
    --text-main: #eef2ff;
    --text-secondary: #ced6f0;
    --text-muted: #94a0c1;
    --text-faint: #6d7895;
    --theme-bg-primary: #11141b;
    --theme-bg-secondary: #161b24;
    --theme-surface: rgba(22, 27, 36, 0.92);
    --theme-surface-light: rgba(31, 38, 50, 0.92);
    --theme-border: rgba(156, 179, 255, 0.18);
    --theme-border-strong: rgba(156, 179, 255, 0.38);
    --theme-text-primary: #eef2ff;
    --theme-text-secondary: #ced6f0;
    --theme-text-muted: #94a0c1;
    --theme-chat-bg: transparent;
    --theme-message-bg: rgba(31, 38, 50, 0.52);
    --theme-assistant-bubble: rgba(31, 38, 50, 0.72);
    --theme-input-bg: rgba(17, 20, 27, 0.56);
    --theme-input-border: rgba(156, 179, 255, 0.24);
    --ff-primary: #9cb3ff;
    --ff-primary-dark: #d2dcff;
    --ff-secondary: #c9d5ff;
    --ff-secondary-dark: #9cb3ff;
    --ff-accent: #e48b8b;
    --ff-accent-dark: #f0b1b1;
    --header-surface: rgba(17, 20, 27, 0.94);
    --border: rgba(156, 179, 255, 0.18);
    --surface: rgba(22, 27, 36, 0.96);
    --surface-light: rgba(31, 38, 50, 0.92);
    --text-primary: #eef2ff;
    --text-muted: #94a0c1;
    --logo-filter: none;
}

body.notebook-shell,
body.notebook-shell * {
    box-sizing: border-box;
}

body.notebook-shell {
    font-family: var(--font-ui);
    color: var(--theme-text-primary);
    background-color: var(--paper-bg);
    background-image:
        repeating-linear-gradient(
            180deg,
            transparent 0,
            transparent calc(var(--grid-size) - 1px),
            var(--rule-line) calc(var(--grid-size) - 1px),
            var(--rule-line) var(--grid-size)
        );
    background-attachment: fixed;
    line-height: var(--grid-size);
    font-size: 16px;
    letter-spacing: 0;
    overflow: hidden;
}

body.notebook-shell a {
    color: inherit;
}

body.notebook-shell *:focus-visible {
    outline: 2px dashed var(--pen-blue);
    outline-offset: 4px;
}

body.notebook-shell .app-container {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-width: 1400px;
    height: var(--app-height, 100vh);
    margin: 0 auto;
    padding: 0;
    background: transparent;
}

body.notebook-shell .app-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        180deg,
        transparent 0,
        transparent calc(var(--grid-size) - 1px),
        rgba(35, 59, 158, 0.12) calc(var(--grid-size) - 1px),
        rgba(35, 59, 158, 0.12) var(--grid-size)
    );
    pointer-events: none;
    opacity: 0.9;
    z-index: 0;
}

body.notebook-shell .sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    padding: 0;
    border-right: 2px solid var(--pen-blue);
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
    z-index: 2;
}

body.notebook-shell .sidebar::before,
body.notebook-shell .sidebar::after {
    display: none;
}

body.notebook-shell .sidebar.hidden,
body.notebook-shell .sidebar-start-collapsed .sidebar {
    width: 56px !important;
    min-width: 56px !important;
    flex: 0 0 56px !important;
    transform: none !important;
    padding: 0 !important;
    background: transparent;
    overflow: visible !important;
    border-radius: 0;
}

body.notebook-shell .sidebar.hidden > *,
body.notebook-shell .sidebar-start-collapsed .sidebar > * {
    display: none !important;
}

body.notebook-shell .restore-sidebar-btn {
    top: 26px;
    left: 18px;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 2px solid var(--pen-blue);
    background: var(--paper-card-strong);
    color: var(--pen-blue);
    box-shadow: var(--paper-shadow-soft);
}

body.notebook-shell .restore-sidebar-btn:hover {
    transform: translateY(-1px) rotate(-1deg);
    background: var(--pen-blue);
    color: var(--paper-bg);
}

body.notebook-shell .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: calc(var(--grid-size) * 3);
    margin-bottom: 0;
    padding: 0 24px;
    border-bottom: 2px solid var(--pen-blue);
    background: transparent;
}

body.notebook-shell .sidebar-header-content {
    gap: 16px;
}

body.notebook-shell .sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

body.notebook-shell .sidebar-logo {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.notebook-shell .sidebar-sketch-logo {
    width: 100%;
    height: 100%;
    stroke: var(--pen-blue);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

body.notebook-shell .sidebar-title {
    font-family: var(--font-hand);
    font-size: 1.6rem;
    line-height: 1;
    color: var(--pen-blue);
    letter-spacing: -0.03em;
    transform: rotate(-2deg);
    margin-bottom: 2px;
}

body.notebook-shell .sidebar-subtitle {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}

body.notebook-shell .sidebar-hamburger,
body.notebook-shell .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(35, 59, 158, 0.18);
    border-left: 2px solid var(--pen-blue);
    border-radius: 0;
    background: rgba(253, 253, 252, 0.54);
    color: var(--pen-blue);
    box-shadow: none;
    transform: rotate(-1deg);
}

body.notebook-shell .mobile-menu-btn {
    display: none;
}

body.notebook-shell .sidebar-hamburger:hover,
body.notebook-shell .mobile-menu-btn:hover {
    background: rgba(35, 59, 158, 0.06);
    border-color: rgba(35, 59, 158, 0.22);
    border-left-color: var(--pen-blue);
    transform: rotate(0deg);
}

body.notebook-shell .history-section {
    flex: 1 1 auto;
    min-height: 0;
    padding: 22px 0 12px;
    overflow-y: auto;
}

body.notebook-shell .history-section.is-empty-state {
    padding-top: 18px;
}

body.notebook-shell .history-section.is-empty-state .history-header {
    padding-bottom: 8px;
}

body.notebook-shell .history-section.is-empty-state .history-search {
    display: none;
}

body.notebook-shell .history-section.is-empty-state .conversation-list {
    padding-top: 8px;
}

body.notebook-shell .history-section::-webkit-scrollbar,
body.notebook-shell .chat-messages::-webkit-scrollbar {
    width: 9px;
}

body.notebook-shell .history-section::-webkit-scrollbar-thumb,
body.notebook-shell .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(35, 59, 158, 0.22);
    border-radius: 999px;
}

body.notebook-shell .history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 24px 12px;
}

body.notebook-shell .history-title {
    font-family: var(--font-mono);
    font-size: 0.73rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--theme-text-muted);
}

body.notebook-shell .new-chat-btn,
body.notebook-shell .sidebar-button,
body.notebook-shell .auth-button {
    appearance: none;
    border: 1px solid rgba(35, 59, 158, 0.18);
    border-left: 2px solid var(--pen-blue);
    background: rgba(253, 253, 252, 0.5);
    color: var(--theme-text-primary);
    border-radius: 0;
    transition:
        transform var(--transition-fast),
        background var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast);
}

body.notebook-shell .new-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-family: var(--font-hand);
    font-size: 1rem;
    color: var(--pen-blue);
    transform: rotate(-1deg);
}

body.notebook-shell .new-chat-btn:hover,
body.notebook-shell .sidebar-button:hover,
body.notebook-shell .auth-button:hover {
    background: rgba(35, 59, 158, 0.06);
    border-color: rgba(35, 59, 158, 0.22);
    border-left-color: var(--pen-blue);
    transform: rotate(0deg);
}

body.notebook-shell .history-search {
    position: relative;
    padding: 6px 24px 18px;
}

body.notebook-shell .search-input {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--theme-border);
    background: transparent;
    color: var(--pen-blue);
    padding: 0 28px 10px 0;
    font-family: var(--font-hand);
    font-size: 1.18rem;
    line-height: 1.2;
}

body.notebook-shell .search-input::placeholder,
body.notebook-shell .chat-input::placeholder {
    color: rgba(35, 59, 158, 0.52);
}

body.notebook-shell .search-input:focus,
body.notebook-shell .chat-input:focus {
    outline: none;
    border-color: var(--pen-blue);
}

body.notebook-shell .search-icon {
    position: absolute;
    right: 26px;
    top: 6px;
    color: var(--theme-text-muted);
    pointer-events: none;
}

body.notebook-shell .conversation-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 14px 14px 18px;
}

body.notebook-shell .conversation-item {
    position: relative;
    width: 100%;
    border: none;
    border-left: 2px solid transparent;
    border-radius: 0;
    padding: 8px 12px 10px 18px;
    background: rgba(253, 253, 252, 0.38);
    color: var(--theme-text-primary);
    text-align: left;
    cursor: pointer;
    transition:
        background var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast);
}

body.notebook-shell .conversation-item::before {
    content: "•";
    position: absolute;
    left: 4px;
    top: 10px;
    color: var(--pen-blue);
    opacity: 0;
    transform: translateX(-4px);
    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast);
}

body.notebook-shell .conversation-item:hover,
body.notebook-shell .conversation-item.active {
    background: rgba(35, 59, 158, 0.04);
    border-left-color: var(--pen-blue);
}

body.notebook-shell .conversation-item:hover::before,
body.notebook-shell .conversation-item.active::before {
    opacity: 1;
    transform: translateX(0);
}

body.notebook-shell .conversation-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}

body.notebook-shell .conversation-source {
    min-width: 0;
    color: var(--theme-text-muted);
}

body.notebook-shell .conversation-title {
    margin-bottom: 4px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.26;
}

body.notebook-shell .conversation-item.active .conversation-title {
    font-family: var(--font-hand);
    font-size: 1.12rem;
    color: var(--pen-blue);
    letter-spacing: -0.01em;
    transform: rotate(-1deg);
}

body.notebook-shell .conversation-item.active .conversation-source,
body.notebook-shell .conversation-item.active .conversation-time,
body.notebook-shell .conversation-item.active .conversation-meta {
    color: rgba(35, 59, 158, 0.78);
}

body.notebook-shell .conversation-preview {
    font-size: 0.79rem;
    line-height: 1.42;
    color: var(--theme-text-muted);
    margin-bottom: 6px;
}

body.notebook-shell .conversation-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}

body.notebook-shell .sidebar-starter-section {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 2px 0 6px;
}

body.notebook-shell .sidebar-starter-section + .sidebar-starter-section {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid rgba(35, 59, 158, 0.1);
}

body.notebook-shell .sidebar-starter-section.is-chip-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
}

body.notebook-shell .sidebar-starter-title {
    padding: 0 14px 4px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}

body.notebook-shell .sidebar-starter-section.is-chip-grid .sidebar-starter-title {
    grid-column: 1 / -1;
    padding-left: 14px;
    padding-right: 14px;
    padding-bottom: 2px;
}

body.notebook-shell .sidebar-starter-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: none;
    border-left: 2px solid transparent;
    border-radius: 0;
    padding: 6px 12px 6px 14px;
    background: rgba(253, 253, 252, 0.36);
    color: var(--theme-text-primary);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.28;
    text-align: left;
    cursor: pointer;
    transition:
        background var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

body.notebook-shell .history-section.is-empty-state .sidebar-starter-item {
    background: rgba(253, 253, 252, 0.55);
    border-left-color: rgba(35, 59, 158, 0.12);
}

body.notebook-shell .sidebar-starter-item::before {
    content: "•";
    flex-shrink: 0;
    color: var(--pen-blue);
    opacity: 0;
    transform: translateX(-4px);
    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast);
}

body.notebook-shell .sidebar-starter-item:hover,
body.notebook-shell .sidebar-starter-item:focus-visible {
    background: rgba(35, 59, 158, 0.05);
    border-left-color: var(--pen-blue);
    color: var(--pen-blue);
    transform: none;
}

body.notebook-shell .sidebar-starter-item:hover::before,
body.notebook-shell .sidebar-starter-item:focus-visible::before {
    opacity: 1;
    transform: translateX(0);
}

body.notebook-shell .sidebar-starter-item.is-command {
    font-family: var(--font-mono);
    font-size: 0.69rem;
    letter-spacing: 0.02em;
    color: var(--pen-blue-dark);
}

body.notebook-shell .sidebar-starter-section.is-chip-grid .sidebar-starter-item {
    justify-content: center;
    min-height: 38px;
    padding: 6px 8px;
    border: 1px dashed rgba(35, 59, 158, 0.18);
    border-left-width: 1px;
    border-radius: 0;
    background: rgba(253, 253, 252, 0.5);
    text-align: center;
}

body.notebook-shell .sidebar-starter-section.is-chip-grid .sidebar-starter-item::before {
    display: none;
}

body.notebook-shell .empty-history {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 10px 0 6px;
    padding: 10px 12px 10px 14px;
    border: 1px dashed var(--theme-border);
    border-radius: 16px;
    background: rgba(35, 59, 158, 0.03);
}

body.notebook-shell .empty-icon {
    margin-bottom: 0;
    font-size: 1.35rem !important;
    line-height: 1;
    font-family: var(--font-hand);
    color: var(--pen-blue) !important;
}

body.notebook-shell .empty-title {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
    margin-bottom: 0;
}

body.notebook-shell .empty-subtitle {
    display: none;
}

body.notebook-shell .sidebar-actions {
    flex-shrink: 0;
    display: grid;
    gap: 10px;
    padding: 18px 20px 20px;
    border-top: 2px solid rgba(35, 59, 158, 0.14);
}

body.notebook-shell .sidebar-button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    color: var(--theme-text-primary);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

body.notebook-shell .sidebar-button svg {
    flex-shrink: 0;
    color: var(--pen-blue);
}

body.notebook-shell .sidebar-button span {
    overflow: hidden;
    text-overflow: ellipsis;
}

body.notebook-shell .chat-container {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: 0 !important;
    width: auto !important;
    max-width: none !important;
    background: transparent;
    border-radius: 0;
    z-index: 1;
}

body.notebook-shell .chat-header {
    min-height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid var(--pen-blue);
    background: transparent;
}

body.notebook-shell .header-left,
body.notebook-shell .header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

body.notebook-shell .header-left {
    flex-shrink: 0;
}

body.notebook-shell .header-backlink {
    display: none !important;
}

body.notebook-shell .chat-title {
    display: none;
}

body.notebook-shell .sports-selector {
    margin-left: auto;
}

body.notebook-shell .header-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
}

body.notebook-shell .header-backlink,
body.notebook-shell .header-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid rgba(35, 59, 158, 0.18);
    border-left: 2px solid var(--pen-blue);
    border-radius: 0;
    background: rgba(253, 253, 252, 0.48);
    color: var(--theme-text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    transition:
        border-color var(--transition-fast),
        color var(--transition-fast),
        background var(--transition-fast),
        transform var(--transition-fast);
}

body.notebook-shell .header-backlink:hover,
body.notebook-shell .header-link:hover {
    color: var(--pen-blue);
    border-color: rgba(35, 59, 158, 0.22);
    border-left-color: var(--pen-blue);
    background: rgba(35, 59, 158, 0.06);
    transform: rotate(0deg);
}

body.notebook-shell .chat-title {
    font-family: var(--font-hand);
    font-size: 1.52rem;
    line-height: 1;
    color: var(--pen-blue);
    letter-spacing: -0.02em;
    transform: rotate(-2deg);
    white-space: nowrap;
}

body.notebook-shell .sports-dropdown {
    position: relative;
}

body.notebook-shell .sports-dropdown-toggle,
body.notebook-shell .model-selector-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid rgba(35, 59, 158, 0.18);
    border-left: 2px solid var(--pen-blue);
    border-radius: 0;
    background: rgba(253, 253, 252, 0.5);
    color: var(--theme-text-primary);
    cursor: pointer;
    transition:
        border-color var(--transition-fast),
        transform var(--transition-fast),
        background var(--transition-fast);
}

body.notebook-shell .sports-dropdown-toggle:hover,
body.notebook-shell .model-selector-button:hover {
    border-color: rgba(35, 59, 158, 0.22);
    border-left-color: var(--pen-blue);
    background: rgba(35, 59, 158, 0.06);
    transform: rotate(0deg);
}

body.notebook-shell .sports-dropdown-toggle span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

body.notebook-shell .sport-icon,
body.notebook-shell .model-selector-text {
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

body.notebook-shell .sport-name {
    font-family: var(--font-hand);
    font-size: 1.12rem;
    color: var(--pen-blue);
}

body.notebook-shell .dropdown-arrow,
body.notebook-shell .model-selector-arrow {
    color: var(--theme-text-muted);
    transition: transform var(--transition-fast);
}

body.notebook-shell .sports-dropdown.active .dropdown-arrow,
body.notebook-shell .floating-model-selector.open .model-selector-arrow {
    transform: rotate(180deg);
}

body.notebook-shell .sports-dropdown-menu,
body.notebook-shell .model-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 250px;
    padding: 10px;
    background: rgba(253, 253, 252, 0.98);
    border: 2px solid var(--pen-blue);
    border-radius: 0;
    box-shadow: var(--paper-shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast);
    z-index: 40;
}

body.notebook-shell .sports-dropdown.active .sports-dropdown-menu,
body.notebook-shell .floating-model-selector.open .model-dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

body.notebook-shell .sport-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-left: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

body.notebook-shell .sport-option:hover,
body.notebook-shell .sport-option.active {
    background: rgba(35, 59, 158, 0.06);
    border-left-color: var(--pen-blue);
}

body.notebook-shell .sport-option-disabled {
    cursor: not-allowed;
}

body.notebook-shell .sport-tag {
    margin-left: auto;
    padding: 4px 7px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(35, 59, 158, 0.08);
    color: var(--pen-blue);
}

body.notebook-shell .sport-tag.coming-soon {
    background: rgba(189, 71, 71, 0.12);
    color: var(--pen-red);
}

body.notebook-shell .single-sport .dropdown-arrow {
    display: none;
}

body.notebook-shell .theme-toggle {
    position: relative;
    width: 58px;
    height: 34px;
    padding: 3px;
    border: 1px solid rgba(35, 59, 158, 0.18);
    border-left: 2px solid var(--pen-blue);
    border-radius: 0;
    background: rgba(253, 253, 252, 0.48);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

body.notebook-shell .theme-toggle:hover {
    border-color: rgba(35, 59, 158, 0.22);
    border-left-color: var(--pen-blue);
    background: rgba(35, 59, 158, 0.06);
}

body.notebook-shell .theme-toggle-thumb {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: var(--pen-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(0);
    transition: transform var(--transition-medium), background var(--transition-medium);
    box-shadow: var(--ink-shadow);
}

body.notebook-shell .theme-toggle[data-theme="light"] .theme-toggle-thumb {
    transform: translateX(24px);
    background: #f2af3f;
}

body.notebook-shell .auth-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pen-blue);
}

body.notebook-shell .auth-button svg {
    flex-shrink: 0;
}

body.notebook-shell .signup-button {
    background: rgba(35, 59, 158, 0.08);
    color: var(--pen-blue);
    border-color: rgba(35, 59, 158, 0.22);
    border-left-color: var(--pen-blue);
}

body.notebook-shell .signup-button:hover {
    background: rgba(35, 59, 158, 0.12);
    color: var(--pen-blue);
}

body.notebook-shell .online-status {
    align-items: center;
    gap: 8px;
    padding: 7px 11px 7px 12px;
    border-radius: 0;
    border: 1px solid rgba(35, 59, 158, 0.18);
    border-left: 2px solid var(--pen-blue);
    background: rgba(253, 253, 252, 0.58);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--theme-text-muted);
}

body.notebook-shell .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pen-green);
    box-shadow: 0 0 0 4px rgba(23, 95, 75, 0.16);
}

body.notebook-shell .online-status.offline .status-dot,
body.notebook-shell .status-dot.offline {
    background: var(--pen-red);
    box-shadow: 0 0 0 4px rgba(189, 71, 71, 0.18);
}

body.notebook-shell .chat-messages {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
    overflow-y: auto;
    padding: 24px 0 10px;
    scroll-behavior: smooth;
}

body.notebook-shell .floating-model-selector,
body.notebook-shell #rate-limit-meter {
    width: 100%;
    margin: 0;
}

body.notebook-shell .floating-model-selector {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: 12;
}

body.notebook-shell .model-selector-button {
    width: 100%;
    justify-content: space-between;
    font-family: var(--font-hand);
    font-size: 1.12rem;
    color: var(--pen-blue);
}

body.notebook-shell .model-dropdown-menu {
    width: 100%;
}

body.notebook-shell #rate-limit-meter {
    --rate-limit-meter-fill: 0%;
    --rate-limit-meter-color: var(--ff-primary);
    position: relative;
    padding: 10px 12px;
    border-left: 2px solid var(--pen-blue);
    border-radius: 0;
    background: rgba(253, 253, 252, 0.78);
}

body.notebook-shell #rate-limit-meter.is-warning {
    border-left-color: #e5a53d;
    background: rgba(229, 165, 61, 0.08);
}

body.notebook-shell #rate-limit-meter.is-critical {
    border-left-color: var(--pen-red);
    background: rgba(189, 71, 71, 0.08);
}

body.notebook-shell .rate-limit-meter-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

body.notebook-shell .rate-limit-meter-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--theme-text-muted);
}

body.notebook-shell #rate-limit-meter.is-critical .rate-limit-meter-label {
    color: var(--pen-red);
}

body.notebook-shell .rate-limit-meter-upgrade {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
    color: var(--pen-blue);
}

body.notebook-shell .rate-limit-meter-track {
    height: 4px;
    border-radius: 999px;
    background: rgba(35, 59, 158, 0.08);
    overflow: hidden;
}

body.notebook-shell .rate-limit-meter-fill {
    width: var(--rate-limit-meter-fill);
    height: 100%;
    border-radius: 999px;
    background: var(--rate-limit-meter-color);
    transition: width 0.4s ease, background 0.4s ease;
}

body.notebook-shell .welcome-screen,
body.notebook-shell .message {
    position: relative;
    width: min(100%, 980px);
    max-width: 980px;
}

body.notebook-shell .welcome-screen {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    column-gap: 28px;
    gap: 0;
    padding: 12px var(--message-gutter) 8px var(--avatar-space);
    margin-bottom: 12px;
    align-items: start;
}

body.notebook-shell .welcome-screen h2 {
    grid-column: 1;
    font-family: var(--font-hand);
    font-size: clamp(2.4rem, 5vw, 3.25rem) !important;
    line-height: 1 !important;
    color: var(--pen-blue) !important;
    margin-bottom: 12px !important;
    letter-spacing: -0.03em;
    transform: rotate(-2deg);
}

body.notebook-shell .welcome-screen > p.text-sm:first-of-type {
    grid-column: 1;
    font-size: 1rem !important;
    line-height: 1.55 !important;
    color: var(--theme-text-secondary) !important;
    max-width: 640px;
}

body.notebook-shell .welcome-sidecar {
    grid-column: 2;
    grid-row: 1 / span 3;
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 6px 0 0 16px;
    border-left: 2px solid rgba(35, 59, 158, 0.18);
}

body.notebook-shell .welcome-sidecar > .floating-model-selector,
body.notebook-shell .welcome-sidecar > #rate-limit-meter {
    width: 100%;
    margin: 0;
}

body.notebook-shell .welcome-sidecar .model-selector-button {
    padding: 8px 12px;
    border-width: 1px;
    border-left-width: 2px;
    border-radius: 0;
    background: rgba(253, 253, 252, 0.52);
}

body.notebook-shell .welcome-sidecar .model-dropdown-menu {
    right: auto;
    left: 0;
}

body.notebook-shell .welcome-help-anchor {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin-top: 0;
    padding: 4px 0 0;
    border: none;
    border-radius: 0;
    background: transparent;
    z-index: 4;
}

body.notebook-shell .welcome-help-anchor::before {
    content: 'Need a tour?';
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}

body.notebook-shell .welcome-help-btn {
    width: 38px;
    height: 38px;
    border: 2px solid var(--pen-blue);
    border-radius: 12px;
    background: rgba(253, 253, 252, 0.76);
    color: var(--pen-blue);
    font-family: var(--font-hand);
    font-size: 1.28rem;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

body.notebook-shell .welcome-help-btn:hover {
    transform: rotate(-4deg);
    background: var(--pen-blue-soft);
}

body.notebook-shell .welcome-help-nudge {
    position: absolute;
    top: calc(100% + 12px);
    bottom: auto;
    left: auto;
    right: 0;
    width: min(244px, calc(100vw - 32px));
    padding: 12px 14px 12px 14px;
    border: 2px solid var(--pen-blue);
    border-radius: 18px;
    background: var(--paper-card-strong);
    box-shadow: var(--paper-shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 22;
}

body.notebook-shell .welcome-help-nudge.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

body.notebook-shell .welcome-help-nudge-close {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    background: transparent;
    color: var(--theme-text-muted);
    cursor: pointer;
    font-size: 1rem;
}

body.notebook-shell .help-nudge-cta {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--theme-text-primary);
    text-align: left;
    font-size: 0.92rem;
    line-height: 1.5;
    cursor: pointer;
    padding-right: 18px;
}

body.notebook-shell .welcome-help-popover {
    position: absolute;
    top: calc(100% + 12px);
    left: auto;
    right: 0;
    width: min(560px, calc(100vw - 48px));
    padding: 22px;
    border: 2px solid var(--pen-blue);
    border-radius: 0;
    background: var(--paper-card-strong);
    box-shadow: var(--paper-shadow);
    display: none;
    z-index: 23;
}

body.notebook-shell .welcome-help-popover.show {
    display: block;
}

body.notebook-shell .help-popover-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-family: var(--font-hand);
    font-size: 1.6rem;
    color: var(--theme-text-primary);
}

body.notebook-shell .help-popover-subtitle,
body.notebook-shell .help-popover-brand-text {
    color: var(--theme-text-secondary);
    font-size: 0.95rem;
    line-height: 1.55;
}

body.notebook-shell .help-popover-body {
    margin-top: 18px;
}

body.notebook-shell .help-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

body.notebook-shell .help-tab-btn {
    border: 1px solid var(--theme-border);
    border-left: 2px solid rgba(35, 59, 158, 0.18);
    background: rgba(253, 253, 252, 0.42);
    border-radius: 0;
    padding: 7px 12px;
    color: var(--theme-text-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-fast);
}

body.notebook-shell .help-tab-btn.is-active {
    background: rgba(35, 59, 158, 0.08);
    border-color: var(--pen-blue);
    color: var(--pen-blue);
}

body.notebook-shell .help-intro-card,
body.notebook-shell .help-feature-item,
body.notebook-shell .help-diagram-step,
body.notebook-shell .help-tip-box,
body.notebook-shell .help-example-item {
    border: 1px solid rgba(35, 59, 158, 0.16);
    border-left: 2px solid rgba(35, 59, 158, 0.22);
    background: rgba(253, 253, 252, 0.52);
    border-radius: 0;
    padding: 14px 15px;
}

body.notebook-shell .help-intro-eyebrow,
body.notebook-shell .help-step-label,
body.notebook-shell .help-plan-tier {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
    margin-bottom: 6px;
}

body.notebook-shell .help-intro-title {
    font-family: var(--font-hand);
    font-size: 1.45rem;
    color: var(--pen-blue);
    line-height: 1.1;
    margin-bottom: 8px;
}

body.notebook-shell .help-intro-copy,
body.notebook-shell .help-plan-copy,
body.notebook-shell .help-example-item,
body.notebook-shell .help-feature-item,
body.notebook-shell .help-diagram-step {
    color: var(--theme-text-secondary);
    font-size: 0.92rem;
    line-height: 1.55;
}

body.notebook-shell .help-section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 0 10px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}

body.notebook-shell .help-feature-grid,
body.notebook-shell .help-diagram,
body.notebook-shell .help-example-list,
body.notebook-shell .help-compact-list,
body.notebook-shell .help-two-col {
    display: grid;
    gap: 12px;
}

body.notebook-shell .help-feature-grid,
body.notebook-shell .help-two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.notebook-shell .help-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

body.notebook-shell .hf-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid rgba(35, 59, 158, 0.18);
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pen-blue);
    background: rgba(35, 59, 158, 0.05);
}

body.notebook-shell .help-code {
    padding: 2px 6px;
    border-radius: 0;
    background: rgba(35, 59, 158, 0.08);
    color: var(--pen-blue);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

body.notebook-shell .help-popover-brand {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-top: 16px;
    margin-top: 18px;
    border-top: 1px solid var(--theme-border);
}

body.notebook-shell .help-popover-brand a {
    color: var(--pen-blue);
    text-decoration: none;
    font-weight: 600;
}

body.notebook-shell .command-hints {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

body.notebook-shell .command-section-label {
    grid-column: 1 / -1;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}

body.notebook-shell .command-hint,
body.notebook-shell .example-prompt {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 64px;
    padding: 12px 14px;
    border: none;
    border-top: 1px dashed var(--theme-border);
    border-left: 2px solid rgba(35, 59, 158, 0.12);
    border-radius: 0;
    background: rgba(253, 253, 252, 0.18);
    cursor: pointer;
    transition:
        border-color var(--transition-fast),
        background var(--transition-fast);
}

body.notebook-shell .command-hint:hover,
body.notebook-shell .example-prompt:hover {
    border-color: var(--pen-blue);
    border-left-color: var(--pen-blue);
    background: rgba(35, 59, 158, 0.04);
}

body.notebook-shell .command-name {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pen-blue);
}

body.notebook-shell .command-desc {
    color: var(--theme-text-secondary);
    font-size: 0.84rem;
    line-height: 1.38;
}

body.notebook-shell .pro-badge {
    align-self: flex-start;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(189, 71, 71, 0.12);
    color: var(--pen-red);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

body.notebook-shell .pro-hint {
    border-style: dashed;
}

body.notebook-shell .command-toggle-details,
body.notebook-shell .pro-toggle-details {
    grid-column: 1 / -1;
}

body.notebook-shell .command-toggle-bar,
body.notebook-shell .pro-toggle-bar {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--theme-border);
    border-radius: 0;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
    background: rgba(253, 253, 252, 0.48);
}

body.notebook-shell .command-toggle-bar::-webkit-details-marker,
body.notebook-shell .pro-toggle-bar::-webkit-details-marker {
    display: none;
}

body.notebook-shell .command-toggle-arrow,
body.notebook-shell .pro-toggle-arrow {
    transition: transform var(--transition-fast);
}

body.notebook-shell .command-toggle-details[open] .command-toggle-arrow,
body.notebook-shell .pro-toggle-details[open] .pro-toggle-arrow {
    transform: rotate(180deg);
}

body.notebook-shell .command-commands-collapsible,
body.notebook-shell .pro-commands-collapsible {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

body.notebook-shell .example-prompts {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 6px;
}

body.notebook-shell .welcome-question-label,
body.notebook-shell .welcome-footer-note {
    grid-column: 1 / -1;
}

body.notebook-shell #seasonal-prompts .font-semibold {
    grid-column: 1 / -1;
    font-family: var(--font-hand);
    font-size: 1.12rem;
    color: var(--pen-blue) !important;
}

body.notebook-shell #seasonal-prompts span {
    color: var(--theme-text-secondary) !important;
}

body.notebook-shell .welcome-screen > p.text-xs:last-of-type,
body.notebook-shell #chat-disclaimer {
    font-size: 0.8rem !important;
    color: var(--theme-text-muted) !important;
    line-height: 1.5;
}

body.notebook-shell .message {
    display: flex;
    gap: 24px;
    width: min(100%, 900px);
    margin-bottom: var(--grid-size);
    position: relative;
}

body.notebook-shell .message.assistant,
body.notebook-shell .message.error {
    margin-right: auto;
    padding: 0 var(--message-gutter);
}

body.notebook-shell .message.user {
    margin-left: auto;
    flex-direction: row-reverse;
    padding: 0 var(--message-gutter);
}

body.notebook-shell .message::before {
    content: none;
}

body.notebook-shell .message-avatar {
    width: auto;
    min-width: 40px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 0;
    padding: 0;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--pen-blue);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: var(--grid-size);
}

body.notebook-shell .message.user .message-avatar {
    min-width: 32px;
    color: var(--pen-blue) !important;
    background: transparent !important;
    font-family: var(--font-hand);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0;
    justify-content: flex-end;
    transform: rotate(-2deg);
}

body.notebook-shell .message.assistant .message-avatar {
    color: var(--pen-blue) !important;
    background: transparent !important;
}

body.notebook-shell .message.error .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(189, 71, 71, 0.14);
    color: var(--pen-red);
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0;
}

body.notebook-shell .message-content {
    flex: 1;
    max-width: 100%;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: var(--theme-text-primary);
}

body.notebook-shell .message-text {
    color: var(--theme-text-primary);
    font-size: 1rem;
    line-height: var(--grid-size);
    white-space: pre-wrap;
    word-break: break-word;
}

body.notebook-shell .message-text.md-rendered,
body.notebook-shell .message-text.rich-command {
    white-space: normal;
}

body.notebook-shell .message.assistant .message-content {
    max-width: 780px;
    color: var(--theme-text-primary);
}

body.notebook-shell .message.user .message-content {
    max-width: min(720px, 100%);
    margin-left: auto;
    text-align: left;
    color: var(--pen-blue);
}

body.notebook-shell .message.user .message-text {
    color: var(--pen-blue);
    font-family: var(--font-hand);
    font-size: 1.2rem;
    line-height: var(--grid-size);
}

body.notebook-shell .message.error .message-text {
    color: var(--pen-red);
}

body.notebook-shell .message.error .message-content {
    padding-left: 16px !important;
    border-left: 2px solid rgba(189, 71, 71, 0.45) !important;
}

body.notebook-shell .error-icon {
    display: none;
}

body.notebook-shell .message-time {
    margin-top: 8px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}

body.notebook-shell .message.user .message-time {
    color: rgba(35, 59, 158, 0.7);
    text-align: right;
}

body.notebook-shell .typing .message-content {
    max-width: 220px;
}

body.notebook-shell .typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0 2px;
}

body.notebook-shell .typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pen-blue);
    opacity: 0.3;
    animation: notebook-bounce 1s infinite ease-in-out;
}

body.notebook-shell .typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

body.notebook-shell .typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes notebook-bounce {
    0%,
    80%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    40% {
        opacity: 0.9;
        transform: translateY(-4px);
    }
}

body.notebook-shell .message-text.md-rendered p,
body.notebook-shell .message-text.md-rendered ul,
body.notebook-shell .message-text.md-rendered ol,
body.notebook-shell .message-text.md-rendered pre,
body.notebook-shell .message-text.md-rendered blockquote,
body.notebook-shell .message-text.md-rendered hr,
body.notebook-shell .message-text.md-rendered h1,
body.notebook-shell .message-text.md-rendered h2,
body.notebook-shell .message-text.md-rendered h3,
body.notebook-shell .message-text.md-rendered h4 {
    margin: 0 0 24px;
}

body.notebook-shell .message-text.md-rendered p:last-child,
body.notebook-shell .message-text.md-rendered ul:last-child,
body.notebook-shell .message-text.md-rendered ol:last-child,
body.notebook-shell .message-text.md-rendered pre:last-child,
body.notebook-shell .message-text.md-rendered blockquote:last-child {
    margin-bottom: 0;
}

body.notebook-shell .message-text.md-rendered h1,
body.notebook-shell .message-text.md-rendered h2,
body.notebook-shell .message-text.md-rendered h3,
body.notebook-shell .message-text.md-rendered h4 {
    font-family: var(--font-hand);
    line-height: 1.15;
    color: var(--pen-blue);
}

body.notebook-shell .message-text.md-rendered ul,
body.notebook-shell .message-text.md-rendered ol {
    padding-left: 22px;
}

body.notebook-shell .message-text.md-rendered li + li {
    margin-top: 6px;
}

body.notebook-shell .message-text.md-rendered a {
    color: var(--pen-blue);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

body.notebook-shell .message-text.md-rendered code,
body.notebook-shell .message-text table code {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(35, 59, 158, 0.08);
    color: var(--pen-blue);
    font-family: var(--font-mono);
    font-size: 0.82em;
}

body.notebook-shell .message-text.md-rendered pre {
    padding: 14px 0 14px 16px;
    border-left: 2px solid var(--pen-blue);
    border-radius: 0;
    background: rgba(35, 59, 158, 0.05);
    overflow-x: auto;
}

body.notebook-shell .message-text.md-rendered pre code {
    display: block;
    padding: 0;
    background: transparent;
    color: inherit;
}

body.notebook-shell .message-text.md-rendered blockquote {
    padding-left: 16px;
    border-left: 2px solid var(--pen-blue);
    color: var(--theme-text-secondary);
}

body.notebook-shell .message-text.md-rendered .md-table-wrap {
    margin: 18px 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}
body.notebook-shell .message-text.md-rendered .md-table-wrap::-webkit-scrollbar { height: 6px; }
body.notebook-shell .message-text.md-rendered .md-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

body.notebook-shell .message-text table {
    width: max-content;
    min-width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    background: rgba(35, 59, 158, 0.035);
    white-space: nowrap;
}

body.notebook-shell .message-text th,
body.notebook-shell .message-text td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--theme-border);
    text-align: left;
    line-height: 1.45;
    white-space: nowrap;
}

body.notebook-shell .message-text th {
    color: var(--pen-blue);
    font-weight: 600;
    letter-spacing: 0.04em;
}

body.notebook-shell .message-text tbody tr:last-child td {
    border-bottom: none;
}

body.notebook-shell .message-text th[align="center"],
body.notebook-shell .message-text td[align="center"] {
    text-align: center;
}

body.notebook-shell .message-text th[align="right"],
body.notebook-shell .message-text td[align="right"] {
    text-align: right;
}

body.notebook-shell .message-text.rich-command > div {
    border-left: 2px solid var(--pen-blue);
    border-radius: 0;
    background: rgba(35, 59, 158, 0.05);
    padding: 12px 0 12px 16px;
}

body.notebook-shell .message-text.rich-command > div > * + * {
    margin-top: 12px;
}

body.notebook-shell .message-text.rich-command > .ff-command-card,
body.notebook-shell .ff-command-card {
    position: relative;
    display: grid;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    margin: 4px 0;
    padding: 14px 0 16px 18px;
    border-left: 3px solid var(--pen-blue);
    border-radius: 0;
    background:
        linear-gradient(180deg, rgba(35, 59, 158, 0.05), rgba(35, 59, 158, 0.025)),
        repeating-linear-gradient(
            180deg,
            transparent 0,
            transparent calc(var(--grid-size) - 1px),
            rgba(35, 59, 158, 0.06) calc(var(--grid-size) - 1px),
            rgba(35, 59, 158, 0.06) var(--grid-size)
        );
    box-shadow: inset 0 1px 0 rgba(35, 59, 158, 0.06);
    overflow: hidden;
}

body.notebook-shell .message-text.rich-command > .ff-command-card::before,
body.notebook-shell .ff-command-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 18px;
    right: 0;
    height: 1px;
    background: rgba(35, 59, 158, 0.18);
    transform: rotate(-0.35deg);
    transform-origin: left center;
    pointer-events: none;
}

body.notebook-shell .message-text.rich-command > .ff-command-card > * + * {
    margin-top: 0;
}

body.notebook-shell .ff-command-card > * {
    min-width: 0;
}

body.notebook-shell .ff-command-header,
body.notebook-shell .ff-command-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 18px;
    flex-wrap: wrap;
}

body.notebook-shell .ff-command-heading {
    flex: 1 1 280px;
    min-width: 0;
}

body.notebook-shell .ff-command-title {
    display: block;
    margin: 0;
    color: var(--pen-blue);
    font-family: var(--font-hand);
    font-size: clamp(1.35rem, 1.12rem + 0.55vw, 1.78rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
    transform: rotate(-1deg);
}

body.notebook-shell .ff-command-subtitle {
    display: block;
    margin-top: 4px;
    color: var(--theme-text-secondary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.5;
    text-transform: uppercase;
}

body.notebook-shell .ff-command-meta,
body.notebook-shell .ff-news-meta {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: wrap;
    color: var(--theme-text-muted);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.5;
    text-transform: uppercase;
}

body.notebook-shell .ff-command-meta {
    justify-content: flex-end;
}

body.notebook-shell .ff-command-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: var(--theme-text-secondary);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.4;
    text-transform: uppercase;
}

body.notebook-shell .ff-command-section-title::after {
    content: '';
    flex: 1 1 auto;
    min-width: 36px;
    height: 1px;
    background: rgba(35, 59, 158, 0.2);
    transform: rotate(-0.3deg);
}

body.notebook-shell .ff-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
    gap: 10px 12px;
}

body.notebook-shell .ff-command-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 84px;
    padding: 10px 12px 10px 14px;
    border-left: 2px solid rgba(35, 59, 158, 0.24);
    background: rgba(253, 253, 252, 0.44);
}

body.notebook-shell[data-theme="dark"] .ff-command-stat,
:root[data-theme="dark"] body.notebook-shell .ff-command-stat {
    background: rgba(17, 20, 27, 0.36);
}

body.notebook-shell .ff-command-stat-value {
    color: var(--pen-blue);
    font-size: clamp(1.32rem, 1.04rem + 0.65vw, 1.9rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

body.notebook-shell .ff-command-stat-label {
    margin-top: 6px;
    color: var(--theme-text-muted);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.45;
    text-transform: uppercase;
}

body.notebook-shell .ff-command-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0 4px;
    border-top: 1px solid rgba(35, 59, 158, 0.12);
    border-bottom: 1px solid rgba(35, 59, 158, 0.12);
    background: rgba(35, 59, 158, 0.025);
    -webkit-overflow-scrolling: touch;
}

body.notebook-shell .ff-command-table {
    width: max-content;
    min-width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    line-height: 1.45;
    white-space: nowrap;
}

body.notebook-shell .ff-command-table th,
body.notebook-shell .ff-command-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--theme-border);
    text-align: left;
    vertical-align: top;
}

body.notebook-shell .ff-command-table th.is-numeric,
body.notebook-shell .ff-command-table td.is-numeric {
    text-align: right;
}

body.notebook-shell .ff-command-table th {
    color: var(--pen-blue);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body.notebook-shell .ff-command-table tbody tr:nth-child(even) {
    background: rgba(35, 59, 158, 0.025);
}

body.notebook-shell .ff-command-table tbody tr:last-child td {
    border-bottom: none;
}

body.notebook-shell .ff-command-table th[align="center"],
body.notebook-shell .ff-command-table td[align="center"] {
    text-align: center;
}

body.notebook-shell .ff-command-table th[align="right"],
body.notebook-shell .ff-command-table td[align="right"] {
    text-align: right;
}

body.notebook-shell .ff-rank-badge,
body.notebook-shell .ff-pos-tag,
body.notebook-shell .ff-value-pill,
body.notebook-shell .ff-status-pill,
body.notebook-shell .ff-tier-badge,
body.notebook-shell .ff-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 26px;
    padding: 3px 9px 4px;
    border-left: 2px solid rgba(35, 59, 158, 0.26);
    background: rgba(35, 59, 158, 0.08);
    color: var(--pen-blue);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
    vertical-align: middle;
}

body.notebook-shell .ff-rank-badge {
    min-width: 2.5rem;
    padding-left: 10px;
    padding-right: 10px;
    transform: rotate(-1.2deg);
}

body.notebook-shell .ff-rank-badge[data-tone="elite"] {
    border-left-color: rgba(35, 59, 158, 0.52);
    background: rgba(35, 59, 158, 0.15);
}

body.notebook-shell .ff-rank-badge[data-tone="strong"] {
    border-left-color: rgba(23, 95, 75, 0.4);
    background: rgba(23, 95, 75, 0.11);
    color: var(--pen-green);
}

body.notebook-shell .ff-rank-badge[data-tone="solid"] {
    border-left-color: rgba(229, 165, 61, 0.42);
    background: rgba(229, 165, 61, 0.1);
    color: #ad6b17;
}

body.notebook-shell .ff-pos-tag {
    letter-spacing: 0.1em;
}

body.notebook-shell .ff-pos-tag.is-qb,
body.notebook-shell .ff-pos-tag[data-pos="QB"] {
    border-left-color: rgba(189, 71, 71, 0.35);
    background: rgba(189, 71, 71, 0.11);
    color: var(--pen-red);
}

body.notebook-shell .ff-pos-tag.is-rb,
body.notebook-shell .ff-pos-tag[data-pos="RB"] {
    border-left-color: rgba(35, 59, 158, 0.35);
}

body.notebook-shell .ff-pos-tag.is-wr,
body.notebook-shell .ff-pos-tag[data-pos="WR"] {
    border-left-color: rgba(23, 95, 75, 0.4);
    background: rgba(23, 95, 75, 0.11);
    color: var(--pen-green);
}

body.notebook-shell .ff-pos-tag.is-te,
body.notebook-shell .ff-pos-tag[data-pos="TE"] {
    border-left-color: rgba(229, 165, 61, 0.45);
    background: rgba(229, 165, 61, 0.12);
    color: #ad6b17;
}

body.notebook-shell .ff-pos-tag.is-dst,
body.notebook-shell .ff-pos-tag[data-pos="DST"],
body.notebook-shell .ff-pos-tag.is-k,
body.notebook-shell .ff-pos-tag[data-pos="K"] {
    border-left-color: rgba(117, 85, 198, 0.38);
    background: rgba(117, 85, 198, 0.12);
    color: #7555c6;
}

body.notebook-shell .ff-value-pill {
    color: var(--theme-text-secondary);
}

body.notebook-shell .ff-value-pill.is-positive,
body.notebook-shell .ff-value-pill.is-up,
body.notebook-shell .ff-value-pill[data-trend="up"],
body.notebook-shell .ff-value-pill[data-tone="positive"] {
    border-left-color: rgba(23, 95, 75, 0.42);
    background: rgba(23, 95, 75, 0.12);
    color: var(--pen-green);
}

body.notebook-shell .ff-value-pill.is-negative,
body.notebook-shell .ff-value-pill.is-down,
body.notebook-shell .ff-value-pill[data-trend="down"],
body.notebook-shell .ff-value-pill[data-tone="negative"] {
    border-left-color: rgba(189, 71, 71, 0.42);
    background: rgba(189, 71, 71, 0.12);
    color: var(--pen-red);
}

body.notebook-shell .ff-value-pill[data-tone="neutral"] {
    color: var(--theme-text-secondary);
}

body.notebook-shell .ff-status-pill {
    color: var(--theme-text-secondary);
}

body.notebook-shell .ff-status-pill.is-good,
body.notebook-shell .ff-status-pill.is-live,
body.notebook-shell .ff-status-pill[data-status="healthy"],
body.notebook-shell .ff-status-pill[data-status="active"],
body.notebook-shell .ff-status-pill[data-tone="positive"] {
    border-left-color: rgba(23, 95, 75, 0.42);
    background: rgba(23, 95, 75, 0.12);
    color: var(--pen-green);
}

body.notebook-shell .ff-status-pill.is-warning,
body.notebook-shell .ff-status-pill[data-status="questionable"],
body.notebook-shell .ff-status-pill[data-status="monitor"],
body.notebook-shell .ff-status-pill[data-tone="warning"],
body.notebook-shell .ff-status-pill[data-tone="caution"] {
    border-left-color: rgba(229, 165, 61, 0.45);
    background: rgba(229, 165, 61, 0.12);
    color: #ad6b17;
}

body.notebook-shell .ff-status-pill.is-danger,
body.notebook-shell .ff-status-pill.is-stale,
body.notebook-shell .ff-status-pill[data-status="out"],
body.notebook-shell .ff-status-pill[data-status="inactive"],
body.notebook-shell .ff-status-pill[data-tone="negative"] {
    border-left-color: rgba(189, 71, 71, 0.42);
    background: rgba(189, 71, 71, 0.12);
    color: var(--pen-red);
}

body.notebook-shell .ff-status-pill[data-tone="neutral"] {
    color: var(--theme-text-secondary);
}

body.notebook-shell .ff-tier-badge {
    border-left-color: rgba(35, 59, 158, 0.38);
    background: rgba(35, 59, 158, 0.1);
    transform: rotate(-0.9deg);
}

body.notebook-shell .ff-delta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--theme-text-secondary);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.3;
}

body.notebook-shell .ff-delta.is-up,
body.notebook-shell .ff-delta.is-positive,
body.notebook-shell .ff-delta[data-trend="up"],
body.notebook-shell .ff-delta[data-tone="positive"] {
    color: var(--pen-green);
}

body.notebook-shell .ff-delta.is-down,
body.notebook-shell .ff-delta.is-negative,
body.notebook-shell .ff-delta[data-trend="down"],
body.notebook-shell .ff-delta[data-tone="negative"] {
    color: var(--pen-red);
}

body.notebook-shell .ff-chip-list {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

body.notebook-shell .ff-chip {
    justify-content: flex-start;
}

body.notebook-shell .ff-command-note {
    padding: 10px 0 10px 14px;
    border-left: 2px solid rgba(35, 59, 158, 0.24);
    background: rgba(35, 59, 158, 0.05);
    color: var(--theme-text-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
}

body.notebook-shell .ff-command-note strong {
    color: var(--pen-blue);
}

body.notebook-shell .ff-command-note[data-tone="positive"] {
    border-left-color: rgba(23, 95, 75, 0.38);
    background: rgba(23, 95, 75, 0.08);
    color: var(--pen-green);
}

body.notebook-shell .ff-command-note[data-tone="negative"] {
    border-left-color: rgba(189, 71, 71, 0.38);
    background: rgba(189, 71, 71, 0.08);
    color: var(--pen-red);
}

body.notebook-shell .ff-command-note[data-tone="info"] {
    border-left-color: rgba(35, 59, 158, 0.3);
}

body.notebook-shell .ff-cmd-code {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px 4px;
    border-left: 2px solid rgba(35, 59, 158, 0.26);
    background: rgba(35, 59, 158, 0.08);
    color: var(--pen-blue);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

body.notebook-shell .ff-command-error {
    padding: 12px 0 12px 14px;
    border-left: 2px solid rgba(189, 71, 71, 0.42);
    background: rgba(189, 71, 71, 0.09);
    color: var(--pen-red);
    font-size: 0.96rem;
    line-height: 1.6;
}

body.notebook-shell .ff-help-row.is-gated {
    opacity: 0.62;
}

body.notebook-shell .ff-command-footer {
    padding-top: 8px;
    border-top: 1px solid rgba(35, 59, 158, 0.14);
    color: var(--theme-text-muted);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.5;
    text-transform: uppercase;
}

body.notebook-shell .ff-news-list {
    display: grid;
    gap: 12px;
}

body.notebook-shell .ff-news-item,
body.notebook-shell .ff-help-row {
    padding: 2px 0 10px 14px;
    border-left: 2px solid rgba(35, 59, 158, 0.18);
    border-bottom: 1px solid rgba(35, 59, 158, 0.12);
}

body.notebook-shell .ff-news-item:last-child,
body.notebook-shell .ff-help-row:last-child {
    border-bottom: none;
}

body.notebook-shell .ff-news-headline {
    display: block;
    color: var(--theme-text-primary);
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.42;
}

body.notebook-shell .ff-news-summary {
    margin-top: 4px;
    color: var(--theme-text-secondary);
    font-size: 0.92rem;
    line-height: 1.55;
}

body.notebook-shell .ff-news-meta {
    margin-top: 6px;
}

body.notebook-shell .ff-help-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 16px;
    color: var(--theme-text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

body.notebook-shell .ff-help-row code {
    justify-self: start;
    padding: 2px 8px;
    background: rgba(35, 59, 158, 0.08);
    color: var(--pen-blue);
    font-family: var(--font-mono);
    font-size: 0.8em;
}

body.notebook-shell .ff-command-link {
    color: var(--pen-blue);
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

body.notebook-shell .ff-command-link:hover {
    color: var(--pen-blue-dark);
}

body.notebook-shell .chat-input-container {
    position: relative;
    padding: 32px 48px;
    background: transparent;
}

body.notebook-shell .chat-input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    height: 2px;
    background: rgba(35, 59, 158, 0.28);
}

body.notebook-shell .chat-context-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    max-width: 900px;
}

body.notebook-shell .chat-context-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

body.notebook-shell .chat-context-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 8px 14px;
    border: none;
    border-left: 2px solid rgba(35, 59, 158, 0.22);
    border-radius: 0;
    background: rgba(253, 253, 252, 0.4);
}

body.notebook-shell .chat-context-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--theme-text-muted);
}

body.notebook-shell .chat-context-select {
    border: none;
    background: transparent;
    color: var(--pen-blue);
    font-family: var(--font-hand);
    font-size: 1.14rem;
    line-height: 1;
    padding-right: 12px;
    cursor: pointer;
}

body.notebook-shell .chat-context-select:focus {
    outline: none;
}

body.notebook-shell .data-freshness-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 8px 14px;
    border-radius: 0;
    border: none;
    border-left: 2px solid rgba(35, 59, 158, 0.22);
    background: rgba(253, 253, 252, 0.5);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--theme-text-secondary);
}

body.notebook-shell .data-freshness-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pen-green);
}

body.notebook-shell .data-freshness-pill.is-warning .data-freshness-dot {
    background: #e5a53d;
}

body.notebook-shell .data-freshness-pill.is-critical .data-freshness-dot,
body.notebook-shell .data-freshness-pill.is-stale .data-freshness-dot {
    background: var(--pen-red);
}

body.notebook-shell .chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 16px;
    max-width: 900px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

body.notebook-shell .chat-input-wrapper:focus-within {
    border-color: transparent;
    box-shadow: none;
    transform: none;
}

body.notebook-shell .chat-input {
    flex: 1;
    min-height: 64px;
    max-height: 240px;
    border: none;
    border-bottom: none;
    background: transparent;
    color: var(--pen-blue);
    font-family: var(--font-hand);
    font-size: 1.18rem;
    line-height: var(--grid-size);
    padding: 0;
    resize: none;
    box-shadow: none;
}

body.notebook-shell .chat-input::placeholder {
    color: rgba(35, 59, 158, 0.42);
}

body.notebook-shell .send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 120px;
    height: 48px;
    padding: 0 24px;
    border: 2px solid var(--pen-blue);
    border-radius: 0;
    background: transparent;
    color: var(--pen-blue);
    font-family: var(--font-hand);
    font-size: 1rem;
    font-weight: 700;
    transform: rotate(-1deg);
    transition:
        transform var(--transition-fast),
        background var(--transition-fast),
        color var(--transition-fast),
        opacity var(--transition-fast);
}

body.notebook-shell .send-button svg {
    width: 18px;
    height: 18px;
}

body.notebook-shell .send-button:hover:not(:disabled) {
    background: var(--pen-blue);
    color: var(--paper-bg);
    transform: rotate(0deg);
}

body.notebook-shell .send-button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

body.notebook-shell #chat-disclaimer {
    margin-top: 14px !important;
}

body.notebook-shell #chat-disclaimer a {
    color: var(--pen-blue) !important;
    text-decoration: none;
}

body.notebook-shell .command-palette {
    position: absolute;
    left: 0;
    bottom: calc(100% + 16px);
    width: min(640px, 100%);
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    border: 2px solid var(--pen-blue);
    border-radius: 20px;
    background: var(--paper-card-strong);
    box-shadow: var(--paper-shadow);
    z-index: 18;
}

body.notebook-shell .command-palette.show {
    display: flex;
}

body.notebook-shell .command-palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 14px;
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

body.notebook-shell .command-palette-item:hover {
    background: var(--pen-blue-soft);
    transform: translateX(2px);
}

body.notebook-shell .cp-cmd {
    min-width: 108px;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pen-blue);
}

body.notebook-shell .cp-desc {
    color: var(--theme-text-secondary);
    font-size: 0.9rem;
}

body.notebook-shell .cp-tier-badge {
    margin-left: auto;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(189, 71, 71, 0.14);
    color: var(--pen-red);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body.notebook-shell .command-palette-item-gated .cp-desc {
    color: var(--theme-text-muted);
}

body.notebook-shell .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 22, 0.48);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 1100;
}

body.notebook-shell .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

body.notebook-shell .custom-modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 14, 22, 0.36);
    backdrop-filter: blur(4px);
    z-index: 2000;
}

body.notebook-shell .custom-modal-overlay.show {
    display: flex;
}

body.notebook-shell .custom-modal {
    width: min(460px, 100%);
    padding: 24px;
    border: 2px solid var(--pen-blue);
    border-radius: 26px;
    background: var(--paper-card-strong);
    box-shadow: var(--paper-shadow);
}

body.notebook-shell .custom-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-family: var(--font-hand);
    font-size: 1.58rem;
    color: var(--pen-blue);
}

body.notebook-shell .custom-modal-message {
    color: var(--theme-text-secondary);
    font-size: 0.98rem;
    line-height: 1.6;
}

body.notebook-shell .custom-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

body.notebook-shell .custom-modal-button {
    border: 2px solid var(--theme-border-strong);
    border-radius: 14px;
    background: transparent;
    color: var(--theme-text-primary);
    padding: 10px 16px;
    font-family: var(--font-hand);
    font-size: 1.06rem;
    cursor: pointer;
}

body.notebook-shell .custom-modal-button.secondary:hover {
    background: var(--pen-blue-soft);
    border-color: var(--pen-blue);
}

body.notebook-shell .custom-modal-button.danger {
    background: var(--pen-blue);
    border-color: var(--pen-blue);
    color: var(--paper-bg);
}

body.notebook-shell .custom-modal-button.danger:hover {
    background: var(--pen-blue-dark);
}

@media (max-width: 1180px) {
    body.notebook-shell .app-container {
        padding: 16px 18px 18px 16px;
    }

    body.notebook-shell .chat-header {
        flex-wrap: wrap;
        align-items: center;
        padding-top: 14px;
        padding-bottom: 14px;
    }

    body.notebook-shell .sports-selector {
        margin-left: 0;
        order: 3;
    }

    body.notebook-shell .header-controls {
        margin-left: auto;
    }

    body.notebook-shell .command-hints,
    body.notebook-shell .command-commands-collapsible {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.notebook-shell .example-prompts,
    body.notebook-shell .help-feature-grid,
    body.notebook-shell .help-two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    body.notebook-shell .app-container {
        padding: 0;
        max-width: none;
    }

    body.notebook-shell .sidebar,
    body.notebook-shell .sidebar.hidden,
    body.notebook-shell .sidebar-start-collapsed .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(94vw, 360px) !important;
        min-width: 0 !important;
        flex: none !important;
        padding: 0 0 20px !important;
        transform: translateX(-108%) !important;
        border-radius: 0 24px 24px 0;
        background: var(--paper-bg) !important;
        box-shadow: 24px 0 56px rgba(10, 14, 22, 0.26);
        z-index: 1200;
        overflow: hidden !important;
    }

    body.notebook-shell .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    body.notebook-shell .sidebar.hidden > *,
    body.notebook-shell .sidebar-start-collapsed .sidebar > * {
        display: inherit;
    }

    body.notebook-shell .chat-container {
        width: 100% !important;
        border-radius: 0;
    }

    body.notebook-shell .mobile-menu-btn {
        display: inline-flex !important;
    }

    body.notebook-shell .sidebar-hamburger {
        display: inline-flex !important;
    }

    body.notebook-shell .restore-sidebar-btn {
        display: none !important;
    }

    body.notebook-shell .chat-header {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        min-height: auto !important;
        padding: 16px !important;
        gap: 10px !important;
    }

    body.notebook-shell .header-left {
        order: 1;
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        overflow: visible !important;
        justify-content: flex-start;
    }

    body.notebook-shell .chat-title {
        display: block;
        font-size: 1.42rem !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    body.notebook-shell .sports-selector,
    body.notebook-shell .header-controls {
        margin-left: 0;
    }

    body.notebook-shell .header-controls {
        order: 2;
        width: auto !important;
        margin-left: auto !important;
        flex-wrap: nowrap !important;
        justify-content: flex-end !important;
    }

    body.notebook-shell .sports-selector {
        order: 3;
        width: 100% !important;
        display: block !important;
    }

    body.notebook-shell .sports-dropdown,
    body.notebook-shell .sports-dropdown-toggle {
        width: 100%;
        display: block;
    }

    body.notebook-shell .header-backlink {
        display: none;
    }

    body.notebook-shell .sidebar-actions {
        gap: 8px;
        padding: 14px 20px 16px;
    }

    body.notebook-shell .sidebar-button {
        padding: 9px 12px;
        font-size: 0.82rem;
    }

    body.notebook-shell .chat-messages,
    body.notebook-shell .chat-input-container {
        padding-left: 0;
        padding-right: 0;
    }

    body.notebook-shell .welcome-screen,
    body.notebook-shell .message.assistant,
    body.notebook-shell .message.error,
    body.notebook-shell .message.user {
        width: 100%;
        padding-right: 16px;
        padding-left: 16px;
    }

    body.notebook-shell .welcome-screen {
        display: flex;
        flex-direction: column;
        grid-template-columns: 1fr;
        padding: 16px 16px 8px !important;
    }

    body.notebook-shell .welcome-screen > h2 {
        order: 1;
    }

    body.notebook-shell .welcome-screen > p.text-sm:first-of-type {
        order: 2;
    }

    body.notebook-shell .welcome-sidecar,
    body.notebook-shell .welcome-screen > h2,
    body.notebook-shell .welcome-screen > p.text-sm:first-of-type,
    body.notebook-shell .welcome-question-label,
    body.notebook-shell .welcome-footer-note {
        grid-column: 1;
    }

    body.notebook-shell .welcome-sidecar {
        order: 3;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        grid-row: auto;
        gap: 10px;
        margin: 8px 0 10px;
        padding: 0;
        border-left: none;
    }

    body.notebook-shell .welcome-sidecar > .floating-model-selector {
        grid-column: 1;
        grid-row: 1;
    }

    body.notebook-shell .welcome-sidecar > #rate-limit-meter {
        grid-column: 1 / -1;
        grid-row: 2;
        position: static !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        text-align: left !important;
        z-index: auto !important;
    }

    body.notebook-shell .message {
        gap: 14px;
        margin-bottom: 24px;
    }

    body.notebook-shell .message-avatar {
        width: 32px;
        height: 32px;
    }

    body.notebook-shell .message.user .message-avatar {
        font-size: 1.3rem;
    }

    body.notebook-shell .chat-input-container {
        padding: 14px 16px 18px;
    }

    body.notebook-shell .welcome-help-anchor {
        position: relative;
        top: auto !important;
        right: auto !important;
        display: flex;
        justify-content: flex-end;
        width: auto;
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        align-self: start;
        margin: 0;
        padding: 0;
        border: none;
        background: transparent;
    }

    body.notebook-shell .welcome-help-anchor::before {
        content: none;
    }

    body.notebook-shell .welcome-help-nudge {
        right: 0;
        width: min(280px, calc(100vw - 48px));
    }

    body.notebook-shell .chat-input-container::before {
        left: 16px;
        right: 16px;
    }

    body.notebook-shell .chat-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    body.notebook-shell .send-button {
        width: 100%;
        transform: none;
    }

    body.notebook-shell .command-palette {
        width: 100%;
    }

    body.notebook-shell .command-hints,
    body.notebook-shell .command-commands-collapsible {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    body.notebook-shell .command-hint,
    body.notebook-shell .example-prompt {
        min-height: 64px;
        padding: 10px 12px;
    }

    body.notebook-shell .command-desc {
        font-size: 0.78rem;
        line-height: 1.32;
    }

    body.notebook-shell .chat-context-bar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 10px;
    }

    body.notebook-shell .chat-context-controls {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    body.notebook-shell .chat-context-control {
        width: 100%;
        justify-content: space-between;
        padding: 7px 10px;
    }

    body.notebook-shell .chat-context-label,
    body.notebook-shell .data-freshness-pill {
        font-size: 0.62rem;
        letter-spacing: 0.08em;
    }

    body.notebook-shell .chat-context-select {
        min-width: 0;
        font-size: 1rem;
    }

    body.notebook-shell .data-freshness-pill {
        grid-column: 1 / -1;
        justify-content: center;
        padding: 7px 10px;
    }

    body.notebook-shell .ff-command-card,
    body.notebook-shell .message-text.rich-command > .ff-command-card {
        gap: 14px;
        padding: 12px 0 14px 14px;
    }

    body.notebook-shell .ff-command-card::before,
    body.notebook-shell .message-text.rich-command > .ff-command-card::before {
        left: 14px;
    }

    body.notebook-shell .ff-command-header,
    body.notebook-shell .ff-command-footer {
        gap: 10px 14px;
    }

    body.notebook-shell .ff-command-meta {
        justify-content: flex-start;
    }

    body.notebook-shell .ff-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    body.notebook-shell .ff-command-stat {
        min-height: 76px;
        padding: 10px 10px 10px 12px;
    }

    body.notebook-shell .ff-command-table {
        font-size: 0.72rem;
    }

    body.notebook-shell .ff-command-table th,
    body.notebook-shell .ff-command-table td {
        padding: 8px 10px;
    }

    body.notebook-shell .ff-news-headline {
        font-size: 0.92rem;
    }

    body.notebook-shell .ff-news-summary,
    body.notebook-shell .ff-command-note {
        font-size: 0.88rem;
        line-height: 1.55;
    }

    body.notebook-shell .ff-help-row {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    body.notebook-shell .command-hints {
        gap: 10px;
    }

    body.notebook-shell .command-hint,
    body.notebook-shell .example-prompt {
        min-height: 70px;
        padding: 12px 14px;
    }

    body.notebook-shell .welcome-help-nudge {
        display: none !important;
    }

    body.notebook-shell .command-hints {
        display: none;
    }

    body.notebook-shell .welcome-question-label,
    body.notebook-shell #seasonal-prompts {
        display: none;
    }

    body.notebook-shell .welcome-footer-note {
        display: none;
        margin-top: 10px !important;
    }
}

@media (max-width: 640px) {
    body.notebook-shell .header-controls {
        gap: 8px;
        justify-content: flex-end;
    }

    body.notebook-shell .header-backlink,
    body.notebook-shell .header-link,
    body.notebook-shell .auth-button {
        width: auto;
        padding-left: 10px;
        padding-right: 10px;
    }

    body.notebook-shell .auth-button-label {
        display: none;
    }

    body.notebook-shell .welcome-screen h2 {
        font-size: clamp(1.72rem, 7.6vw, 2.02rem) !important;
        line-height: 1.02 !important;
    }

    body.notebook-shell .welcome-help-btn {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 1.15rem;
    }

    body.notebook-shell .message.user .message-text {
        font-size: 1.28rem;
    }

    body.notebook-shell .message.assistant .message-text,
    body.notebook-shell .message.assistant .message-text.md-rendered {
        font-size: 0.96rem;
        line-height: 1.6;
    }

    body.notebook-shell .ff-command-title {
        font-size: 1.28rem;
    }

    body.notebook-shell .ff-command-subtitle,
    body.notebook-shell .ff-command-meta,
    body.notebook-shell .ff-news-meta,
    body.notebook-shell .ff-command-footer {
        font-size: 0.6rem;
        letter-spacing: 0.08em;
    }

    body.notebook-shell .chat-input {
        font-size: 1.18rem;
        min-height: 68px;
    }

    body.notebook-shell .help-popover-title {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    body.notebook-shell .sidebar,
    body.notebook-shell .sidebar.hidden,
    body.notebook-shell .sidebar-start-collapsed .sidebar {
        width: calc(100vw - 10px) !important;
    }

    body.notebook-shell .ff-stat-grid {
        grid-template-columns: 1fr;
    }

    body.notebook-shell .ff-rank-badge,
    body.notebook-shell .ff-pos-tag,
    body.notebook-shell .ff-value-pill,
    body.notebook-shell .ff-status-pill,
    body.notebook-shell .ff-tier-badge,
    body.notebook-shell .ff-chip {
        font-size: 0.64rem;
    }
}

@media (max-height: 920px) and (min-width: 901px) {
    body.notebook-shell #rate-limit-meter {
        margin-top: 4px;
    }

    body.notebook-shell .welcome-screen {
        padding-top: 10px;
        margin-bottom: 8px;
    }

    body.notebook-shell .welcome-screen h2 {
        font-size: clamp(2.1rem, 4.1vw, 2.85rem) !important;
        margin-bottom: 8px !important;
    }

    body.notebook-shell .welcome-help-nudge,
    body.notebook-shell .welcome-question-label,
    body.notebook-shell #seasonal-prompts {
        display: none !important;
    }

    body.notebook-shell .welcome-footer-note {
        margin-top: 10px !important;
    }
}
