:root {
    --green: #16864b;
    --green-light: #edf8f2;
    --green-border: #b9dfca;
    --text: #202422;
    --sub-text: #6d746f;
    --background: #f3f5f4;
    --border: #d8ddda;
    --white: #ffffff;
}


* {
    box-sizing: border-box;
}


html {
    -webkit-text-size-adjust: 100%;
}


body {
    margin: 0;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--background);
    color: var(--text);
}


.container {
    width: 100%;
    max-width: 480px;

    margin: 0 auto;

    padding: 20px 16px 40px;
}


h1 {
    margin: 0 0 20px;

    font-size: 26px;
}


.title-dot {
    color: var(--green);
}


h2 {
    margin: 0 0 18px;

    font-size: 19px;
}


h3 {
    margin: 22px 0 12px;

    font-size: 17px;
}


.card {
    width: 100%;

    padding: 18px;

    background: var(--white);

    border-radius: 14px;

    box-shadow:
        0 2px 8px
        rgba(0, 0, 0, 0.08);

    overflow: hidden;
}


label {
    display: block;

    margin-top: 16px;
    margin-bottom: 6px;

    font-weight: 700;
}


input[type="time"],
input[type="number"],
.edit-form input {
    display: block;

    width: 100%;
    max-width: 100%;
    min-width: 0;

    padding: 12px;

    border: 1px solid var(--border);

    border-radius: 8px;

    background: var(--white);
    color: var(--text);

    font-size: 17px;
}


/* 勤務日 */

.date-picker-wrap {
    position: relative;

    width: 100%;
    height: 54px;
}


.date-picker-display {
    position: absolute;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 0 14px;

    border: 1px solid var(--border);

    border-radius: 8px;

    background: var(--white);

    font-size: 17px;
}


.date-picker-icon {
    font-size: 18px;
}


.date-picker-native {
    position: absolute !important;

    inset: 0 !important;

    width: 100% !important;
    height: 100% !important;

    min-width: 0 !important;

    margin: 0 !important;
    padding: 0 !important;

    opacity: 0;

    cursor: pointer;
}


/* 営収 */

.revenue-input {
    display: grid;

    grid-template-columns:
        auto
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 8px;

    width: 100%;
}


.revenue-input input {
    min-width: 0;

    text-align: right;

    font-size: 20px;
    font-weight: 700;
}


.yen-mark {
    color: var(--green);

    font-size: 21px;
    font-weight: 800;
}


.unit {
    color: var(--sub-text);
}


/* 拘束時間 */

.input-type {
    margin-top: 24px;
}


.input-type-title {
    display: block;

    margin-bottom: 10px;

    font-weight: 700;
}


.radio-label {
    display: flex;

    align-items: center;

    gap: 8px;

    margin: 10px 0;

    font-weight: 400;
}


.radio-label input {
    width: 20px;
    height: 20px;

    accent-color: var(--green);
}


.duration-input {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 8px;

    margin-top: 12px;
}


.duration-input input {
    min-width: 0;

    text-align: center;
}


.calculated-result {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 12px;

    margin-top: 18px;

    padding: 14px;

    background: var(--green-light);

    border-radius: 8px;
}


/* ボタン */

button {
    width: 100%;

    padding: 14px;

    border: none;
    border-radius: 9px;

    font-size: 16px;
    font-weight: 700;

    cursor: pointer;

    -webkit-tap-highlight-color:
        transparent;
}


#saveButton {
    margin-top: 26px;

    background: var(--green);
    color: var(--white);
}


.menu-buttons {
    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 10px;

    margin-top: 14px;
}


.graph-menu-button {
    grid-column: 1 / -1;
}


.secondary-button {
    background: var(--white);

    color: var(--text);

    border: 1px solid var(--border);
}


.hidden {
    display: none !important;
}


/* モーダル */

.modal {
    position: fixed;

    inset: 0;

    z-index: 1000;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 16px;

    background:
        rgba(0, 0, 0, 0.45);
}


.modal-panel {
    position: relative;

    width: 100%;
    max-width: 460px;

    max-height: 88vh;

    overflow-y: auto;

    padding: 22px 18px;

    background: var(--white);

    border-radius: 14px;
}


.close-button {
    position: absolute;

    top: 8px;
    right: 8px;

    width: 42px;
    height: 42px;

    padding: 0;

    background: transparent;

    color: var(--text);

    font-size: 28px;
    font-weight: 400;
}


.period-label {
    margin-bottom: 20px;

    padding: 10px;

    background: var(--background);

    border-radius: 8px;

    color: var(--sub-text);

    font-size: 14px;
}


.summary-row {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 12px;

    padding: 10px 0;
}


.summary-row strong {
    text-align: right;
}


.green-value {
    color: var(--green);

    font-size: 18px;
}


hr {
    margin: 20px 0;

    border: 0;

    border-top:
        1px solid
        var(--border);
}


.modal-action {
    margin-top: 24px;
}


/* 13勤務目 */

.shift-selector {
    margin-bottom: 18px;
}


.selector-title {
    display: block;

    margin-bottom: 10px;

    font-size: 14px;
    font-weight: 700;
}


.shift-buttons {
    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 8px;
}


.shift-option {
    margin: 0;
}


.shift-option input {
    position: absolute;

    opacity: 0;

    pointer-events: none;
}


.shift-option span {
    display: block;

    padding: 11px;

    border:
        1px solid
        var(--border);

    border-radius: 8px;

    text-align: center;

    cursor: pointer;
}


.shift-option input:checked + span {
    background: var(--green);

    color: var(--white);

    border-color: var(--green);
}


.forecast-box {
    margin-top: 12px;

    padding: 14px;

    background: var(--green-light);

    border:
        1px solid
        var(--green-border);

    border-radius: 10px;
}


.forecast-main {
    margin-bottom: 14px;

    font-size: 17px;
    font-weight: 700;

    line-height: 1.5;
}


.forecast-line {
    display: flex;

    justify-content: space-between;

    gap: 12px;

    padding: 7px 0;

    font-size: 14px;
}


.forecast-line strong {
    text-align: right;
}


.forecast-note {
    margin-top: 12px;

    padding-top: 12px;

    border-top:
        1px solid
        var(--green-border);

    color: var(--sub-text);

    font-size: 13px;

    line-height: 1.6;
}


/* 営収グラフ */

.chart-modal-panel {
    max-width: 760px;
}


.chart-period-switch {
    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 8px;

    margin-bottom: 12px;
}


.chart-period-button {
    padding: 10px;

    background: var(--white);
    color: var(--text);

    border:
        1px solid
        var(--border);
}


.chart-period-button.active {
    background: var(--green);
    color: var(--white);

    border-color: var(--green);
}


.chart-summary {
    display: flex;

    justify-content: space-between;
    align-items: center;

    gap: 12px;

    margin-bottom: 12px;

    font-size: 14px;
}


.chart-summary strong {
    color: var(--green);

    font-size: 16px;
}


.chart-scroll {
    width: 100%;

    overflow: hidden;

    padding: 4px 0 8px;

    border:
        1px solid
        var(--border);

    border-radius: 10px;

    background: var(--white);
}


#revenueChartCanvas {
    display: block;

    width: 100%;
    max-width: 100%;
    height: 300px;
}


.chart-empty {
    padding: 28px 14px;

    border:
        1px dashed
        var(--border);

    border-radius: 10px;

    background: var(--background);

    color: var(--sub-text);

    text-align: center;
}


.chart-note {
    margin-top: 10px;

    color: var(--sub-text);

    font-size: 12px;
    line-height: 1.5;
}


/* 履歴 */

.history-row {
    padding: 16px 0;

    border-bottom:
        1px solid
        var(--border);
}


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


.history-top {
    display: flex;

    justify-content: space-between;
    align-items: flex-start;

    gap: 12px;
}


.history-info {
    flex: 1;

    min-width: 0;
}


.history-date {
    margin-bottom: 8px;

    font-weight: 800;
}


.history-detail {
    display: grid;

    grid-template-columns:
        auto
        1fr;

    gap:
        5px
        12px;

    font-size: 14px;
}


.history-detail span {
    color: var(--sub-text);
}


.history-revenue {
    color: var(--green);

    font-weight: 800;
}


.history-actions {
    display: flex;

    flex-direction: column;

    gap: 6px;
}


.edit-button,
.delete-button {
    width: auto;

    padding: 8px 11px;

    font-size: 13px;
}


.edit-button {
    background: var(--green);

    color: var(--white);
}


.delete-button {
    background: #707572;

    color: var(--white);
}


/* 編集 */

.edit-form {
    margin-top: 14px;

    padding: 14px;

    background: var(--background);

    border-radius: 10px;
}


.edit-form label {
    margin-top: 12px;

    font-size: 14px;
}


.edit-form label:first-child {
    margin-top: 0;
}


.edit-duration {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 7px;
}


.edit-duration input {
    min-width: 0;

    text-align: center;
}


.edit-revenue {
    text-align: right;
}


.edit-actions {
    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 8px;

    margin-top: 14px;
}


.edit-save-button {
    background: var(--green);

    color: var(--white);
}


.edit-cancel-button {
    background: var(--white);

    color: var(--text);

    border: 1px solid var(--border);
}


@media (max-width: 360px) {

    .container {
        padding-left: 12px;
        padding-right: 12px;
    }


    .card {
        padding-left: 14px;
        padding-right: 14px;
    }


    .history-top {
        flex-direction: column;
    }


    .history-actions {
        width: 100%;

        flex-direction: row;
    }


    .history-actions button {
        flex: 1;
    }

}

/* ==============================
   使い方ガイド
   ============================== */

.help-button {
    position: fixed;

    right: 16px;
    bottom: calc(
        18px + env(safe-area-inset-bottom)
    );

    z-index: 900;

    width: 38px;
    height: 38px;

    padding: 0;

    border-radius: 50%;

    background: var(--green);
    color: var(--white);

    font-size: 21px;
    font-weight: 800;
    line-height: 38px;

    box-shadow:
        0 3px 10px
        rgba(0, 0, 0, 0.18);
}


.guide-modal-panel {
    max-width: 520px;
}


.guide-image {
    display: block;

    width: 100%;
    height: auto;

    border-radius: 8px;
}
