/* =================================================================== */
/* 1. 基本設定 (Root, Body)
/* =================================================================== */
:root {
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-error: #B3261E;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-background: #FFFBFE;
    --md-sys-color-on-background: #1C1B1F;
    --md-sys-color-surface: #FFFBFE;
    --md-sys-color-on-surface: #1C1B1F;
    --md-sys-color-surface-variant: #E7E0EC;
    --md-sys-color-on-surface-variant: #49454F;
    --md-sys-color-outline: #79747E;
}
html, body {
    height: 100%;
}
body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
h1, h2 {
    background: none;
}

/* =================================================================== */
/* 2. サイト全体レイアウト (PukiWiki Skin)
/* =================================================================== */
/* 2.1. App Bar */
.m3-app-bar {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--md-sys-color-surface);
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    gap: 16px;
    flex-shrink: 0;
}
.m3-app-bar .logo {
    display: block;
    height: 40px;
    width: 40px;
}
.m3-app-bar .logo img {
    height: 100%;
    width: 100%;
}
.m3-app-bar .page-title {
    font-size: 22px;
    font-weight: 400;
    margin: 0;
    flex-grow: 1;
}
.m3-app-bar .page-title a {
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
}
.m3-app-bar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 2.2. Navigation Drawer */
.m3-navigation-drawer {
    width: 280px;
    background-color: var(--md-sys-color-surface);
    border-right: 1px solid var(--md-sys-color-surface-variant);
    flex-shrink: 0;
    overflow-y: auto;
    box-sizing: border-box;
}
#m3-drawer-toggle {
    display: none;
}
.m3-drawer-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.m3-drawer-header .logo { width: 32px; height: 32px; }
.m3-drawer-header .site-title { font-size: 18px; font-weight: 500; }
.m3-drawer-content { padding: 0 12px 24px; }
.m3-divider {
    border: none;
    height: 1px;
    background-color: var(--md-sys-color-surface-variant);
    margin: 8px 0;
}
.m3-drawer-subtitle {
    font-size: 12px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    padding: 8px 16px;
    margin-top: 8px;
}
.m3-drawer-list { list-style-type: none; padding: 0; margin: 0; }
.m3-drawer-list a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 24px;
    text-decoration: none;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 14px;
    font-weight: 500;
}
.m3-drawer-list a:hover { background-color: rgba(103, 80, 164, 0.08); }
.m3-drawer-list a .material-icons { font-size: 24px; }

/* 2.3. Drawer Accordion */
.m3-drawer-accordion .m3-accordion-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 4px 16px;
    border-radius: 24px;
}
.m3-drawer-accordion .m3-accordion-trigger:hover { background-color: rgba(103, 80, 164, 0.08); }
.m3-drawer-accordion .m3-drawer-subtitle { padding: 8px 0; margin: 0; }
.m3-drawer-accordion .m3-accordion-icon {
    color: var(--md-sys-color-on-surface-variant);
    transition: transform 0.3s ease;
}
.m3-drawer-accordion .m3-accordion-icon.rotated { transform: rotate(180deg); }
.m3-drawer-accordion .m3-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}
.m3-drawer-accordion .m3-accordion-content.active {
    max-height: 1000px;
    transition: max-height 0.5s ease-in;
}

/* 2.4. Scrim (Overlay) */
.m3-scrim {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.m3-scrim.is-active {
    opacity: 1;
    pointer-events: auto;
}

/* 2.5. Main Content Area */
.m3-main-container {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}
.m3-content-body-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
}

/* =================================================================== */
/* 3. 汎用コンポーネント
/* =================================================================== */
/* 3.1. Card */
.m3-card {
    background-color: var(--md-sys-color-surface);
    border-radius: 12px;
    padding-top: 2px;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 2px;
    width: 100%;
    max-width: 700px;
    margin: 10px auto;
    border: 2px solid var(--md-sys-color-surface-variant);
    box-sizing: border-box;
}
.m3-card-title {
    font-size: 16px;
    line-height: 15px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
    margin: 0 0 16px 0;
}
.m3-card-subtitle {
    font-size: 14px;
    line-height: 2px;
    color: var(--md-sys-color-on-surface-variant);
    margin: -24px 0 16px 0;
}

/* 3.2. Button */
.m3-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.1px;
    line-height: 20px;
    text-transform: none;
    box-sizing: border-box;
}
.m3-button.filled { background-color: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.m3-button.filled:hover { box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.m3-button.outlined { background-color: transparent; color: var(--md-sys-color-primary); border: 1px solid var(--md-sys-color-outline); }
.m3-button.outlined:hover { background-color: rgba(103, 80, 164, 0.08); }
.m3-button.error { background-color: var(--md-sys-color-error); color: var(--md-sys-color-on-error); }
.m3-button.error-text { background-color: transparent; color: var(--md-sys-color-error); border: 1px solid var(--md-sys-color-error); }
.m3-button.error-text:hover { background-color: rgba(179, 38, 30, 0.08); }
.m3-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    padding: 8px; border: none;
    background-color: transparent;
    border-radius: 50%;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: background-color 0.2s;
}
.m3-icon-button:hover { background-color: rgba(0, 0, 0, 0.08); }
.m3-icon-button .material-icons { font-size: 24px; }
.m3-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* 3.3. Form Elements */
.m3-form-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.m3-form-row > * { flex: 1; min-width: 150px; }
.m3-form-subtitle { margin: 0px 0 0px 0; font-weight: 500; color: var(--md-sys-color-primary); }
.m3-text-field, .m3-select { position: relative; background-color: #F3EDF7; border-radius: 4px 4px 0 0; height: 56px; box-sizing: border-box; }
.m3-text-field input, .m3-select select {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    width: 100%; padding: 21px 12px 0; border: none;
    border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
    border-radius: 4px; background-color: transparent;
    font-size: 16px; color: var(--md-sys-color-on-surface);
    outline: none; transition: border-color 0.2s;
    box-sizing: border-box; line-height: 1.5; height: 3.5rem;
}
.m3-text-field input:focus, .m3-select select:focus { border-bottom: 2px solid var(--md-sys-color-primary); }
.m3-text-field label, .m3-select label {
    position: absolute; left: 12px; top: 28px;
    transform: translateY(-50%); font-size: 16px;
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none; transition: all 0.2s ease;
    transform-origin: left top;
}
.m3-text-field input:focus + label,
.m3-text-field input:not(:placeholder-shown) + label,
.m3-select select:valid + label {
    top: 8px; transform: translateY(0) scale(0.75);
    color: var(--md-sys-color-primary);
}
.m3-text-field input[type="date"],
.m3-text-field input[type="time"] { text-align: left; }
.m3-text-field input[type="date"]::-webkit-date-and-time-value,
.m3-text-field input[type="time"]::-webkit-date-and-time-value { text-align: left; }
.m3-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2349454F' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 12px center;
    background-size: 1em;
}
.m3-select select { padding-right: 32px; }
.m3-checkbox-wrapper {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; cursor: pointer;
}
.m3-checkbox-wrapper input[type="checkbox"] { opacity: 0; position: absolute; width: 100%; height: 100%; cursor: pointer; }
.m3-checkbox-icon { width: 18px; height: 18px; pointer-events: none; }
.m3-checkbox-outline { stroke: var(--md-sys-color-on-surface-variant); stroke-width: 2px; fill: transparent; transition: all 0.2s ease-out; }
.m3-checkbox-tick { stroke: var(--md-sys-color-on-primary); stroke-width: 2.5px; fill: none; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset 0.3s ease-out; }
.m3-checkbox-wrapper input[type="checkbox"]:checked + label .m3-checkbox-outline { stroke: var(--md-sys-color-primary); fill: var(--md-sys-color-primary); }
.m3-checkbox-wrapper input[type="checkbox"]:checked + label .m3-checkbox-tick { stroke-dashoffset: 0; }
.m3-checkbox-wrapper input[type="checkbox"]:disabled + label { cursor: not-allowed; opacity: 0.5; }
.m3-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    margin-bottom: 24px;
}
.m3-checkbox-row .m3-checkbox-label {
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
}

/* 3.4. Table */
.m3-table-container { overflow-x: auto; }
.m3-table {
    width: 100%; border-collapse: collapse; margin: 0px 0;
    border: 2px solid var(--md-sys-color-surface-variant);
    border-radius: 1px; overflow: hidden;
}
.m3-table th, .m3-table td {padding: 2px;text-align: left;border-bottom: 1px solid var(--md-sys-color-surface-variant); font-size: 14px;}
.m3-table th { background-color: #F3EDF7; font-weight: 500; vertical-align: top; }
.m3-table th span {font-weight: 400;color: var(--md-sys-color-on-surface-variant);font-size: 13px;}
.m3-table tr:last-child td, .m3-table tr:last-child th { border-bottom: none; }

/* 3.5. List & Accordion */
.m3-list {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-surface-variant);
    border-radius: 12px; overflow: hidden;
    max-width: 800px; margin: 16px auto;
}
.m3-list-item { padding: 10px; border-bottom: 1px solid var(--md-sys-color-surface-variant); }
.m3-list-item:last-child { border-bottom: none; }
.m3-list-item .m3-card-title { margin: 0 0 4px 0; }
.m3-list-item .m3-card-subtitle { margin: 0; }
.m3-list-item .m3-table { margin-top: 16px; border: 1px solid var(--md-sys-color-surface-variant); border-radius: 8px; overflow: hidden; }
.m3-list-item .m3-table th { background-color: #F3EDF7; }
.m3-accordion-trigger { display: flex; justify-content: space-between; align-items: center; cursor: pointer; gap: 16px; }
.m3-accordion-header { flex-grow: 1; }
.m3-accordion-date { font-size: 14px; color: var(--md-sys-color-on-surface-variant); margin-top: 4px; }
.m3-accordion-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.m3-accordion-actions .m3-button { padding: 5px 16px; }
.m3-accordion-actions .m3-button .material-icons { margin-right: 8px; }
.m3-accordion-icon { color: var(--md-sys-color-on-surface-variant); transition: transform 0.3s ease; }
.m3-accordion-icon.rotated { transform: rotate(180deg); }
.m3-accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out, padding-top 0.4s ease-out; }
.m3-accordion-content.active { padding-top: 16px; max-height: 500px; transition: max-height 0.5s ease-in, padding-top 0.5s ease-in; }
.m3-accordion-content .m3-card-subtitle { margin-bottom: 12px; }

/* =================================================================== */
/* 4. アプリケーション特化コンポーネント
/* =================================================================== */
/* 4.1. Van Display */
.m3-van-card {
    display: grid; grid-template-columns: 95px 1fr;
    grid-template-rows: auto 1fr auto;
    border: 1px solid var(--md-sys-color-surface-variant);
    border-radius: 10px; margin-bottom: 5px; overflow: hidden;
}
.m3-van-footer-remarks {
    grid-area: 3 / 1 / 4 / 3; /* 3行目、1列目から、4行目、3列目の手前まで（全幅） */
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    padding: 2px 12px;
    
    /* 視覚的な調整 */
    border-top: 1px solid var(--md-sys-color-surface-variant);
    background-color: #F3EDF7;
    box-sizing: border-box;
}
.m3-van-card .m3-van-header {
background-color: #F3EDF7;padding: 5px;width:auto ;height: 100%;box-sizing: border-box;
grid-area: 1 / 1 / 3 / 2;
}
.m3-van-card .m3-table-container {
grid-area: 1 / 2 / 3 / 3; /* 1行目、2列目から、3行目、3列目の手前まで */
overflow-y: auto; 
}

.m3-van-card .m3-table { margin: 0; border: none; border-radius: 0; }
.m3-van-card .m3-form-actions .m3-button {
    padding: 0px;
    border-radius: 10px;
    width:100%;
}
.m3-van-card .m3-form-actions .m3-button .material-icons {
    font-size: 1rem;
}
.m3-van-header { display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 4px 12px; width: 10rem; }
.m3-van-title-line { display: table-row; align-items: center; justify-content: space-between; gap: 8px; }
.m3-van-name { font-size: 15px; font-weight: 500; color: var(--md-sys-color-on-surface); padding: 0px 2px 2px 2px;}
.m3-van-badge { padding: 2px 8px; border-radius: ; font-size: 12px; font-weight: 500; white-space: nowrap; }
.m3-van-badge--asa { background-color: #E8DEF8; color: #21005D; }
.m3-van-badge--kaeri { background-color: #D6E3FF; color: #001B3E; }
.m3-van-badge--de { background-color: #F3DDDD; color: #410002; }
.m3-van-locations {
    display:table-column ; align-items: flex-start; gap: 8px;
    text-align:center;
    font-size: 13px; color: var(--md-sys-color-on-surface-variant);
    border-top: 2px solid var(--md-sys-color-surface-variant);
    padding-top: 8px;
    padding-left: 0px;
}
.m3-van-locations .material-icons { font-size: 21px; margin-top: 0px; padding: 0px 0px; }
.m3-van-seats {
    font-size: 24px; font-weight: 700; text-align: center;
    color: var(--md-sys-color-primary);
    border-top: 1px solid var(--md-sys-color-surface-variant);
    padding-top: 12px;
}
.m3-van-remarks { font-size: 13px; color: var(--md-sys-color-on-surface-variant); padding: 0px 5px }
.m3-table-wrapper { margin-bottom: 24px; }
.m3-table-wrapper:last-child { margin-bottom: 0; }
.m3-table th:has(.m3-van-header) { width: 14rem; vertical-align: top; padding: 0; }
.m3-table td.m3-table-order {
    width: 1.0rem; min-width: 0 !important;
    padding: 1px 0 1px px; text-align: center;
    font-weight: 350; color: var(--md-sys-color-on-surface-variant);
    font-size: 12px;
    
}
.m3-table td.m3-table-name { width: 6em; font-size:13px; }
.van-schedule-regist .m3-table th:first-child { width: 1.5rem; }
.van-schedule-regist .m3-table th:nth-child(3) { width: 3rem; }

/* 4.2. Demand Display */
.m3-title-line { display: flex; align-items: baseline; gap: 12px; }
.m3-circle-name {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    padding: 0px 0px; border-radius: 10px;
    width:4rem;
    text-align:center;
    font-size: 12px; font-weight: 500; white-space: nowrap;
}
.m3-table th:has(.m3-title-line) { width: 25%; min-width: 180px; white-space: nowrap; }
.m3-table th:has(.m3-demand-details) {
    background-color: var(--md-sys-color-surface);
    text-align: left; font-weight: 400;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
}
.m3-demand-details {
    font-size: 12px; color: var(--md-sys-color-on-surface-variant);
    padding-top: 0px;
}

/* 4.3. Utility Components */
.m3-entry-point { text-align: center; margin: 24px; }
.m3-entry-point .m3-button {
    width: 4rem;
    height: 4rem;
    border-radius: 2rem;
    position: fixed;
    right: 32px;
    bottom: 32px;
    z-index: 999;
}
.m3-diff-container { display: flex; align-items: center; gap: 16px; margin: 24px 0; flex-wrap: wrap; }
.m3-diff-container > div { flex: 1; }
.m3-arrow { font-size: 24px; font-weight: bold; text-align: center; }
.m3-card-header {
    position: sticky;
    inset: -24px 0 0 2px;
    padding: 8px 0;
    display: flex; flex-wrap: wrap; justify-content: space-between;
    align-items: center; gap: 12px;
    background-color: var(--md-sys-color-background);
}
.m3-card-header .m3-card-title { margin: 0; }
.m3-card-counts { display: flex; gap: 5px; flex-shrink: ;  }
.m3-count-chip {
    display: inline-flex; align-items: center; gap:5px;
    padding: 0.5px 5px; border-radius: 8px;
    font-size: 13px; font-weight: 400;
    width:95px; justify-content: center
}
.m3-count-chip .material-icons { font-size: 13px; }
.m3-count-chip.total { background-color: #E0E0E0; color: #1C1B1F; }
.m3-count-chip.assigned { background-color: #E8DEF8; color: #49454F; }
.m3-count-chip.unassigned { background-color: #F3DDDD; color: #410002; }

/* =================================================================== */
/* 5. レスポンシブデザイン
/* =================================================================== */
@media (max-width: 800px) {
    #m3-drawer-toggle { display: inline-flex; }
    .m3-navigation-drawer {
        position: fixed; left: 0; top: 0; height: 100%;
        z-index: 1000; transform: translateX(-105%);
        transition: transform 0.3s ease-in-out;
    }
    .m3-navigation-drawer.is-open {
        transform: translateX(0);
        box-shadow: 0 8px 10px -5px rgba(0,0,0,0.2), 0 16px 24px 2px rgba(0,0,0,0.14), 0 6px 30px 5px rgba(0,0,0,0.12);
    }
    .m3-content-body-wrapper { padding: 16px; }
}

@media (max-width: 100px) {
    .m3-card {padding: 10px;}
    .m3-card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .m3-form-row { flex-direction: column; gap: 24px; }
    .m3-form-actions { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
    .m3-form-actions > * { margin: 0 !important; }
    .m3-form-actions > div { display: flex; flex-direction: column-reverse; gap: 12px; }
    .m3-diff-container { flex-direction: column; align-items: stretch; }
    .m3-arrow { transform: rotate(90deg); margin: 24px 0; }
    .van-schedule-regist .m3-table { min-width: 300px; }
    .van-schedule-regist .m3-table th:nth-child(4),
    .van-schedule-regist .m3-table td:nth-child(4) { min-width: 120px; }
    .van-schedule-regist .m3-table th:nth-child(5),
    .van-schedule-regist .m3-table td:nth-child(5) { min-width: 150px; }
    .m3-van-card { display:block-columm; }
    .m3-van-card .m3-van-header { border-bottom: 1px solid var(--md-sys-color-surface-variant); }
}
/* 22. Login Form (追記) */
.m3-login-card {
    max-width: 420px; /* ログインフォームの最適な幅を設定 */
}

.m3-form-error {
    color: var(--md-sys-color-error);
    font-size: 14px;
    padding: 0 16px;
    margin: -8px 0 16px 0;
    text-align: center;
}

/* 23. Emoji Suggest Component (追記) */
#emoji_suggest_container {
    position: absolute; /* ページと一緒にスクロールするように変更 */
    width: 256px;
    height: 200px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--md-sys-color-surface-variant);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 8px;
    gap: 4px;
    overflow-y: scroll;
    z-index: 10;
    display: none; /* 初期状態は非表示 */
    flex-wrap: wrap;
    align-content: flex-start;
}