@charset "UTF-8";


    .todo-item > .todo-due-date .target-date {
        padding-left: 0 !important;
        display: inline !important; /* インライン表示を強制 */
    }

    .todo-item > .todo-due-date .start-date {
        display: inline !important; /* インライン表示を強制 */
        text-align: left !important;
    }

    /* 2行目: 優先度 + Todo名 */
    .todo-item > .todo-priority {
        float: left;
        clear: left;
        margin: 0 0.75rem 0.5rem 3px;
        justify-self: unset !important;
        display: flex;
        align-items: center;
    }

    .todo-item > .todo-name {
        display: flex;
        align-items: center; /* 垂直中央揃え */
        margin-bottom: 0.25rem;
        margin-left: calc(-20px + 0.75rem + 10px); /* 優先度の位置調整に合わせて修正 */
        padding-left: 0 !important;
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.4;
        overflow: visible;
        min-height: 1.5rem; /* 最小高さを設定 */
    }

    /* メモがある場合のTodo名にポインターカーソル */
    .todo-item > .todo-name[onclick] {
        cursor: pointer;
    }

/* ====================
   ドラッグアンドドロップ
==================== */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    cursor: grab;
    color: #bdbdbd;
    transition: all 0.2s ease;
    margin-right: 1rem;
    opacity: 0;
}

.drag-handle:hover {
    color: #78909c;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle .material-icons {
    font-size: 1.125rem;
    margin: 0;
}

/* Todoアイテムホバー時にドラッグハンドルを表示 */
.todo-item:hover .drag-handle {
    opacity: 1;
}

/* ドラッグ中は常に表示 */
.todo-item.dragging .drag-handle {
    opacity: 1;
}

.todo-item.dragging {
    opacity: 0.5;
    z-index: 1000;
}

.drag-placeholder {
    height: 2px;
    background: #78909c;
    margin: 0.5rem 2rem;
    border-radius: 1px;
    position: relative;
    animation: pulse 1.5s infinite;
}

.placeholder-line {
    position: absolute;
    top: -1rem;
    left: 50%;
    transform: translateX(-50%);
    background: #78909c;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* モバイルではドラッグハンドルを非表示 */
/* モバイルでのみ、両方空の場合は非表示 */
@media (max-width: 768px) {
    .todo-due-date[data-empty="true"] {
        display: none !important;
    }
}

/* PCでは矢印を表示しない */
@media (min-width: 769px) {
    
    /* PC表示での開始日「-」の中央揃え（強力な修正） */
    .todo-item .todo-due-date .start-date {
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* モバイルでのドラッグハンドル設定 */
@media (max-width: 768px) {
    .drag-handle {
        display: flex;
        opacity: 0; /* 通常時は非表示 */
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        color: #78909c;
        font-size: 1.2rem;
        transition: opacity 0.2s ease;
        z-index: 2;
    }
    
    /* 長押しドラッグ中は表示 */
    .todo-item.long-press-active .drag-handle {
        opacity: 1;
    }
    
    /* ドラッグ中のスタイル調整 */
    .todo-item.mobile-dragging {
        opacity: 0.8;
        transform: scale(1.02);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        z-index: 1000;
        background-color: #f8f9fa;
    }
    
    /* モバイルでテキスト選択を無効化 */
    .todo-item,
    .todo-item * {
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        user-select: none !important;
        -webkit-touch-callout: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    /* ドラッグ中は全体でテキスト選択を完全無効化 */
    body.dragging-active * {
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        user-select: none !important;
        -webkit-touch-callout: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }
}

/* カテゴリアイテム専用のドラッグハンドル */
.category-item .drag-handle {
    width: 16px;
    margin-right: 0.5rem;
    color: #bdbdbd;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.category-item .drag-handle .material-icons {
    font-size: 1rem;
}

/* ホバー時にドラッグハンドルを表示 */
.category-item:hover .drag-handle {
    opacity: 1;
}

/* ドラッグ中は常に表示 */
.category-item.dragging .drag-handle {
    opacity: 1;
}

.category-item.dragging {
    opacity: 0.6;
    z-index: 1000;
    background-color: #f0f0f0;
}

/* カテゴリアイテム専用のドラッグハンドル */
.category-item .drag-handle {
    width: 16px;
    margin-right: 0.5rem;
    color: #bdbdbd;
}

.category-item .drag-handle .material-icons {
    font-size: 1rem;
}

.category-item.dragging {
    opacity: 0.6;
    z-index: 1000;
    background-color: #f0f0f0;
}

/* カテゴリアイテムは通常通り */
.category-item {
    padding-left: 1rem;
}


/* ====================
   リセット & 基本設定
==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 余計な横スクロール防止 */
html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #fafafa;
    color: #212121;
    line-height: 1.6;
    font-weight: 400;
    color: #555555;

}

/* ====================
   レイアウト
==================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ====================
   サイドナビゲーション
==================== */
.sidebar {
    width: 300px;
    background: #ffffff;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    font-size: 15px;
}

.sidebar h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2.5rem;
    color: #1a1a1a;
    display: flex;
    align-items: center;
}

.sidebar h1 .material-icons {
    margin-right: 0.75rem;
    font-size: 1.75rem;
    color: #1976d2;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section:first-child {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.nav-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #757575;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 500;
}

.nav-item:hover {
    background-color: #f5f5f5;
    transform: translateX(2px);
}

.nav-item.active {
    background-color: #f5f5f5;
    color: #555555;
    /* box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);*/
}

.nav-item .material-icons {
    margin-right: 0.875rem;
    font-size: 1.25rem;
    color: inherit;
}

.nav-item .count {
    margin-left: auto;
    background: transparent;
    color: #555555;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0;
    border-radius: 0;
    min-width: 20px;
    text-align: center;
}

.nav-item.active .count {
    background: transparent;
    color: #555555;
}

.category-item {
    position: relative;
}

.priority-item {
    position: relative;
    padding-left: 40px;
}

.status-item {
    position: relative;
    padding-left: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    font-weight: 600;
    color: #757575;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.section-header:hover {
    background-color: #f5f5f5;
}

.section-toggle {
    margin-right: 0.5rem;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.section-content {
    display: none;
    overflow: hidden;
    transition: all 0.3s ease;
}

.category-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.bottom-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    margin-top: 1.5rem;
}

.category-settings-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #78909c;
    transition: color 0.2s ease;
    box-shadow: none !important;
}

.category-settings-btn .material-icons {
    margin: 0;
    font-size: 26px;
}

.category-settings-btn:hover {
    background: transparent !important;
    color: #546e7a;
    transform: none !important;
    box-shadow: none !important;
}

/* ====================
   モバイルヘッダー
==================== */
.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    background: #ffffff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #757575;
    margin: 0;
    display: flex;
    align-items: center;
}

.mobile-title .material-icons,
.mobile-title .material-symbols-outlined {
    margin-right: 0.5rem;
    font-size: 1.25rem;
    color: #78909c;
}

/* ====================
   ボトムナビゲーション
==================== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 8px 16px 8px;
    color: #9e9e9e;
    text-decoration: none;
    min-width: 60px;
    min-height: 60px;
    border-radius: 8px;
    cursor: pointer;
    /* タッチ最適化 */
    -webkit-tap-highlight-color: rgba(120, 144, 156, 0.2);
    touch-action: manipulation;
    user-select: none;
    /* 確実にクリック可能にする */
    position: relative;
    z-index: 1;
}

/* 子要素のクリックイベントを無効化して親に委譲 */
.bottom-nav-item * {
    pointer-events: none;
}

.bottom-nav-item:hover {
    color: #78909c;
    background-color: #f5f5f5;
}

.bottom-nav-item.active {
    color: #78909c;
}

.bottom-nav-item .material-icons {
    font-size: 28px; /* 24px → 28px に変更 */
    margin-bottom: 2px;
}

.bottom-nav-label {
    font-size: 12px; /* 10px → 12px に変更 */
    font-weight: 500;
    white-space: nowrap;
}

/* 中央の追加ボタンを強調 */
.bottom-nav-item.add-todo-mobile {
    color: #78909c;
}

.bottom-nav-item.add-todo-mobile .material-icons {
    font-size: 32px;
    margin-bottom: 0;
}

.bottom-nav-item.add-todo-mobile:hover {
    color: #546e7a;
    transform: scale(1.1);
}

/* ====================
   右下フローティング追加ボタン
==================== */
.floating-add-btn {
    display: none; /* デスクトップでは非表示 */
}

@media (max-width: 768px) {
    .floating-add-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: calc(80px + env(safe-area-inset-bottom) + 32px); /* 16px → 32px に変更 */
        right: 16px;
        width: 56px;
        height: 56px;
        background: rgba(120, 144, 156, 0.85);
        color: white;
        border: none;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        cursor: pointer;
        transition: all 0.3s ease;
        z-index: 99;
    }

    .floating-add-btn:hover {
        background: rgba(84, 110, 122, 0.9);
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    }

    .floating-add-btn:active {
        transform: scale(0.95);
    }

    .floating-add-btn .material-icons {
        font-size: 24px;
        margin: 0;
    }
}

/* ====================
   スライドメニュー（廃止予定）
==================== */
.slide-menu {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100%;
    background: #ffffff;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transition: right 0.3s ease;
    overflow-y: auto;
    display: none; /* 廃止のため非表示 */
}

.slide-menu.open {
    right: 0;
}

.slide-menu-content {
    padding: 0;
}

.slide-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.slide-menu-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.slide-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #757575;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.slide-menu-close:hover {
    background: #e0e0e0;
    color: #424242;
}

.slide-menu-close .material-icons {
    font-size: 24px;
}

.slide-menu-section {
    border-bottom: 1px solid #f0f0f0;
}

.slide-section-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    color: #757575;
    font-weight: 600;
    font-size: 0.875rem;
}

.slide-section-header .material-icons {
    margin-right: 0.75rem;
    font-size: 20px;
}

.slide-menu-section .nav-item {
    padding: 0.75rem 1.5rem;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid #f5f5f5;
}

.slide-menu-section .nav-item:last-child {
    border-bottom: none;
}

.slide-menu-section .nav-item:hover {
    background-color: #f0f0f0;
    transform: none;
}

.slide-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: none; /* 廃止のため非表示 */
}

.slide-menu-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ====================
   メニュービュー（新規追加）
==================== */
.menu-view {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.menu-section {
    border-bottom: 1px solid #f0f0f0;
}

.menu-section:last-child {
    border-bottom: none;
}

.menu-section-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    color: #757575;
    font-weight: 600;
    font-size: 1rem; /* 0.875rem → 1rem に変更 */
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-section-header:hover {
    background-color: #f0f0f0;
}

.menu-section-header .section-toggle {
    margin-right: 0.5rem;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.menu-section-header .material-icons:not(.section-toggle) {
    margin-right: 0.75rem;
    font-size: 20px;
}

.menu-section-content {
    padding: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.menu-section-content.collapsed {
    display: none;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 1rem; /* 0.875rem → 1rem に変更 */
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background-color: #f0f0f0;
}

.menu-item .material-icons,
.menu-item .material-symbols-outlined {
    margin-right: 0.875rem;
    font-size: 1.5rem !important; /* 統一サイズを強制適用 */
}

.menu-item .count {
    margin-left: auto;
    background: transparent;
    color: #555555;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0;
    border-radius: 0;
    min-width: 20px;
    text-align: center;
}

/* ====================
   ボタン
==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn .material-icons {
    margin-right: 0.5rem;
    font-size: 1.125rem;
}

.btn-primary {
    background: #78909c;
    color: white;
}

.btn-primary:hover {
    background: #546e7a;
}

.btn-secondary {
    background: #f5f5f5;
    color: #424242;
}

.btn-secondary:hover {
    background: #eeeeee;
}

.btn-danger {
    background: #f06292;
    color: white;
}

.btn-danger:hover {
    background: #c62828;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* カテゴリ管理の編集・削除ボタン専用スタイル */
#existing-categories .btn {
    padding: 0.5rem;
    min-width: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#existing-categories .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#existing-categories .btn .material-icons {
    margin: 0;
    font-size: 1rem;
}

/* 編集・復元ボタン専用スタイル */
.todo-actions .btn,
.todo-actions-pc .btn,
.todo-actions-mobile .btn {
    background: transparent;
    color: #bdbdbd;
    box-shadow: none;
    padding: 0.5rem;
    min-width: auto;
}

.todo-actions .btn:hover,
.todo-actions-pc .btn:hover,
.todo-actions-mobile .btn:hover {
    background: transparent;
    color: #424242;
    transform: none;
    box-shadow: none;
}

.todo-actions .btn .material-icons,
.todo-actions-pc .btn .material-icons,
.todo-actions-mobile .btn .material-icons {
    margin: 0;
    font-size: 1.25rem;
}

/* ====================
   メインエリア
==================== */
.main-content {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    background: #fafafa;
}

.main-title {
    font-size: 2.25rem;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: -0.025em;
}

.add-todo-btn {
    width: 100%;
    height: 48px;
    border-radius: 8px;
    padding: 0;
    /* box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);*/
}

.add-todo-btn .material-icons {
    margin: 0;
    font-size: 1.5rem;
}

/* ====================
   ソート機能
==================== */
.todo-header {
    display: grid;
    grid-template-columns: 20px auto 20px 120px 150px 1fr auto;
    align-items: center;
    gap: 1.5rem;
    padding: 0.7rem 2rem 0.7rem 0.9rem;
    background: #ffffff;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-bottom: 2px solid #f5f5f5;
}

.header-drag-handle {
    width: 20px;
    height: 20px;
    /* ドラッグハンドルと同じサイズの空白スペース */
}

.header-checkbox {
    width: 20px;
    height: 20px;
    /* チェックボックスと同じサイズの空白スペース */
}


.sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: #9e9e9e;
    justify-self: center;
}

.sort-btn:hover {
    background: #f5f5f5;
    color: #757575;
}

.sort-btn.active {
    color: #78909c;
}

.sort-btn .material-icons {
    font-size: 1.125rem;
}

.todo-header .todo-due-date {
    display: grid;
    grid-template-columns: 65px 65px;
    align-items: center;
    font-size: 0.875rem;
    color: #757575;
    justify-self: start;
    white-space: nowrap;
    overflow: visible;
    gap: 0.75rem;
    width: 150px;
}

.date-sort-btn {
    padding: 0.125rem;
    justify-self: center;
}

.date-sort-btn .material-icons {
    font-size: 1rem;
}

.date-sort-btn[data-sort="targetDate"] {
    justify-self: center;
}

/* フォーム内の完了日入力欄のパディングをリセット */
#todo-target-date {
    padding-left: 1rem !important;
}

.date-sort-btn[data-sort="completedAt"] {
    justify-self: end;
    margin-left: auto;
}

/* ====================
   Todo リスト
==================== */
.todo-list {
    background: #ffffff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.todo-item {
    display: grid;
    grid-template-columns: 20px auto 20px 120px 150px 1fr auto;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 2rem 1.5rem 1rem;
    border-bottom: 1px solid #f5f5f5;
    transition: all 0.2s ease;
    position: relative;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #78909c;
}

.todo-content {
    flex: 1;
    display: grid;
    grid-template-columns: 120px 80px 100px 1fr;
    align-items: center;
    gap: 1rem;
}

.todo-name {
    font-weight: 500;
    color: #1a1a1a;
    position: relative;
    padding-left: 12px;
    font-size: 0.9em;
}

.todo-category {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.375rem 0.875rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    justify-self: center;
    text-align: center;
}

.todo-priority {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    justify-self: center;
}

.todo-priority .material-icons {
    margin: 0;
    font-size: 1rem;
    padding-top: 0.5rem;
}

.priority-high {
    color: #f06292;
}

.priority-medium {
    color: #9e9e9e;
}

.priority-low {
    color: #9e9e9e;
}

.priority-none {
    color: #9e9e9e;
}

.todo-due-date {
    display: grid;
    grid-template-columns: 65px 65px;
    align-items: center;
    font-size: 0.875rem;
    color: #757575;
    justify-self: start;
    white-space: nowrap;
    overflow: visible;
    gap: 0.75rem;
    width: 150px;
}

.todo-due-date .start-date {
    text-align: center;
}

.todo-due-date .target-date {
    text-align: center;
}

.todo-due-date.overdue {
    color: #f06292;
    font-weight: 600;
}

.todo-completed-date {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: #9e9e9e;
    justify-self: start;
}

.todo-completed-date .material-icons {
    margin-right: 0.25rem;
    font-size: 1rem;
}

.todo-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.todo-item:hover .todo-actions {
    opacity: 1;
}

.todo-item.on-hold {
    background-color: #f8f9fa;
}

/* ====================
   モーダル
==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #ffffff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #757575;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn .material-icons {
    font-size: 1.5rem;
}

.close-btn:hover {
    background: #f5f5f5;
    color: #424242;
}

/* ====================
   フォーム
==================== */
.form-group {
    margin-bottom: 1rem;
}

/* 終日スイッチの上にスペースを追加 */
.form-switch-label {
    margin-top: 1.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.form-col {
    flex: 1;
    min-width: 0; /* flexアイテムの最小幅を0に */
    overflow: hidden; /* はみ出し防止 */
}

/* 日付入力専用の調整 */
#todo-start-date,
#todo-target-date {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.875rem 1rem !important; /* 他の入力欄と同じpadding */
    border: 2px solid #e0e0e0 !important; /* 他の入力欄と同じborder */
}

/* モバイル専用の日付入力調整 */
@media (max-width: 768px) {
    /* モバイルでカスタム日付表示をselectボックス風に調整 */
    .custom-date-display {
        margin-bottom: 1rem;
    }
    
    /* カテゴリ・優先度・開始日・完了日のラベルを非表示（プレースホルダー形式） */
    .form-group.form-row .form-label {
        display: none;
    }
    
    /* 日付入力を縦並びに変更 */
    .form-group.form-row {
        flex-direction: column;
        gap: 0;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* 開始日・完了日のform-groupに統一マージン */
    .form-group:has(.form-row) {
        margin-top: 1rem;
    }
    
    /* メモ入力欄に統一マージン */
    .form-group:has(#todo-memo) {
        margin-top: 1rem;
    }
    
    .form-col {
        width: 100% !important;
        margin-bottom: 1rem;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-sizing: border-box;
    }
    
    .form-col:last-child {
        margin-bottom: 0;
    }
    
    .form-col .form-label {
        width: 20%;
        margin-bottom: 0;
        font-size: 0.875rem;
        flex-shrink: 0;
    }
    
    .form-col .form-input {
        width: 60%;
        flex-shrink: 1;
        padding: 0.75rem 1rem !important;
        box-sizing: border-box !important;
        min-width: 0;
        border: none !important;
        background: #fafafa !important;
        border-radius: 8px !important;
    }
    
    /* 曜日表示用スパン（モバイル） */
    .date-day-display {
        font-size: 0.875rem;
        color: #78909c;
        width: 15%;
        text-align: left;
        flex-shrink: 0;
        display: inline-block;
        overflow: hidden;
        white-space: nowrap;
        margin-left: 0.25rem;
    }
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #757575;
    font-size: 0.875rem;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #757575;
    font-size: 0.875rem;
}

.form-checkbox {
    margin-right: 0.5rem;
}

/* スイッチ（トグル）スタイル */
.form-switch-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    color: #757575;
    font-size: 0.875rem;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.switch-text {
    color: #757575;
}

.switch-container {
    position: relative;
    width: 50px;
    height: 24px;
}

.switch-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #bdbdbd;
    transition: 0.3s;
    border-radius: 24px;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: 0.3s;
    border-radius: 50%;
}

.switch-input:checked + .switch-slider {
    background-color: #78909c;
}

.switch-input:checked + .switch-slider:before {
    transform: translateX(26px);
}

.switch-slider:hover {
    box-shadow: 0 0 0 8px rgba(120, 144, 156, 0.1);
}

/* カスタム日付表示（統一UI用） */
.custom-date-display {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: #fafafa;
    color: #78909c;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.custom-date-display:hover {
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(120, 144, 156, 0.1);
}

.date-text {
    flex-grow: 1;
    margin-left: 0.5rem;
}

.date-icon {
    color: #78909c;
    font-size: 1.2rem;
    opacity: 0.7;
    margin-right: 0;
}

/* 日付と時間の横並びレイアウト */
.date-time-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.date-time-row .custom-date-display {
    flex: 1;
}

.date-time-row .time-input {
    width: 90px;
    flex-shrink: 0;
    padding: 0.75rem 1rem !important;
    border: none;
    border-radius: 8px;
    background: #fafafa;
    color: #78909c;
    font-size: 0.875rem;
    text-align: center;
    box-sizing: border-box;
}

/* 曜日表示の基本スタイル（全画面共通） */
.date-day-display {
    font-size: 0.875rem;
    color: #78909c;
    margin-left: 0.5rem;
    display: inline-block;
    min-width: 30px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem !important;
    border: none !important;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #fafafa !important;
    color: #78909c !important;
}

/* select要素にドロップダウン矢印 */
.form-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24' fill='%2378909c'%3e%3cpath d='M480-360 280-560h400L480-360Z'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 1rem center !important;
    background-size: 1.2rem !important;
    padding-right: 2.8rem !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* 日付入力欄の特別なスタイル */
input[type="date"],
input[type="datetime-local"] {
    border: none !important;
    background: #fafafa !important;
    border-radius: 8px !important;
    color: #78909c !important;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(120, 144, 156, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* ====================
   カラーピッカー
==================== */
.color-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.color-option.selected {
    border-color: #374151;
    transform: scale(1.1);
}

/* ====================
   カテゴリ管理
==================== */
#existing-categories>div {
    transition: all 0.2s ease;
}

#existing-categories>div:hover {
    background-color: #f0f0f0 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ====================
   空の状態
==================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #757575;
}

.empty-state .material-icons {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #bdbdbd;
}

.empty-state p {
    font-size: 1.125rem;
    font-weight: 500;
}

/* ====================
   通知
==================== */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: #388e3c;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    font-weight: 500;
    max-width: calc(100vw - 2rem);
    word-wrap: break-word;
    box-sizing: border-box;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* ====================
   メモ開閉機能
==================== */
.memo-toggle {
    margin-left: 0.5rem;
    color: #9e9e9e;
    cursor: pointer;
    display: inline-block;
    transition: all 0.2s ease;
}

.memo-toggle:hover {
    color: #555555;
}

.memo-toggle .material-icons {
    font-size: 1rem;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.memo-toggle.open .material-icons {
    transform: rotate(0deg);
}

.memo-area {
    background: rgb(249, 249, 249);
    border-left: 2px solid rgb(120, 144, 156);
    margin: 0px;
    padding: 1rem 1.5rem 1rem calc(20px + 1.5rem + -17px + 1.5rem + 205px + 1.5rem + 150px + 1.5rem + 12px);
    border-bottom: 1px solid rgb(245, 245, 245);
    animation: 0.3s ease 0s 1 normal none running slideDown;
}

.memo-content {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #555555;
}

.memo-label {
    font-weight: 600;
    color: #78909c;
    white-space: nowrap;
}

.memo-text {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }

    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

/* ====================
   アニメーション
==================== */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====================
   レスポンシブ
==================== */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .mobile-header {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .bottom-nav {
        display: flex;
    }

    .main-content {
        padding: 1rem;
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    .main-title {
        font-size: 1.75rem;
    }

    /* ====== モバイル用Todoアイテムレイアウト ====== */
    .todo-item {
        display: block !important; /* flexからblockに戻す */
        grid-template-columns: unset !important;
        align-items: unset !important;
        gap: unset !important;
        padding: 1rem;
        position: relative; /* 相対位置を設定 */
    }

    /* 1行目レイアウト調整 */
    .todo-item > .todo-checkbox {
        float: left;
        margin: 0.125rem 0.75rem 0.5rem 0;
    }

    .todo-item > .todo-category {
        display: inline-block;
        margin-right: 0.75rem;
        margin-bottom: 0.5rem;
        padding: 0.25rem 0.75rem;
        font-size: 0.75rem;
        width: auto;
        justify-content: unset !important;
        justify-self: unset !important;
        text-align: unset !important;
        order: unset !important;
    }

    .todo-item > .todo-due-date,
    .todo-item > .todo-completed-date {
        display: inline-block;
        margin-right: 0.5rem; /* 編集アイコンとの間隔調整 */
        margin-bottom: 0.5rem;
        font-size: 0.875rem;
        grid-template-columns: unset !important; /* grid設定を削除 */
        gap: unset !important; /* gap設定を削除 */
        width: auto;
        justify-self: unset !important;
        white-space: nowrap !important; /* 1行表示を強制 */
        overflow: unset !important;
        order: unset !important;
    }

    /* モバイル用編集ボタンを日付の右横に表示 */
    .todo-actions-mobile {
        display: inline-block !important;
        vertical-align: top;
        margin: -2px 0 0.5rem 0.5rem !important;
        opacity: 1 !important;
    }
    
    /* モバイル用編集ボタンの色をより薄く */
    .todo-actions-mobile .btn {
        color: #d0d0d0 !important; /* より薄いグレー */
    }
    
    .todo-actions-mobile .btn:hover {
        color: #9e9e9e !important; /* ホバー時も薄めに調整 */
    }
    
    /* PC用編集ボタンをモバイルで非表示 */
    .todo-actions-pc {
        display: none !important;
    }

    /* 4行目: メモ内容 */
    .memo-area {
        clear: both;
        margin: 0 0 0 0 !important;
        padding: 0.25rem 0 0 calc(8px + 0.75rem + 10px) !important;
        border-left: none !important;
        border-bottom: none !important;
        background: transparent !important;
        animation: none;
    }

    /* フロートのクリア */
    .todo-item::after {
        content: "";
        display: table;
        clear: both;
    }

    /* 既存のorder指定を無効化 */
    .todo-item > * {
        order: unset !important;
    }

    /* 既存のflexスタイルをリセット */
    .todo-checkbox {
        align-self: unset !important;
    }

    .todo-content {
        display: none; /* モバイルでは使用しない */
    }

    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
        padding: 1.5rem;
        margin-bottom: calc(1rem + 80px + env(safe-area-inset-bottom));
        max-height: 90vh;
    }

    .btn {
        padding: 0.875rem 1.25rem;
    }

    /* カテゴリ管理のボタンをモバイルでも適切に表示 */
    #existing-categories .btn {
        padding: 0.5rem;
    }

    /* ソートヘッダーもモバイル対応 */
    .todo-header {
        display: none;
    }

    /* 通知位置調整 */
    .notification {
        position: fixed; /* 念のため明示 */
        /* left/right と bottom を使うなら width は auto に */
        inset: auto 0 calc(90px + env(safe-area-inset-bottom)) 0; /* top right bottom left */
        width: auto;                 /* ← ここが重要 */
        max-width: 100vw;            /* 念のための上限 */
        box-sizing: border-box;
        margin: 0;
        border-radius: 0;
        padding: 1rem 1.5rem;
        transform: translateY(100%); /* 横幅には影響しない */
        /* 長文対策（URL等） */
        overflow-wrap: break-word;
        /* フッターナビのタップを妨害しない */
        pointer-events: none;
    }

    .notification.show {
        transform: translateY(0);
    }

    /* iOS Safari自動ズーム防止 */
    /* すべてのフォーム要素のベース設定 */
    input,
    textarea,
    select,
    button {
        font-size: 16px; /* ズーム回避の最重要ポイント */
        line-height: 1.4;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    /* 見た目を小さくする場合（ズームは防ぎつつ縮小） */
    .small-input {
        font-size: 16px;               /* 実際のフォントサイズ */
        transform: scale(0.875);       /* 見た目を14px相当に */
        transform-origin: left center; /* 縮小位置調整 */
    }
    
    /* プレースホルダーのフォントサイズも統一 */
    input::placeholder,
    textarea::placeholder {
        font-size: 16px;
    }
    
    input::-webkit-input-placeholder,
    textarea::-webkit-input-placeholder {
        font-size: 16px;
    }
    
    input::-moz-placeholder,
    textarea::-moz-placeholder {
        font-size: 16px;
    }
    
    input:-ms-input-placeholder,
    textarea:-ms-input-placeholder {
        font-size: 16px;
    }

    /* スライドメニュー設定ボタン */
    .slide-menu-settings {
        padding: 1rem 1.5rem;
    }

    .slide-category-settings-btn {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 0.75rem 1rem;
        background: none;
        border: none;
        cursor: pointer;
        color: #78909c;
        font-size: 0.875rem;
        font-weight: 500;
        border-radius: 8px;
        transition: all 0.2s ease;
    }

    .slide-category-settings-btn:hover {
        background: #f0f0f0;
        color: #546e7a;
    }

    .slide-category-settings-btn .material-icons {
        margin-right: 0.75rem;
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .todo-item > .todo-priority .material-icons,
    .todo-item > .todo-priority .material-symbols-outlined {
        padding-top: calc(0.5rem + 7px);
        font-size: 1rem !important;
    }
    
    /* 優先度なしの「-」をモバイルで非表示 */
    .priority-none-dash {
        display: none !important;
    }
    
    /* 優先度なしの場合でもモバイルでスペースを確保 */
    .todo-item > .todo-priority.priority-none {
        min-width: 20px; /* アイコンと同じ幅を確保 */
        display: inline-block !important;
        vertical-align: top; /* カテゴリと縦位置を揃える */
        min-height: 1.5rem; /* カテゴリの高さと揃える */
    }
    
    /* 日付がない場合の「-」をモバイルで非表示 */
    .mobile-hidden {
        display: none !important;
    }
    
    /* PC専用の「-」をモバイルで非表示 */
    .pc-only {
        display: none !important;
    }
    
    /* モバイルでのみ矢印を表示 */
    .todo-item > .todo-due-date .target-date::before {
        content: ' → ';
        color: #9e9e9e;
    }
}

@media (min-width: 769px) {
    .sidebar {
        display: block;
    }

    .bottom-nav {
        display: none;
    }

    .slide-menu {
        display: none;
    }

    .slide-menu-overlay {
        display: none;
    }

    /* メニュービューをPC表示では非表示 */
    .menu-view {
        display: none;
    }
    
    /* PC用編集ボタンを表示、モバイル用を非表示 */
    .todo-actions-pc {
        display: flex !important;
        gap: 0.5rem;
        opacity: 0;
        transition: opacity 0.2s ease;
    }
    
    .todo-item:hover .todo-actions-pc {
        opacity: 1;
    }
    
    .todo-actions-mobile {
        display: none !important;
    }
    
    /* フォーム要素のpadding強制適用（モバイル専用） */
    select.form-select,
    input[type="time"].time-input,
    .form-input,
    .custom-date-display {
        padding: 0.75rem 1rem !important;
        box-sizing: border-box !important;
    }
    
    /* フォームグループの間隔をモバイルで狭くする */
    .form-group {
        margin-bottom: 0.75rem !important;
    }
}

/* 最強のモバイル専用CSS（PWA対応） */
@media (max-width: 768px) {
    body .modal-content select[id*="todo"],
    body .modal-content input[type="time"],
    body .date-time-row input[type="time"],
    body #todo-category,
    body #todo-priority,
    body #todo-start-time,
    body #todo-target-time {
        padding: 0.75rem 1rem !important;
        height: auto !important;
        min-height: 3rem !important;
        box-sizing: border-box !important;
        -webkit-appearance: none !important;
        appearance: none !important;
    }
    
    /* フォームグループ間隔の最強設定 */
    body .modal-content .form-group,
    body #todo-modal .form-group,
    .modal .form-group {
        margin-bottom: 0.75rem !important;
        margin-top: 0 !important;
    }
}
    