* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    padding: 15px;
    min-height: 100vh;
}

.container {
    background: white;
    border-radius: 8px;
    padding: 25px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #000000;
    letter-spacing: 0.5px;
}

.sort-section {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.sort-btn {
    flex: 1;
    padding: 10px 15px;
    background: #ffffff;
    color: #555555;
    border: 2px solid #cccccc;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s;
}

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

.sort-btn.active {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
}

.slack-section {
    background: #f9f9f9;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.slack-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #333333;
    cursor: pointer;
}

.slack-section input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #000000;
}

.slack-section input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 12px;
    color: #333333;
    display: none;
    margin-top: 8px;
}

.slack-section input[type="text"].show {
    display: block;
}

.input-section {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

#taskInput {
    flex: 1;
    min-width: 150px;
    padding: 12px 15px;
    border: 2px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    color: #000000;
}

#taskInput:focus {
    outline: none;
    border-color: #000000;
    background: #fafafa;
}

#deadlineInput {
    padding: 12px 10px;
    border: 2px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    color: #000000;
}

#deadlineInput:focus {
    outline: none;
    border-color: #000000;
    background: #fafafa;
}

#importanceInput {
    padding: 12px 8px;
    border: 2px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    color: #000000;
    cursor: pointer;
    width: 70px;
}

#importanceInput:focus {
    outline: none;
    border-color: #000000;
    background: #fafafa;
}

.input-section button {
    padding: 12px 20px;
    background: #000000;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    transition: background 0.2s;
}

.input-section button:hover {
    background: #333333;
}

.action-section {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.select-all-btn {
    flex: 1;
    padding: 10px 15px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: background 0.2s;
}

.select-all-btn:hover {
    background: #357abd;
}

.delete-selected-btn {
    flex: 1;
    padding: 10px 15px;
    background: #e94b3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: background 0.2s;
}

.delete-selected-btn:hover {
    background: #c73a2d;
}

.task-list {
    list-style: none;
    margin-bottom: 25px;
}

/* === 基本的なタスクアイテム === */
.task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #ffffff;
    border-top: 2px solid #333333;
    border-right: 2px solid #333333;
    border-bottom: 2px solid #333333;
    border-left: 8px solid #333333;
    border-radius: 4px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.task-item:hover {
    background: #f8f8f8;
}

.task-item.selected {
    background: #f0f0f0;
}

/* === 完了状態 === */
.task-item.completed {
    opacity: 0.5;
    border-top: 2px dashed #999999;
    border-right: 2px dashed #999999;
    border-bottom: 2px dashed #999999;
    border-left: 8px dashed #999999;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: #888888;
}

.task-item.completed .task-deadline {
    text-decoration: line-through;
    color: #aaaaaa;
}

.task-item.completed .task-time {
    text-decoration: line-through;
    color: #aaaaaa;
}

/* === スヌーズ状態 === */
.task-item.snoozed {
    background: #f5f5f5;
    border-top-color: #777777;
    border-right-color: #777777;
    border-bottom-color: #777777;
    border-left-color: #777777;
}

/* === 重要度別の左端色分け（修正版） === */
/* 高：赤 */
.task-item.high {
    border-left-color: #e74c3c !important;
}

/* 中：オレンジ */
.task-item.middle {
    border-left-color: #f39c12 !important;
}

/* 低：緑 */
.task-item.low {
    border-left-color: #27ae60 !important;
}

/* === 期限状態による背景色分け === */
.task-item.overdue {
    background-color: #f5f5f5;
}

.task-item.overdue .task-deadline {
    color: #000000;
    font-weight: 600;
}

.task-item.urgent {
    background-color: #f0f0f0;
}

.task-item.urgent .task-deadline {
    color: #333333;
    font-weight: 600;
}

.task-item.soon {
    background-color: #ffffff;
}

.task-item.soon .task-deadline {
    color: #666666;
}

/* === チェックボックス === */
.checkbox-complete {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #000000;
    flex-shrink: 0;
    margin: 0;
    position: relative;
}

.checkbox-complete::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-right: none;
    border-top: none;
    transform: translate(-50%, -60%) rotate(-45deg);
    opacity: 0.3;
    pointer-events: none;
}

/* === 選択丸ボタン === */
.checkbox-select-circle {
    width: 16px;
    height: 16px;
    border: 2px solid #666666;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    background: white;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-select-circle:hover {
    border-color: #333333;
    background: #f8f8f8;
}

.checkbox-select-circle.selected {
    background: #333333;
    border-color: #333333;
}

.checkbox-select-circle.selected::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* === タスク情報 === */
.task-info {
    flex: 1;
    cursor: pointer;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.task-text {
    color: #000000;
    font-size: 13px;
    font-weight: 500;
    word-break: break-word;
    line-height: 1.3;
}

.task-meta {
    display: flex;
    gap: 10px;
    color: #777777;
    font-size: 11px;
    flex-wrap: wrap;
}

.task-time {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #000000;
    font-weight: 600;
    font-size: 12px;
}

.task-time-label {
    font-size: 10px;
    color: #777777;
    font-weight: normal;
}

.task-deadline {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #777777;
    font-size: 11px;
}

.task-importance {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
}

.snooze-badge {
    font-size: 10px;
    background: #444444;
    color: white;
    padding: 1px 4px;
    border-radius: 2px;
}

/* === アクションボタン === */
.task-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.edit-btn {
    background: #50c878;
    color: white;
    border: none;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    min-height: auto;
    font-weight: 500;
}

.edit-btn:hover {
    background: #45b06f;
}

.delete-btn {
    background: #e94b3c;
    color: white;
    border: none;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    min-height: auto;
    font-weight: 500;
}

.delete-btn:hover {
    background: #c73a2d;
}

.empty-message {
    text-align: center;
    color: #cccccc;
    padding: 30px;
    font-size: 13px;
}

.reset-section {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.reset-btn {
    background: #ffffff;
    color: #000000;
    border: 2px solid #888888;
    padding: 10px 20px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.reset-btn:hover {
    background: #f0f0f0;
    border-color: #555555;
}

/* === モーダル === */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.2s;
    border: 2px solid #cccccc;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #777777;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    transition: color 0.2s;
}

.close:hover {
    color: #000000;
}

.modal h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #000000;
}

.modal-input-group {
    margin-bottom: 15px;
}

.modal-input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #333333;
    font-weight: 600;
}

.modal-input-group input,
.modal-input-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: #000000;
}

.modal-input-group input:focus,
.modal-input-group select:focus {
    outline: none;
    border-color: #000000;
    background: #fafafa;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.save-btn {
    background: #000000;
    color: white;
}

.save-btn:hover {
    background: #333333;
}

.cancel-btn {
    background: #f0f0f0;
    color: #333333;
    border: 2px solid #cccccc;
}

.cancel-btn:hover {
    background: #e0e0e0;
    border-color: #999999;
}

/* === レスポンシブ === */
@media (max-width: 500px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .input-section {
        gap: 6px;
    }

    #taskInput {
        flex: 1 1 100%;
        min-width: 0;
    }

    #deadlineInput {
        flex: 1;
        padding: 10px;
        font-size: 13px;
    }

    #importanceInput {
        width: 65px;
        padding: 10px 6px;
    }

    .input-section button {
        flex: 1;
        padding: 10px 15px;
        font-size: 13px;
    }

    .action-section {
        gap: 6px;
    }

    .select-all-btn,
    .delete-selected-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .task-item {
        padding: 8px 10px;
        gap: 6px;
        margin-bottom: 6px;
    }

    .task-info {
        gap: 1px;
    }

    .task-meta {
        gap: 8px;
        font-size: 10px;
    }

    .sort-section {
        margin-bottom: 15px;
    }

    .sort-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .modal-content {
        margin: 20% auto;
        width: 95%;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }

    .checkbox-complete {
        width: 18px;
        height: 18px;
    }

    .checkbox-select-circle {
        width: 14px;
        height: 14px;
        border-width: 1.5px;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 12px;
    }

    h1 {
        font-size: 18px;
    }

    .input-section {
        gap: 4px;
    }

    #deadlineInput,
    #importanceInput {
        font-size: 12px;
    }

    .task-item {
        padding: 7px 8px;
        gap: 5px;
        margin-bottom: 5px;
    }

    .edit-btn,
    .delete-btn {
        padding: 3px 6px;
        font-size: 10px;
    }

    .task-time {
        font-size: 11px;
    }

    .task-text {
        font-size: 12px;
    }

    .action-section {
        gap: 4px;
    }

    .select-all-btn,
    .delete-selected-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .checkbox-complete {
        width: 16px;
        height: 16px;
    }

    .checkbox-select-circle {
        width: 12px;
        height: 12px;
    }
}