.routine-heading {
    margin-bottom: 34px;
}
.routine-workspace {
    padding: 14px;
    min-width: 0;
}
.routine-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.routine-toolbar h2 {
    margin: 0 0 6px;
    font-size: 16px;
}
.routine-toolbar p {
    font-size: 12px;
    margin: 0;
}
.routine-total {
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--primary);
    background: var(--soft);
    font-size: 11px;
    white-space: nowrap;
}
.routine-context {
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-size: 12px;
}
.routine-sheet-scroll {
    position: relative;
    overflow: auto;
    max-height: 68vh;
    border: 1px solid var(--line);
    border-radius: 12px;
    scrollbar-width: thin;
}
.routine-sheet {
    display: grid;
    grid-template-columns: repeat(7, minmax(132px, 1fr));
    min-width: 924px;
    min-height: 350px;
    align-items: stretch;
}
.routine-day {
    min-width: 0;
    border-right: 1px solid var(--line);
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 47px,
        var(--line) 47px,
        var(--line) 48px
    );
}
.routine-day:last-child {
    border-right: 0;
}
.routine-day-heading {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 8px;
    min-height: 62px;
    background: var(--surface-raised, #f3f3f9);
    border-bottom: 1px solid var(--line);
}
.routine-day-heading h3 {
    font-size: 12px;
    margin: 0 0 6px;
    color: var(--ink);
}
.routine-day-heading time {
    font-size: 10px;
    color: var(--muted);
}
.routine-day-count {
    margin-left: auto;
    color: var(--muted);
    font-size: 10px;
}
.routine-today {
    color: var(--primary);
    font-size: 9px;
}
.is-today .routine-day-heading {
    background: var(--soft);
    box-shadow: inset 0 3px var(--primary);
}
.routine-day-body {
    padding: 6px 4px 12px;
}
.routine-task {
    display: flex;
    gap: 4px;
    align-items: start;
    padding: 7px 6px;
    margin-bottom: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface, #fff);
}
.routine-task label {
    display: flex;
    align-items: start;
    gap: 6px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.6;
}
.routine-task input[type="checkbox"] {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
    accent-color: var(--green);
}
.routine-task span {
    overflow-wrap: anywhere;
}
.routine-task.is-completed label span {
    text-decoration: line-through;
    color: var(--muted);
}
.routine-task.is-completed {
    border-color: var(--green);
}
.routine-task-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}
.routine-edit,
.routine-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0 3px;
    font-size: 16px;
}
.routine-edit:hover {
    color: var(--primary);
}
.routine-edit-form {
    width: 100%;
    min-width: 0;
}
.routine-edit-form input {
    min-width: 0;
    width: 100%;
    padding: 8px 6px;
    font-size: 12px;
}
.routine-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.routine-edit-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0;
    background: var(--soft);
    color: var(--primary);
    font-size: 11px;
}
.routine-edit-actions button[type="button"] {
    color: var(--muted);
    background: transparent;
}
.routine-remove:hover {
    color: #c75c73;
}
.routine-day-empty {
    margin: 8px 2px 12px;
    font-size: 11px;
    line-height: 1.7;
    color: var(--muted);
}
.routine-add {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}
.routine-add input {
    padding: 8px 6px;
    font-size: 11px;
    background: var(--surface, #fff);
    min-width: 0;
}
.routine-add button {
    flex-shrink: 0;
    width: 28px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--soft);
    color: var(--primary);
    font-size: 18px;
}
.routine-footnote {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
}
@media (max-width: 1200px) {
    .routine-sheet {
        grid-template-columns: repeat(7, minmax(170px, 1fr));
        min-width: 1190px;
    }
}
@media (max-width: 650px) {
    .routine-toolbar {
        align-items: start;
        flex-direction: column;
    }
    .routine-workspace {
        padding: 12px;
    }
}
