/* ==========================================================================
   Connect Portal - High-End Design System
   ========================================================================== */

:root {
    /* Colors - Deep Slate & Professional Blue */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.1);
    --bg-slate: #f8fafc;
    --card-border: #e2e8f0;
    --text-main: #0f172a;
    --text-sub: #64748b;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Elevation & Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Layout */
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Global Styles ── */
body {
    background-color: var(--bg-slate);
    color: var(--text-main);
    line-height: 1.6;
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 300px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-left: 4px solid var(--primary);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toast-in 0.3s ease-out forwards;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--primary); }

.toast-icon { font-size: 1.25rem; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.1rem;
}

.toast-message {
    font-size: 0.825rem;
    color: var(--text-sub);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

/* ── Buttons ── */
.btn {
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition);
    border-radius: var(--radius-md);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    border: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

/* ── Page Header ── */
.todo-page-header {
    background: linear-gradient(145deg, #0f172a 0%, #1e40af 100%);
    padding: 2.5rem 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    margin-bottom: 2.5rem;
}

.todo-page-title {
    font-size: 1.75rem;
    letter-spacing: -0.025em;
    color: #ffffff; /* 読みやすい白に変更 */
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.todo-page-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85); /* 透明度を調整した白に変更 */
}

/* ── Tabs ── */
.todo-tabs {
    background: #e2e8f0;
    padding: 0.35rem;
    border-radius: 14px;
    display: inline-flex;
    margin-bottom: 2rem;
    position: relative;
    gap: 0.25rem;
}

.todo-tab {
    padding: 0.6rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-sub);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    z-index: 1;
}

.todo-tab:hover {
    color: var(--text-main);
}

.todo-tab.active {
    background: #fff;
    color: var(--primary);
    box-shadow: var(--shadow-md);
}

.todo-page-subtitle {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.72);
    margin: 0;
}

.btn-add-task {
    font-size: 0.95rem;
    padding: 0.75rem 1.75rem;
    background: rgba(255,255,255,0.15) !important;
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255,255,255,0.35) !important;
    box-shadow: none !important;
    color: #fff !important;
    border-radius: 10px;
}

.btn-add-task:hover {
    background: rgba(255,255,255,0.28) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
}

/* ── Filter & Search Bar ── */
.todo-filter-bar {
    display: flex;
    justify-content: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
    align-items: center;
}

/* ── Columns ── */
.todo-columns-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.column-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

/* ── Task Items (Refined Cards) ── */
.todo-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.todo-item {
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}

.todo-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.todo-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #cbd5e1;
}

.todo-item.is-own-task::before { background: var(--primary); }
.todo-item.is-done { opacity: 0.6; }
.todo-item.is-done::before { background: var(--success); }

.todo-content {
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.task-title-block h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.task-desc-text {
    font-size: 0.85rem;
    color: var(--text-sub);
}

.task-meta-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ── Modals (Glassmorphism) ── */
.task-modal-overlay {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.task-modal {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    width: 100%;
    max-width: 650px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255,255,255,0.4);
    overflow: hidden;
    animation: modal-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.task-modal-header {
    padding: 1.5rem 2rem;
    background: var(--bg-slate);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Task Metadata (Refined) ── */
.task-meta-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.task-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-slate);
    color: var(--text-sub);
    border: 1px solid var(--card-border);
    transition: var(--transition);
}

.task-meta-chip.deadline {
    background: #fff1f2;
    color: #e11d48;
    border-color: #fecdd3;
}

.task-meta-chip.deadline.overdue {
    background: var(--danger);
    color: #fff;
    border-color: #be123c;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.task-creator-info {
    font-size: 0.73rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border-radius: 6px;
}

.task-creator-info i {
    font-size: 0.65rem;
    opacity: 0.7;
}

/* ── Avatars ── */
.task-assignee-avatars {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.mini-avatar {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    border: 1.5px solid #fff;
    box-shadow: var(--shadow-sm);
}

/* ── Actions ── */
.task-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.task-delete-btn:hover {
    color: var(--danger);
    background: #fee2e2;
}

/* ── Form Controls (Premium Refinement) ── */
.form-control {
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius-md);
    font-size: 0.95rem; /* Larger font as requested */
    background: #fff;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
/* ── Modal Body & Layout ── */
.task-modal-body {
    padding: 2.25rem 2.75rem;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.form-group {
    margin-bottom: 1.75rem;
}

.form-group label {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Subtasks (Refined List) ── */
.subtasks-list-wrap {
    background: var(--bg-slate);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--card-border);
}

.subtask-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.subtask-row:last-child { margin-bottom: 0; }

/* ── Custom Checkbox ── */
.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.custom-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

/* ── Checkboxes (Hidden Native) ── */
input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    cursor: pointer;
}

/* ── Mobile Responsive ── */
@media (max-width: 640px) {
    .todo-columns-container {
        grid-template-columns: 1fr;
    }
    
    .todo-page-header {
        padding: 1.5rem;
    }
    
    .task-modal-body {
        padding: 1.5rem;
    }
    
    .todo-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* ── Utilities ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
/* ── Modal Fine-tuning ── */
.task-modal {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.task-modal-header {
    padding: 1.5rem 2rem;
    background: var(--bg-slate);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.task-modal-close {
    background: #e2e8f0;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.task-modal-close:hover {
    background: #fee2e2;
    color: var(--danger);
}

.task-modal-footer {
    padding: 1.5rem 2rem;
    background: var(--bg-slate);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}
    background: #f8faff;
    margin: 0 -1.5rem; /* モーダルのパディング分を広げる */
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e0e7ff;
    border-bottom: 1px solid #e0e7ff;
}

.memo-section {
    background: #fcfcfc;
    margin: 0 -1.5rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #f1f5f9;
}

.section-label {
    display: block;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    color: #1e293b !important;
    margin-bottom: 0.75rem !important;
}

.text-sub {
    font-weight: 400;
    font-size: 0.8rem;
    color: #64748b;
    margin-left: 0.4rem;
}

.subtask-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.subtask-row:last-child { border-bottom: none; }

.st-title {
    flex: 2;
    padding: 0.5rem 0.65rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.85rem;
    background: #fafafa;
}

.st-title:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
}

.st-assignee {
    flex: 1.5;
    padding: 0.5rem 0.65rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.85rem;
    background: #fafafa;
    color: #475569;
}

.st-assignee:focus {
    outline: none;
    border-color: #3b82f6;
}

.subtask-remove-btn {
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
    border-radius: 4px;
    transition: color 0.15s;
    display: flex;
    align-items: center;
}

.subtask-remove-btn:hover { color: #ef4444; }

.btn-add-subtask {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.4rem 0.9rem;
    background: #f0f9ff;
    color: #0284c7;
    border: 1.5px dashed #7dd3fc;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-add-subtask:hover {
    background: #e0f2fe;
    border-color: #38bdf8;
}

/* ── ラベルバッジ（通知/非通知） ── */
.notify-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 999px;
    border: 1px solid #fcd34d;
}

.memo-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    background: #f1f5f9;
    color: #475569;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
}

/* ── Date Picker ── */
.date-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.date-picker-input {
    width: 100%;
    padding-right: 2.5rem !important;
    cursor: pointer;
}

.date-picker-input:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
}

.date-picker-icon {
    position: absolute;
    right: 0.85rem;
    color: #3b82f6;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0.7;
}

/* ── Flatpickr Calendar ── */
.flatpickr-calendar {
    background: #fff;
    border-radius: 14px !important;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18) !important;
    border: 1px solid #e2e8f0 !important;
    font-family: 'Noto Sans JP', 'Inter', sans-serif !important;
    padding: 0.5rem;
    z-index: 99999 !important;
}

.flatpickr-months {
    background: #2563eb;
    border-radius: 8px 8px 0 0;
    padding: 0.5rem 0.25rem;
}

.flatpickr-month, .flatpickr-current-month {
    color: #fff !important;
    fill: #fff !important;
    font-weight: 700 !important;
}

.flatpickr-prev-month, .flatpickr-next-month {
    color: #fff !important;
    fill: #fff !important;
}

.flatpickr-weekday {
    font-weight: 700;
    color: #64748b !important;
    font-size: 0.8rem;
}

.flatpickr-day {
    border-radius: 8px !important;
    font-size: 0.88rem;
    color: #1e293b;
    transition: background 0.15s, color 0.15s;
}

.flatpickr-day:hover {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
    border-color: transparent !important;
}

.flatpickr-day.selected, .flatpickr-day.selected:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #fff !important;
    font-weight: 700;
}

.flatpickr-day.today {
    border-color: #2563eb !important;
    color: #2563eb;
    font-weight: 700;
}

.flatpickr-day.today:hover {
    background: #2563eb !important;
    color: #fff !important;
}

/* ── マルチセレクトドロップダウン ── */
.multi-select-dropdown {
    position: relative;
    overflow: visible !important; /* 子要素を切り落とさない */
}

.dropdown-toggle.form-control {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-toggle.form-control::after {
    content: '▾';
    color: #94a3b8;
    font-size: 0.85rem;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15,23,42,0.18);
    z-index: 99999 !important; /* 最前面を保証 */
    overflow-y: auto;
    max-height: 220px;
    display: none; /* JSで表示制御 */
    flex-direction: column; /* 縦並びを強制 */
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.88rem;
    color: #334155;
    position: relative;
}

.dropdown-item:hover { background: #f0f7ff; }

.dropdown-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #2563eb;
    margin: 0;
}

/* ── ドラッグ＆ドロップ ── */
.draggable-user {
    cursor: grab;
    user-select: none;
}

.draggable-user.dragging {
    opacity: 0.4;
    cursor: grabbing;
    background: #f8fafc;
}

.draggable-user.drag-over {
    background: #eff6ff;
    box-shadow: inset 0 2px 0 #3b82f6;
}

.drag-handle {
    color: #cbd5e1;
    font-size: 0.8rem;
    margin-right: -0.1rem;
    cursor: grab;
    transition: color 0.15s;
}

.draggable-user:hover .drag-handle {
    color: #94a3b8;
}

/* ── 完了時タスクのフェードスタイル ── */
.todo-item.is-done {
    opacity: 0.6;
}

/* ── サブタスク期限 ── */
.st-deadline.date-picker-input {
    min-width: 140px;
    flex: 1.2;
}

/* ── タブナビゲーション ── */
.todo-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: #f1f5f9;
    padding: 0.35rem;
    border-radius: 12px;
    width: fit-content;
    max-width: 100%; /* スマホ対応 */
    overflow-x: auto; /* スマホ対応 */
    white-space: nowrap; /* スマホ対応 */
    -webkit-overflow-scrolling: touch;
}

/* スクロールバーを隠す (任意) */
.todo-tabs::-webkit-scrollbar {
    display: none;
}

.todo-tab {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0; /* 潰さない */
    white-space: nowrap; /* 折り返さない */
}

.todo-tab:hover {
    color: #1e293b;
    background: rgba(255,255,255,0.5);
}

.todo-tab.active {
    background: #fff;
    color: #2563eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.todo-tab .count-badge {
    font-size: 0.75rem;
    background: #e2e8f0;
    color: #475569;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
}

.todo-tab.active .count-badge {
    background: #dbeafe;
    color: #2563eb;
}

/* ── 空の状態（プロ仕様） ── */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 16px;
    color: #94a3b8;
    margin: 2rem 0;
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    display: block;
    color: #cbd5e1;
}

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

/* ── 検索・並べ替えバー（最終研磨） ── */
.todo-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin-bottom: 2rem;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    max-width: 1000px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px; /* 少し狭めてスタックしやすく */
}

.filter-group i.icon-muted {
    font-size: 1.1rem;
    color: #94a3b8;
}

/* カスタムセレクト / ドロップダウン */
.sort-select, .dropdown-toggle.form-control {
    background-color: #fff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 0.6rem 1rem !important;
    font-weight: 600 !important;
    color: #334155 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03) !important;
}

.sort-select:hover, .dropdown-toggle.form-control:hover {
    border-color: #3b82f6 !important;
    background-color: #fbfcfe !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08) !important;
}

.sort-select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1) !important;
}

/* ── セクションヘッダー（期限別） ── */
.deadline-group-header {
    margin: 1.5rem 0 0.5rem;
    padding: 0;
}

.deadline-group-header .header-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    width: fit-content;
    border: none;
}

/* 期限超過: 赤 */
.group-overdue .header-content {
    background: #fef2f2;
    color: #dc2626;
    border-left: 3px solid #ef4444;
}

/* 今日 : 黄 */
.group-today .header-content {
    background: #fffbeb;
    color: #d97706;
    border-left: 3px solid #f59e0b;
}

/* 今後の予定: 青 */
.group-upcoming .header-content {
    background: #eff6ff;
    color: #2563eb;
    border-left: 3px solid #3b82f6;
}

/* 期限なし: グレー */
.group-noDeadline .header-content {
    background: #f8fafc;
    color: #64748b;
    border-left: 3px solid #94a3b8;
}

.deadline-group-header .group-count {
    margin-left: 0.35rem;
    background: rgba(0,0,0,0.08);
    color: inherit;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
}

/* 期限超過の特別スタイル */
.todo-item.is-overdue {
    border-left-color: #ef4444 !important;
    background: #fff1f2;
}

/* パルスアニメーション：緊急性 */
@keyframes overduePulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.todo-item.is-overdue {
    animation: overduePulse 2s infinite;
}

/* ── 空の状態（プロ仕様） ── */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 16px;
    color: #94a3b8;
    margin: 2rem 0;
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    display: block;
    color: #cbd5e1;
}

/* ── 2列カラムレイアウト ── */
.todo-columns-container {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 2rem;
    width: 100%;
}

.todo-column {
    flex: 1;
    min-width: 0; /* 防止: Flexアイテムのオーバーフロー */
    background: #f8fafc;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.column-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #cbd5e1;
}

/* ユーティリティ */
.hidden {
    display: none !important;
}

/* ── レスポンシブ対応 (スマホ) ── */
@media (max-width: 900px) {
    .todo-columns-container {
        flex-direction: column;
        gap: 1.25rem;
    }
    
    .todo-column {
        padding: 0.85rem;
        border-radius: 12px;
    }

    .column-title {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.4rem;
    }

    .todo-page-header {
        padding: 1rem 0 !important;
        margin-bottom: 1rem !important;
        background: transparent !important;
        border-bottom: none !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .todo-page-title {
        font-size: 1.5rem !important;
    }
    
    .btn-add-task {
        width: 100%;
        justify-content: center;
        padding: 0.8rem;
    }
}

@media (max-width: 600px) {
    .task-title-block {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .task-title-block h4 {
        max-width: 100%;
        white-space: normal;
    }
    
    .todo-content {
        grid-template-columns: auto 1fr;
    }
    
    .task-right-wrap {
        grid-column: 1 / -1;
        justify-content: flex-start;
        border-top: 1px solid #f1f5f9;
        padding-top: 0.5rem;
        margin-top: 0.25rem;
    }
}

/* ── 詳細検索ボタン ── */
.btn-advanced-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-advanced-filter:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.btn-advanced-filter i {
    color: var(--brand-blue);
}

/* ── 詳細検索モーダル ( プロフェッショナル刷新 ) ── */
.advanced-filter-modal.professional {
    background: #ffffff;
    border-radius: 28px;
    width: 100%;
    max-width: 760px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 30px 60px -12px rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(241, 245, 249, 0.8);
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.advanced-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.75rem 2.5rem;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-icon {
    width: 48px;
    height: 48px;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.1);
}

.header-text h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.header-sub {
    margin: 0.2rem 0 0 0;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.advanced-filter-close {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    color: #94a3b8;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.advanced-filter-close:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fecaca;
    transform: rotate(90deg);
}

.advanced-filter-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 2.5rem;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

.filter-modal-section {
    padding: 2.25rem 0;
    border-bottom: 1px solid #f8fafc;
}

.filter-modal-section.has-bg {
    margin: 0 -2.5rem;
    padding: 1.75rem 2.5rem;
    background: #fbfcfe;
    border-bottom: 1px solid #f1f5f9;
}

.filter-section-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

.filter-section-label i {
    font-size: 1.15rem;
}

.filter-section-label .text-sub {
    font-size: 0.8rem;
    font-weight: 500;
    color: #94a3b8;
    margin-left: 0.25rem;
}

.text-primary { color: #3b82f6; }
.text-success { color: #10b981; }
.text-info    { color: #0ea5e9; }

/* 条件・ソート行のデザイン */
.conditions-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.condition-row, .sort-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: #ffffff;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: all 0.2s;
    animation: slideInRow 0.3s ease-out forwards;
}

@keyframes slideInRow {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.condition-row:hover, .sort-row:hover {
    background: #f8fafc;
    border-color: #f1f5f9;
}

/* 脱・標準セレクトスタイル */
.condition-row select, .sort-row select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding: 0.65rem 2.25rem 0.65rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #334155;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
}

.condition-row select:hover, .sort-row select:hover {
    border-color: #cbd5e1;
    background-color: #fbfcfe;
}

.st-field { width: 170px; }
.st-op    { width: 150px; }
.st-order { width: 130px; }

.form-control-compact {
    flex: 1;
    padding: 0.65rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    background: #ffffff;
    transition: all 0.2s;
}

.form-control-compact:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* プロ仕様の削除ボタン */
.btn-remove-row {
    width: 34px;
    height: 34px;
    background: transparent;
    border: 1.5px solid #f1f5f9;
    color: #94a3b8;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-remove-row:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fecaca;
    transform: scale(1.05);
}

/* 追加ボタン (Ghost Style) */
.btn-ghost-add {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    width: 100%;
    justify-content: center;
    transition: all 0.2s;
}

.btn-ghost-add:hover {
    background: #f8faff;
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-ghost-add i {
    font-size: 1.1rem;
}

/* 高級感のあるフッター */
.advanced-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2.5rem;
    background: #fbfcfe;
    border-top: 1px solid #f1f5f9;
    gap: 2rem;
}

.save-search-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    padding: 0.25rem;
    border-radius: 12px;
    width: 100%;
    max-width: 300px;
    transition: focus-within 0.2s;
}

.save-search-container:focus-within {
    border-color: #3b82f6;
}

.save-search-container input {
    border: none;
    background: transparent;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    width: 100%;
}

.save-search-container input:focus {
    outline: none;
}

.btn-save-action {
    width: 32px;
    height: 32px;
    background: #eff6ff;
    color: #3b82f6;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save-action:hover {
    background: #3b82f6;
    color: #ffffff;
}

.footer-right {
    display: flex;
    gap: 1rem;
}

.btn-outline-reset {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #ffffff;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline-reset:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

.btn-solid-apply {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 0.950rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-solid-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(37, 99, 235, 0.5);
    filter: brightness(1.1);
}

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

/* 保存済み検索チップの微調整 */
.saved-search-chip {
    padding: 0.45rem 1rem;
    background: #ffffff;
    border: 1.5px solid #f1f5f9;
    border-radius: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.saved-search-chip:hover {
    border-color: #3b82f6;
    background: #fdfeff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}

/* ── 期限リマインド設定セクション ── */
.reminder-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem !important;
    margin-bottom: 1.5rem;
}

.reminder-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.checkbox-pill {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.checkbox-pill input {
    display: none;
}

.checkbox-pill span {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s;
}

.checkbox-pill input:checked + span {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
}

.reminder-custom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #cbd5e1;
}

.small-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
}

.date-picker-input-small {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.8rem !important;
    background: #fff !important;
    max-width: 140px;
}

.mt-2 { margin-top: 0.5rem; }

/* ── タスクアクション（複製・削除） ── */
.task-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.5rem;
}

.task-copy-btn, .task-delete-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.task-copy-btn:hover {
    background: #eff6ff;
    color: #3b82f6;
}

.task-delete-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* モバイル対応：アクションボタンの位置調整 */
@media (max-width: 600px) {
    .task-actions {
        margin-left: auto;
    }
}
