/* Local notebook, using the shared macOS materials and controls. */
/* 頁面撐滿內容區，空白狀態才能在表格區內垂直置中 */
.mw-page-scroll:has(.notes-app) { display: flex; flex-direction: column; }
.notes-main { display: flex; flex: 1 0 auto; flex-direction: column; min-height: 100%; }
.notes-app { display: flex; flex: 1 0 auto; flex-direction: column; padding: 32px; color: var(--label); }
.notes-app [hidden], .notes-editor [hidden] { display: none !important; }
.notes-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.notes-heading-row h2 { font-size: 26px; font-weight: 700; letter-spacing: -.025em; }
.notes-heading-row p { margin-top: 6px; }
.notes-heading-row > button .ico, .notes-heading-actions .ico { width: 16px; height: 16px; }
.notes-heading-actions { display: flex; flex: none; align-items: center; gap: 8px; }
.notes-muted { color: var(--label-2); font-size: 12px; }
.notes-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 24px; }
.notes-controls .mw-search { max-width: 390px; }
.notes-controls input { font-size: 13px; }
.notes-sort { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; color: var(--label-2); }
.notes-sort .ico { width: 14px; height: 14px; }
.notes-items { list-style: none; padding: 0; margin: 0; }
.notes-columns, .notes-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 12px; align-items: center; padding-right: 12px; }
.notes-summary { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 150px; gap: 24px; align-items: center; padding: 18px 16px; min-width: 0; text-align: left; color: var(--label); }
.notes-columns { border-bottom: 1px solid var(--separator); }
.notes-columns .notes-summary { padding-top: 0; padding-bottom: 12px; font-size: 12px; color: var(--label-2); }
.notes-item { border-bottom: 1px solid var(--separator); }
.notes-row:hover { background: var(--fill-1); }
.notes-row > button { width: 100%; min-height: 78px; }
.notes-email { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; font-weight: 600; }
.notes-email > span { overflow-wrap: anywhere; }
.notes-email .ico { width: 14px; height: 14px; flex: none; color: var(--label-2); }
.notes-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--label-2); }
.notes-date { color: var(--label-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.notes-actions { display: flex; justify-content: flex-end; gap: 2px; }
.notes-actions .mac-icon-btn { width: 32px; height: 32px; min-width: 32px; }
.notes-actions .ico { width: 16px; height: 16px; }
.notes-item.is-expanded { margin: 8px 0; border: 1px solid rgba(10,132,255,.34); border-radius: 10px; background: rgba(10,132,255,.045); }
.notes-item.is-expanded .notes-row { border-radius: 9px 9px 0 0; background: rgba(10,132,255,.09); }
.notes-item.is-expanded .notes-email .ico { transform: rotate(90deg); color: var(--accent); }
.notes-expanded { padding: 20px 40px 24px; }
.notes-expanded h3 { color: var(--label-2); font-size: 12px; margin-bottom: 10px; }
.notes-expanded p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.85; user-select: text; }
.notes-empty { display: flex; flex: 1 0 auto; min-height: 280px; flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; }
.notes-empty > .ico { width: 40px; height: 40px; color: var(--label-3); margin-bottom: 20px; }
.notes-empty h3 { font-size: 20px; font-weight: 600; }
.notes-empty p { color: var(--label-2); font-size: 14px; line-height: 1.8; margin: 12px 0 24px; }
.notes-editor { color: var(--label); width: min(540px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; overflow-y: auto; }
.notes-editor::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(5px); }
.notes-editor-hint { margin: 4px 0 24px; line-height: 1.6; }
.notes-editor label { display: block; font-size: 13px; font-weight: 600; margin: 18px 0 8px; }
.notes-editor input, .notes-editor textarea, .notes-editor select { width: 100%; border-radius: 8px; padding: 10px 12px; font-size: 15px; }
.notes-editor textarea { resize: vertical; min-height: 100px; }
.notes-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.notes-error { margin: 12px 16px; padding: 12px; font-size: 13px; line-height: 1.7; border-radius: 8px; background: rgba(255, 69, 58, .12); color: #ffb4ae; }
.notes-app button:focus-visible, .notes-editor button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.notes-app button:disabled, .notes-editor button:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 1140px) {
    .notes-app { padding: 24px; }
    .notes-summary { gap: 16px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 130px; }
    .notes-expanded { padding: 20px 24px; }
}
@media (max-width: 860px) {
    /* 窄版內容區不是固定高度：以頂部列（57px）以下的可視範圍為準 */
    .notes-main { min-height: calc(100dvh - 57px); }
}
@media (max-width: 639px) {
    /* 只在有底部分頁列的寬度預留它的高度（57px + 安全區域） */
    .notes-main { padding-bottom: calc(57px + env(safe-area-inset-bottom)); }
}
@media (max-width: 700px) {
    .notes-app { padding: 20px 14px; }
    .notes-heading-row h2 { font-size: 23px; }
    .notes-heading-actions > button { padding: 8px 10px; font-size: 12px; }
    .notes-heading-actions { gap: 6px; }
    /* 窄螢幕的匯入／匯出只顯示圖示（按鈕仍有 aria-label） */
    .notes-heading-actions .mac-btn-secondary > span { display: none; }
    .notes-controls { flex-wrap: wrap; }
    .notes-controls .mw-search { max-width: none; }
    .notes-sort { margin-left: auto; }
    .notes-columns { display: none; }
    .notes-row { grid-template-columns: minmax(0, 1fr) 104px; gap: 4px; padding-right: 6px; }
    .notes-summary { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 16px 10px; }
    .notes-email { font-size: 13px; }
    .notes-preview { margin-left: 24px; }
    .notes-date { margin-left: 24px; font-size: 11px; }
    .notes-actions { align-self: start; margin-top: 10px; }
    .notes-expanded { padding: 18px; }
    .notes-editor { padding: 20px; }
    .notes-editor input, .notes-editor textarea { font-size: 16px; }
}
@media (pointer: coarse) {
    .notes-actions { flex-wrap: wrap; }
    .notes-app .mac-icon-btn, .notes-editor .mac-icon-btn { min-width: 44px; min-height: 44px; }
}
@media (max-width: 400px) {
    .notes-row { display: block; padding-right: 0; }
    .notes-actions { margin: 0; padding: 0 10px 10px; }
}
