@charset "UTF-8";

:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    --text-primary: #3b230d;
    --text-secondary: color-mix(in srgb, var(--text-primary) 50%, transparent);

    /* Category colors */
    --category-green: mediumseagreen;
    --category-lime: yellowgreen;
    --category-brown: tan;
    --category-pink: lightcoral;
    --category-purple: mediumpurple;
    --category-skyblue: #7fbfff;
    --category-gray: gray;

    /* Category color mix percentages */
    --category-border-mix: 30%;
    --category-bg-mix: 6%;
}

/* 状態管理用ユーティリティクラス */
.is-hidden {
    display: none !important;
}

html {
    color: var(--text-primary);
    height: 100%;
}

html[theme="DARK"] {
    --text-primary: #f4f4f5;
}

html[theme="PINK"] {
    --text-primary: #3b230d;
}

html[theme="LAB"] {
    --text-primary: var(--custom-text-color, #3b230d);
}

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

.material-symbols-outlined {
    font-family: "Material Symbols Outlined", sans-serif;
    font-variation-settings:
        "FILL" 0,
        "wght" 300,
        "GRAD" 0,
        "opsz" 24;
    width: 24px;
    height: 24px;
    white-space: nowrap;
    overflow: hidden;
}

@font-face {
    font-family: "EB Garamond Num";
    font-style: normal;
    font-weight: 400;
    src: url("/fonts/subset-EBGaramond-Regular.woff2") format("woff2");
    font-display: swap;
    /* 数字と記号（, ¥ \）だけをこのフォントで表示 */
    unicode-range:
        U+0030-0039,
        /* 0〜9 */
        U+002C,
        /* , */
        U+005C,
        /* バックスラッシュ（Windowsの¥対策） */
        U+00A5;
    /* ¥ */
}

@font-face {
    font-family: "Spectral Light AlphaNum";
    font-style: normal;
    font-weight: 300;
    src: url("/fonts/subset-Spectral-Light.woff2") format("woff2");
    font-display: swap;
    unicode-range:
        U+002D,
        /* - (ハイフン) */
        U+2013,
        /* – (エヌダッシュ) */
        U+0030-0039,
        /* 0–9 */
        U+0041-005A,
        /* A–Z */
        U+0061-007A;
    /* a–z */
}

/* ページ */
#app {
    --_page-width: min(100%, 42rem);
    --_background-color: #f0eee9;
    --_content-color: white;
    --_border-color: color-mix(in srgb,
            var(--_content-color) 80%,
            var(--text-primary) 20%);
    --_active-color: color-mix(in srgb,
            var(--_content-color) 95%,
            var(--text-primary) 5%);

    font-family: system-ui, sans-serif;
    background-color: var(--_background-color);
    width: 100%;
    min-height: 0;
    height: auto;
    margin: 0;
}

.ios-pwa #app {
    min-height: 100vh;
}

[theme="LIGHT"] #app {
    --_background-color: #f0eee9;
    --_content-color: white;
}

[theme="DARK"] #app {
    --_background-color: black;
    --_content-color: #18181b;
}

[theme="PINK"] #app {
    --_background-color: #ffe0ef;
    --_content-color: #fff9fc;
}

[theme="LAB"] #app {
    --_background-color: var(--custom-bg-color, #f5f5f5);
    --_content-color: var(--custom-content-color, #ffffff);
    --_border-color: color-mix(in srgb,
            var(--custom-content-color, #ffffff) 85%,
            black 15%);
    --_active-color: color-mix(in srgb,
            var(--custom-content-color, #ffffff) 90%,
            black 10%);
}

/* ボタン */

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    text-underline-offset: calc(3 / 16 * 1rem);
}

a:visited {
    color: var(--text-primary);
}

/* アイコンのみ */
.button[data-type="icon-only"] {
    color: var(--text-primary);
    text-decoration: none;
    padding: calc(8 / 16 * 1rem);
    border-radius: 50%;
    border: none;
    background-color: unset;
}

.button[data-type="icon-only"][data-background="white"] {
    background-color: var(--_content-color);
}

.button[data-type="icon-only"] .button__icon {
    font-size: calc(24 / 16 * 1rem);
}

.button[data-type="icon-only"]:active {
    color: inherit;
    background-color: var(--_active-color);
}

.button[data-type="icon-only"]:disabled {
    color: color-mix(in srgb,
            var(--_content-color) 80%,
            var(--text-primary) 20%);
    cursor: not-allowed;
}

/* 塗りつぶし */
.button[data-type="fill"] {
    font-size: 1rem;
    font-weight: 500;
    padding: 1rem calc(28 / 16 * 1rem);
    width: 100%;
    border-radius: calc(28 / 16 * 1rem);
    border: none;
}

.button[data-type="fill"][data-size="s"] {
    padding: calc(8 / 16 * 1rem) calc(28 / 16 * 1rem);
    width: fit-content;
}

.button[data-type="outline"] {
    font-size: 1rem;
    font-weight: 500;
    padding: 1rem calc(28 / 16 * 1rem);
    width: 100%;
    border-radius: calc(28 / 16 * 1rem);
    border: 1px solid var(--_border-color);
}

.button[data-type="list"] {
    font-size: 1rem;
    font-weight: 400;
    padding: 1rem calc(28 / 16 * 1rem);
    width: 100%;
    border: none;
}

.button[data-type="list"] .button__text {
    flex: 1;
}

.button[data-background="blue"] {
    color: var(--text-primary);
    background-color: #edffff;
    border: 1px solid #bce5eb;
}

[theme="DARK"] .button[data-background="blue"] {
    background-color: #152d37;
    border: 1px solid #296275;
}

.button[data-background="blue"]:active {
    background-color: #bce5eb;
}

[theme="DARK"] .button[data-background="blue"]:active {
    background-color: #152d37;
}

.button[data-background="white"] {
    color: var(--text-primary);
    background-color: var(--_content-color);
}

.button[data-background="white"]:active {
    background-color: var(--_active-color);
}

.button[data-background="green"] {
    color: var(--text-primary);
    border: 1px solid #dbf2a4;
    background-color: #f7fce9;
}

[theme="DARK"] .button[data-background="green"] {
    border: 1px solid #394e19;
    background-color: #1c2b08;
}

.button[data-background="green"]:active {
    background-color: #dbf2a4;
}

[theme="DARK"] .button[data-background="green"]:active {
    background-color: #394e19;
}

.button[data-type="fill"][data-size="s"][data-background="green"] {
    border: none;
    box-shadow: 0 0 0 1px #dbf2a4;
}

[theme="DARK"] .button[data-type="fill"][data-size="s"][data-background="green"] {
    border: none;
    box-shadow: 0 0 0 1px #425c18;
}

.button[data-color="crimson"] {
    color: crimson;
}

[theme="DARK"] .button[data-color="crimson"] {
    color: #ff6b7e;
}

.button[data-align="center"] {
    text-align: center;
}

/* ヘッダー */
.header {
    /*grid-row: 1 / 2;*/
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 1rem;
    width: var(--_page-width);
    min-height: calc(24px + (8 / 16 * 1rem) * 2 + (12 / 16 * 1rem) * 2);
    padding: calc(var(--safe-top) + 12 / 16 * 1rem) calc(16 / 16 * 1rem) calc(12 / 16 * 1rem) calc(16 / 16 * 1rem);
    background-color: var(--_background-color);
    background: linear-gradient(to bottom,
            var(--_background-color) calc(100% - 1rem),
            transparent);
}

.header__title {
    font-family: "Hiragino Mincho ProN", "Hiragino Mincho Pro", ui-serif, serif;
    font-size: calc(24 / 16 * 1rem);
    font-weight: 500;
    flex: 1;
    margin-block: 0;
    line-height: 1;
    user-select: none;
}

.header__title[data-serif="en"] {
    font-family: "Spectral Light AlphaNum", ui-serif, serif;
    font-size: calc(28 / 16 * 1rem);
    font-weight: 300;
    letter-spacing: -0.01em;
}

.header__menu {
    display: flex;
    align-items: center;
    justify-content: end;
    gap: calc(8 / 16 * 1rem);
    flex: 1;
}

.header:has(.header__title) .header__menu {
    flex: unset;
}

/* メイン */
.main {
    --_header-height: calc(24px + (8 / 16 * 1rem) * 2 + (12 / 16 * 1rem) * 2);
    --_footer-height: calc(24px + (8 / 16 * 1rem) * 2 + (2 / 16 * 1rem) * 2 + 12px + (4 / 16 * 1rem));
    --_footer-button-height: calc(24px + 1rem * 2 + 2px + (20 / 16 * 1rem) * 2);
    display: flex;
    flex-direction: column;
    width: var(--_page-width);
    min-height: 0;
    height: auto;
    padding: 0 calc(16 / 16 * 1rem);
    padding-top: calc(var(--safe-top) + var(--_header-height));
    padding-bottom: calc(24 / 16 * 1rem);
    margin: 0 auto;
}

#app:has(.footer) .main {
    padding-bottom: calc(var(--_footer-height) + 16 / 16 * 1rem);
}

#app:has(.footer__button) .main {
    padding-bottom: calc(var(--_footer-button-height) + 20 / 16 * 1rem);
}

.ios-pwa .main {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.main[data-gap="s"] {
    gap: calc(12 / 16 * 1rem);
}

.main[data-gap="m"] {
    gap: calc(20 / 16 * 1rem);
}

.main[data-padding-top="s"] {
    padding-top: calc(var(--safe-top) + var(--_header-height) + 20 / 16 * 1rem);
}

.main[data-padding-top="m"] {
    padding-top: calc(var(--safe-top) + var(--_header-height) + 4rem);
}

#app:has(.footer) .main[data-padding-bottom="true"] {
    padding-bottom: calc(var(--_footer-height) + (24 / 16 * 1rem) + (16 / 16 * 1rem) * 2 + 1rem * 2);
}

.main__empty {
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(8 / 16 * 1rem);
    padding: calc(40 / 16 * 1rem) calc(20 / 16 * 1rem);
}

.main__empty-icon {
    font-size: 5rem;
    line-height: 1;
    font-family: "Material Symbols Outlined", sans-serif;
    font-variation-settings:
        "FILL" 0,
        "wght" 100,
        "GRAD" 0,
        "opsz" 48;
    width: 1em;
    height: 1em;
    white-space: nowrap;
    overflow: hidden;
}

.main__empty-text {
    line-height: 1.3;
    text-align: center;
}

/* フッター */
.footer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(4 / 16 * 1rem);
    width: var(--_page-width);
    margin: 0 auto;
    padding-bottom: calc(var(--safe-bottom) / 2);
    background-color: color-mix(in srgb, var(--_background-color) 75%, transparent);
    backdrop-filter: blur(calc(8 / 16 * 1rem));
}

@media (min-width: 42rem) {
    .footer {
        background-color: var(--_background-color);
        backdrop-filter: unset;
    }
}

.button[data-type="nav"] {
    color: var(--text-primary);
    font-family: "Spectral Light AlphaNum", ui-serif, serif;
    font-size: calc(12 / 16 * 1rem);
    font-weight: 300;
    line-height: 1em;
    letter-spacing: -0.01em;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(4 / 16 * 1rem);
    padding: calc(8 / 16 * 1rem);
}

.button[data-type="nav"] .footer__icon {
    padding: calc(2 / 16 * 1rem) calc(12 / 16 * 1rem);
    border-radius: calc(28 / 16 * 1rem);
    display: flex;
}

.button[data-type="nav"][data-state="active"] .footer__icon {
    box-shadow: 0 0 0 1px #ffeaa5;
    background-color: #fffaeb;
}

[theme="DARK"] .button[data-type="nav"][data-state="active"] .footer__icon {
    box-shadow: 0 0 0 1px #7a300d;
    background-color: #461802;
}

.button[data-type="nav"]:active .footer__icon {
    background-color: color-mix(in srgb,
            var(--_background-color) 90%,
            var(--text-primary) 10%);
}

.button[data-type="nav"][data-state="active"]:active .footer__icon {
    background-color: #ffeaa5;
}

[theme="DARK"] .button[data-type="nav"][data-state="active"]:active .footer__icon {
    background-color: #7a300d;
}

.button[data-type="FAB"] {
    position: absolute;
    top: calc(((24 / 16 * 1rem) + (20 / 16 * 1rem) * 2 + 1rem) * -1);
    right: 0;
    box-shadow: 0 0 1rem 0 rgba(0, 0, 0, 0.1);
    padding: calc(20 / 16 * 1rem);
    border-radius: calc(28 / 16 * 1rem);
    display: flex;
    gap: calc(8 / 16 * 1rem);
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: calc(42rem + 20 / 16 * 1rem * 2)) {
    .button[data-type="FAB"] {
        right: calc((20 / 16 * 1rem));
    }

    .label {
        display: none;
    }
}

.button[data-type="FAB"][data-position="center"] {
    left: 50%;
    transform: translateX(-50%);
}

/* トースト */
.toast {
    position: fixed;
    top: calc(var(--safe-top) + 20 / 16 * 1rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    max-width: calc(var(--_page-width) - (20 / 16 * 1rem) * 2);
    display: flex;
    align-items: center;
    justify-content: start;
    gap: calc(8 / 16 * 1rem);
    padding: calc(12 / 16 * 1rem);
    padding-right: calc(20 / 16 * 1rem);
    border-radius: 1rem;
    border: 1px solid var(--_border-color);
    background-color: var(--_content-color);
    box-shadow: 0 0 1rem 0 rgba(0, 0, 0, 0.1);
    transition:
        transform 0.3s ease-in-out,
        visibility 0.2s ease-in-out;
}

.toast__text {
    font-weight: 500;
    line-height: 1;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
    flex: 1 1 auto;
}

.toast[data-type="success"] {
    border-color: #b0eac4;
    background-color: #eefbf3;
}

[theme="DARK"] .toast[data-type="success"] {
    border-color: #0e462c;
    background-color: #07271a;
}

.toast[data-type="success"] .toast__icon {
    color: mediumseagreen;
}

.toast[data-type="update"] {
    color: var(--text-primary);
    background-color: #edffff;
    border: 1px solid #bce5eb;
    cursor: pointer;
}

[theme="DARK"] .toast[data-type="update"] {
    background-color: #152d37;
    border: 1px solid #296275;
}

.toast[data-state="visible"] {
    transform: translateX(-50%) translateY(0);
    visibility: visible;
}

.toast[data-state="hidden"] {
    transform: translateX(-50%) translateY(calc((100% + (20 / 16 * 1rem)) * -1));
    visibility: hidden;
}

/* ダイアログ */
dialog {
    position: fixed;
    /* Safariで表示に不具合があるので明示する */
    inset: 0;
    /* Safariで表示に不具合があるので明示する */
    overscroll-behavior-block: contain;
    transition-duration: 200ms;
    transition-property: display, overlay, opacity, transform;
    transition-timing-function: ease-out;
    transition-behavior: allow-discrete;
    border: unset;
    background-color: var(--_background-color);

    &::backdrop {
        background-color: oklch(from black l c h / 25%);
        transition-duration: inherit;
        transition-property: opacity;
        transition-timing-function: inherit;
        pointer-events: none !important;
    }

    &:modal,
    &:modal::backdrop {
        @starting-style {
            opacity: 0;
        }
    }

    &:not(:modal),
    &:not(:modal)::backdrop {
        opacity: 0;
    }
}

[theme="DARK"] dialog {
    color: #f4f4f5;
    background-color: #0e0e11;

    &::backdrop {
        background-color: oklch(from black l c h / 70%);
    }
}

dialog[open] {
    display: grid;
    grid-template-rows: auto;
    align-content: start;
    pointer-events: auto;
}

body[data-dialog-open] {
    overflow: hidden;
}

body[data-dialog-open] *:not(dialog[open], dialog[open] *) {
    pointer-events: none;
}

/* モーダル */
dialog[data-type="modal"] {
    --_modal-max-height: 90dvh;
    gap: 1rem;
    width: min(90%, 40rem);
    padding: calc(24 / 16 * 1rem);
    border-radius: calc(28 / 16 * 1rem);
    max-height: var(--_modal-max-height);

    &:modal,
    &:modal::backdrop {
        @starting-style {
            opacity: 0;
        }
    }
}

.modal-header {
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: calc(8 / 16 * 1rem);
    height: fit-content;
}

.modal-content {
    display: flex;
    flex-direction: column;
    gap: calc(12 / 16 * 1rem);
}

.modal-content .button[data-type="list"] {
    padding: 1rem calc(24 / 16 * 1rem);
}

@media screen and (max-width: 48rem) {
    dialog[data-type="modal"] {
        top: auto;
        bottom: 0;
        width: 100%;
        height: auto;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;

        &:modal,
        &:modal::backdrop {
            @starting-style {
                transform: translateY(50px);
            }
        }
    }

    .modal-header__button {
        display: none;
    }
}

/* アラート */
dialog[data-type="alert"] {
    width: min(90%, 28rem);
    padding: calc(24 / 16 * 1rem);
    border-radius: calc(28 / 16 * 1rem);
    background-color: #f5f5f5;
}

[theme="DARK"] dialog[data-type="alert"] {
    background-color: #0e0e11;
}

dialog[data-type="alert"]::backdrop {
    background-color: rgba(222, 222, 222, 0.8);
}

[theme="DARK"] dialog[data-type="alert"]::backdrop {
    background-color: rgba(100, 100, 100, 0.8);
}

.dialog__header {
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: calc(8 / 16 * 1rem);
}

.dialog__title {
    font-size: calc(20 / 16 * 1rem);
    font-weight: 500;
    flex: 1;
    margin: 0;
}

.dialog__content {
    display: flex;
    flex-direction: column;
    gap: calc(12 / 16 * 1rem);
    font-size: 1rem;
    line-height: 1.5;
    margin: calc(12 / 16 * 1rem) 0;
}

.dialog__footer {
    display: flex;
    justify-content: end;
    gap: calc(8 / 16 * 1rem);
    margin-top: 1rem;
}

.dialog__footer .button {
    width: fit-content;
}

.form-control-label {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    row-gap: calc(4 / 16 * 1rem);
    border: 0;
    padding: 0;
}

.form-control-label label {
    line-height: 1.2;
}

.form-control-label__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.date-filter-select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.date-filter-select {
    padding: 0 calc(24 / 16 * 1rem) 0 calc(4 / 16 * 1rem);
    border-radius: calc(8 / 16 * 1rem);
    border: none;
    background-color: unset;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1;
    text-align: right;
    cursor: pointer;
    min-height: calc(40 / 16 * 1rem);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    direction: rtl;
    /* ブラウザごとのデフォルト矢印を非表示 */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.date-filter-select:focus-visible {
    outline: unset;
}

.date-filter-select__icon {
    position: absolute;
    right: 0;
    pointer-events: none;
    font-size: calc(20 / 16 * 1rem);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.input-text {
    width: 100%;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    line-height: 1;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--_border-color);
    width: 100%;
    box-sizing: border-box;
    background-color: var(--_content-color);
}

[theme="DARK"] input[type="text"],
[theme="DARK"] input[type="email"],
[theme="DARK"] input[type="password"] {
    background-color: #18181b;
}

input[type="text"][data-size="lg"] {
    font-size: calc(40 / 16 * 1rem);
    font-weight: 400;
    line-height: 1.3;
}

input[type="text"][aria-invalid="true"],
input[type="password"][aria-invalid="true"] {
    border-color: crimson;
}

.input-text__error-text {
    color: crimson;
    margin: 0.5rem 0 0;
    display: none;
}

.input-text:has(input[type="text"][aria-invalid="true"]) .input-text__error-text,
.input-text:has(input[type="password"][aria-invalid="true"]) .input-text__error-text {
    display: block;
}

input[type="text"][data-type="num"] {
    text-align: right;
    padding: calc(8 / 16 * 1rem) 1rem;
}

.input-text:has(input[type="text"][data-type="num"]) {
    position: relative;
    font-family: "EB Garamond Num", ui-serif, serif;
}

.input-text:has(input[type="text"][data-type="num"])::after {
    content: "¥";
    position: absolute;
    left: 1rem;
    top: calc(8 / 16 * 1rem);
    bottom: 0;
    color: gainsboro;
    font-size: calc(40 / 16 * 1rem);
    line-height: 1.3;
}

[theme="DARK"] .input-text:has(input[type="text"][data-type="num"])::after {
    color: #52525b;
}

textarea {
    line-height: 1.3;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--_border-color);
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    field-sizing: content;
    min-height: calc(1rem * 2 + 1.3rem * 3);
    background-color: var(--_content-color);
}

[theme="DARK"] textarea {
    background-color: #18181b;
}

input[type="text"]:focus-visible,
input[type="password"]:focus-visible,
textarea:focus-visible {
    outline: unset;
    box-shadow: 0 0 0 0.15rem #ffeaa5;
    box-sizing: border-box;
}

[theme="DARK"] input[type="text"]:focus-visible,
[theme="DARK"] input[type="password"]:focus-visible,
[theme="DARK"] textarea:focus-visible {
    box-shadow: 0 0 0 0.15rem #461802;
}

::placeholder {
    color: var(--text-secondary);
}

input[type="text"]:disabled,
input[type="password"]:disabled,
textarea:disabled {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    background-color: var(--_content-color);
    border: unset;
    -webkit-opacity: 1 !important;
    opacity: 1 !important;
}

.form-container__body {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: calc(8 / 16 * 1rem);
}