/* AI todo board responsive rules
   Source: ai-todo-board.css. Generated by CSS split refactor; do not edit original during staging. */

@media (max-width: 1180px) {
    .ai-todo-week-board.is-focus-mode {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .ai-todo-detail-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .ai-todo-compose-fields {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .ai-todo-week-heading-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ai-todo-week-toolbar-actions {
        width: 100%;
        justify-content: space-between;
    }
}

/* ── Mobile: 글씨 축소 + 요일별 풀스크린 스냅 스크롤 ─── */
@media (max-width: 768px) {
    .ai-todo-item {
        box-sizing: border-box;
        max-width: 100%;
    }

    .ai-todo-item-title {
        font-size: 14px;
        line-height: 1.4;
    }

    .ai-todo-item-desc,
    .ai-todo-history-desc,
    .ai-todo-mention-candidate p {
        font-size: 12px;
    }

    .ai-todo-week-section-day {
        font-size: 12px;
    }

    .ai-todo-badge,
    .ai-todo-mention,
    .ai-notion-status-pill {
        font-size: 11px;
        min-height: 22px;
        padding: 3px 8px;
    }

    .ai-todo-item-source-badges {
        max-width: min(92px, 24vw);
    }

    /* 요일마다 화면 한 섹션 — 가로 스크롤 스냅 */
    .ai-todo-week-board {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
        margin-top: 12px;
        padding: 0 0 12px;
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        /* grid 속성 무효화 */
        grid-template-columns: unset;
    }

    .ai-todo-week-board::-webkit-scrollbar {
        display: none;
    }

    .ai-todo-week-section,
    .ai-todo-week-section-span {
        flex: 0 0 100%;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        scroll-snap-align: start;
    }

    .ai-todo-week-board.is-focus-mode {
        grid-template-columns: unset;
    }
}

/* Mobile AI todo app layout: flatten outer card and compact controls. */
@media (max-width: 768px) {
    body {
        background: #f8fafc;
    }

    .ai-todo-card.card { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; margin-bottom: 14px; overflow: visible; }
    .ai-todo-card::before { display: none; }
    .ai-todo-header { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 10px; margin: 0 0 10px; padding: 0 2px; }
    .ai-todo-header,
    .ai-todo-week-toolbar { width: 100%; max-width: 100%; min-width: 0; }
    .ai-todo-header h3 { font-size: 22px; line-height: 1.1; white-space: nowrap; }
    .ai-todo-header-actions { display: none; }
    .ai-todo-action-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 6px; }
    .ai-todo-action-buttons .small-btn { width: 100%; min-width: 0; min-height: 36px; padding: 0 8px; border-radius: 14px; font-size: 12px; white-space: nowrap; }
    .ai-todo-week-toolbar { display: block; margin-top: 0; padding: 6px 0 4px; }
    .ai-todo-week-toolbar-main { gap: 7px; }
    .ai-todo-week-heading-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; align-items: stretch; }
    .ai-todo-week-heading-left { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px; gap: 4px; align-items: center; width: 100%; min-width: 0; padding: 4px; border-radius: 22px; border: 1px solid rgba(214, 207, 190, 0.72); background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(248,246,239,0.82) 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.96), 0 10px 22px rgba(61,68,54,0.07); backdrop-filter: blur(14px); }
    .ai-todo-week-heading-left h4 { grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 36px; padding: 0 10px; border-radius: 18px; color: #172033; font-size: 15px; font-weight: 900; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(255,255,255,0.46); }
    .ai-todo-week-anchor-controls { grid-column: 1 / -1; grid-row: 1; display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px; gap: 4px; align-items: center; pointer-events: none; }
    .ai-todo-week-anchor-controls .small-btn { min-width: 0; width: 38px; min-height: 36px; padding: 0; border-radius: 18px; border: 0; font-size: 0; font-weight: 900; background: rgba(255,255,255,0.78); color: #566052; box-shadow: inset 0 1px 0 rgba(255,255,255,0.96); pointer-events: auto; }
    .ai-todo-week-anchor-controls .small-btn::before { font-size: 22px; line-height: 1; transform: translateY(-1px); }
    .ai-todo-week-anchor-controls .small-btn:first-child::before { content: "‹"; }
    .ai-todo-week-anchor-controls .small-btn:last-child::before { content: "›"; }
    .ai-todo-week-anchor-controls .small-btn:first-child { grid-column: 1; grid-row: 1; }
    .ai-todo-week-anchor-controls .small-btn:last-child { grid-column: 3; grid-row: 1; justify-self: end; }
    .ai-todo-week-anchor-controls .ai-todo-date-input { grid-column: 2; grid-row: 1; z-index: 2; width: 100%; min-width: 0; height: 36px; min-height: 36px; opacity: 0; cursor: pointer; pointer-events: auto; }
    .ai-todo-week-toolbar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; justify-content: stretch; width: 100%; gap: 7px; padding: 5px; border-radius: 22px; background: linear-gradient(180deg, rgba(255,255,255,0.88) 0%, rgba(241,238,228,0.74) 100%); border: 1px solid rgba(214,207,190,0.72); box-shadow: inset 0 1px 0 rgba(255,255,255,0.92); backdrop-filter: blur(14px); }
    .ai-todo-search-wrap { width: 100%; min-width: 0; }
    .ai-todo-week-toolbar-actions .ai-todo-search-wrap { grid-column: 1 / -1; }
    .ai-todo-search-field { min-height: 38px; border-radius: 18px; border-color: rgba(214,207,190,0.74); font-size: 14px; background: rgba(255,255,255,0.92); box-shadow: inset 0 1px 2px rgba(15,23,42,0.04); }
    .ai-todo-week-toolbar-actions .view-toggle-btn { width: 100%; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 0; font-size: 14px; font-weight: 900; color: #64748b; background: transparent; box-shadow: none; }
    .ai-todo-week-toolbar-actions .view-toggle-btn.active { background: linear-gradient(180deg, #ffffff 0%, #fbfaf6 100%); color: #3f6b4a; box-shadow: 0 7px 16px rgba(63,107,74,0.13), inset 0 1px 0 rgba(255,255,255,0.98); }
    #aiTodoWeekBoard:not(.is-focus-mode), .ai-todo-week-board { width: 100%; max-width: 100%; gap: 0 !important; margin-top: 2px; padding: 0 0 10px; scroll-padding-inline: 0; }
    #aiTodoWeekBoard:not(.is-focus-mode) > *, .ai-todo-week-section, .ai-todo-week-section-span { flex: 0 0 100% !important; min-width: 100% !important; max-width: 100%; }
    .ai-todo-week-section, .ai-notion-sync-card { padding: 14px; border-radius: 24px; background: #ffffff; border-color: rgba(226,232,240,0.88); box-shadow: none; }
    .ai-todo-week-section-header { margin-bottom: 7px; padding: 9px 12px; border-radius: 22px; color: #f8fafc; background: linear-gradient(135deg, #244f73 0%, #3d7da7 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 10px 20px rgba(45,93,132,0.12); }
    .ai-todo-week-section-header.is-note { background: linear-gradient(135deg, #2f604f 0%, #5b9a7d 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 10px 20px rgba(47,96,79,0.12); }
    .ai-todo-week-section-header.is-done { background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 10px 20px rgba(100,116,139,0.12); }
    .ai-todo-week-section-date { border-radius: 999px; background: rgba(255,255,255,0.2); color: rgba(255,255,255,0.92); }
    .ai-todo-week-list { min-height: 0; gap: 4px; }
    .ai-todo-item { padding: 5px 6px; }
    .ai-todo-section-add-btn { width: 30px; min-width: 30px; height: 30px; }
}

@media (max-width: 390px) {
    .ai-todo-action-buttons .small-btn { padding: 0 10px; font-size: 12px; }
    .ai-todo-header,
    .ai-todo-week-toolbar { width: 100%; }
    .ai-todo-week-heading-left { grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 4px; }
    .ai-todo-week-anchor-controls { grid-template-columns: 36px minmax(0, 1fr) 36px; }
    .ai-todo-week-anchor-controls .small-btn { width: 36px; }
    .ai-todo-week-toolbar-actions { gap: 6px; }
    .ai-todo-week-toolbar-actions .view-toggle-btn { padding: 0 12px; }
}

@media (max-width: 768px) {
    #aiTodoDetailModal {
        padding: 0;
        align-items: stretch;
    }

    #aiTodoDetailModal .ai-todo-modal-content {
        width: 100dvw;
        max-width: 100dvw;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        padding: 18px;
        border-radius: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    #aiTodoDetailModal .modal-header {
        position: sticky;
        top: 0;
        z-index: 5;
        margin: -18px -18px 10px;
        padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 12px;
        background: rgba(255,255,255,0.96);
        border-bottom: 1px solid rgba(226, 232, 240, 0.86);
        backdrop-filter: blur(12px);
    }

    #aiTodoDetailModal .modal-header h3 {
        font-size: 24px;
        line-height: 1.1;
    }

    #aiTodoDetailModal .close-btn {
        width: 44px;
        min-width: 44px;
        height: 44px;
        font-size: 26px;
    }

    .ai-todo-modal-body {
        width: 100%;
        max-width: 100%;
        gap: 12px;
        overflow-x: hidden;
    }

    .ai-todo-detail-meta,
    .ai-todo-mention-row,
    .ai-todo-detail-actions,
    .ai-todo-side-header,
    .ai-todo-history-header {
        max-width: 100%;
    }

    .ai-todo-detail .field,
    .ai-todo-detail textarea,
    .ai-todo-detail select,
    .ai-todo-detail input,
    .ai-todo-detail button {
        max-width: 100%;
    }

    .ai-todo-detail-textarea {
        width: 100%;
        min-height: 118px;
        font-size: 16px;
        line-height: 1.45;
    }

    .ai-todo-detail-fields {
        grid-template-columns: 1fr !important;
        gap: 10px;
        width: 100%;
    }

    .ai-todo-detail-fields .field {
        min-width: 0;
    }

    .ai-todo-detail-fields select,
    .ai-todo-detail-fields input {
        width: 100%;
        min-width: 0;
        min-height: 46px;
        font-size: 16px;
    }

    .ai-todo-placement-hint {
        margin: 0;
        padding: 10px 12px;
        font-size: 13px;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .ai-todo-detail-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .ai-todo-detail-actions .primary-btn,
    .ai-todo-detail-actions .secondary-btn {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        padding: 0 10px;
        border-radius: 14px;
        font-size: 15px;
        white-space: nowrap;
    }

    .ai-todo-side-header {
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .ai-todo-side-header h4,
    .ai-todo-history-summary {
        font-size: 18px;
    }

    .ai-todo-mention-row {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .ai-todo-history-item {
        padding: 12px;
        border-radius: 16px;
    }

    .ai-todo-history-header {
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .ai-todo-history-time,
    .ai-todo-history-desc {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 390px) {
    .ai-todo-detail-actions {
        grid-template-columns: 1fr;
    }
}

/* Mobile detail modal compact field sizing. */
@media (max-width: 768px) {
    #aiTodoDetailModal .ai-todo-modal-content {
        padding: 14px;
    }

    #aiTodoDetailModal .modal-header {
        margin: -14px -14px 8px;
        padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 10px;
    }

    .ai-todo-modal-body {
        gap: 10px;
    }

    .ai-todo-detail .field {
        display: grid;
        gap: 6px;
    }

    .ai-todo-detail .field label,
    .ai-todo-detail .field-label {
        font-size: 13px;
        line-height: 1.2;
    }

    .ai-todo-detail-textarea {
        min-height: 96px;
        padding: 12px 14px;
        border-radius: 16px;
        font-size: 16px;
        line-height: 1.42;
    }

    .ai-todo-detail-fields {
        gap: 8px;
    }

    .ai-todo-detail-fields select,
    .ai-todo-detail-fields input[type="date"] {
        height: 46px;
        min-height: 46px;
        padding: 0 40px 0 14px;
        border-radius: 14px;
        font-size: 16px;
        line-height: 46px;
    }

    .ai-todo-placement-hint {
        padding: 9px 11px;
        border-radius: 14px;
    }

    .ai-todo-detail-actions {
        margin-top: 0;
    }

    .ai-todo-detail-section {
        gap: 8px;
        padding-top: 10px;
    }
}

/* Mobile compose modal compact sizing mirrors the detail modal. */
@media (max-width: 768px) {
    #aiTodoComposeModal {
        padding: 0;
        align-items: stretch;
    }

    #aiTodoComposeModal .ai-todo-compose-modal-content {
        width: 100dvw;
        max-width: 100dvw;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        padding: 14px;
        border-radius: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    #aiTodoComposeModal .modal-header {
        position: sticky;
        top: 0;
        z-index: 5;
        margin: -14px -14px 8px;
        padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 10px;
        background: rgba(255,255,255,0.96);
        border-bottom: 1px solid rgba(226, 232, 240, 0.86);
        backdrop-filter: blur(12px);
    }

    #aiTodoComposeModal .modal-header h3 {
        font-size: 24px;
        line-height: 1.1;
    }

    #aiTodoComposeModal .close-btn {
        width: 44px;
        min-width: 44px;
        height: 44px;
        font-size: 26px;
    }

    .ai-todo-compose-modal-body {
        width: 100%;
        max-width: 100%;
        gap: 10px;
        padding: 0;
        overflow-x: hidden;
    }

    .ai-todo-compose-modal-body .field {
        display: grid;
        gap: 6px;
        min-width: 0;
        max-width: 100%;
    }

    .ai-todo-compose-modal-body .field-label {
        font-size: 13px;
        line-height: 1.2;
    }

    .ai-todo-compose-textarea {
        width: 100%;
        min-height: 96px;
        max-width: 100%;
        padding: 12px 14px;
        border-radius: 16px;
        font-size: 16px;
        line-height: 1.42;
    }

    .ai-todo-compose-fields {
        grid-template-columns: 1fr !important;
        gap: 8px;
        width: 100%;
        max-width: 100%;
    }

    .ai-todo-compose-fields select,
    .ai-todo-compose-fields input[type="date"] {
        width: 100%;
        min-width: 0;
        height: 46px;
        min-height: 46px;
        padding: 0 40px 0 14px;
        border-radius: 14px;
        font-size: 16px;
        line-height: 46px;
    }

    #aiTodoComposeModal .modal-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin: 12px -14px -14px;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
        background: rgba(255,255,255,0.96);
        border-top: 1px solid rgba(226, 232, 240, 0.86);
    }

    #aiTodoComposeModal .modal-actions .primary-btn,
    #aiTodoComposeModal .modal-actions .secondary-btn {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        padding: 0 10px;
        border-radius: 14px;
        font-size: 15px;
        white-space: nowrap;
    }
}

@media (max-width: 390px) {
    #aiTodoComposeModal .modal-actions {
        grid-template-columns: 1fr;
    }
}

/* Mobile compose modal overlap and overflow fixes. */
@media (max-width: 768px) {
    #aiTodoComposeModal {
        background: #ffffff;
    }

    #aiTodoComposeModal .ai-todo-compose-modal-content {
        background: #ffffff;
        border: 0;
        box-shadow: none;
        box-sizing: border-box;
        overflow-x: clip;
    }

    #aiTodoComposeModal .modal-header {
        background: #ffffff;
        margin-bottom: 14px;
    }

    #aiTodoComposeModal .modal-header + .ai-todo-compose-modal-body {
        padding-top: 4px;
    }

    #aiTodoComposeModal .ai-todo-compose-modal-body,
    #aiTodoComposeModal .ai-todo-compose-modal-body *,
    #aiTodoComposeModal .ai-todo-compose-fields,
    #aiTodoComposeModal .ai-todo-compose-fields * {
        box-sizing: border-box;
    }

    #aiTodoComposeModal .ai-todo-compose-fields {
        min-width: 0;
        overflow-x: hidden;
    }

    #aiTodoComposeModal .ai-todo-compose-fields .field {
        width: 100%;
        min-width: 0;
        overflow: hidden;
    }

    #aiTodoComposeModal .ai-todo-compose-fields select,
    #aiTodoComposeModal .ai-todo-compose-fields input[type="date"] {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        appearance: auto;
        -webkit-appearance: none;
    }

    #aiTodoDueDateInput {
        inline-size: 100%;
    }

    #aiTodoComposePlacementHint {
        max-width: 100%;
        overflow-wrap: anywhere;
    }
}

/* === 2026-06-07 responsive dark theme corrections === */
@media (max-width: 768px) {
    body {
        background: var(--color-bg);
    }

    .ai-todo-week-heading-left,
    .ai-todo-week-toolbar-actions,
    .ai-todo-week-section,
    .ai-notion-sync-card {
        background: var(--color-surface);
        border-color: var(--color-border);
        box-shadow: none;
    }

    .ai-todo-week-heading-left h4,
    .ai-todo-week-anchor-controls .small-btn,
    .ai-todo-search-field {
        background: var(--color-surface-2);
        color: var(--color-text-primary);
        border-color: var(--color-border-strong);
        box-shadow: none;
    }

    .ai-todo-week-toolbar-actions .view-toggle-btn {
        color: var(--color-text-secondary);
    }

    .ai-todo-week-toolbar-actions .view-toggle-btn.active {
        background: var(--color-accent-muted);
        color: var(--color-info-text);
        box-shadow: none;
    }

    #aiTodoDetailModal .modal-header,
    #aiTodoComposeModal,
    #aiTodoComposeModal .ai-todo-compose-modal-content,
    #aiTodoComposeModal .modal-header,
    #aiTodoComposeModal .modal-actions {
        background: var(--color-surface);
        border-color: var(--color-border);
    }
}
