/* ASK AI 패널의 '메모' 탭(문서 메모)과 메모·캡처 탭에서의 패널 모양.
   모양은 ASK 앱 메모 탭을 웹 색(tokens.css)으로 옮겼다: 상태 줄 · 오류 띠 · 충돌 상자 · 입력 칸 · 미리보기. */

/* 메모·캡처 탭: 대화 탭 줄·대화·입력창 자리를 모두 숨긴다(사용량과 상관없는 탭). */
.viewer-chat[data-mode="memo"] .chat-tabs,
.viewer-chat[data-mode="memo"] .chat-log,
.viewer-chat[data-mode="memo"] .chat-foot,
.viewer-chat[data-mode="capture"] .chat-tabs,
.viewer-chat[data-mode="capture"] .chat-log,
.viewer-chat[data-mode="capture"] .chat-foot {
    display: none !important;
}

/* 탭이 넷이라 휴대폰에서 번역 시트 탭과 함께 머리에 들어가게 조금 좁힌다. 그래도 넘치면 탭 줄만 옆으로 민다. */
.chat-modes {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.chat-modes::-webkit-scrollbar {
    display: none;
}

.chat-mode {
    flex: none;
}

@media (max-width: 759px) {
    .chat-mode {
        padding: 0 8px;
    }

    .pdf-viewer.side-open.chat-open .chat-head {
        gap: 8px;
    }
}

.chat-notes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    min-height: 0;
    padding: 12px 16px 16px;
    font-size: 13px;
}

.notes-status {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--ink-faint);
    font-size: 12px;
}

.notes-status > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notes-status .error {
    color: #b3412f;
}

.notes-count {
    flex: none;
}

.notes-banner,
.notes-conflict {
    flex: none;
    border-radius: 8px;
    background: color-mix(in srgb, #b3412f 10%, transparent);
    color: #b3412f;
    font-size: 12.5px;
    line-height: 1.55;
}

.notes-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
}

.notes-banner button,
.notes-conflict-actions button {
    flex: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.notes-conflict-actions button:disabled {
    opacity: 0.4;
    cursor: default;
}

.notes-conflict {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.notes-conflict p {
    margin: 0;
}

.notes-conflict textarea {
    width: 100%;
    height: 80px;
    resize: none;
    padding: 4px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--chat-ground, #fbfbf8);
    color: var(--ink);
    font: inherit;
}

.notes-conflict-actions {
    display: flex;
    gap: 12px;
}

.notes-input {
    flex: 1;
    width: 100%;
    min-height: 0;
    resize: none;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    outline: none;
    background: var(--chat-ground, #fbfbf8);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    line-height: 24px;
    transition: border-color 0.15s;
}

.notes-input:focus {
    border-color: var(--ink-soft);
}

.notes-input::placeholder {
    color: var(--ink-faint);
}

.notes-input:disabled {
    opacity: 0.6;
}

.notes-preview-label {
    flex: none;
    padding-top: 4px;
    color: var(--ink-faint);
    font-size: 12px;
}

/* 미리보기: 마크다운·수식·쪽 칩. 앱 메모 미리보기와 같은 글자 크기. */
.notes-preview {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg);
    color: var(--ink);
    font-size: 13px;
    line-height: 24px;
    word-break: break-word;
}

.notes-preview.empty {
    color: var(--ink-faint);
}

.notes-preview h1,
.notes-preview h2,
.notes-preview h3,
.notes-preview h4,
.notes-preview h5,
.notes-preview h6 {
    margin: 16px 0 8px;
    font-weight: 500;
    line-height: 1.35;
}

.notes-preview > :first-child {
    margin-top: 0;
}

.notes-preview > :last-child {
    margin-bottom: 0;
}

.notes-preview h1 { margin-bottom: 12px; font-size: 17px; }
.notes-preview h2 { font-size: 15px; }
.notes-preview h3 { margin: 12px 0 6px; font-size: 14px; }
.notes-preview h4 { margin: 12px 0 4px; font-size: 13px; }
.notes-preview h5 { margin: 10px 0 4px; font-size: 12.5px; }
.notes-preview h6 { margin: 10px 0 4px; color: var(--ink-soft); font-size: 12px; font-weight: 400; }

.notes-preview p {
    margin: 0 0 8px;
}

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

.notes-preview li {
    margin-bottom: 4px;
}

.notes-preview strong {
    font-weight: 500;
}

.notes-preview code {
    padding: 2px 4px;
    border-radius: 4px;
    background: var(--solid);
    color: var(--accent-ink);
    font-size: 0.92em;
}

.notes-preview pre {
    margin: 8px 0;
    overflow-x: auto;
    padding: 10px;
    border-radius: 8px;
    background: var(--card);
}

.notes-preview pre code {
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: 12px;
}

.notes-preview blockquote {
    margin: 8px 0;
    padding-left: 12px;
    border-left: 2px solid var(--line);
    color: var(--ink-soft);
}

.notes-preview table {
    display: block;
    width: 100%;
    margin: 8px 0;
    overflow-x: auto;
    border-collapse: collapse;
    text-align: left;
}

.notes-preview th,
.notes-preview td {
    padding: 4px 8px;
    border: 1px solid var(--line);
    vertical-align: top;
}

.notes-preview th {
    background: var(--card);
    font-weight: 500;
}

.notes-preview a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

.notes-preview .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
}

/* p.N 쪽 칩: 누르면 그 쪽으로 간다. 없는 쪽이면 흐리게. */
.note-page-chip {
    display: inline;
    padding: 0 6px;
    border: 0;
    border-radius: 4px;
    background: var(--accent-tint);
    color: var(--accent-ink);
    font: inherit;
    font-size: 11.5px;
    vertical-align: 1px;
    white-space: nowrap;
    cursor: pointer;
}

.note-page-chip:hover {
    background: color-mix(in srgb, var(--accent-tint), var(--accent) 22%);
}

.note-page-chip[aria-disabled="true"] {
    background: var(--solid);
    color: var(--ink-faint);
    cursor: not-allowed;
}

.notes-banner button:focus-visible,
.notes-conflict-actions button:focus-visible,
.note-page-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
