/* Reusable controls, cards, messages, charts, and feedback UI. */

.nav {
        display: grid;
        gap: 4px;
        flex: 1 1 auto;
        align-content: start;
      }

.nav button {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        border-radius: 8px;
        color: var(--muted);
        background: transparent;
        cursor: pointer;
        text-align: left;
        font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 13px;
        line-height: 16px;
        transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
      }

.nav button.active {
        color: #000000;
        background: #ffffff;
        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
        font-weight: 700;
      }

.nav button:hover {
        color: var(--text);
        background: var(--surface-2);
      }

.btn.sidebar-new-chat {
        width: 100%;
        min-height: 40px;
        display: none;
      }

body[data-active-tab="study"] .btn.sidebar-new-chat {
        display: inline-flex;
      }

.nav svg,
      .icon {
        width: 18px;
        height: 18px;
        flex: 0 0 auto;
      }

.dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--green);
        box-shadow: 0 0 0 4px rgba(47, 143, 107, 0.12);
      }

.panel,
      .item {
        border: 1px solid var(--line-soft);
        border-radius: 12px;
        background: var(--surface);
      }

.panel {
        padding: 25px;
        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
      }

.panel-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        margin-bottom: 14px;
      }

.panel h3 {
        color: #000000;
        font-size: 18px;
        line-height: 24px;
        font-weight: 650;
      }

.panel-head.compact {
        margin-top: 0;
      }

.muted {
        color: var(--muted);
      }

.small {
        font-size: 13px;
        line-height: 1.55;
      }

.row {
        display: flex;
        align-items: center;
        gap: 10px;
      }

.wrap {
        flex-wrap: wrap;
      }

.btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 38px;
        padding: 0 14px;
        border-radius: 8px;
        color: var(--text);
        background: var(--surface);
        border: 1px solid var(--line-soft);
        cursor: pointer;
        white-space: nowrap;
        font-weight: 600;
        font-size: 13px;
        transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
      }

.btn:hover {
        background: var(--surface-2);
        border-color: var(--line);
      }

.btn.primary {
        color: #ffffff;
        border-color: #000000;
        background: #000000;
        font-weight: 700;
      }

.btn.primary:hover {
        background: #565e74;
        border-color: #565e74;
      }

#newChat {
        color: #ffffff;
        border-color: #000000;
        background: #000000;
      }

#newChat:hover {
        border-color: #565e74;
        background: #565e74;
      }

.btn.danger {
        color: var(--red);
        background: #ffffff;
      }

.btn:disabled {
        cursor: not-allowed;
        opacity: 0.55;
      }

.field,
      .select,
      .textarea {
        width: 100%;
        min-height: 40px;
        color: var(--text);
        background: var(--surface-2);
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        outline: none;
      }

.field,
      .select {
        padding: 0 12px;
      }

.field:focus,
      .select:focus,
      .textarea:focus {
        border-color: var(--tertiary);
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
      }

.dropzone {
        display: grid;
        place-items: center;
        min-height: 180px;
        padding: 22px;
        border: 1px dashed var(--line);
        border-radius: 12px;
        background: var(--surface-2);
        text-align: center;
        cursor: pointer;
      }

.icon-btn {
        width: 32px;
        height: 32px;
        display: inline-grid;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 4px;
        color: var(--muted);
        background: transparent;
        cursor: pointer;
      }

.icon-btn:hover {
        color: var(--text);
        background: var(--surface-2);
      }

.icon-btn.compact {
        width: 28px;
        height: 28px;
      }

.icon-btn.danger:hover {
        color: var(--red);
        background: rgba(239, 68, 68, 0.08);
      }

.dropzone.dragging {
        border-color: #565e74;
        background: var(--surface-2);
      }

.dropzone strong {
        display: block;
        margin-bottom: 8px;
        font-size: 18px;
      }

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

.item {
        padding: 13px;
      }

.item-title {
        font-weight: 700;
        line-height: 1.4;
        word-break: break-word;
      }

.meta {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 8px;
        color: var(--muted);
        font-size: 12px;
      }

.badge {
        display: inline-flex;
        align-items: center;
        min-height: 24px;
        padding: 0 8px;
        border-radius: 999px;
        border: 1px solid var(--line);
        color: var(--muted);
        background: var(--surface-2);
        font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 12px;
      }

.badge.parsed {
        color: var(--green);
        border-color: rgba(47, 143, 107, 0.34);
      }

.badge.failed {
        color: var(--red);
        border-color: rgba(184, 74, 74, 0.34);
      }

.badge.gold {
        color: var(--text);
        border-color: var(--line-soft);
        background: #ffffff;
      }

.chat-box {
        height: clamp(430px, calc(100vh - 384px), 640px);
        min-height: 400px;
        overflow: auto;
        display: grid;
        align-content: start;
        gap: 16px;
        padding: 24px;
        border: 1px solid var(--line-soft);
        border-radius: 12px;
        background: #ffffff;
      }

.message {
        max-width: 84%;
        padding: 16px;
        border-radius: 12px;
        line-height: 1.65;
        white-space: pre-wrap;
        border: 1px solid transparent;
      }

.message.user {
        justify-self: end;
        color: var(--text);
        border-color: var(--line-soft);
        background: var(--surface-2);
      }

.message.assistant {
        justify-self: start;
        border-color: var(--line-soft);
        border-left: 4px solid #07006c;
        background: var(--surface);
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
      }

.markdown-body {
        white-space: normal;
      }

.markdown-body h1,
      .markdown-body h2,
      .markdown-body h3 {
        margin: 14px 0 8px;
        line-height: 1.35;
      }

.markdown-body h1:first-child,
      .markdown-body h2:first-child,
      .markdown-body h3:first-child,
      .markdown-body p:first-child {
        margin-top: 0;
      }

.markdown-body h1 {
        color: var(--text);
        font-size: 18px;
      }

.markdown-body h2,
      .markdown-body h3 {
        font-size: 16px;
      }

.markdown-body p {
        margin: 0 0 10px;
      }

.markdown-body p:last-child {
        margin-bottom: 0;
      }

.markdown-body ul,
      .markdown-body ol {
        margin: 8px 0;
        padding-left: 20px;
      }

.markdown-body table {
        width: 100%;
        margin: 10px 0;
        border-collapse: collapse;
        font-size: 14px;
      }

.markdown-body th,
      .markdown-body td {
        padding: 8px 9px;
        border: 1px solid var(--line);
        text-align: left;
        vertical-align: top;
      }

.markdown-body th {
        color: var(--text);
        background: var(--surface-2);
      }

.message-wrap {
        display: grid;
        justify-items: start;
        gap: 8px;
      }

.message-label {
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
      }

.message-wrap.user {
        justify-items: end;
      }

.history-item {
        width: 100%;
        padding: 12px;
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        color: var(--text);
        background: var(--surface);
        cursor: pointer;
        text-align: left;
      }

.history-item.active {
        border-color: var(--line-soft);
        background: var(--surface-2);
      }

.history-item .btn.danger {
        min-height: 32px;
        padding: 0 10px;
        background: #fff8ef;
      }

.history-item .row {
        align-items: flex-start;
      }

.inline-citations {
        max-width: min(84%, 720px);
        padding: 10px 12px;
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        background: var(--surface-2);
      }

.study-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(180px, 0.6fr);
        gap: 10px;
        margin-bottom: 12px;
      }

.control-card {
        display: grid;
        gap: 6px;
        padding: 10px;
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        background: var(--surface);
      }

.control-label,
      .insight-kicker {
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.02em;
      }

.chat-status {
        min-height: 38px;
        margin-bottom: 12px;
        padding: 9px 11px;
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        color: var(--muted);
        background: var(--surface-2);
        font-size: 13px;
        line-height: 1.45;
      }

.chat-status.is-busy {
        color: #006a61;
      }

.chat-status.error {
        color: var(--red);
        border-color: rgba(184, 74, 74, 0.34);
        background: #fff3ee;
      }

.composer {
        margin-top: 12px;
        border: 1px solid var(--line-soft);
        border-radius: 12px;
        background: var(--surface);
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
        overflow: hidden;
      }

.composer .textarea {
        min-height: 92px;
        border: 0;
        border-radius: 0;
        background: var(--surface);
      }

.composer .textarea:focus {
        box-shadow: none;
      }

.composer-actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px;
        border-top: 1px solid var(--line-soft);
        background: #f7f9fb;
      }

.composer-buttons {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
      }

.composer-attachment {
        padding: 0 10px 10px;
      }

.attachment-chip {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px;
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        background: #fff;
      }

.attachment-chip img {
        width: 44px;
        height: 44px;
        object-fit: cover;
        border-radius: 6px;
        border: 1px solid var(--line-soft);
      }

.context-divider {
        height: 1px;
        margin: 18px 0;
        background: var(--line-soft);
      }

.insight-card {
        padding: 12px;
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        background: var(--surface);
        line-height: 1.6;
      }

.insight-card.accent {
        border-color: #c0c1ff;
        background: #f5f3ff;
      }

body[data-active-tab="study"] .study-history-panel,
      body[data-active-tab="study"] .study-context-panel {
        display: flex;
        flex-direction: column;
        padding: 0;
        min-height: 0;
        min-width: 0;
      }

body[data-active-tab="study"] .study-history-panel .panel-head,
      body[data-active-tab="study"] .study-context-panel > .panel-head:first-child {
        flex: 0 0 auto;
        margin: 0;
        padding: 16px;
        border-bottom: 1px solid var(--line-soft);
      }

body[data-active-tab="study"] .study-history-panel .panel-head h3,
      body[data-active-tab="study"] .context-section-title {
        color: var(--muted);
        font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 13px;
        line-height: 16px;
        font-weight: 650;
        letter-spacing: 0.05em;
      }

body[data-active-tab="study"] .study-history-panel .panel-head h3,
      body[data-active-tab="study"] .context-section-title {
        text-transform: uppercase;
      }

body[data-active-tab="study"] .study-chat-panel > .panel-head {
        display: none;
      }

body[data-active-tab="study"] .study-chat-panel #newChat {
        display: none;
      }

body[data-active-tab="study"] .study-chat-panel > .panel-head p {
        display: none;
      }

body[data-active-tab="study"] #chatHistory,
      body[data-active-tab="study"] #citationList,
      body[data-active-tab="study"] #learningInsights {
        padding: 8px;
      }

body[data-active-tab="study"] #citationList,
      body[data-active-tab="study"] #learningInsights {
        padding: 0;
      }

body[data-active-tab="study"] #chatHistory {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: 4px;
        overflow-x: hidden;
        overflow-y: auto;
      }

body[data-active-tab="study"] .study-context-panel > #citationList {
        display: none;
      }

body[data-active-tab="study"] .study-context-panel > #learningInsights {
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
      }

body[data-active-tab="study"] .context-divider {
        flex: 0 0 auto;
        margin: 16px;
      }

body[data-active-tab="study"] .context-section-title {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
        padding: 16px 16px 12px;
      }

body[data-active-tab="study"] .context-section-title .icon {
        width: 14px;
        height: 14px;
      }

body[data-active-tab="study"] .study-context-panel .panel-head.compact {
        flex: 0 0 auto;
        padding: 16px 16px 8px;
        border-bottom: 0;
      }

body[data-active-tab="study"] .study-controls {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        height: 56px;
        margin: 0;
        padding: 10px 24px;
        border-bottom: 1px solid var(--line-soft);
        background: rgba(247, 249, 251, 0.82);
        backdrop-filter: blur(2px);
        min-width: 0;
      }

body[data-active-tab="study"] .study-controls .control-card {
        width: 240px;
        flex: 0 0 240px;
        max-width: 320px;
        display: flex;
        align-items: center;
        padding: 0;
        border: 0;
        background: transparent;
        min-width: 0;
      }

body[data-active-tab="study"] .study-controls .control-card:first-child {
        order: 2;
        width: 360px;
        flex-basis: 360px;
      }

body[data-active-tab="study"] .study-controls .control-card:nth-child(2) {
        order: 1;
      }

body[data-active-tab="study"] .study-controls .control-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
      }

body[data-active-tab="study"] .study-controls .select {
        width: 100%;
        height: 34px;
        min-height: 34px;
        min-width: 160px;
        max-width: 100%;
        border-radius: 6px;
        background: #ffffff;
        font-size: 13px;
        font-weight: 650;
      }

body[data-active-tab="study"] .chat-status {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
      }

body[data-active-tab="study"] .chat-status.error {
        position: static;
        width: auto;
        height: auto;
        margin: 10px 24px 0;
        overflow: visible;
        clip: auto;
      }

body[data-active-tab="study"] .chat-box {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        margin: 0;
        align-content: start;
        border: 0;
        border-radius: 0;
        background: transparent;
      }

body[data-active-tab="study"] .composer {
        flex: 0 0 auto;
        margin: 0 24px 24px;
      }

body[data-active-tab="study"] .history-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        max-width: 100%;
        min-height: 48px;
        max-height: 48px;
        padding: 12px;
        border: 0;
        color: var(--muted);
        background: transparent;
        overflow: hidden;
      }

body[data-active-tab="study"] .history-item.active {
        color: var(--text);
        background: #eceef0;
      }

body[data-active-tab="study"] .history-icon {
        display: inline-grid;
        place-items: center;
        flex: 0 0 auto;
        color: currentColor;
      }

body[data-active-tab="study"] .history-icon .icon {
        width: 15px;
        height: 15px;
      }

body[data-active-tab="study"] .history-title {
        flex: 1 1 0;
        min-width: 0;
        overflow: hidden;
        color: currentColor;
        font-size: 15px;
        line-height: 24px;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

body[data-active-tab="study"] .history-item.active .history-title {
        color: var(--text);
        font-weight: 650;
      }

body[data-active-tab="study"] .history-delete {
        width: 28px;
        height: 28px;
        flex: 0 0 28px;
        opacity: 0.72;
      }

body[data-active-tab="study"] .message-wrap {
        padding: 0 24px;
      }

body[data-active-tab="study"] #chatBox > .empty {
        width: min(320px, calc(100% - 48px));
        margin: 120px auto 0;
        background: #ffffff;
      }

body[data-active-tab="study"] .message-wrap.user {
        justify-items: end;
      }

body[data-active-tab="study"] .message {
        max-width: min(72%, 576px);
        padding: 16px 17px;
        border-radius: 12px;
        font-size: 15px;
        line-height: 24.38px;
      }

body[data-active-tab="study"] .message.user {
        border-color: var(--line-soft);
        border-top-right-radius: 2px;
        background: var(--surface-2);
      }

body[data-active-tab="study"] .message.assistant {
        padding: 21px;
        border-color: var(--line-soft);
        border-left: 4px solid #07006c;
        background: #ffffff;
      }

body[data-active-tab="study"] .message-label {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding-left: 4px;
        color: var(--text);
        font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 13px;
        font-weight: 650;
      }

body[data-active-tab="study"] .assistant-mark {
        display: inline-grid;
        place-items: center;
        width: 24px;
        height: 24px;
        border-radius: 2px;
        color: #ffffff;
        background: #07006c;
        font-size: 10px;
      }

body[data-active-tab="study"] .inline-citations {
        max-width: min(84%, 720px);
        margin-left: 4px;
        border-radius: 0 0 12px 12px;
      }

body[data-active-tab="study"] .citation-card,
      body[data-active-tab="study"] .insight-card {
        margin: 0 16px 12px;
        width: calc(100% - 32px);
        max-width: calc(100% - 32px);
        box-sizing: border-box;
      }

body[data-active-tab="study"] .citation-card {
        padding: 13px;
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        background: var(--bg);
        overflow: hidden;
      }

body[data-active-tab="study"] .citation-title {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        overflow: hidden;
        color: var(--text);
        font-size: 15px;
        line-height: 24px;
        font-weight: 650;
      }

body[data-active-tab="study"] .citation-title .icon {
        flex: 0 0 auto;
        width: 14px;
        height: 14px;
        color: var(--secondary);
      }

body[data-active-tab="study"] .citation-title > span:last-child {
        display: block;
        flex: 1 1 0;
        width: 0;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }

body[data-active-tab="study"] .citation-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin: 4px 0 8px 24px;
      }

body[data-active-tab="study"] .citation-tags span {
        max-width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        min-height: 20px;
        padding: 2px 8px;
        border-radius: 4px;
        color: var(--muted);
        background: #e6e8ea;
        font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 11px;
      }

body[data-active-tab="study"] .citation-card blockquote {
        display: -webkit-box;
        overflow: hidden;
        overflow-wrap: anywhere;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 4;
        margin: 0 0 0 24px;
        padding: 4px 0 4px 10px;
        border-left: 2px solid var(--line-soft);
        color: var(--muted);
        font-size: 13px;
        font-style: italic;
        line-height: 18px;
        max-width: 100%;
      }

body[data-active-tab="study"] .insight-card {
        min-height: 104px;
        padding: 13px;
        border-radius: 8px;
        background: var(--bg);
        overflow-wrap: anywhere;
      }

body[data-active-tab="study"] .insight-card.accent {
        position: relative;
        overflow: visible;
        border-color: #c0c1ff;
        background: #f5f3ff;
      }

body[data-active-tab="study"] .insight-card.accent::before {
        content: "";
        position: absolute;
        inset: 0 auto 0 0;
        width: 4px;
        background: #07006c;
      }

body[data-active-tab="study"] .insight-card.accent > * {
        position: relative;
      }

body[data-active-tab="study"] .insight-kicker {
        color: #07006c;
        font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        font-size: 15px;
        line-height: 24px;
        letter-spacing: 0;
        text-transform: none;
      }

body[data-active-tab="study"] .mastery-card {
        display: grid;
        gap: 8px;
      }

body[data-active-tab="study"] .mastery-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        color: var(--muted);
        font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 13px;
      }

body[data-active-tab="study"] .mastery-row strong {
        color: #006a61;
      }

body[data-active-tab="study"] .mastery-track {
        height: 6px;
        overflow: hidden;
        border-radius: 999px;
        background: #e6e8ea;
      }

body[data-active-tab="study"] .mastery-track span {
        display: block;
        height: 100%;
        border-radius: inherit;
        background: #006a61;
      }

body[data-active-tab="study"] .composer {
        border-radius: 8px;
        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
      }

body[data-active-tab="study"] .composer .textarea {
        min-height: 96px;
        padding: 18px;
      }

body[data-active-tab="study"] .composer-actions {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        padding: 8px 12px;
        background: #ffffff;
      }

body[data-active-tab="study"] .composer-tools {
        display: flex;
        align-items: center;
        gap: 8px;
      }

.citations {
        margin-top: 8px;
        display: grid;
        gap: 6px;
      }

details {
        color: var(--muted);
        font-size: 12px;
      }

details summary {
        cursor: pointer;
        color: var(--text);
      }

.question {
        display: grid;
        gap: 10px;
        padding: 14px;
        border: 1px solid var(--line-soft);
        border-radius: 12px;
        background: #ffffff;
      }

.stage-chip {
        min-height: 28px;
        padding: 0 10px;
        border: 1px solid var(--line);
        border-radius: 999px;
        color: var(--muted);
        background: var(--surface-2);
        font-size: 12px;
        display: inline-flex;
        align-items: center;
      }

.stage-chip.active {
        color: #ffffff;
        border-color: #000000;
        background: #000000;
        font-weight: 700;
      }

.chart {
        width: 100%;
        height: 320px;
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        background: var(--surface-2);
      }

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

.progress-tools {
        display: grid;
        gap: 8px;
        margin-top: 8px;
      }

.note-area {
        min-height: 86px;
      }

.save-state {
        min-height: 20px;
        color: var(--muted);
      }

.bar {
        height: 8px;
        border-radius: 999px;
        background: var(--surface-2);
        overflow: hidden;
      }

.bar span {
        display: block;
        height: 100%;
        width: 0;
        background: linear-gradient(90deg, var(--teal), var(--blue));
      }

.markdown {
        min-height: 360px;
        max-height: 62vh;
        overflow: auto;
        padding: 18px;
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        background: #ffffff;
        line-height: 1.75;
        box-shadow: none;
      }

.markdown h1,
      .markdown h2,
      .markdown h3 {
        margin: 18px 0 10px;
        line-height: 1.35;
      }

.markdown h1:first-child,
      .markdown h2:first-child {
        margin-top: 0;
      }

.markdown h1 {
        color: var(--text);
        font-size: 22px;
      }

.markdown h2 {
        font-size: 18px;
      }

.markdown ul,
      .markdown ol {
        padding-left: 20px;
      }

.markdown table {
        width: 100%;
        margin: 14px 0;
        border-collapse: collapse;
        font-size: 14px;
      }

.markdown th,
      .markdown td {
        padding: 9px 10px;
        border: 1px solid var(--line);
        text-align: left;
        vertical-align: top;
      }

.markdown th {
        color: var(--text);
        background: var(--surface-2);
      }

.empty,
      .error,
      .loading {
        padding: 18px;
        border: 1px solid var(--line-soft);
        border-radius: var(--radius);
        color: var(--muted);
        background: var(--surface-2);
        line-height: 1.6;
      }

.empty-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 12px;
      }

.error {
        color: var(--red);
        border-color: rgba(184, 74, 74, 0.34);
      }

.toast {
        position: fixed;
        right: 22px;
        bottom: 22px;
        z-index: 20;
        max-width: min(420px, calc(100vw - 44px));
        padding: 12px 14px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--surface);
        color: var(--text);
        box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
        transform: translateY(16px);
        opacity: 0;
        pointer-events: none;
        transition: 0.2s ease;
      }

.toast.show {
        opacity: 1;
        transform: translateY(0);
      }

.hidden {
        display: none !important;
      }
