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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f5;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

/* Cycle List */
.cycles {
    margin: 20px 0;
}

.cycle-item {
    background: #f9f9f9;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 4px;
    cursor: pointer;
    border-left: 4px solid #2563eb;
    transition: all 0.2s;
}

.cycle-item:hover {
    background: #f0f0f0;
}

.cycle-item.active {
    background: #e3f2fd;
    border-left-color: #1976d2;
}

/* Button */
.btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin: 10px 0;
}

.btn:hover {
    background: #1d4ed8;
}

.btn-delete {
    background: #dc2626;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

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

/* PDCA Form */
.pdca-form {
    margin-top: 30px;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e5e5;
}

.form-header h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 10px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #16a34a);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

/* Phase Sections */
.phase {
    margin: 20px 0;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
    overflow: hidden;
}

.phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    background: white;
    transition: background 0.2s;
}

.phase-header:hover {
    background: #f9f9f9;
}

.phase-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    padding-left: 12px;
    border-left: 4px solid #ccc;
    display: flex;
    align-items: center;
    gap: 10px;
}

.phase-title.plan {
    border-left-color: #2563eb;
    color: #2563eb;
}

.phase-title.do {
    border-left-color: #ea580c;
    color: #ea580c;
}

.phase-title.check {
    border-left-color: #9333ea;
    color: #9333ea;
}

.phase-title.act {
    border-left-color: #16a34a;
    color: #16a34a;
}

.phase-icon {
    font-size: 20px;
    font-weight: bold;
}

.phase-icon.completed {
    color: #16a34a;
}

.phase-toggle {
    color: #999;
    font-size: 12px;
    transition: transform 0.3s;
}

.phase.collapsed .phase-toggle {
    transform: rotate(-90deg);
}

.phase-content {
    padding: 20px;
    transition: max-height 0.3s ease;
}

.phase.collapsed .phase-content {
    display: none;
}

label {
    display: block;
    margin: 15px 0 5px 0;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Goal Section */
.goal-section {
    background: #f0f9ff;
    border: 2px solid #2563eb;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.goal-section label {
    color: #2563eb;
    font-weight: 600;
    margin-bottom: 8px;
}

.goal-section input {
    width: 120px;
    padding: 8px 12px;
    border: 1px solid #93c5fd;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
}

.goal-display-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.goal-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.goal-target {
    font-size: 18px;
    font-weight: 700;
    color: #1e40af;
}

.goal-streak {
    font-size: 32px;
    font-weight: 700;
    color: #ea580c;
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 2px dashed #ea580c;
}

.btn-edit {
    background: transparent;
    border: 1px solid #2563eb;
    color: #2563eb;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.btn-edit:hover {
    background: #2563eb;
    color: white;
}

.streak-badge {
    display: inline-block;
    background: #ea580c;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 10px;
}

/* Daily Logs */
.daily-logs {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.daily-logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.daily-logs h4 {
    color: #555;
    font-size: 16px;
    margin: 0;
}

.view-toggle {
    display: flex;
    gap: 5px;
    background: #e5e5e5;
    border-radius: 4px;
    padding: 2px;
}

.view-btn {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.view-btn:hover {
    color: #333;
}

.view-btn.active {
    background: white;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-small {
    background: #2563eb;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 15px;
}

.btn-small:hover {
    background: #1d4ed8;
}

.log-entry {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    margin: 10px 0;
}

.log-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.log-entry-date {
    font-weight: 600;
    color: #ea580c;
    font-size: 13px;
}

.log-entry-delete {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 0 5px;
}

.log-entry-delete:hover {
    color: #dc2626;
}

.log-entry-text {
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

/* Calendar View */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.calendar-day {
    aspect-ratio: 1;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 5px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    position: relative;
}

.calendar-day.has-log {
    background: #e3f2fd;
    border-color: #2563eb;
    cursor: pointer;
}

.calendar-day.has-log:hover {
    background: #bbdefb;
}

.calendar-day-number {
    font-weight: 600;
    color: #333;
}

.calendar-day-indicator {
    width: 6px;
    height: 6px;
    background: #ea580c;
    border-radius: 50%;
    margin-top: 3px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 12px;
    color: #666;
    text-align: center;
}

.calendar-month {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-nav {
    display: flex;
    gap: 10px;
}

.calendar-nav button {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
}

.calendar-nav button:hover {
    background: #f5f5f5;
}

/* Tablet */
@media (max-width: 900px) {
    .container {
        max-width: 100%;
        padding: 25px;
    }

    .calendar {
        gap: 6px;
    }

    .calendar-day {
        font-size: 11px;
    }
}

/* Mobile */
@media (max-width: 600px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 15px;
        border-radius: 0;
    }

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

    .btn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }

    .form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .form-header h2 {
        font-size: 20px;
    }

    .btn-delete {
        width: 100%;
    }

    .phase-header {
        padding: 12px 15px;
    }

    .phase-title {
        font-size: 16px;
    }

    .phase-content {
        padding: 15px;
    }

    textarea {
        font-size: 16px;
        padding: 12px;
    }

    .calendar {
        gap: 4px;
    }

    .calendar-day {
        font-size: 10px;
        padding: 3px;
    }

    .calendar-header {
        font-size: 10px;
        gap: 4px;
    }

    .view-toggle {
        width: 100%;
    }

    .view-btn {
        flex: 1;
    }

    .daily-logs-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .goal-section input {
        flex: 1;
        max-width: 150px;
    }

    .btn-small {
        width: auto;
    }

    .log-entry {
        padding: 10px;
    }

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

    .goal-streak {
        font-size: 24px;
        padding: 8px;
    }
}

/* Improve touch targets on mobile */
@media (hover: none) {
    .btn,
    .cycle-item,
    .phase-header,
    .view-btn,
    .calendar-day {
        min-height: 44px;
    }

    button {
        cursor: pointer;
    }
}
