/* ==================================================
   css/global.css - 共通スタイル (完全版)
   ================================================== */

/* --- 1. 基本設定 --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 98%; /* 画面幅を有効活用 */
    width: 98%;
    margin: 20px auto;
    background-color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

h1, h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 25px;
    font-weight: 600;
}
h1 { font-size: 2.2em; }
h2 {
    font-size: 1.6em;
    padding-bottom: 15px;
    border-bottom: 2px solid #34495e;
}

.message {
    text-align: center; margin-bottom: 20px; padding: 10px; border-radius: 5px; font-weight: bold;
}
.message p { margin: 0; }
.message p[style*="red"] { color: #dc3545; background: #f8d7da; border: 1px solid #f5c6cb; }
.message p[style*="green"] { color: #28a745; background: #d4edda; border: 1px solid #c3e6cb; }
.message p[style*="orange"] { color: #fd7e14; background: #fff3cd; border: 1px solid #ffeeba; }


/* --- 2. フォーム要素 (高さを40pxに統一・ズレ防止) --- */
.form-section {
    margin-top: 30px; padding-top: 20px; border-top: 1px solid #eee;
}
form div { margin-bottom: 0; }

label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #4a6a8a;
}

/* 入力欄・プルダウン共通 */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    height: 40px; /* 高さを統一 */
    padding: 6px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    vertical-align: middle;
    background-color: #fff;
    margin: 0;
    font-family: inherit;
}

/* テキストエリア */
textarea {
    height: auto;
    min-height: 100px;
    resize: vertical;
    padding: 10px;
}

/* 日付とセレクトボックスの幅は中身に合わせる（基本設定） */
input[type="date"], select { width: auto; min-width: 80px; }

/* セレクトボックス装飾 */
select {
    appearance: none; 
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2334495E%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13.6-6.4H19.6c-4.8%200-9.2%201.2-13.6%206.4-4.8%204.8-6.4%2010.8-6.4%2017.6s1.6%2012.8%206.4%2017.6l128%20128c4.8%204.8%2010.8%206.4%2017.6%206.4s12.8-1.6%2017.6-6.4l128-128c4.8-4.8%206.4-10.8%206.4-17.6S291.8%2074.2%20287%2069.4z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
    padding-right: 30px;
    cursor: pointer;
}

input:focus, textarea:focus, select:focus {
    border-color: #3498db; box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3); outline: none;
}

/* ==================================================
   ボタン・リンクの共通デザイン
   ================================================== */

/* ベースのボタンスタイル */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    height: 44px;
    padding: 0 25px;
    font-size: 1.1em;
    font-weight: 600;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    box-sizing: border-box;
    line-height: normal;
}

.btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
    color: #fff !important;
}

/* 色のバリエーション */

/* メイン操作（登録・更新・ログイン）: 青 */
.btn-primary {
    background-color: #3498db;
}
.btn-primary:hover {
    background-color: #2980b9;
}

/* 更新用ボタン（緑） */
.btn-success {
    background-color: #2ecc71;
    color: white;
}
.btn-success:hover {
    background-color: #27ae60;
}

/* 危険な操作（削除）: 赤 */
.btn-danger {
    background-color: #e74c3c;
}
.btn-danger:hover {
    background-color: #c0392b;
}

/* サブ操作（キャンセル・戻る）: グレー */
.btn-secondary {
    background-color: #95a5a6;
}
.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* フォーム内のデフォルトボタン（buttonタグ）への適用 */
button[type="submit"] {
    /* @extend .btn; の代わりに中身を直接書きます */
    display: inline-flex;
    justify-content: center;
    align-items: center;
    height: 44px;
    padding: 0 25px;
    font-size: 1.1em;
    font-weight: 600;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    box-sizing: border-box;
    line-height: normal;
}

button[type="submit"]:hover {
    transform: translateY(-1px);
}


/* --- 3. その他共通パーツ --- */
/* テーブル */
.list-section { margin-top: 30px; padding-top: 20px; border-top: 1px solid #eee; }
table {
    width: 100%; border-collapse: collapse; margin-top: 20px;
    background: #fff; border-radius: 8px; overflow: hidden;
}
th, td { border: 1px solid #eaedf1; padding: 12px; text-align: left; }
th { background: #ecf0f1; color: #555; font-size: 0.9em; text-transform: uppercase; }
tbody tr:nth-child(even) { background-color: #f9fbfd; }
tbody tr:hover { background-color: #eef2f6; }

/* リンク */
a { color: #3498db; text-decoration: none; transition: color 0.2s; }
a:hover { color: #2980b9; text-decoration: underline; }

/* 施設情報 */
.facility-info {
    background: #e9f3f9; padding: 20px; border-radius: 8px; margin-bottom: 25px; border-left: 5px solid #3498db;
}
.facility-info p { margin: 8px 0; color: #2c3e50; }

/* フィルタ */
.filter-section {
    text-align: center; margin-bottom: 30px; padding-bottom: 25px; border-bottom: 1px solid #e0e0e0;
}
.filter-section label { margin-right: 15px; color: #4a6a8a; display: inline-block; }
.filter-section select, .filter-section button { margin-right: 10px; vertical-align: middle; }

/* 部署管理インデント */
.department-name-indent-0 { padding-left: 0px; }
.department-name-indent-1 { padding-left: 20px; }
.department-name-indent-2 { padding-left: 40px; }
.department-name-indent-3 { padding-left: 60px; }

/* 日付ナビ */
.date-nav a {
    background: #ecf0f1; color: #2c3e50; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 0.9em;
}
.date-nav a:hover { background: #bdc3c7; text-decoration: none; }
.date-nav .current-date { font-size: 1.4em; font-weight: bold; color: #2c3e50; min-width: 220px; text-align: center; }

/* ステータスバッジ */
.status-badge {
    display: inline-block; padding: 6px 12px; border-radius: 50px; font-size: 0.8em; font-weight: 600; color: white; min-width: 70px; text-align: center;
}
.status-leave   { background-color: #e74c3c; }
.status-wfh     { background-color: #2ecc71; }
.status-out     { background-color: #f39c12; }
.status-trip    { background-color: #9b59b6; }
.status-meeting { background-color: #3498db; }
.status-other   { background-color: #95a5a6; }


/* --- 4. 認証ページ (ログイン等) --- */
body.auth-page {
    height: 100vh; display: flex; justify-content: center; align-items: center;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    margin: 0;
}
.auth-card {
    background: #fff; width: 100%; max-width: 400px; padding: 40px;
    border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.1); text-align: center;
}
.auth-logo { margin-bottom: 30px; }
.auth-logo h1 { font-size: 1.8em; color: #0056b3; margin: 0 0 10px 0; border-bottom: none; }
.auth-logo p { color: #666; font-size: 0.9em; margin: 0; }
.btn-block { display: block; width: 100%; padding: 12px; font-size: 1.1em; border-radius: 6px; text-align: center; box-sizing: border-box; }
.btn-primary { background: #007bff; color: white; font-weight: bold; box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2); }
.btn-primary:hover { background: #0056b3; transform: translateY(-2px); }
.auth-form-group { margin-bottom: 20px; text-align: left; }
.auth-form-group input { background: #f9f9f9; }
.auth-footer { margin-top: 20px; font-size: 0.85em; color: #888; }


/* --- 5. ダッシュボードスタイル --- */
/* セクション区切り */
.spacer { height: 40px; border-bottom: 1px dashed #eee; margin-bottom: 40px; }

.section-header { margin-bottom: 20px; }
.section-title {
    font-size: 1.3em; color: #2c3e50; margin-bottom: 5px;
    border-left: 5px solid #ccc; padding-left: 12px; font-weight: bold; letter-spacing: 0.05em;
}
.section-desc { color: #666; font-size: 0.9em; margin: 0 0 0 5px; }

/* グリッド */
.dashboard-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px;
}

/* メニューカード共通 */
.menu-card {
    background: #f9f9f9; 
    border-radius: 8px; padding: 20px; text-decoration: none; color: #333;
    border: 1px solid #eee; transition: all 0.2s ease;
    display: flex; flex-direction: column; align-items: flex-start; position: relative; overflow: hidden;
}
.menu-card:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.08); 
    background: #fff;
}

.card-icon {
    font-size: 2em; margin-bottom: 10px; 
    width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.menu-card h3 { margin: 0 0 5px 0; font-size: 1.1em; color: #2c3e50; font-weight: bold; }
.menu-card p { margin: 0; font-size: 0.85em; color: #777; line-height: 1.5; }

/* アクセントカラー設定 */
.card-blue { border-top: 4px solid #3498db; }
.card-blue .card-icon { background-color: #e3f2fd; color: #3498db; }
.card-blue:hover { border-color: #3498db; }

.card-green { border-top: 4px solid #2ecc71; }
.card-green .card-icon { background-color: #e8f5e9; color: #2ecc71; }
.card-green:hover { border-color: #2ecc71; }

.card-orange { border-top: 4px solid #fd7e14; }
.card-orange .card-icon { background-color: #fff3e0; color: #fd7e14; }
.card-orange:hover { border-color: #fd7e14; }


/* --- 6. 共通ヘッダー (シンプル区切り線スタイル) --- */
.site-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky; top: 0; z-index: 1000;
    width: 100%; height: 50px;
    display: flex; align-items: center;
}

.header-inner {
    width: 100%; max-width: 100%; margin: 0 auto; padding: 0 20px;
    display: flex; justify-content: space-between; align-items: center; height: 100%;
}

.header-logo {
    font-size: 1.3em; font-weight: bold; color: #0056b3; text-decoration: none;
    white-space: nowrap; margin-right: 40px; display: flex; align-items: center;
}

.header-nav {
    display: flex; align-items: center; flex-grow: 1; height: 100%;
}

.nav-list {
    display: flex; list-style: none; margin: 0; margin-left: auto; padding: 0; align-items: center; height: 100%;
}
.nav-list li { margin: 0; display: flex; align-items: center; height: 100%; }

/* リンク本体 */
.nav-list a {
    text-decoration: none; color: #555; font-weight: 600; font-size: 0.9em;
    display: flex; align-items: center; height: 30px; padding: 0 15px; margin: 0;
    background-color: transparent !important; border: none !important; border-radius: 0 !important;
    box-shadow: none !important;
    border-right: 1px solid #e0e0e0 !important;
    transition: color 0.2s;
}
.nav-list li:last-child a { border-right: none !important; }
.nav-list a:hover { color: #0056b3; background-color: transparent !important; }
.nav-list a.active { color: #0056b3; background-color: transparent !important; }

.header-user {
    display: flex; align-items: center; gap: 15px; margin-left: 30px;
}
.user-name { font-size: 0.9em; font-weight: normal; color: #333; }

.logout-link {
    font-size: 0.85em; color: #888; text-decoration: none;
    border: 1px solid #ddd; padding: 3px 10px; border-radius: 4px;
    background: #fff; height: auto; line-height: normal;
    white-space: nowrap; /* 文字の折り返しを禁止（1行に強制） */
    flex-shrink: 0;      /* 横幅が狭くなってもボタンを縮めない */
}
.logout-link:hover { background: #f9f9f9; color: #333; }

.mobile-menu-btn {
    display: none; background: none; border: none; cursor: pointer;
    flex-direction: column; justify-content: space-around; width: 30px; height: 20px;
    padding: 0; z-index: 1001;
}
.mobile-menu-btn span {
    display: block; width: 100%; height: 2px; background-color: #333; border-radius: 2px; transition: all 0.3s;
}


/* --- 7. スマホ対応 (768px以下) --- */
@media (max-width: 900px) {

        /* 1. 背景色を白にする（グレーの隙間を消す） */
    body {
        background-color: #ffffff;
    }

    /* 2. コンテナを画面いっぱいに広げる */
    .container {
        width: 100% !important;      /* 幅100% */
        max-width: 100% !important;  /* 最大幅制限を解除 */
        margin: 0 !important;        /* 外側の余白をゼロに */
        border-radius: 0 !important; /* 角丸をなくす */
        box-shadow: none !important; /* 影をなくす */
        
        /* 内部の余白は少し残す（お好みで調整してください） */
        padding: 10px !important;    
    }

    .navbar { padding: 0 15px; }
    .navbar-user span { display: none; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .section-title { font-size: 1.2em; }

    .mobile-menu-btn { display: flex; }
    .header-nav {
        position: fixed; top: 50px; right: -100%; width: 250px; height: calc(100vh - 50px);
        background: #fff; box-shadow: -2px 5px 10px rgba(0,0,0,0.1);
        flex-direction: column; align-items: flex-start; padding: 20px;
        transition: right 0.3s ease; display: flex; z-index: 999;
    }
    .header-nav.open { right: 0; }
    .nav-list {
        flex-direction: column; width: 100%; height: auto; align-items: flex-start;
        border-bottom: 1px solid #eee; padding-bottom: 15px; margin-bottom: 15px;
    }
    .nav-list li { width: 100%; display: block; margin-bottom: 5px; }
    .nav-list a {
        display: block; width: 100%; padding: 10px 0; border: none !important; font-size: 1em; height: auto;
    }
    .header-user {
        flex-direction: column; align-items: flex-start; margin: 0; width: 100%; gap: 10px;
    }
    .logout-link {
        display: block; width: 100%; text-align: center; padding: 10px;
        border: 1px solid #ddd; background: #f9f9f9;
        box-sizing: border-box; /* paddingを含めて100%にする */
        margin: 0;              /* 余計な余白を消す */
    }
}

/* =============================================
   通知エリア (Dashboard用)
   ============================================= */
.notification-section {
    background-color: #fff9db; /* 薄い黄色 */
    border: 1px solid #ffe066;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.notification-header {
    font-weight: bold;
    color: #e67700;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.notification-list {
    list-style: none;
    margin: 0;
    padding: 0;
     /* 高さ制限 (約2件分 + 少し余裕を持たせるサイズ) */
    /* 1件あたり約50px～60pxと想定して 130px くらいに設定 */
    max-height: 130px; 
    
    /* 中身がこれを超えたら縦スクロールバーを出す */
    overflow-y: auto;
    
    /* スクロールバーが内容に被らないように少し右に余白 */
    padding-right: 5px;
}

.notification-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 10px 15px;
    margin-bottom: 8px;
    transition: background 0.2s;
}
.notification-item:last-child { margin-bottom: 0; }
.notification-item:hover { background-color: #fcfcfc; }

.notification-link {
    text-decoration: none;
    color: #333;
    display: block;
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}
.notification-link:hover { text-decoration: none; color: #0056b3; }

.notification-time {
    font-size: 0.85em;
    color: #888;
    white-space: nowrap;
    min-width: 80px;
}

.notification-message {
    font-size: 0.95em;
    font-weight: 500;
}

/* 既読(×)ボタン */
.btn-notif-close {
    background: none;
    border: none;
    color: #555 !important; 
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 15px;
    height: auto;
    width: auto;
    display: inline-block;
}
.btn-notif-close:hover {
    color: #e74c3c;
    background: none;
    transform: scale(1.2);
}

/* スマホ対応 */
@media (max-width: 600px) {
    .notification-link { flex-direction: column; align-items: flex-start; gap: 5px; }
    .notification-time { font-size: 0.8em; }
}

/* ==================================================
   共通フィルタ・絞り込みバー (Dropdown UI)
   ================================================== */

/* ドロップダウンの親枠 */
.custom-dropdown {
    position: relative;
    /* ▼▼▼ 追加: これで中の「ラベル」と「ボタン」が横並びになります ▼▼▼ */
    display: flex;
    align-items: center;
    gap: 8px; /* ラベルとボタンの間の隙間 */
}

/* --- ドロップダウン内のリストアイテム --- */

/* 行全体の設定 */
.chk-item {
    display: flex !important;        /* Flexboxで横並びを強制 */
    align-items: center !important;  /* 上下中央揃え */
    justify-content: flex-start !important; /* 左寄せ */
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;              /* 上下左右の余白 */
    border-bottom: 1px solid #f9f9f9;
    color: #333;
    font-size: 0.95em;
    background: #fff;
    cursor: pointer;
    line-height: 1.2;               /* 行間を少し詰める */
}
.chk-item:hover {
    background-color: #f0f7ff;
}

/* チェックボックス (左端に固定) */
.chk-item input[type="checkbox"] {
    transform: scale(1.2);          /* 少し大きく */
    margin: 0 8px 0 0 !important;   /* 右に8pxの隙間を確保、他は0 */
    padding: 0;
    flex-shrink: 0;                 /* 画面が狭くても絶対に潰れないようにする */
    cursor: pointer;
}

/* テキスト部分 (親要素からのズレはPHPのstyle属性で制御) */
.item-text {
    display: block;
    word-break: break-all;          /* 長い単語は改行 */
    flex-grow: 1;                   /* 右側の余白を埋める */
    text-align: left !important;    /* 左寄せ強制 */
    /* PHP側で margin-left が付与されるため、ここでは指定不要 */
}

/* 部署ヘッダー (区切り) */
.dept-header {
    background-color: #f0f0f0; /* 薄いグレー */
    padding: 6px 12px;
    font-weight: bold;
    font-size: 0.85em;
    color: #555;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #eee;
    cursor: default; /* クリックできないことを示すカーソル */
    pointer-events: none; /* ホバー反応などを無効化 */
}

/* リストの一番上がヘッダーだった場合、上の線は消す */
.dropdown-content .dept-header:first-child {
    border-top: none;
}

/* フィルタ内のボタンエリア (右寄せ) */
.filter-actions {
    display: flex;
    gap: 10px;
    margin-left: auto; /* これで右端に寄る */
}

/* 白いバー本体 */
.filter-bar {
    display: flex;
    width: 100%;             /* ★追加: 横幅いっぱいに広げる */
    box-sizing: border-box;  /* ★追加: paddingを含めて幅計算する */
    gap: 10px;
    align-items: center;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    flex-wrap: wrap;
}

/* --- レスポンシブ (スマホ対応) --- */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 15px;
    }
    .dropdown-btn {
        width: 100%;
        box-sizing: border-box;
        min-width: auto;
    }
    .dropdown-content {
        width: 100%;
        min-width: auto;
    }
    .filter-actions {
        margin-left: 0;
        width: 100%;
    }
    .filter-actions .btn {
        width: 100%;
        text-align: center;
        display: block;
    }
}


/* ==================================================
   [追記分] スケジュールページ共通パーツ (元calendar.css)
   ================================================== */

/* --- トップバー & モード切替 --- */
.top-bar { 
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; 
    margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 15px;
}
.mode-switcher { display: flex; }
.mode-switcher a { 
    padding: 8px 16px; border: 1px solid #bdc3c7; text-decoration: none; color: #555; background: #f9fbfd;
}
.mode-switcher a:first-child { border-radius: 6px 0 0 6px; border-right: none; }
.mode-switcher a:last-child { border-radius: 0 6px 6px 0; }
.mode-switcher a.active { background: #3498db; color: white; border-color: #3498db; }

/* --- 日付ナビゲーション ( < 202X年 > ) --- */
.nav-btn { background: #ecf0f1; padding: 8px 16px; border-radius: 20px; color: #333; }

/* --- フィルタエリア --- */
.filter-section {
    display: flex; align-items: center; gap: 15px; flex-wrap: wrap; border: 1px solid #eee;
}

/* --- フォーム・ポップアップ (登録・編集画面) --- */
.form-popup { 
    margin-top: 40px; padding: 30px; background: #f9fbfd; 
    border-radius: 8px; border: 1px solid #eaedf1; border-top: 5px solid #3498db; 
}
.form-popup.edit-mode { border-top-color: #2ecc71; background: #f0f9f4; }
.form-popup h2, .form-popup h3 { text-align: left; margin-top: 0; padding-bottom: 10px; border-bottom: 1px solid #ddd; }

.title-input-group { display: flex; gap: 10px; align-items: center; width: 100%; }
.title-input-group select { width: auto !important; min-width: 160px; }
.title-input-group input { flex: 1; }

.datetime-responsive-wrapper { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.dt-block { display: flex; align-items: center; gap: 10px; }
.dt-time-row { display: flex; align-items: center; gap: 10px; }

/* 時間選択プルダウン */
.time-select-group { display: flex; align-items: center; gap: 5px; }
.form-popup .time-select-group select { min-width: 70px !important; }

/* チェックボックス装飾 */
.dt-checkbox {
    margin: 0 !important; height: 40px !important; 
    display: flex !important; align-items: center !important; 
    cursor: pointer; font-weight: bold; color: #555; white-space: nowrap;
    padding: 0 10px; border: 1px solid #bdc3c7; border-radius: 4px; background: #fff;
}

.dt-checkbox input { margin-right: 8px !important; transform: scale(1.3); }

.form-actions { margin-top: 40px; display: flex; gap: 15px; align-items: center; }

/* --- 詳細表示ポップアップ (詳細クリック時) --- */
#detail-view-area {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%;
    background: #fff; border-top: 2px solid #3498db;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1); padding: 15px; box-sizing: border-box; 
    z-index: 3000; max-height: 40vh; overflow-y: auto;
}
.detail-close-row { text-align: right; margin-bottom: 5px; }
.close-detail { background: #eee; border: none; font-size: 1.5em; cursor: pointer; color: #555; width:36px; height:36px; border-radius:50%; line-height:1; }
#detail-view-area h3 { margin: 0 0 10px 0; font-size: 1.2em; color: #333; border-bottom: 1px solid #eee; padding-bottom: 5px; }
.detail-row { margin-bottom: 8px; font-size: 0.95em; }
.detail-label { font-weight: bold; color: #555; display: inline-block; width: 60px; vertical-align: top; }

/* --- スマホ用調整 (フォーム周りのみ) --- */
@media screen and (max-width: 768px) {
    .top-bar { flex-direction: column; gap: 10px; }
    .mode-switcher { width: 100%; }
    .mode-switcher a { flex: 1; text-align: center; }
    
    .form-popup { padding: 15px; background: #f8f9fa; }
    .title-input-group { flex-direction: column; align-items: stretch; }
    .title-input-group select, .title-input-group input { width: 100% !important; margin-bottom: 10px; }
    .datetime-responsive-wrapper, .dt-block, .dt-time-row { display: block; }
    .dt-block { margin-bottom: 15px; padding: 10px; background: #fff; border: 1px solid #eee; border-radius: 4px; }
    .form-actions { flex-direction: column; }
    .form-actions button, .form-actions a { width: 100%; }
    
    /* 日付ナビのスマホ配置 */
    .date-nav { flex-wrap: wrap; gap: 10px; }
    .date-nav .current-date { width: 100%; order: 1; margin-bottom: 5px; }
    .date-nav a { order: 2; flex: 1; text-align: center; padding: 10px 0; }
}


        .facility-name { font-size: 0.9em; font-weight: bold; color: #333; }
        .facility-name span { display: block; margin-top: 2px; font-size: 0.85em; color: #777; font-weight: normal; }
        
        .week-table .facility-col { width: 120px; min-width: 120px; position: sticky; left: 0; z-index: 30; background: #ecf0f1; border-right: 2px solid #dce1e6; box-shadow: 2px 0 5px rgba(0,0,0,0.05); }
        .week-table .facility-name { position: sticky; left: 0; z-index: 25; background: #fff; border-right: 2px solid #dce1e6; box-shadow: 2px 0 5px rgba(0,0,0,0.05); }
        
        @media screen and (max-width: 768px) {
            .week-table .facility-col, .week-table .facility-name { width: 80px; min-width: 80px; font-size: 0.8em; }
            .filter-section form { flex-direction: column; align-items: stretch !important; }
            .filter-section div { width: 100%; }
            .filter-section select { width: 100%; }
        }

        #detail-view-area {
            display: none; position: fixed; bottom: 0; left: 0; width: 100%;
            background: #fff; border-top: 2px solid #3498db;
            box-shadow: 0 -2px 10px rgba(0,0,0,0.1); padding: 15px; box-sizing: border-box; z-index: 1000;
            max-height: 40vh; overflow-y: auto;
        }
        .detail-close-row { text-align: right; margin-bottom: 5px; }
        .close-detail { background: #eee; border: none; font-size: 1.5em; cursor: pointer; color: #555; width:36px; height:36px; border-radius:50%; line-height:1; }
        
        #detail-view-area h3 { margin: 0 0 10px 0; font-size: 1.2em; color: #333; border-bottom: 1px solid #eee; padding-bottom: 5px; }
        .detail-row { margin-bottom: 8px; font-size: 0.95em; }
        .detail-label { font-weight: bold; color: #555; display: inline-block; width: 60px; vertical-align: top; }

        /* --- 日付ナビゲーション ( < 202X年 > ) --- */
        .date-nav {
            display: flex; 
            justify-content: center; 
            align-items: center; 
            gap: 20px; 
            margin-bottom: 20px;
        }
        .date-nav .current-date {
            font-size: 1.4em; 
            font-weight: bold; 
            color: #2c3e50; 
            min-width: 220px; 
            text-align: center;
        }
        
        /* カレンダーバーの高さ制限と省略表示 */
        .res-bar {
            height: 38px !important; 
            overflow: hidden !important;
            padding: 2px 4px !important;
        }
        .res-title {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            display: block;
        }
        
        /* ヘッダーの日付文字サイズ調整 */
        .week-table th { font-weight: normal; font-size: 0.95em; }
        th.today { font-weight: 900 !important; }

    /* ==================================================
   共通フィルタ・絞り込みバー (Dropdown UI)
   ================================================== */

/* 外枠エリアのりセット */
.filter-section {
    border: none !important;
    padding: 0 !important;
    margin-bottom: 20px;
}

/* 白いバー本体 */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #fff;
    padding: 15px;
    border-radius: 8px; /* 角丸を少し柔らかく */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* 影を少しリッチに */
    flex-wrap: wrap;
}

/* ドロップダウンの親枠 */
.custom-dropdown {
    position: relative;
}

/* ドロップダウンボタン (見た目) */
.dropdown-btn {
    padding: 10px 15px; /* クリックエリアを確保 */
    border: 1px solid #e0e0e0; /* 薄いグレー */
    background: #fff;
    cursor: pointer;
    border-radius: 6px;
    min-width: 180px;
    text-align: left;
    font-size: 0.95em;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
.dropdown-btn:hover {
    background-color: #f8f9fa;
    border-color: #ccc;
}
.dropdown-btn::after {
    content: "▼";
    font-size: 0.7em;
    color: #999;
    margin-left: 10px;
}

/* ドロップダウンの中身 (リスト) */
.dropdown-content {
    display: none;
    position: absolute;
    top: 110%; /* ボタンから少し離す */
    left: 0;
    background-color: #fff;
    min-width: 280px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15); /* 浮いている感を出す */
    z-index: 1000;
    border: 1px solid #eee;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px 0;
    border-radius: 8px;
}
.dropdown-content.show {
    display: block;
    animation: fadeIn 0.1s ease-out;
}

/* アニメーション用 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* リストアイテム (行) */
.chk-item {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 15px;
    border-bottom: 1px solid #f9f9f9;
    color: #333;
    font-size: 0.95em;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}
.chk-item:last-child { border-bottom: none; }
.chk-item:hover { background-color: #f0f7ff; /* ホバー時は薄い青 */ }

/* チェックボックス */
.chk-item input[type="checkbox"] {
    transform: scale(1.3);
    margin-right: 12px; /* 文字との間隔 */
    flex-shrink: 0;
    cursor: pointer;
}

/* テキスト部分 */
.item-text {
    display: block;
    word-break: break-all;
    flex-grow: 1;
    line-height: 1.4;
}

/* 部署ヘッダー (区切り) */
.dept-header {
    background: #f8f9fa;
    padding: 8px 15px;
    font-weight: bold;
    font-size: 0.85em;
    color: #666;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* フィルタ内のボタンエリア (右寄せ) */
.filter-actions {
    display: flex;
    gap: 10px;
    margin-left: auto; /* これで右端に寄る */
}

/* --- レスポンシブ (スマホ対応) --- */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 15px;
    }
    .dropdown-btn {
        width: 100%;
        box-sizing: border-box;
        min-width: auto;
    }
    .dropdown-content {
        width: 100%;
        min-width: auto;
    }
    .filter-actions {
        margin-left: 0;
        width: 100%;
    }
    .filter-actions .btn {
        width: 100%;
        text-align: center;
        display: block;
    }
}