*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f4f6f8;
    line-height: 1.6;
}

a {
    color: #3b82f6;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========== サイドメニュー ========== */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    transition: grid-template-columns .22s ease;
}

/* サイドバーは fixed でグリッドの流れから外れるため、メインは常に2カラム目に置く
   （1カラム目=260px はサイドバー用の予約スペース） */
.app-main {
    grid-column: 2;
}

/* サイドバー折りたたみ状態（アイコンのみのレール表示）はデスクトップ幅のみ。
   スマホ幅では下部メディアクエリのドロワー（スライドイン）設計を使う */
@media (min-width: 961px) {
html.sidebar-collapsed .app-shell {
    grid-template-columns: 64px minmax(0, 1fr);
}

html.sidebar-collapsed .sidebar {
    width: 64px;
    /* フライアウトを固定フッターバー等より前面に出す */
    z-index: 45;
}

html.sidebar-collapsed .sidebar-inner {
    width: 64px;
    /* アクティブ項目のハイライトがレール端に密着しないよう左右に余白を作る */
    padding-left: 8px;
    padding-right: 8px;
    /* hover時のラベルフライアウトをレール外へ出すため可視にする */
    overflow: visible;
}

/* レール表示ではラベル類を隠してアイコンだけ見せる。
   ・通常メニューのラベル span は hover時のフライアウトに流用するので隠さない
   ・アコーディオンの親ラベルはフライアウトパネルの見出しを使うので隠す
   ・サブメニューは hover時のフライアウトパネルとして表示する（display:none にしない） */
html.sidebar-collapsed .sidebar-brand,
html.sidebar-collapsed .sidebar-brand-text,
html.sidebar-collapsed .sidebar-trigger-label > span,
html.sidebar-collapsed .sidebar-accordion-icon,
html.sidebar-collapsed .sidebar-user-text,
html.sidebar-collapsed .sidebar-logout {
    display: none;
}

/* アイコンを中央寄せ */
html.sidebar-collapsed .sidebar-header,
html.sidebar-collapsed .sidebar-link,
html.sidebar-collapsed .sidebar-accordion-trigger,
html.sidebar-collapsed .sidebar-trigger-label,
html.sidebar-collapsed .sidebar-user-meta {
    justify-content: center;
}

html.sidebar-collapsed .sidebar-link,
html.sidebar-collapsed .sidebar-accordion-trigger {
    gap: 0;
    padding-left: 0;
    padding-right: 0;
    position: relative;
}

html.sidebar-collapsed .sidebar-user-meta {
    margin-bottom: 0;
}

/* 折りたたみ時: 勤怠管理テキストは隠れ、ボタンだけを中央寄せ＋「展開」向きに反転 */
html.sidebar-collapsed .sidebar-header-bar {
    justify-content: center;
}

html.sidebar-collapsed .sidebar-collapse-btn {
    transform: rotate(180deg);
}

/* 未読バッジはアイコン右上の小さなドットにする */
html.sidebar-collapsed .sidebar-badge {
    position: absolute;
    top: 6px;
    right: 12px;
    min-width: 9px;
    width: 9px;
    height: 9px;
    padding: 0;
    font-size: 0;
    line-height: 0;
    border: 1.5px solid #1f4168;
}

/* レール表示: 通常リンクのラベルをアイコン右側のフライアウト（吹き出し）にする。既定は非表示。
   メニューを縦スクロールさせても切れないよう position:fixed とし、縦横位置は JS が
   --fly-top / --fly-left にリンクの座標をセットする。 */
html.sidebar-collapsed .sidebar-link > span:not(.sidebar-badge) {
    position: fixed;
    left: var(--fly-left, 76px);
    top: var(--fly-top, 50%);
    transform: translateY(-50%) translateX(-8px);
    margin: 0;
    padding: 7px 12px;
    white-space: nowrap;
    background: #213750;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(2, 8, 20, 0.38);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 50;
    transition: opacity .16s ease, transform .18s cubic-bezier(.2, .7, .3, 1), visibility .18s;
}

/* フライアウト左側の三角（吹き出しのしっぽ） */
html.sidebar-collapsed .sidebar-link > span:not(.sidebar-badge)::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -4px;
    width: 9px;
    height: 9px;
    background: inherit;
    transform: translateY(-50%) rotate(45deg);
    border-radius: 2px;
}

/* hoverでフライアウトを右へスライドしながらフェードイン */
html.sidebar-collapsed .sidebar-link:hover > span:not(.sidebar-badge) {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* hoverでアイコンを少し拡大して反応を出す */
html.sidebar-collapsed .sidebar-link:hover .sidebar-icon,
html.sidebar-collapsed .sidebar-accordion-trigger:hover .sidebar-icon {
    transform: scale(1.14);
}

/* ===== レール表示: アコーディオンの子メニューを hover でフライアウト（プルダウン）表示 ===== */
html.sidebar-collapsed .sidebar-accordion {
    position: relative;
}

/* レール時は全アコーディオンを強制 open にして中身を描画するため、
   open時のハイライト背景が常時付かないように打ち消す（hover時のみ色を付ける） */
html.sidebar-collapsed .sidebar-accordion[open] .sidebar-accordion-trigger {
    background-color: transparent;
    border-color: transparent;
}

html.sidebar-collapsed .sidebar-accordion-trigger:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(203, 213, 225, 0.3);
}

/* サブメニューを右側に浮かぶパネルにする。既定は非表示。
   縦位置は JS が --fly-top にビューポート内へ収めた値をセットする（はみ出し防止）。
   背景はレール右端(64px)から表示し、左の透明ボーダー(12px)を
   トリガー右端(x=56)まで延ばして当たり判定を繋ぐ（hoverが切れない）。 */
html.sidebar-collapsed .sidebar-accordion .sidebar-submenu {
    display: grid;
    gap: 2px;
    position: fixed;
    left: 52px;
    border-left: 12px solid transparent;
    background-clip: padding-box;
    top: var(--fly-top, 8px);
    bottom: auto;
    min-width: 220px;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    margin: 0;
    padding: 8px;
    background: #213750;
    border-radius: 0 12px 12px 0;
    box-shadow: 6px 0 34px rgba(2, 8, 20, 0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-8px);
    transition: opacity .16s ease, transform .18s cubic-bezier(.2, .7, .3, 1), visibility .18s;
    z-index: 60;
}

/* hoverでパネルを表示 */
html.sidebar-collapsed .sidebar-accordion:hover .sidebar-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

/* パネル見出し（親メニュー名） */
html.sidebar-collapsed .sidebar-submenu-title {
    display: block;
    margin: 2px 6px 6px;
    color: #9fb6d4;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* パネル内の子リンクはツリーの縦線をやめて押しやすいボタン状にする */
html.sidebar-collapsed .sidebar-accordion .sidebar-submenu .sidebar-sublink {
    border-left: none;
    border-radius: 6px;
    padding: 8px 10px;
    white-space: nowrap;
}

html.sidebar-collapsed .sidebar-accordion .sidebar-submenu .sidebar-sublink:hover {
    background: rgba(255, 255, 255, 0.10);
}

html.sidebar-collapsed .sidebar-accordion .sidebar-submenu .sidebar-sublink.is-active {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 6px;
}
} /* end @media (min-width: 961px) レール表示 */

.sidebar {
    background:
        radial-gradient(circle at 18% 12%, rgba(255,255,255,0.14) 0, rgba(255,255,255,0.14) 14%, transparent 42%),
        radial-gradient(circle at 88% 84%, rgba(125,211,252,0.18) 0, rgba(125,211,252,0.18) 12%, transparent 44%),
        linear-gradient(160deg, #17314f 0%, #1f4168 48%, #28547f 100%);
    border-right: 1px solid #2f4b70;
    color: #fff;
    /* スクロール位置に関わらず常にビューポート全高を覆う
       （本文がドロップダウン等で伸びても下端に隙間が出ないよう sticky ではなく fixed） */
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    z-index: 20;
    transition: transform .22s ease, width .22s ease;
    /* overflow は内側ラッパーに持たせる */
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 18px;
    height: 100%;
    width: 260px;
    box-sizing: border-box;
    /* 全体はスクロールさせず、メニュー部分だけをスクロールさせる
       （ヘッダーとログイン者情報を常に表示するため） */
    overflow: hidden;
}

.sidebar-header {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 30px;
}

.sidebar-brand {
    display: block;
    color: #fff;
    text-decoration: none;
}

.sidebar-brand:hover {
    text-decoration: none;
}

/* ロゴ画像エリア: ロゴは白いサブ文字付き（暗背景用）なので、白カードではなく
   少し沈めた暗パネルに載せる。白文字・緑KOHSEI・青リングがすべて映える。 */
.sidebar-brand.has-logo {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(4, 12, 26, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 6px 16px rgba(2, 8, 20, 0.25);
    transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.sidebar-brand.has-logo:hover {
    transform: translateY(-1px);
    background: rgba(4, 12, 26, 0.36);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 10px 22px rgba(2, 8, 20, 0.32);
}

.sidebar-logo {
    display: block;
    width: 100%;
    height: auto;
}

/* ロゴの下: 勤怠管理テキスト ＋ 開閉ボタンを横並びにする行 */
.sidebar-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    row-gap: 3px;
    white-space: nowrap;
    font-family: "Yu Mincho", "Hiragino Mincho ProN", "Times New Roman", serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    color: #fff;
    text-decoration: none;
}

.sidebar-brand-text:hover {
    color: #fff;
    text-decoration: none;
}

.sidebar-brand-text::after {
    content: "ATTENDANCE";
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.22em;
    color: #b9d2ef;
}

/* サイドバー開閉ボタン（ロゴの下、勤怠管理テキストの横） */
.sidebar-collapse-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #cfe0f3;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.sidebar-collapse-btn svg {
    width: 18px;
    height: 18px;
}

/* スマホ用トップバー・ドロワー部品（デスクトップでは非表示） */
.mobile-topbar { display: none; }
.nav-backdrop { display: none; }
.sidebar-close-btn { display: none; }

/* ドロワー表示中は背面のスクロールを固定 */
body.nav-locked { overflow: hidden; }

/* デスクトップではレール自体が見えているため左端タブは出さない。
   表示はモバイル折りたたみ時のみ（下部のメディアクエリで制御） */

.sidebar-menu {
    display: grid;
    gap: 8px;
    /* 項目が少ない権限（一般 等）で余白に合わせて各行が縦に伸びないよう上詰めにする */
    align-content: start;
    /* ヘッダー/ユーザー情報を固定し、ここだけ縦スクロールさせる */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* スクロールバーは非表示（展開時・レール時とも）。ホイール/トラックパッドでのスクロールは有効。 */
    scrollbar-width: none;              /* Firefox */
    -ms-overflow-style: none;           /* 旧Edge/IE */
    margin: 0;
    padding: 0;
}
.sidebar-menu::-webkit-scrollbar {      /* Chrome/Safari/Edge */
    width: 0;
    height: 0;
}
/* 折りたたみ（レール）表示。ラベル/子メニューの吹き出しは position:fixed でレール外へ出すので、
   メニュー自体は縦スクロール可（横は clip）にしてよい。これで画面高が低いときも
   メニューがログイン者情報に重ならず、はみ出し分はスクロールで辿れる。 */
html.sidebar-collapsed .sidebar-menu {
    /* 吹き出しは position:fixed で外に出すので、レールでも縦スクロール可（横はclip）。
       スクロールバー自体は基本ルールで非表示（アイコンに被らない）。 */
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* メニューのグループ見出し（項目が多くてもぱっと見で区切れる） */
.sidebar-group-label {
    margin: 14px 6px 0;
    padding: 0 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    color: #6b7f96;
    user-select: none;
}
.sidebar-menu > .sidebar-group-label:first-child {
    margin-top: 0;
}
/* レール（折りたたみ）表示では文字を隠して区切り線にする */
html.sidebar-collapsed .sidebar-group-label {
    margin: 8px auto 2px;
    padding: 0;
    width: 24px;
    height: 0;
    overflow: hidden;
    color: transparent;
    border-top: 1px solid rgba(203,213,225,0.22);
}

.sidebar-accordion {
    margin: 0;
}

.sidebar-accordion[open] .sidebar-accordion-trigger {
    background-color: rgba(255,255,255,0.08);
    border-color: rgba(203,213,225,0.22);
}

.sidebar-accordion-trigger {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 12px;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.sidebar-accordion-trigger::-webkit-details-marker {
    display: none;
}

.sidebar-accordion-trigger:hover {
    background-color: rgba(255,255,255,0.12);
    border-color: rgba(203,213,225,0.3);
    color: #fff;
}

.sidebar-accordion-icon {
    width: 8px;
    height: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s ease;
    flex-shrink: 0;
    margin-top: -2px;
}

.sidebar-accordion[open] .sidebar-accordion-icon {
    transform: rotate(225deg);
    margin-top: 2px;
}

.sidebar-submenu {
    margin-top: 8px;
    padding-left: 12px;
    display: grid;
    gap: 6px;
}

/* 親メニュー名の見出し。通常表示では不要（レール表示のフライアウト時のみ使う） */
.sidebar-submenu-title {
    display: none;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 9px;
    border-left: 2px solid rgba(203,213,225,0.22);
    padding: 7px 10px 7px 12px;
    color: #cbd5e1;
    font-size: 13px;
    text-decoration: none;
}

.sidebar-sublink:hover {
    border-left-color: rgba(248,250,252,0.55);
    color: #fff;
    text-decoration: none;
}

.sidebar-sublink.is-active {
    border-left-color: #bfdbfe;
    color: #fff;
    background-color: rgba(255,255,255,0.08);
    border-radius: 0 8px 8px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 12px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

/* メニューアイコン共通 */
.sidebar-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    display: block;
    transition: transform .16s ease;
}

.sidebar-sublink .sidebar-icon {
    width: 16px;
    height: 16px;
    opacity: 0.9;
}

.sidebar-trigger-label {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.sidebar-link:hover {
    background-color: rgba(255,255,255,0.12);
    border-color: rgba(203,213,225,0.3);
    color: #fff;
    text-decoration: none;
}

.sidebar-link.is-active {
    background-color: rgba(255,255,255,0.2);
    border-color: rgba(248,250,252,0.45);
    color: #fff;
}

.sidebar-user {
    flex: 0 0 auto;
    margin-top: 0;
}

.sidebar-user-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #4a6080;
}

.sidebar-user-name {
    margin: 0;
    color: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.sidebar-user-email {
    margin: 2px 0 0;
    color: #cbd5e1;
    font-size: 11px;
    line-height: 1.35;
    word-break: break-all;
}

.sidebar-user form {
    margin: 0;
}

/* 開発者専用: 権限切替（ログアウトの上）。 */
.sidebar-devauth {
    margin-bottom: 10px;
    padding: 8px 10px;
    border: 1px dashed rgba(203, 213, 225, 0.35);
    border-radius: 8px;
    background: rgba(234, 179, 8, 0.08);
}
.sidebar-devauth-label {
    display: block;
    margin-bottom: 5px;
    color: #fde68a;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
}
.sidebar-devauth-select {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 1px solid rgba(203, 213, 225, 0.4);
    border-radius: 6px;
    background-color: rgba(15, 23, 42, 0.35);
    color: #f1f5f9;
    font-size: 12px;
    cursor: pointer;
}
/* レール表示（折りたたみ）では隠す */
html.sidebar-collapsed .sidebar-devauth {
    display: none;
}

.sidebar-logout.btn-outline {
    width: 100%;
    border-color: rgba(203,213,225,0.4);
    color: #e2e8f0;
    background-color: rgba(15, 23, 42, 0.16);
}

.sidebar-logout.btn-outline:hover {
    background-color: rgba(255,255,255,0.12);
    border-color: rgba(248,250,252,0.55);
    color: #fff;
}

.app-main {
    min-width: 0;
    transition: padding .22s ease;
}

@media (max-width: 960px) {
    /* ===== スマホ: 上部バー + 左からスライドインするドロワー ===== */
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 8px;
        position: sticky;
        top: 0;
        z-index: 30;
        height: 56px;
        padding: 0 8px;
        background: linear-gradient(160deg, #17314f 0%, #1f4168 60%, #28547f 100%);
        border-bottom: 1px solid #2f4b70;
    }

    .mobile-nav-toggle {
        position: relative;
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: none;
        border-radius: 10px;
        background: transparent;
        color: #fff;
        cursor: pointer;
    }

    .mobile-nav-toggle:active {
        background: rgba(255, 255, 255, 0.14);
    }

    .mobile-nav-toggle svg {
        width: 24px;
        height: 24px;
    }

    /* 未読のお知らせがあるときのドット表示 */
    .mobile-nav-dot {
        position: absolute;
        top: 9px;
        right: 9px;
        width: 9px;
        height: 9px;
        border-radius: 50%;
        background: #f87171;
        border: 1.5px solid #1f4168;
    }

    .mobile-topbar-title {
        color: #fff;
        font-family: "Yu Mincho", "Hiragino Mincho ProN", "Times New Roman", serif;
        font-size: 18px;
        font-weight: 700;
        letter-spacing: 0.14em;
        text-decoration: none;
    }

    .mobile-topbar-title:hover {
        text-decoration: none;
    }

    /* 本体は1カラム。上部バーの分だけ通常フローで下げる */
    .app-shell {
        display: block;
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .app-main {
        grid-column: auto;
    }

    /* サイドバーを左からのドロワーにする */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(82vw, 300px);
        height: auto;
        transform: translateX(-100%);
        transition: transform .26s ease;
        border-right: 1px solid #2f4b70;
        border-bottom: none;
        box-shadow: 6px 0 28px rgba(15, 23, 42, 0.32);
        z-index: 60;
    }

    html.nav-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-inner {
        width: auto;
        height: 100%;
        padding: 18px 16px;
        gap: 18px;
        /* デスクトップ同様、メニュー部分だけをスクロールさせる */
        overflow: hidden;
    }

    /* 背景オーバーレイ（タップで閉じる） */
    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 50;
        background: rgba(15, 23, 42, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity .26s ease, visibility .26s ease;
    }

    html.nav-open .nav-backdrop {
        opacity: 1;
        visibility: visible;
    }

    /* ドロワーヘッダー: デスクトップ用の折りたたみ矢印は隠し、閉じる(×)ボタンを表示 */
    .sidebar-collapse-btn {
        display: none;
    }

    .sidebar-close-btn {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.08);
        color: #cfe0f3;
        cursor: pointer;
    }

    .sidebar-close-btn:active {
        background: rgba(255, 255, 255, 0.2);
    }

    .sidebar-close-btn svg {
        width: 22px;
        height: 22px;
    }

    /* メニューは縦並び。タップしやすいよう余白を広めに */
    .sidebar-menu {
        display: grid;
        gap: 4px;
    }

    .sidebar-link,
    .sidebar-accordion-trigger {
        font-size: 15px;
        padding: 12px;
    }

    .sidebar-sublink {
        padding-top: 11px;
        padding-bottom: 11px;
        font-size: 14px;
    }

    .sidebar-accordion {
        width: auto;
    }

    .sidebar-submenu {
        padding-left: 12px;
    }

    .sidebar-user {
        margin-top: auto;
    }
}

/* ========== メインコンテンツ ========== */
.container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 24px clamp(16px, 2.8vw, 32px);
}

.container-sm {
    max-width: 420px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ========== カード ========== */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    padding: 32px;
}

/* ========== ボタン ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s, opacity 0.15s;
}

.btn:hover {
    text-decoration: none;
    opacity: 0.9;
}

/* 多重送信防止で送信中のボタン（低速回線でも二重送信させない間の見た目） */
.is-submitting {
    cursor: progress !important;
    opacity: 0.6 !important;
}

.btn-primary {
    background-color: #1e3a5f;
    color: #fff;
    width: 100%;
}

.btn-primary:hover {
    background-color: #162d4a;
    color: #fff;
}

.btn-outline {
    background-color: transparent;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 6px 14px;
    font-size: 13px;
}

.btn-outline:hover {
    background-color: #f1f5f9;
}

.btn-secondary {
    background-color: #fff;
    color: #1e3a5f;
    border: 1px solid #1e3a5f;
}

.btn-secondary:hover {
    background-color: #eef2f7;
    color: #1e3a5f;
}

.btn-danger-outline {
    background-color: transparent;
    color: #ef4444;
    border: 1px solid #fca5a5;
    padding: 6px 14px;
    font-size: 13px;
}

.btn-danger-outline:hover {
    background-color: #fef2f2;
}

/* ========== アラート ========== */
/* ===== 画面上部フラッシュ トースト（〜を更新しました 等） ===== */
.app-toast-wrap {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: max-content;
    max-width: min(92vw, 560px);
    pointer-events: none;
}
.app-toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 46px 12px 15px;
    border-radius: 12px;
    box-shadow: 0 16px 38px -14px rgba(15, 23, 42, .45);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    animation: app-toast-in .28s cubic-bezier(.2, .8, .2, 1);
}
@keyframes app-toast-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
.app-toast.is-hiding { opacity: 0; transform: translateY(-10px); transition: opacity .35s ease, transform .35s ease; }
.app-toast-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.app-toast-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.app-toast-ico { flex: 0 0 auto; display: inline-flex; }
.app-toast-ico svg { width: 20px; height: 20px; }
.app-toast-success .app-toast-ico { color: #059669; }
.app-toast-error .app-toast-ico { color: #dc2626; }
.app-toast-msg { min-width: 0; word-break: break-word; }
/* 閉じるボタン(×)は dialog.css の .flash-close（縦中央・right:8px）に任せる。
   トースト側は右側の余白だけ確保する（flash-has-close より確実に効かせる）。 */
.app-toast.flash-has-close { padding-right: 42px; }

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ========== ダッシュボード ========== */
.page-title {
    font-size: 20px;
    font-weight: bold;
    color: #1e293b;
    margin: 0 0 24px;
}

.staff-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid #dbe4ee;
}

.staff-page-heading {
    min-width: 0;
}

.staff-page-eyebrow {
    margin: 0 0 8px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.staff-page-title {
    margin: 0;
    font-size: 30px;
    line-height: 1.15;
    color: #0f172a;
}

.staff-create-btn {
    width: auto;
    min-width: 168px;
    padding: 12px 18px;
    border: 1px solid #1e3a5f;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .staff-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .staff-page-title {
        font-size: 26px;
    }

    .staff-create-btn {
        width: 100%;
        min-width: 0;
    }
}

.welcome-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a9e 100%);
    color: #fff;
    border-radius: 8px;
    padding: 28px 32px;
    margin-bottom: 24px;
}

.welcome-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.4);
    margin-bottom: 12px;
    display: block;
}

.welcome-card h2 {
    font-size: 18px;
    font-weight: normal;
    margin: 0 0 4px;
    opacity: 0.85;
}

.welcome-card .user-name {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

.welcome-card .user-email {
    font-size: 13px;
    opacity: 0.7;
    margin: 8px 0 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.info-item {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}

.info-item .label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}

.info-item .value {
    font-size: 18px;
    font-weight: bold;
    color: #1e293b;
}

/* ========== フォーム共通 ========== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* フォームのセクションカードを2カラムに並べる（PC） */
.staff-form-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1.25rem;
}

/* 半幅カード内ではフィールドを1カラムに（窮屈さ回避） */
.staff-form-columns .form-grid {
    grid-template-columns: 1fr;
}

@media (max-width: 900px) {
    .staff-form-columns {
        grid-template-columns: 1fr;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .35rem;
}

.form-label.required::after {
    content: ' *';
    color: #dc2626;
}

.field-lock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 2px 7px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background-color: #eff6ff;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    vertical-align: middle;
}

/* 作業員名簿で使用する項目を示すバッジ（SSOバッジと色味を変えて区別） */
.field-roster-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 2px 7px;
    border: 1px solid #fcd34d;
    border-radius: 999px;
    background-color: #fffbeb;
    color: #b45309;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    vertical-align: middle;
}

/* 名簿バッジの凡例 */
.roster-legend {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1rem;
    padding: .55rem .9rem;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    background-color: #fffbeb;
    color: #92400e;
    font-size: .82rem;
    line-height: 1.6;
}

.form-control {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: .9rem;
    background: #fff;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #2f6dba;
    box-shadow: 0 0 0 3px rgba(40, 84, 127, 0.14);
}

/* 入力要素の高さを検索付きセレクト(42px)に統一。
   ただしテーブル内の小型入力(.form-control-sm)は密度優先で対象外。 */
input.form-control:not(.form-control-sm),
select.form-control:not(.form-control-sm) {
    min-height: 42px;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .65rem center;
    background-size: 18px;
    padding-right: 2.2rem;
}

.form-control-locked,
.form-control[readonly] {
    background-color: #f8fafc;
    border-color: #dbe4ee;
    color: #64748b;
    cursor: not-allowed;
}

.form-control-locked:focus,
.form-control[readonly]:focus {
    border-color: #dbe4ee;
    box-shadow: none;
}

.form-hint {
    font-size: .78rem;
    color: #9ca3af;
    margin: .3rem 0 0;
}

/* セクション見出し直下の説明文（補足のインフォボックス） */
.form-section-note {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid #dbe7f3;
    border-radius: 8px;
    background: #f5f9fd;
    color: #44566b;
    font-size: .8rem;
    line-height: 1.7;
}

/* ラベル横の補足アイコン（ホバー/フォーカスで説明を表示） */
/* ラベルは全幅のブロックにして、後続の input を必ず下に配置する
   （inline-flex だと幅の狭い input がラベル横に並んでしまう） */
.form-label:has(.info-tip) {
    display: flex;
    align-items: center;
}

/* 必須の * をアイコンより前に表示する */
.form-label:has(.info-tip)::after {
    order: 1;
}

.info-tip {
    order: 2;
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    color: #9aa7b8;
    cursor: help;
}

.info-tip:hover,
.info-tip:focus-visible {
    color: #2f6dba;
    outline: none;
}

.info-tip-icon {
    width: 15px;
    height: 15px;
    display: block;
}

.info-tip-bubble {
    position: absolute;
    bottom: calc(100% + 9px);
    left: -8px;
    z-index: 50;
    width: max-content;
    max-width: 260px;
    padding: 8px 11px;
    background: #1f2937;
    color: #f1f5f9;
    font-size: .75rem;
    font-weight: 400;
    line-height: 1.55;
    letter-spacing: 0;
    text-align: left;
    white-space: normal;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(3px);
    transition: opacity .12s ease, transform .12s ease;
    pointer-events: none;
}

.info-tip-bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 13px;
    border: 6px solid transparent;
    border-top-color: #1f2937;
}

.info-tip:hover .info-tip-bubble,
.info-tip:focus-visible .info-tip-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ===== 有給台帳 日付列（取得対象日を主役に、有給取得日は控えめに） ===== */
.paid-th-sub {
    color: #94a3b8;
    font-weight: 500;
}


.paid-date-primary {
    white-space: nowrap;
    font-weight: 700;
    color: #0f172a;
    font-size: .95rem;
}

.paid-date-sub {
    white-space: nowrap;
    color: #94a3b8;
    font-size: .8rem;
}

/* ===== 有給台帳 備考セル（1行はそのまま／複数行はアイコン＋tooltip） ===== */
.paid-note-cell {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #475569;
}

.paid-note-cell--icon {
    overflow: visible;
}

.note-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: #9aa7b8;
    cursor: help;
}

.note-tip:hover,
.note-tip:focus-visible {
    color: #2f6dba;
    outline: none;
}

.note-tip-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.note-tip-bubble {
    position: absolute;
    bottom: calc(100% + 9px);
    left: -8px;
    z-index: 50;
    width: max-content;
    max-width: 320px;
    padding: 8px 11px;
    background: #1f2937;
    color: #f1f5f9;
    font-size: .75rem;
    font-weight: 400;
    line-height: 1.55;
    letter-spacing: 0;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(3px);
    transition: opacity .12s ease, transform .12s ease;
    pointer-events: none;
}

.note-tip-bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    left: var(--note-arrow-left, 13px);
    border: 6px solid transparent;
    border-top-color: #1f2937;
}

/* JSで下側に配置したとき矢印を上向きに */
.note-tip-bubble.is-below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #1f2937;
}

.note-tip.note-tip-open .note-tip-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ========== フォームページ（登録・編集） リデザイン ========== */
.form-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    padding: 22px 28px;
    margin-bottom: 22px;
    border-radius: 14px;
    color: #fff;
    background:
        radial-gradient(circle at 14% 18%, rgba(255,255,255,0.12) 0, rgba(255,255,255,0.12) 12%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(125,211,252,0.20) 0, rgba(125,211,252,0.20) 12%, transparent 46%),
        linear-gradient(135deg, #17314f 0%, #1f4168 50%, #28547f 100%);
    box-shadow: 0 10px 28px rgba(15, 49, 79, 0.20);
}

.form-hero-main {
    min-width: 0;
    flex: 1 1 280px;
}

.form-hero-eyebrow {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(199, 222, 248, 0.85);
}

.form-hero-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.form-hero-desc {
    margin: 6px 0 0;
    font-size: .82rem;
    line-height: 1.6;
    color: rgba(226, 238, 252, 0.82);
}

/* セクションカード */
.form-section {
    background: #fff;
    border: 1px solid #e7edf4;
    border-radius: 12px;
    padding: 4px 24px 22px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

/* 多項目フォーム: セクションカードを横幅いっぱいに均等配置 */
/* 横幅に応じて列数が自動で決まり、カードが余白なく全幅に広がる */
.staff-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 18px;
    align-items: start;
}

.staff-form-grid .form-section {
    margin: 0;
}

@media (max-width: 420px) {
    .staff-form-grid {
        grid-template-columns: 1fr;
    }
}

/* 必須・基本ブロック（常時表示で強調） */
.form-section--primary {
    border-color: #bcd3ec;
    background: #fbfdff;
    box-shadow: 0 4px 16px rgba(31, 65, 104, 0.08);
}

/* タブ */
.form-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 18px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    /* スクロールしてもタブが常に見えるよう上部に固定（中身はバーの下に潜る） */
    position: sticky;
    top: 0;
    z-index: 15;
}

.form-tab-btn {
    appearance: none;
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    font-size: .88rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    border-radius: 8px;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.form-tab-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.form-tab-btn:hover {
    color: #1f4168;
    background: #eef2f7;
}

.form-tab-btn.is-active {
    color: #fff;
    background: linear-gradient(135deg, #1f4168 0%, #28547f 100%);
    box-shadow: 0 2px 8px rgba(31, 65, 104, 0.30);
}

.form-tab-btn.is-active:hover {
    color: #fff;
}

.form-tab-btn .form-tab-badge {
    display: inline-block;
    margin-left: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc2626;
    vertical-align: middle;
}

.form-tab-btn.is-active .form-tab-badge {
    background: #fecaca;
}

.form-tab-panel {
    display: none;
}

.form-tab-panel.is-active {
    display: block;
}

/* 有給カード: 有給休暇の有無が「無」のとき半透明オーバーレイで設定不可を示す */
.paid-lock-wrap {
    position: relative;
}

.paid-lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.55);
}

.paid-lock-overlay[hidden] {
    display: none;
}

.paid-lock-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 360px;
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.7;
    text-align: center;
}

.paid-lock-icon {
    width: 30px;
    height: 30px;
    opacity: .9;
}

/* 入力エラー強調 */
.form-control.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* トグル項目群: 整列したグリッド（ラベル左／ボタン右で各列が揃う） */
.toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 2px 28px;
}

.toggle-grid .form-group {
    margin-bottom: 0;
}

/* ブロックトグル（ラベル上・有無下）を横並びで配置するグリッド
   最小幅は最長ラベル＋バッジ（例: 中小企業退職金共済制度の有無＋名簿）が
   1行に収まる幅に設定。これ未満になると auto-fit で列数が減るため、
   ラベル／バッジが折り返して各列の高さがバラつくのを防ぐ。 */
.toggle-block-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    align-items: start;
}

.toggle-block-grid .form-group {
    margin-bottom: 0;
}

.toggle-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid #f1f5f9;
}

.toggle-field .form-label {
    margin: 0;
    white-space: nowrap;
}

.toggle-field-hint {
    flex-basis: 100%;
    margin: 0;
}

/* 有/無 セグメントトグル */
.toggle-group {
    display: inline-flex;
    min-height: 42px;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

/* ブロック表示: 他のフォーム入力（ラベル上・全幅）に揃える */
.toggle-group-block {
    display: flex;
    width: 100%;
    border-radius: 6px;
}

.toggle-group-block .toggle-option {
    flex: 1;
}

.toggle-group-block .toggle-option span {
    min-width: 0;
    width: 100%;
    padding: 0 12px;
}

.toggle-option {
    position: relative;
    display: flex;
    margin: 0;
    cursor: pointer;
}
.toggle-option[hidden] { display: none; }

.toggle-option input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.toggle-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 0 18px;
    text-align: center;
    font-size: .9rem;
    color: #475569;
    user-select: none;
    transition: background .12s ease, color .12s ease;
}

.toggle-option + .toggle-option span {
    border-left: 1px solid #e5e7eb;
}

.toggle-option:hover span {
    background: #f1f6fb;
}

.toggle-option input:checked + span {
    background: #1f4168;
    color: #fff;
    font-weight: 600;
}

.toggle-option input:checked:hover + span {
    background: #1b3a5c;
}

.toggle-option input:focus-visible + span {
    box-shadow: inset 0 0 0 2px rgba(40, 84, 127, 0.45);
}

/* 検索付き単一セレクト */
.search-select {
    position: relative;
}

.search-select-control {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 42px;
    padding: .5rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: .9rem;
    color: #1e293b;
    text-align: left;
    cursor: pointer;
}

.search-select.is-open .search-select-control,
.search-select-control:focus {
    outline: none;
    border-color: #2f6dba;
    box-shadow: 0 0 0 3px rgba(40, 84, 127, 0.14);
}

.search-select.is-invalid-wrap .search-select-control {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* 無効状態（選択肢が無いとき等） */
.search-select.is-disabled .search-select-control {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}
.search-select.is-disabled .search-select-caret {
    opacity: .4;
}

.search-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-select-value.is-placeholder {
    color: #9ca3af;
}

.search-select-clear {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.search-select-clear[hidden] {
    display: none;
}

.search-select-clear:hover {
    background: #eef2f7;
    color: #475569;
}

.search-select-caret {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-right: 1.6px solid #64748b;
    border-bottom: 1.6px solid #64748b;
    transform: rotate(45deg);
    margin-top: -3px;
}

.search-select-dropdown {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.search-select-search {
    width: 100%;
    border: none;
    border-bottom: 1px solid #eef2f7;
    padding: 10px 12px;
    font-size: .9rem;
    outline: none;
}

.search-select-options {
    max-height: 240px;
    overflow-y: auto;
}

.search-select-option {
    padding: 9px 12px;
    font-size: .9rem;
    color: #1e293b;
    cursor: pointer;
}

.search-select-option:hover,
.search-select-option.is-active {
    background: #f1f6fb;
}

.search-select-empty {
    padding: 10px 12px;
    font-size: .85rem;
    color: #9ca3af;
}

/* 検索付きマルチセレクト */
.multiselect {
    position: relative;
}

.multiselect-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 6px 8px 6px 34px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #fff;
    /* 左に検索アイコン（カードと区別しやすく） */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 9px center;
    background-size: 16px;
    cursor: text;
}

.multiselect-control:focus-within {
    border-color: #2f6dba;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(40, 84, 127, 0.14);
}

.multiselect.is-invalid-wrap .multiselect-control {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.multiselect-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.multiselect-tags:empty {
    display: none;
}

.multiselect-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 3px 10px;
    background: #eaf2fb;
    color: #1f4168;
    border: 1px solid #cfe0f3;
    border-radius: 999px;
    font-size: .82rem;
    line-height: 1.4;
}

.multiselect-tag button {
    appearance: none;
    border: none;
    background: transparent;
    color: #1f4168;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    border-radius: 50%;
}

.multiselect-tag button:hover {
    background: rgba(31, 65, 104, 0.14);
}

.multiselect-search {
    flex: 1;
    min-width: 140px;
    border: none;
    outline: none;
    padding: 4px;
    font-size: .9rem;
    background: transparent;
}

.multiselect-dropdown {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.15);
}

.multiselect-option {
    padding: 11px 14px;
    font-size: .9rem;
    color: #1e293b;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.12s ease;
}

.multiselect-option:last-child {
    border-bottom: none;
}

.multiselect-option:hover {
    background: #e7eef7;
}

.multiselect-option.is-active {
    background: #dbeafe;
    font-weight: 500;
}

.multiselect-empty {
    padding: 14px 14px;
    font-size: .85rem;
    color: #9ca3af;
    text-align: center;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 20px;
    padding: 16px 0 14px;
    font-size: .92rem;
    font-weight: 700;
    color: #1e293b;
    border-bottom: 1px solid #eef2f7;
}

.form-section-title::before {
    content: "";
    width: 4px;
    height: 16px;
    border-radius: 99px;
    background: linear-gradient(180deg, #1f4168, #28547f);
}

/* フィールドを2カラムで配置（レスポンシブ） */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 20px;
}

.form-row.is-single {
    grid-template-columns: 1fr;
}

/* form-rowで片方を指定したpxで表示するclass */
/* --short-col でカラム幅を上書き可能（例: style="--short-col: 120px;"） */
.form-row-short {
    --short-col: 100px;
    grid-template-columns: 1fr var(--short-col);
}
@media (max-width: 1200px) {
    .form-row-short {
        grid-template-columns: 1fr;
    }
}

.form-row .form-group {
    margin-bottom: 1rem;
}

.mb-0 {
    margin-bottom: 0 !important;
}

/* 調整給グループ（旧家族手当＋営業手当＋給与調整＝調整給 を1まとまりで示す） */
.adjustment-box {
    border: 1px solid #d8e0ea;
    border-radius: 10px;
    padding: 12px 14px 14px;
    margin-bottom: 1rem;
    background: #f7fafc;
}
.adjustment-box-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    font-size: .85rem;
    font-weight: 700;
    color: #1f4168;
}
.adjustment-box-note {
    font-size: .72rem;
    font-weight: 400;
    color: #94a3b8;
}

/* 画像アップロード（ドラッグ＆ドロップ / クリック選択） */
.image-upload {
    width: 100%;
}

.image-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 160px;
    padding: 20px;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    text-align: center;
    color: #64748b;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.image-upload-zone:hover,
.image-upload-zone:focus-visible {
    border-color: #2f6dba;
    background: #f1f6fb;
    outline: none;
}

.image-upload-zone.is-dragover {
    border-color: #2f6dba;
    background: #e6f0fb;
}

.image-upload-icon {
    width: 34px;
    height: 34px;
    color: #94a3b8;
}

.image-upload-zone p {
    margin: 0;
    font-size: .85rem;
    line-height: 1.6;
}

.image-upload-link {
    color: #2f6dba;
    font-weight: 600;
    text-decoration: underline;
}

.image-upload-formats {
    font-size: .75rem !important;
    color: #9ca3af;
}

.image-upload-preview {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* hidden 属性を display:flex より優先させる */
.image-upload-preview[hidden] {
    display: none;
}

.image-upload-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
}

.image-upload-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.image-upload-clear {
    background: none;
    border: none;
    padding: 0;
    color: #2f6dba;
    font-size: .8rem;
    text-decoration: underline;
    cursor: pointer;
}

.image-upload-remove {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    color: #475569;
    cursor: pointer;
}

/* チェックボックスチップ（特記事項など、固定リストの複数選択） */
.check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.check-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font-size: .85rem;
    color: #334155;
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease;
}

.check-chip:hover {
    border-color: #94a3b8;
}

.check-chip input {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    accent-color: #1f4168;
    cursor: pointer;
}

.check-chip:has(input:checked) {
    border-color: #2f6dba;
    background: #f1f6fb;
    color: #1f4168;
    font-weight: 600;
}

.check-chip.is-disabled {
    opacity: .5;
    cursor: not-allowed;
}

.check-chip.is-disabled input {
    cursor: not-allowed;
}

/* 所属部署（指定部署に必ず含まれ、外せない）。ロックを明示し「所属」バッジを付ける */
.check-chip.is-own-dept {
    border-color: #2f6dba;
    background: #eaf2fb;
    color: #1f4168;
    font-weight: 600;
    cursor: not-allowed;
}
.check-chip.is-own-dept input {
    cursor: not-allowed;
}
.check-chip.is-own-dept > span::after {
    content: '所属';
    display: inline-block;
    margin-left: .4em;
    padding: .05em .45em;
    font-size: .68rem;
    font-weight: 700;
    color: #fff;
    background: #2f6dba;
    border-radius: 999px;
    vertical-align: middle;
}

/* 指定部署カード（権限が「指定部署」系のとき表示・必須）
   基本情報ブロック（背景 #fbfdff）の上に置くため、白背景で浮き立たせる */
.auth-dept-card {
    border: 1px solid #cbdcee;
    border-radius: 10px;
    padding: 14px 16px 16px;
    margin-bottom: 1rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(31, 65, 104, 0.05);
}

.auth-dept-card.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* 扶養情報ブロック（扶養人数に応じて生成） */
.dependent-block {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px 16px;
    margin-top: 12px;
    background: #fbfdff;
}

.dependent-block-title {
    display: inline-flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 3px 12px;
    border-radius: 99px;
    background: #1f4168;
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
}

/* 日付など、分割入力のインライン行 */
.field-inline {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.field-inline .field-unit {
    color: #6b7280;
    font-size: .85rem;
}

/* 分割番号入力（記号-番号 / 4桁-6桁-1桁 など）。
   狭い幅でも潰れすぎないよう最小幅を確保し、桁数が少ない欄でも数字を表示できるよう
   左右パディングを抑えて中央寄せにする。入りきらない場合は field-inline で折り返す。 */
.field-inline .join-part {
    min-width: 2.6em;
    padding-left: .4rem;
    padding-right: .4rem;
    text-align: center;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .form-hero {
        padding: 18px 20px;
    }
    .form-hero-main {
        flex-basis: 100%;
    }
    .master-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .hero-book-form {
        width: 100%;
    }
    .hero-select {
        flex: 1 1 auto;
        min-width: 0;
    }
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.form-actions .btn {
    white-space: nowrap;
}

.form-actions-cancel {
    flex: 0 0 auto;
}

.form-actions-submit {
    width: auto;
    min-width: 160px;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex: 0 0 auto;
}

/* アイコンのみのコンパクトボタン（検索など。幅を取らない） */
.btn.btn-icon {
    width: auto;
    flex: 0 0 auto;
    padding-left: 12px;
    padding-right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}
.btn.btn-icon svg { display: block; width: 18px; height: 18px; }

@media (max-width: 720px) {
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions-cancel,
    .form-actions-submit {
        width: 100%;
        justify-content: center;
    }
}

/* ========== フォーム固定フッターバー（従業員登録・編集） ========== */
.form-footer-bar {
    position: fixed;
    left: 260px;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.08);
    padding: 14px clamp(16px, 2.8vw, 32px);
    transition: left .22s ease, padding .22s ease;
}

/* サイドバー折りたたみ時: レール幅分だけ空けて本文に揃える */
html.sidebar-collapsed .form-footer-bar {
    left: 64px;
}

.form-footer-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* 固定フッターに隠れないよう、フォームページの下部に余白を確保 */
.has-form-footer {
    padding-bottom: 96px;
}

@media (max-width: 960px) {
    .form-footer-bar,
    html.sidebar-collapsed .form-footer-bar {
        left: 0;
    }
}

@media (max-width: 720px) {
    /* スマホでも縦積みにせず、キャンセル/更新を横並び（等幅）で表示する */
    .form-footer-bar-inner {
        gap: 10px;
    }

    .form-footer-bar-inner .form-actions-cancel,
    .form-footer-bar-inner .form-actions-submit {
        flex: 1 1 0;
        justify-content: center;
    }
}

/* ========== バッジ ========== */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-green {
    background: #d1fae5;
    color: #065f46;
}

.badge-gray {
    background: #f3f4f6;
    color: #6b7280;
}

/* 従業員一覧のSSO連携状態をアイコンで表す（連携済み＝緑リンク／未連携＝灰リンク断） */
.sso-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.sso-ico svg { width: 18px; height: 18px; }
.sso-ico-linked   { color: #059669; }
.sso-ico-unlinked { color: #9ca3af; }

.badge-red {
    background: #fee2e2;
    color: #991b1b;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

/* ========== フィルター ========== */
.filter-label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .3rem;
}

.filter-input {
    padding: .45rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: .875rem;
    width: 100%;
}

.filter-select {
    padding: .45rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: .875rem;
    background: #fff;
    max-width: 100%;
    text-overflow: ellipsis;
}

/* ========== 従業員テーブル ========== */
.staff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.staff-table th {
    padding: .6rem 1rem;
    text-align: left;
    font-size: .78rem;
    font-weight: 600;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.staff-table td {
    padding: .7rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.staff-table tr:last-child td {
    border-bottom: none;
}

/* 選択可能行 */
.staff-table tr.selectable {
    cursor: pointer;
}

.staff-table tr.row-selected td {
    background: #eff6ff;
}

.staff-table tr.selectable:hover td {
    background: #f0f9ff;
}

/* 従業員一覧: 横スクロール時に氏名列（3列目）を左端に固定する。
   氏名が一番左まで来たら止まる＝position:sticky; left:0。背景は行の状態と揃える。 */
.staff-table th:nth-child(3),
.staff-table td:nth-child(3) {
    position: sticky;
    left: 0;
    z-index: 5;              /* 横スクロールで流れる通常セルより前面 */
    background: #fff;        /* 既定行の背景（透け防止） */
}
.staff-table thead th:nth-child(3) {
    z-index: 11;             /* ヘッダ(top固定 z-index:10)より前面＝左上の角 */
    background: #f9fafb;     /* ヘッダ背景 */
}
.staff-table tr.row-selected td:nth-child(3) { background: #eff6ff; }
.staff-table tr.selectable:hover td:nth-child(3) { background: #f0f9ff; }

/* カスタムチェックボックス */
.row-check,
#check-all {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    display: block;
    margin: 0 auto;
    position: relative;
    flex-shrink: 0;
    transition: border-color .15s, background .15s;
}

.row-check:hover,
#check-all:hover {
    border-color: #6366f1;
}

.row-check:checked,
#check-all:checked {
    background: #6366f1;
    border-color: #6366f1;
}

.row-check:indeterminate,
#check-all:indeterminate {
    background: #a5b4fc;
    border-color: #6366f1;
}

.row-check:checked::after,
#check-all:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

#check-all:indeterminate::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 6px;
    width: 8px;
    height: 2px;
    background: #fff;
}

.staff-table tr:hover td {
    background: #f9fafb;
}

.row-retired td {
    color: #9ca3af;
}

.staff-name-link {
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
}

.staff-name-link:hover {
    color: #3b82f6;
    text-decoration: underline;
}

/* 編集ボタンがある一覧では名前をリンクにせずプレーン表示にする（リンク重複回避） */
.staff-name-plain {
    font-weight: 600;
    color: #1e293b;
}

/* ========== 従業員一覧（リデザイン） ========== */
/* ヒーロー右側のアクションボタン（白ベース） */
.hero-action {
    flex: 0 0 auto;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 18px;
    border-radius: 999px;
    background: #fff;
    color: #1f4168;
    border: 1px solid #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .02em;
    white-space: nowrap;
    text-decoration: none;
}

.hero-action:hover {
    background: #eaf2fb;
    color: #17314f;
    text-decoration: none;
}

/* 副次アクション（白パネル上では枠線ボタン） */
.hero-action--ghost {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
}
.hero-action--ghost:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* 白パネル（フィルター・テーブルの土台） */
.list-panel {
    background: #fff;
    border: 1px solid #e7edf4;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.list-panel + .list-panel {
    margin-top: 16px;
}

.list-toolbar {
    padding: 16px 18px;
}

.list-count {
    padding: .72rem 1.1rem;
    border-bottom: 1px solid #eef2f7;
    font-size: .82rem;
    color: #64748b;
}

/* フィルター入力のフォーカス／セレクト矢印 */
.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #2f6dba;
    box-shadow: 0 0 0 3px rgba(40, 84, 127, 0.14);
}

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .55rem center;
    background-size: 16px;
    padding-right: 2rem;
}

/* 人物セル（アバター＋氏名＋フリガナ） */
.list-person {
    display: flex;
    align-items: center;
    gap: 11px;
}

.list-avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #1f4168;
    background: #e7eef7;
    border: 1px solid #d7e3f0;
    overflow: hidden;
}

.list-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-person-name {
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
    white-space: nowrap;
}

.list-person-name:hover {
    color: #2f6dba;
    text-decoration: underline;
}

.list-person-kana {
    margin-top: 1px;
    font-size: .74rem;
    color: #94a3b8;
    white-space: nowrap;
}

.row-retired .list-avatar {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
}

/* 権限バッジ配色 */
.badge-auth-1 { background: #f1f5f9; color: #475569; }
.badge-auth-2 { background: #dbeafe; color: #1e40af; }
.badge-auth-4 { background: #e0e7ff; color: #3730a3; }
.badge-auth-3 { background: #ccfbf1; color: #115e59; }
.badge-auth-5 { background: #ffedd5; color: #9a3412; }
.badge-auth-99 { background: #fef3c7; color: #92400e; }

/* ========== 詳細画面 ========== */
.section-title {
    font-size: .9rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid #e5e7eb;
}

.info-dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: .5rem .75rem;
    margin: 0;
    font-size: .875rem;
}

.info-dl dt {
    color: #6b7280;
    font-weight: 500;
    padding-top: .1rem;
}

.info-dl dd {
    margin: 0;
    color: #1e293b;
    word-break: break-all;
}

/* ========== 従業員詳細（リデザイン） ========== */
.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .82rem;
    font-weight: 600;
    color: #475569;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 7px 15px 7px 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    transition: color .15s ease, background .15s ease, border-color .15s ease,
                box-shadow .15s ease, transform .1s ease;
}

.detail-back:hover {
    color: #1f4168;
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 3px 8px rgba(15, 23, 42, .09);
}

.detail-back:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

.detail-back:focus-visible {
    outline: 2px solid #93b4dd;
    outline-offset: 2px;
}

/* ヒーロー */
.detail-hero {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 26px 30px;
    border-radius: 14px;
    color: #fff;
    background:
        radial-gradient(circle at 14% 18%, rgba(255,255,255,0.12) 0, rgba(255,255,255,0.12) 12%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(125,211,252,0.20) 0, rgba(125,211,252,0.20) 12%, transparent 46%),
        linear-gradient(135deg, #17314f 0%, #1f4168 50%, #28547f 100%);
    box-shadow: 0 10px 28px rgba(15, 49, 79, 0.22);
}

.detail-avatar {
    flex: 0 0 auto;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
    background: rgba(255,255,255,0.16);
    border: 2px solid rgba(255,255,255,0.30);
    overflow: hidden;
}
.detail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.detail-hero-main {
    min-width: 0;
    flex: 1;
}

.detail-hero-kana {
    margin: 0 0 4px;
    font-size: .8rem;
    letter-spacing: .04em;
    color: rgba(226, 238, 252, 0.85);
}

.detail-hero-name {
    margin: 0 0 10px;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.detail-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-hero .badge {
    background: rgba(255,255,255,0.16);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.28);
}

.detail-hero .badge.badge-on-green { background: rgba(52, 211, 153, 0.30); border-color: rgba(110, 231, 183, 0.55); }
.detail-hero .badge.badge-on-red   { background: rgba(248, 113, 113, 0.30); border-color: rgba(252, 165, 165, 0.55); }

/* クイックステータス */
.detail-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 18px 0 22px;
}

.detail-stat {
    background: #fff;
    border: 1px solid #e7edf4;
    border-radius: 10px;
    padding: 14px 16px;
}

.detail-stat-label {
    margin: 0 0 6px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: #94a3b8;
    text-transform: uppercase;
}

.detail-stat-value {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    word-break: break-all;
}

.detail-stat-value.is-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: .04em;
}

/* 情報カードグリッド */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

/* 任意適用モディファイア（detail-statsを置かない詳細画面向け）
   --spaced: ヒーロー下に余白を付ける / --equal: 同じ行のカード高さを揃える */
.detail-hero--spaced { margin-bottom: 20px; }
.detail-grid.detail-grid--equal { align-items: stretch; }

.detail-card {
    background: #fff;
    border: 1px solid #e7edf4;
    border-radius: 12px;
    padding: 0 22px 6px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.detail-card-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 16px 0 14px;
    font-size: .9rem;
    font-weight: 700;
    color: #1e293b;
    border-bottom: 1px solid #eef2f7;
}

.detail-card-title::before {
    content: "";
    width: 4px;
    height: 16px;
    border-radius: 99px;
    background: linear-gradient(180deg, #1f4168, #28547f);
}

.detail-card.is-warn .detail-card-title::before {
    background: linear-gradient(180deg, #b91c1c, #ef4444);
}

/* 項目はラベル上・値下のタイルを複数列で配置（固定ラベル幅をやめ、長い日本語でも折り返さない） */
.detail-dl {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 2px 20px;
    margin: 0;
    padding: 12px 0 16px;
}

.detail-dl > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 2px;
    min-width: 0;
    border-bottom: 1px solid #f1f5f9;
}

/* タグ・備考など内容が広い項目は全幅で表示 */
.detail-dl > div:has(.detail-tags),
.detail-dl > div:has(dd[style*="pre-wrap"]) {
    grid-column: 1 / -1;
}

/* 長いテキスト項目（事業所名・会社名など）を広い列で表示する（オプトイン） */
.detail-dl > div.dl-wide  { grid-column: span 2; }
.detail-dl > div.dl-wide3 { grid-column: span 3; }

.detail-dl dt {
    margin: 0;
    color: #94a3b8;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .03em;
}

.detail-dl dd {
    margin: 0;
    color: #1e293b;
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-all;
}

/* 詳細: タグ・テーブル・小見出し */
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    font-size: .8rem;
    white-space: nowrap;
}
.detail-subtitle {
    margin: 14px 0 8px;
    font-size: .82rem;
    font-weight: 700;
    color: #475569;
}
.detail-table-wrap { overflow-x: auto; }
.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.detail-table th,
.detail-table td {
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}
.detail-table th {
    color: #748196;
    font-weight: 600;
    font-size: .78rem;
    background: #f9fafb;
}
.detail-table td { color: #1e293b; }
.detail-empty { margin: 0; color: #9ca3af; font-size: .85rem; }

@media (max-width: 900px) {
    .detail-stats { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .detail-hero { flex-direction: column; text-align: center; }
    .detail-hero-badges { justify-content: center; }
    .detail-stats { grid-template-columns: 1fr; }
    .detail-dl > div { grid-template-columns: 1fr; gap: 2px; }
}

/* ========== ページネーション ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    background: #fff;
    text-decoration: none;
    transition: background-color .15s, border-color .15s, color .15s;
}

.pagination-link:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    text-decoration: none;
}

.pagination-link.is-active {
    background: #1e3a5f;
    border-color: #1e3a5f;
    color: #fff;
    font-weight: 600;
}

.pagination-link.is-disabled {
    color: #cbd5e1;
    background: #f8fafc;
    cursor: default;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    color: #94a3b8;
    font-size: 13px;
}

/* ========== 休日設定カレンダー ========== */
.holiday-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem;
}

.holiday-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.palette-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    font-size: .85rem;
    color: #334155;
    cursor: pointer;
    user-select: none;
    transition: border-color .12s, box-shadow .12s, background .12s;
}

.palette-chip:hover {
    background: #f8fafc;
}

.palette-chip .swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex: 0 0 auto;
}

.palette-chip.is-active {
    border-color: #1f4168;
    box-shadow: 0 0 0 3px rgba(31, 65, 104, 0.12);
    font-weight: 600;
}

.palette-chip.palette-erase .swatch {
    background: repeating-linear-gradient(45deg, #e5e7eb, #e5e7eb 3px, #fff 3px, #fff 6px);
}

/* カレンダー全体（PCは大きめに表示） */
.holiday-calendar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.cal-month {
    border: 1px solid #e7edf4;
    border-radius: 12px;
    padding: 14px 16px 16px;
    background: #fff;
}

.cal-month-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-wd {
    text-align: center;
    font-size: .76rem;
    font-weight: 600;
    color: #94a3b8;
    padding-bottom: 3px;
}

.cal-wd.is-sun { color: #dc2626; }
.cal-wd.is-sat { color: #2563eb; }

.cal-cell {
    position: relative;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1px;
    padding-top: 4px;
    border-radius: 7px;
    border: 1px solid transparent;
    cursor: pointer;
    background: #f8fafc;
    transition: background .1s, border-color .1s;
}

.cal-cell.is-empty {
    background: transparent;
    cursor: default;
}

.cal-cell:not(.is-empty):hover {
    border-color: #1f4168;
}

.cal-day {
    font-size: .9rem;
    line-height: 1.1;
    color: #475569;
}

.cal-day.is-sun { color: #dc2626; }
.cal-day.is-sat { color: #2563eb; }

.cal-mark {
    font-size: .68rem;
    line-height: 1.1;
    font-weight: 700;
    color: #fff;
    padding: 1px 4px;
    border-radius: 3px;
}

/* 祝日マーカー（区分設定の有無に関わらず表示） */
.cal-cell.is-holiday::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #dc2626;
}

.cal-cell.is-holiday.has-kind::after {
    background: #fff;
}

.cal-cell.is-holiday:not(.has-kind) .cal-day {
    color: #dc2626;
    font-weight: 700;
}

.cal-holiday {
    font-size: .6rem;
    line-height: 1.05;
    color: #dc2626;
    text-align: center;
    padding: 0 2px;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 区分が設定されたセル: data-kind に応じて JS が色を付与 */
.cal-cell.has-kind {
    color: #fff;
}

.cal-cell.has-kind .cal-day {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 700;
}

/* 区分設定時は祝日名テキストを隠す（色付き背景で読めないため。赤丸は維持） */
.cal-cell.has-kind .cal-holiday {
    display: none;
}

/* ========== マスタ エクスポート/インポート ========== */
.master-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.master-io-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.master-io-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    text-decoration: none;
}


/* ===== 役職履歴・職務経歴テーブル ===== */
.history-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.history-section-header .form-section-title {
    margin-bottom: 0;
}

.history-table-wrap {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.history-table th,
.history-table td {
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    vertical-align: middle;
    white-space: nowrap;
}

.history-table thead th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 13px;
}

.history-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.history-table tbody tr:hover {
    background: #f1f5f9;
}

.history-table td:first-child {
    min-width: 160px;
    white-space: normal;
}

.history-table td:last-child {
    width: 56px;
    text-align: center;
}

.field-inline--compact {
    gap: 4px;
}

.field-inline--compact .field-unit {
    font-size: 13px;
}

/* ===== 給与マスタ 一括グリッド ===== */
.salary-grid {
    min-width: 600px;
}

.salary-grid th,
.salary-grid td {
    padding: .35rem .5rem;
}

.salary-grid th .req {
    color: #dc2626;
    margin-left: 2px;
}

.salary-grid .col-no {
    width: 44px;
    text-align: center;
    color: #94a3b8;
    font-size: .8rem;
    white-space: nowrap;
}

.salary-grid .col-kbn { width: 240px; }
.salary-grid .col-grade,
.salary-grid .col-issue { width: 80px; }
.salary-grid .col-money { width: 130px; text-align: right; }
.salary-grid .col-op { width: 156px; text-align: center; white-space: nowrap; }
.salary-grid .col-op .cell-del-btn + .cell-del-btn { margin-left: 6px; }

/* 閲覧行のセル（読み取り専用表示） */
.salary-grid .view-cell {
    padding: 10px 10px;
    color: #1f2937;
    font-size: .9rem;
    white-space: nowrap;
}
.salary-grid .view-cell.cell-center { text-align: center; }
.salary-grid .view-cell.cell-money-text { text-align: right; font-variant-numeric: tabular-nums; }
.salary-view-row:hover td { background: #f8fafc; }

/* グリッド内の入力欄（通常フォームより低い高さでコンパクトに） */
.cell-input {
    width: 100%;
    min-height: 34px;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: .85rem;
    background: #fff;
    color: #1f2937;
}

.cell-input:focus {
    outline: none;
    border-color: #285480;
    box-shadow: 0 0 0 2px rgba(40, 84, 127, 0.15);
}

.cell-input:disabled {
    background: #f3f4f6;
    color: #9ca3af;
}

.cell-input.cell-center { text-align: center; }
.cell-input.cell-money  { text-align: right; }

.cell-input.is-invalid {
    border-color: #dc2626;
    background: #fef2f2;
}

.cell-del-btn {
    width: auto;
    padding: .3rem .6rem;
    font-size: .78rem;
    white-space: nowrap;
}

/* 削除予定の既存行 */
.salary-grid tr.row-deleting td {
    background: #fff5f5;
}

.salary-grid tr.row-deleting .cell-input {
    text-decoration: line-through;
}

/* 保存バー */
.salary-savebar {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: 14px 0 4px;
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(247, 249, 252, 0), #f7f9fc 40%);
    z-index: 20;
}

/* ===== 保険料マスタ 一括グリッド（列数が多いので独自幅） ===== */
.insurance-grid {
    min-width: 1280px;
}

/* グループ見出し（報酬月額／健康保険料 など）と小見出し（以上・未満・全額・折半額） */
.insurance-grid thead th {
    text-align: center;
    font-size: .8rem;
    line-height: 1.3;
    white-space: nowrap;
}

/* 2行ヘッダの固定: 1行目は top:0、2行目は1行目の高さ分だけ下げて重なりを防ぐ
   （2行目の top は JS が実測してセットする。未計算時の暫定値を変数で持つ） */
.insurance-grid thead tr:first-child th { top: 0; }
.insurance-grid thead tr:last-child th { top: var(--ins-head-h, 56px); }

/* ヘッダ内の料率編集（健康保険料率・支援金率・厚生年金保険料率） */
.insurance-grid .rate-field {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
}
.insurance-grid .rate-input {
    width: 56px;
    box-sizing: border-box;
    padding: 2px 4px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: .78rem;
    text-align: right;
    background: #fff;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
}
.insurance-grid .rate-input:focus {
    outline: none;
    border-color: #285480;
    box-shadow: 0 0 0 2px rgba(40, 84, 127, 0.15);
}
.insurance-grid .rate-input.is-invalid {
    border-color: #dc2626;
    background: #fef2f2;
}
.insurance-grid .rate-unit {
    font-size: .72rem;
    font-weight: 400;
    color: #64748b;
}
.insurance-grid thead th small {
    display: block;
    font-weight: 400;
    font-size: .68rem;
    color: #64748b;
}

.insurance-grid .col-grade { width: 64px; }
.insurance-grid td.col-grade { white-space: nowrap; }
.insurance-grid .col-op { width: 156px; }

/* 数値セルは右寄せ・等幅。入力欄も含めコンパクトに */
.insurance-grid .view-cell { padding: 8px 10px; font-size: .85rem; }
.insurance-grid .cell-input { font-size: .82rem; padding: 6px 6px; }
.insurance-grid .cell-input.cell-money { min-width: 80px; }

/* ===== 賞与所得税マスタ 一括グリッド（3段ヘッダ・列数が多い） ===== */
.bonus-tax-grid {
    /* 横スクロールを抑えるため内容ぴったりの幅に（width:100% で引き伸ばさない）。
       各セルもコンパクトにして全体幅を最小化する。 */
    width: auto;
    min-width: 0;
    /* collapse だと border がテーブル側レイヤーに描画され、sticky ヘッダーの
       スクロール時に border が取り残されて白く見える。separate にして各セルが
       自前の border を持つことで sticky に追従させる。 */
    border-collapse: separate;
    border-spacing: 0;
}

/* セルの余白（横スクロールは許容しつつ、詰めすぎない程よい余白に） */
.bonus-tax-grid th,
.bonus-tax-grid td {
    padding: 6px 10px;
}

.bonus-tax-grid thead th {
    text-align: center;
    font-size: .78rem;
    line-height: 1.25;
    white-space: nowrap;
    /* separate では隣接セルの border が重ならないため、各セルに下線・左線を
       引いて 3 段ヘッダーの枠を保つ（sticky に追従する）。 */
    border-bottom: 1px solid #e5e7eb;
    border-left: 1px solid #eef2f6;
}

/* 本文セルも separate 用に下線を持たせる（collapse 時と同じ見た目に） */
.bonus-tax-grid tbody td {
    border-bottom: 1px solid #f3f4f6;
}

/* 3段ヘッダの固定: 各行を前段までの高さ分だけ下げて重なりを防ぐ
   （各段の高さは JS が実測して変数にセット。未計算時の暫定値を持つ） */
.bonus-tax-grid thead tr:nth-child(1) th { top: 0; }
.bonus-tax-grid thead tr:nth-child(2) th { top: var(--bt-head-h1, 28px); }
.bonus-tax-grid thead tr:nth-child(3) th {
    top: calc(var(--bt-head-h1, 28px) + var(--bt-head-h2, 24px));
}

.bonus-tax-grid .col-no { width: 34px; }
.bonus-tax-grid .col-rate { width: 60px; }
.bonus-tax-grid td.col-rate { white-space: nowrap; }
/* 操作は「編集／取消」1ボタンのみなので最小幅に */
.bonus-tax-grid .col-op { width: 1%; white-space: nowrap; text-align: center; }
.bonus-tax-grid .col-op .cell-del-btn { padding: .3rem .6rem; font-size: .78rem; }

/* 数値セル・入力欄（横スクロール許容のため詰めすぎない） */
.bonus-tax-grid .view-cell { padding: 7px 10px; font-size: .82rem; }
.bonus-tax-grid .cell-input { min-height: 32px; font-size: .8rem; padding: 5px 7px; }
.bonus-tax-grid .cell-input.cell-money { min-width: 0; }

/* ========== 汎用モーダル ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1000;
}
/* display:flex を上書きして確実に隠す */
.modal-overlay[hidden] { display: none; }

.modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
    width: 100%;
    max-width: 760px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e7edf4;
}

.modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

/* タイトル横にアイコンを添える（付与/取得/時間休モーダル等） */
.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.modal-title-wrap .paid-panel-ico { width: 30px; height: 30px; }
.modal-title-wrap .paid-panel-ico svg { width: 16px; height: 16px; }

.modal-close {
    appearance: none;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 .25rem;
}
.modal-close:hover { color: #475569; }

.modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
}

.modal-body .modal-row:hover td { background: #f8fafc; }

/* 従事者数バッジ（クリックでモーダルを開く） */
.staff-count-badge {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .7rem;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.staff-count-badge:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.18);
}
.staff-count-badge:active { transform: translateY(1px); }
.staff-count-badge:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.staff-count-icon { width: 15px; height: 15px; flex-shrink: 0; }
.staff-count-num { font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; }
.staff-count-unit { font-weight: 500; font-size: .75rem; opacity: .85; margin-left: 1px; }

/* 従事者0名（クリック不可・抑えた配色） */
.staff-count-badge.is-empty {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: default;
}
.staff-count-badge.is-empty:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
    box-shadow: none;
}

/* ===== 作業員名簿 編集: 上=基本情報/会社情報/日付(横3列) → 区切り → 作業員、操作は固定フッター ===== */
.wl-header-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: stretch; /* 同じ行のカード高さを揃える */
}
@media (min-width: 992px) {
    .wl-header-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
.wl-header-grid > .form-section {
    margin-bottom: 0;
    height: 100%; /* グリッドセルいっぱいに広げて3枚の高さを揃える */
}
.wl-edit-divider {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 22px 0;
}

/* ===== 作業員名簿 作業員選択UI ===== */
.wl-source-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}
.wl-source-tab {
    appearance: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 9px 18px;
    font-size: .9rem;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .12s ease, border-color .12s ease;
}
.wl-source-tab:hover { color: #1f4168; }
.wl-source-tab.is-active { color: #1f4168; border-bottom-color: #2f6dba; }

.wl-source-panel { display: none; }
.wl-source-panel.is-active { display: block; }

.wl-picker-filters {
    display: flex;
    gap: .75rem;
    margin-bottom: .7rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.wl-picker-filters > .form-group {
    flex: 1 1 220px;
    min-width: 200px;
    margin-bottom: 0;
}

.wl-person-list {
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}
.wl-person {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background .12s ease;
}
.wl-person:last-child { border-bottom: none; }
.wl-person:hover { background: #f8fafc; }
.wl-person input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: #1f4168; cursor: pointer; }
.wl-person:has(input:checked) { background: #f1f6fb; }
.wl-person.is-added { opacity: .55; cursor: not-allowed; }
.wl-person.is-added:hover { background: #fff; }
.wl-person-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.wl-person-name { font-size: .9rem; font-weight: 600; color: #1f2937; }
.wl-person-kana { font-size: .72rem; color: #94a3b8; }
.wl-person-context { font-size: .75rem; color: #64748b; white-space: nowrap; text-align: right; }
.wl-person-empty { text-align: center; padding: 1.5rem; color: #9ca3af; font-size: .85rem; margin: 0; }

.wl-selected-note { margin: 12px 2px 0; font-size: .82rem; color: #94a3b8; }
.wl-selected-note.is-selected { color: #1f4168; font-weight: 600; }

.wl-check-scroll { max-height: 230px; overflow-y: auto; padding: 2px; }

.wl-person-fixed { display: flex; align-items: center; gap: 10px; }
.wl-badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    background: #eef2f7;
    color: #475569;
    white-space: nowrap;
}
.wl-badge-staff { background: #eaf2fb; color: #1f4168; }
.wl-badge-subcontractor { background: #fdf2e9; color: #9a5b1e; }

/* ===== 作業員名簿 詳細 ===== */
/* 統計ストリップ（作業員数・区分別・テンプレ） */
.wl-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.wl-stat {
    position: relative;
    background: #fff;
    border: 1px solid #e7edf4;
    border-radius: 12px;
    padding: 14px 16px 14px 20px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}
.wl-stat::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: #94a3b8;
}
.wl-stat--total::before { background: #6366f1; }
.wl-stat--staff::before { background: #3b82f6; }
.wl-stat--sub::before   { background: #f59e0b; }
.wl-stat--tpl::before   { background: #94a3b8; }
.wl-stat-label { font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: #94a3b8; }
.wl-stat-value { margin-top: 4px; font-size: 1.55rem; font-weight: 800; color: #1e293b; line-height: 1.1; }
.wl-stat-value .wl-stat-unit { font-size: .82rem; font-weight: 700; color: #64748b; margin-left: 2px; }
.wl-stat-text  { margin-top: 6px; font-size: .9rem; font-weight: 700; color: #1e293b; line-height: 1.35; word-break: break-word; }

/* 名簿テーブル（アバター＋チップ＋ホバー） */
.wl-roster th, .wl-roster td { vertical-align: middle; }
.wl-roster tbody tr { transition: background-color .12s ease; }
.wl-roster tbody tr:hover { background: #f8fafc; }
.wl-name { display: flex; align-items: center; gap: 10px; }
.wl-avatar {
    flex: none;
    width: 34px; height: 34px;
    border-radius: 999px;
    display: grid; place-items: center;
    font-weight: 700; font-size: .9rem;
    color: #fff;
    background: #64748b;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}
.wl-avatar--staff { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.wl-avatar--subcontractor { background: linear-gradient(135deg, #fbbf24, #d97706); }
/* SSOアバター画像がある従業員は写真で表示（円に切り抜き） */
.wl-avatar img { width: 100%; height: 100%; border-radius: 999px; object-fit: cover; display: block; }
.wl-name-text { font-weight: 700; color: #1e293b; white-space: nowrap; }
.wl-cell-tags { min-width: 150px; }
.wl-muted { color: #cbd5e1; }

/* 名簿情報カード: アイコン付きセクション見出し＋区切り。
   線種を統一するため、区切りは実線1種類のみ。項目ごとの下線はこのカードでは消す（下記）。 */
/* 先頭セクション（基本情報）とカードタイトル（名簿情報）の間に余白を作る。
   後続セクションは下の `+` 指定が優先されるので二重にならない。 */
.wl-info-sec { margin-top: 14px; }
.wl-info-sec + .wl-info-sec {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #eef2f7;
}
/* 項目下線（.detail-dl > div の border-bottom）を打ち消して、セクション区切りと混在させない */
.wl-info-sec .detail-dl > div {
    border-bottom: none;
}
.wl-info-head {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 2px;
}
.wl-info-ico {
    flex: none;
    width: 28px; height: 28px;
    border-radius: 8px;
    display: grid; place-items: center;
    background: #eef2ff;
    color: #6366f1;
}
.wl-info-ico svg { width: 15px; height: 15px; }
.wl-info-title { font-size: .84rem; font-weight: 700; color: #334155; letter-spacing: .01em; }
.wl-info-sec--basic   .wl-info-ico { background: #eef2ff; color: #6366f1; }
.wl-info-sec--company .wl-info-ico { background: #ecfeff; color: #0e8ba8; }
.wl-info-sec--date    .wl-info-ico { background: #f0fdf4; color: #16a34a; }
/* このカード内の dl は見出し直下に詰める */
.wl-info-sec .detail-dl { padding-top: 8px; padding-bottom: 4px; }

/* ===== 従事者名簿 ランディング ===== */
.roster-sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
}
.roster-sheet-option {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .85rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.roster-sheet-option:hover { border-color: #cbd5e1; }
.roster-sheet-option:has(input:checked) {
    border-color: #93c5fd;
    background: #eff6ff;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.12);
}
.roster-sheet-option input { margin-top: .2rem; flex-shrink: 0; }
.roster-sheet-name { display: block; font-weight: 700; color: #1e293b; font-size: .9rem; }
.roster-sheet-desc { display: block; font-size: .76rem; color: #64748b; margin-top: .15rem; }
.roster-hint { font-size: .78rem; color: #94a3b8; }
.roster-links { display: flex; flex-wrap: wrap; gap: .6rem; }
.roster-links a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem .9rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #1f4168;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
.roster-links a:hover { background: #eaf2fb; border-color: #cbd5e1; }

/* ===== 一覧テーブルの列ソート ===== */
.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: relative;
}
.sortable-th:hover { color: #1f4168; }
/* 既定の上下矢印（淡色） */
.sortable-th::after {
    content: "⇅";
    margin-left: .35em;
    font-size: .8em;
    color: #cbd5e1;
}
/* 昇順／降順時の矢印（強調） */
.sortable-th[data-sort-dir="asc"]::after  { content: "▲"; color: #2563eb; }
.sortable-th[data-sort-dir="desc"]::after { content: "▼"; color: #2563eb; }

/* サーバ側ソートの見出しリンク（全データを並び替え。ページ内クライアントソートの置き換え） */
.sort-link {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.sort-link:hover { color: #1f4168; }
.sort-link .sort-arrow { font-size: .75em; color: #2563eb; }
/* 未ソート列は淡い上下矢印をホバーヒントとして表示 */
.sort-link:not(.is-active) .sort-arrow::before { content: "⇅"; color: #cbd5e1; }

/* ===== 詳細画面: 左ナビ＋本文（アンカー） ===== */
.detail-layout {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-top: 18px;
}
.detail-nav {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding-right: 2px;
}
.detail-nav-link {
    display: block;
    padding: .5rem .75rem;
    border-radius: 8px;
    border-left: 3px solid transparent;
    color: #475569;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.detail-nav-link:hover { background: #f1f5f9; color: #1f4168; text-decoration: none; }
.detail-nav-link.is-active {
    background: #eaf2fb;
    color: #17314f;
    border-left-color: #2563eb;
}
.detail-content { min-width: 0; }
.detail-section { scroll-margin-top: 16px; }
.detail-section + .detail-section { margin-top: 18px; }
.detail-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
    align-items: start;
}

/* 狭い画面: ナビを本文上部の横スクロールに切替 */
@media (max-width: 860px) {
    .detail-layout { grid-template-columns: 1fr; }
    .detail-nav {
        position: static;
        flex-direction: row;
        overflow-x: auto;
        max-height: none;
        gap: 6px;
        padding-bottom: 6px;
    }
    .detail-nav-link { border-left: none; border-bottom: 3px solid transparent; }
    .detail-nav-link.is-active { border-left: none; border-bottom-color: #2563eb; }
}

/* ===== 従業員詳細: フラットなシート型（カードの箱を廃止・.detail-content 限定） ===== */
.detail-content {
    background: #fff;
    border: 1px solid #e7edf4;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    padding: 2px 30px;
    margin-top: 22px;
}
/* セクションは横罫線で区切る */
.detail-content .detail-section { padding: 22px 0; }
.detail-content .detail-section + .detail-section { border-top: 1px solid #eef2f7; }
/* 箱をやめてフラットに（同一セクション内の小グループは横並びのまま） */
.detail-content .detail-section-grid { gap: 8px 36px; }
.detail-content .detail-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}
/* 見出し: アイコン付き＋淡色チップ */
.detail-content .detail-card-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 9px;
    padding: 7px 18px 7px 14px;
    margin-bottom: 14px;
    background: #eaf2fb;
    color: #1f4168;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .04em;
}
.detail-content .detail-card-title::before { content: none; }   /* アクセントバー除去 */
.detail-content .detail-card.is-warn .detail-card-title {
    background: #fdecec;
    color: #b91c1c;
}
.detail-card-icon { width: 18px; height: 18px; flex-shrink: 0; }
/* タイルの行罫線を消してすっきり */
.detail-content .detail-dl > div { border-bottom: none; padding: 7px 0; }
.detail-content .detail-dl { padding: 8px 0 4px; }

/* ===== 詳細ページ: カード型（従業員・外注先従事者で共用。余白多め・マルチカラムでバランス配置） ===== */
.detail-sheet { margin-top: 24px; }

/* 2カラムをバランスよく詰める（高さ違いのカードでも隙間が出にくい） */
.detail-cards { column-count: 2; column-gap: 22px; }
.detail-cards .scard { break-inside: avoid; margin: 0 0 22px; }
/* 全幅カード（テーブル・登録情報など）はカラムコンテナの外に置く */
.detail-sheet .scard.is-wide { margin: 0 0 22px; }
.detail-sheet .scard.is-wide:last-child { margin-bottom: 0; }

.scard {
    background: #fff;
    border: 1px solid #edf1f6;
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 26px rgba(15, 23, 42, .045);
    padding: 18px 22px 14px;
}

/* 警告カード（退職・死亡など）は赤系のアクセント */
.scard.is-warn { border-color: #f5d9d9; }
.scard.is-warn .scard-ico { background: linear-gradient(135deg, #fdecec 0%, #fbdcdc 100%); color: #b91c1c; }
.scard.is-warn .scard-title { color: #b91c1c; }

/* 見出し: 角丸タイルのアイコン＋文字（青チップの羅列をやめて視覚ノイズを軽減） */
.scard-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 13px;
    margin-bottom: 4px;
    border-bottom: 1px solid #f1f4f8;
}
.scard-ico {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #eef5fe 0%, #e2edfb 100%);
    color: #2a5180;
}
.scard-ico .detail-card-icon { width: 19px; height: 19px; }
.scard-title { font-size: .96rem; font-weight: 700; color: #1f2d3d; letter-spacing: .02em; }

/* 項目: ラベル左・値右の整然としたスペックシート */
.scard-dl { margin: 0; padding: 4px 0 0; }
.scard-dl > div {
    display: flex;
    gap: 16px;
    align-items: baseline;
    padding: 9px 2px;
    border-bottom: 1px solid #f4f6fa;
}
.scard-dl > div:last-child { border-bottom: none; }
.scard-dl dt {
    flex: 0 0 8em;
    color: #94a3b8;
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .02em;
    line-height: 1.45;
}
.scard-dl dd {
    flex: 1;
    margin: 0;
    min-width: 0;
    color: #1e293b;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.5;
    word-break: break-all;
}
.scard-dl dd.is-empty { color: #cbd5e1; font-weight: 500; }

/* タグなど内容が広い項目は縦積みで全幅に */
.scard-dl > div.is-block { flex-direction: column; gap: 7px; align-items: stretch; }
.scard-dl > div.is-block dt { flex: none; }

/* 全幅カードの項目は内部も2列に */
.scard-dl--2col { column-count: 2; column-gap: 40px; }
.scard-dl--2col > div { break-inside: avoid; }

.scard-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.scard-tag {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    background: #eef3f9;
    color: #33598a;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* カード内のテーブル・小見出し・空表示 */
.scard .detail-table-wrap { overflow-x: auto; margin-top: 6px; }
.scard .detail-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.scard .detail-table th,
.scard .detail-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
.scard .detail-table th { color: #94a3b8; font-weight: 600; font-size: .74rem; letter-spacing: .02em; background: #f8fafc; }
.scard .detail-table tr:last-child td { border-bottom: none; }
.scard .detail-table td { color: #1e293b; }
.scard .detail-subtitle { margin: 4px 0 2px; font-size: .78rem; font-weight: 700; color: #64748b; }
.scard .detail-empty { margin: 6px 0 2px; color: #cbd5e1; font-size: .86rem; }

@media (max-width: 820px) {
    .detail-cards { column-count: 1; }
    .scard-dl--2col { column-count: 1; }
}
@media (max-width: 560px) {
    .scard-dl > div { flex-direction: column; gap: 2px; }
    .scard-dl dt { flex: none; }
}

/* ===== 外注先編集: 見出し（アイコンチップ）＋テーブル軽量化 ===== */
.subc-edit .section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 9px;
    padding: 7px 18px 7px 14px;
    margin: 0 0 1.1rem;
    background: #eaf2fb;
    color: #1f4168;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .04em;
}
.subc-edit .staff-table th {
    background: transparent;
    color: #94a3b8;
    font-size: .72rem;
    letter-spacing: .04em;
    border-bottom: 2px solid #eef2f7;
    padding: .5rem .9rem;
}
.subc-edit .staff-table td {
    border-bottom: 1px solid #f1f5f9;
    padding: .7rem .9rem;
}
.subc-edit .staff-table tbody tr:hover td { background: #f8fafc; }

/* ===== 重要なお知らせ: バナー＋強制モーダル ===== */
.news-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem 1.1rem;
    margin-bottom: 4px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
    border-radius: 10px;
    color: #991b1b;
    font-size: .88rem;
}
.news-banner-text { display: flex; align-items: center; gap: 8px; min-width: 0; }
.news-banner-text .detail-card-icon { width: 18px; height: 18px; flex-shrink: 0; color: #dc2626; }
.news-banner-btn {
    flex-shrink: 0;
    padding: .42rem .95rem;
    border-radius: 8px;
    background: #dc2626;
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.news-banner-btn:hover { background: #b91c1c; color: #fff; text-decoration: none; }

/* 強制モーダル（重要なお知らせ） */
.news-modal .news-modal-title { font-size: 1.05rem; font-weight: 700; color: #1e293b; margin: 0 0 .35rem; }
.news-modal .news-modal-meta { font-size: .78rem; color: #94a3b8; margin: 0 0 .9rem; }
.news-modal .news-modal-body {
    font-size: .9rem;
    color: #334155;
    line-height: 1.7;
    max-height: 50vh;
    overflow-y: auto;
}
.news-modal .detail-card-icon { width: 18px; height: 18px; }

/* ===== お知らせ画面（閲覧側）: タイトル一覧＋表示モーダル ===== */
/* 未読/既読 セグメントタブ */
.news-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    background: #eef2f7;
    border-radius: 12px;
}
.news-tab-btn {
    appearance: none;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 9px;
    color: #64748b;
    font-weight: 700;
    font-size: .88rem;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.news-tab-btn.is-active { background: #fff; color: #1f4168; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14); }
.news-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #dbe3ee;
    color: #475569;
    font-size: .72rem;
    font-weight: 700;
}
.news-tab-btn.is-active .news-tab-count { background: #1f4168; color: #fff; }

/* お知らせ行（通知リスト風） */
.news-feed { display: flex; flex-direction: column; gap: 10px; }
.news-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    font: inherit;
    cursor: pointer;
    background: #fff;
    border: 1px solid #e7edf4;
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.news-row:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.10); border-color: #dbe3ee; }
.news-row-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0edff;
    color: #2563eb;
}
.news-row.is-important .news-row-icon { background: #fde8e8; color: #dc2626; }
.news-row-icon .detail-card-icon { width: 20px; height: 20px; }
.news-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.news-row-title { font-weight: 700; color: #1e293b; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.news-row-meta { display: flex; align-items: center; gap: 7px; font-size: .76rem; color: #94a3b8; }
.news-row-type { font-weight: 700; color: #2563eb; }
.news-row.is-important .news-row-type { color: #dc2626; }
.news-row-date { display: inline-flex; align-items: center; gap: 4px; }
.news-row-chevron { flex-shrink: 0; color: #cbd5e1; transition: color .15s ease, transform .15s ease; }
.news-row:hover .news-row-chevron { color: #94a3b8; transform: translateX(2px); }
/* お知らせ表示モーダル（おしゃれ版） */
.news-vmodal {
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: nvm-fade .18s ease;
}
@keyframes nvm-fade { from { opacity: 0; } to { opacity: 1; } }

.news-vmodal-card {
    position: relative;
    width: 100%;
    max-width: 680px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.34);
    animation: nvm-in .24s cubic-bezier(.2, .8, .2, 1);
}
@keyframes nvm-in {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

.news-vmodal-accent {
    display: block;
    height: 5px;
    flex-shrink: 0;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}
.news-vmodal.is-important .news-vmodal-accent { background: linear-gradient(90deg, #dc2626, #fb7185); }

.news-vmodal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.news-vmodal-close:hover { background: #e2e8f0; color: #1e293b; }

.news-vmodal-head { display: flex; align-items: center; gap: 10px; padding: 22px 28px 0; }
.news-vmodal-badge {
    padding: 3px 12px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .04em;
    background: #e0edff;
    color: #1d4ed8;
}
.news-vmodal-badge.is-important { background: #fde8e8; color: #b91c1c; }
.news-vmodal-date { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; color: #94a3b8; }

.news-vmodal-title {
    margin: 12px 28px 0;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.45;
    color: #0f172a;
    letter-spacing: .01em;
}
.news-vmodal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    margin: 16px 28px 0;
    padding-top: 16px;
    border-top: 1px solid #eef2f7;
    font-size: .95rem;
    line-height: 1.95;
    color: #334155;
}
.news-vmodal-foot { padding: 18px 28px 24px; display: flex; justify-content: flex-end; }
.news-vmodal-more { margin: 12px 28px 0; font-size: .8rem; color: #94a3b8; text-align: center; }

/* サイドバー: 未読件数バッジ */
.sidebar-badge {
    margin-left: auto;
    flex-shrink: 0;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
/* 申請バッジ: 承認待ち(要承認)=アンバー / 自分の申請=ブルー で色味を分ける */
.sidebar-badge.sidebar-badge-pending { background: #f59e0b; }
.sidebar-badge.sidebar-badge-mine    { background: #3b82f6; }
/* 2つ並ぶとき（自分の申請＋承認待ち）は間隔を空ける。margin-left:auto は先頭だけに効かせる */
.sidebar-badge + .sidebar-badge { margin-left: 4px; }

/* ===== 従業員一覧: 帳票一括ダウンロードバー ===== */
.bulk-bar-wrap {
    padding: .9rem 1.1rem;
    border-bottom: 1px solid #eef2f7;
}
.bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .8rem;
    padding: .55rem .8rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.bulk-bar-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .85rem;
}
.bulk-bar-divider {
    align-self: stretch;
    width: 1px;
    min-height: 26px;
    background: #e2e8f0;
}
.bulk-bar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}
.bulk-selected {
    font-size: .85rem;
    color: #475569;
    white-space: nowrap;
}
.bulk-selected strong {
    color: #1e3a5f;
    font-size: 1rem;
}
.bulk-date {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    color: #475569;
    white-space: nowrap;
}
.bulk-date .filter-input {
    width: auto;
    padding: .35rem .5rem;
    font-size: .82rem;
}
.bulk-actions-label {
    font-size: .78rem;
    color: #94a3b8;
    white-space: nowrap;
}
/* 帳票DLボタン（.btn の width:100% / padding を上書きしてコンパクトに揃える） */
.bulk-doc-btn {
    width: auto;
    padding: .42rem .85rem;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
    color: #fff;
    background: #1e3a5f;
    border: 1px solid #1e3a5f;
    border-radius: 6px;
}
.bulk-doc-btn:hover:not(:disabled) {
    background: #162d4a;
}
.bulk-doc-btn:disabled {
    cursor: not-allowed;
}
/* 未選択時（実装済みボタン）はグレーアウト */
.bulk-doc-btn:disabled:not(.is-coming-soon) {
    background: #cbd5e1;
    border-color: #cbd5e1;
}
/* 準備中ボタンは終始ミュート表示 */
.bulk-doc-btn.is-coming-soon {
    color: #94a3b8;
    background: #fff;
    border-color: #e2e8f0;
}
.coming-soon-badge {
    display: inline-block;
    margin-left: .35rem;
    padding: .05rem .35rem;
    border-radius: 999px;
    background: #eef2f7;
    color: #94a3b8;
    font-size: .65rem;
    font-weight: 600;
    vertical-align: middle;
}
.bulk-hint {
    font-size: .76rem;
    color: #94a3b8;
    white-space: nowrap;
}
.staff-table th.col-check,
.staff-table td.col-check {
    width: 40px;
    text-align: center;
    white-space: nowrap;
}

/* ===== マスタ機能停止中の案内バナー ===== */
.master-notice {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .85rem 1.1rem;
    margin-bottom: 16px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    color: #9a3412;
}
.master-notice > svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: #ea580c;
}
.master-notice strong {
    display: block;
    font-size: .9rem;
}
.master-notice span {
    display: block;
    margin-top: .15rem;
    font-size: .8rem;
    color: #b45309;
}

/* お知らせ 既読者確認モーダル */
.readers-summary { font-size: .85rem; color: #475569; margin: 0 0 1rem; }
.readers-section { margin-bottom: 1rem; }
.readers-section:last-child { margin-bottom: 0; }
.readers-section-head { font-size: .78rem; font-weight: 700; color: #1f4168; margin-bottom: .45rem; }
.readers-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; max-height: 220px; overflow-y: auto; }
.readers-list li { display: flex; align-items: center; gap: 10px; padding: 7px 11px; border-radius: 8px; background: #f8fafc; font-size: .85rem; }
.readers-name { font-weight: 600; color: #1e293b; flex: 1; min-width: 0; }
.readers-dept { font-size: .76rem; color: #94a3b8; white-space: nowrap; }
.readers-date { font-size: .76rem; color: #64748b; white-space: nowrap; }

/* ============================================================
   従業員詳細（タブ型・青系 / sd-*）
   ============================================================ */
.sd-page { display:flex; flex-direction:column; gap:16px; }

.sd-back { align-self:flex-start; display:inline-flex; align-items:center; gap:6px; font-size:.82rem; color:#5b7088; text-decoration:none; padding:2px 0; }
.sd-back:hover { color:#2563eb; }

/* ---- ヒーローのアバター（他画面と同色のヒーロー内に大きめ表示） ---- */
.sd-hero-avatar {
    flex:0 0 auto; width:94px; height:94px; border-radius:50%; overflow:hidden;
    display:flex; align-items:center; justify-content:center;
    font-size:36px; font-weight:700; color:#fff;
    background:rgba(255,255,255,.16); border:2px solid rgba(255,255,255,.45);
    box-shadow:0 8px 22px rgba(0,0,0,.22);
}
.sd-hero-avatar img { width:100%; height:100%; object-fit:cover; }

/* ヒーロー内のステータスタグ */
.sd-chips { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.sd-chip { font-size:.74rem; font-weight:700; padding:4px 11px; border-radius:999px; border:1px solid rgba(255,255,255,.3); background:rgba(255,255,255,.16); color:#fff; }
.sd-chip.is-green { background:rgba(52,211,153,.34); border-color:rgba(110,231,183,.6); }
.sd-chip.is-red   { background:rgba(248,113,113,.36); border-color:rgba(252,165,165,.6); }
.sd-chip.is-cyan  { background:rgba(56,189,248,.34); border-color:rgba(125,211,252,.6); }
.sd-chip.is-mute  { background:rgba(148,163,184,.34); border-color:rgba(203,213,225,.55); }
.sd-chip.is-ghost { background:rgba(255,255,255,.12); }
.sd-hero-meta { margin:10px 0 0; font-size:.74rem; color:rgba(255,255,255,.62); }

/* ---- 帳票DLバー ---- */
.sd-docbar { display:flex; align-items:center; flex-wrap:wrap; gap:10px; padding:13px 18px; border-radius:14px; background:#fff; border:1px solid #e8eef6; box-shadow:0 4px 14px rgba(15,23,42,.04); }
.sd-docbar-label { display:inline-flex; align-items:center; gap:7px; font-size:.85rem; font-weight:700; color:#1e3356; }
.sd-docbar-label svg { width:17px; height:17px; color:#2563eb; }
.sd-docbar-date { display:inline-flex; align-items:center; gap:6px; font-size:.8rem; color:#5b7088; }
.sd-docbar-date .filter-input { width:auto; }
.sd-docbar-spacer { flex:1 1 auto; }
.sd-doc-btn { cursor:pointer; font-size:.82rem; font-weight:600; padding:.45rem .9rem; border-radius:9px; color:#1d4ed8; background:#e8f0fe; border:1px solid #cfe0fb; white-space:nowrap; transition:background .15s ease, transform .15s ease; }
.sd-doc-btn:hover { background:#d6e4fd; transform:translateY(-1px); }

/* 帳票ボタンのダウンロードアイコン（詳細・一覧の両方で共通） */
.sd-doc-btn, .bulk-doc-btn { display:inline-flex; align-items:center; gap:.4rem; }
.doc-btn-ico { width:15px; height:15px; flex:none; }

/* ---- タブ（従業員フォームと同じ form-tabs を使用。パネル内の複数カードに余白） ---- */
.sd-page .form-tab-panel.is-active { display:flex; flex-direction:column; gap:14px; }

/* ---- カード ---- */
.sd-card { background:#fff; border:1px solid #e8eef6; border-radius:16px; padding:18px 22px 10px; box-shadow:0 4px 16px rgba(15,23,42,.05); }
.sd-card-accent { background:linear-gradient(180deg,#f4f8ff,#fff 64%); border-color:#dbe7fb; }
.sd-card.is-warn { border-color:#fcd34d; background:linear-gradient(180deg,#fffaeb,#fff 64%); }
.sd-card-head { display:flex; align-items:center; gap:10px; padding-bottom:12px; margin-bottom:10px; border-bottom:1px solid #eef2f7; }
.sd-card-ico { flex:0 0 auto; width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center; border-radius:9px; color:#fff; background:linear-gradient(135deg,#2563eb,#3b82f6); box-shadow:0 6px 14px -4px rgba(37,99,235,.55); }
.sd-card-ico svg { width:17px; height:17px; }
.sd-card-head h2 { margin:0; font-size:1.02rem; font-weight:800; color:#0f1e3a; letter-spacing:.01em; }

/* ---- SSO連携カード（従業員詳細・システム管理者のみ） ---- */
.sso-card { padding-bottom:18px; }
.sso-card-state { margin-left:auto; font-size:.72rem; font-weight:700; padding:3px 10px; border-radius:999px; }
.sso-card-state.is-on  { color:#0369a1; background:#e0f2fe; border:1px solid #bae6fd; }
.sso-card-state.is-off { color:#64748b; background:#f1f5f9; border:1px solid #e2e8f0; }

.sso-linked { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.sso-linked-avatar { flex:0 0 auto; width:46px; height:46px; border-radius:50%; overflow:hidden; display:inline-flex; align-items:center; justify-content:center;
    background:linear-gradient(135deg,#38bdf8,#2563eb); color:#fff; font-weight:800; font-size:1.05rem; }
.sso-linked-avatar img { width:100%; height:100%; object-fit:cover; }
.sso-linked-body { min-width:0; flex:1 1 220px; }
.sso-linked-name { margin:0; font-size:.96rem; font-weight:700; color:#13233f; }
.sso-linked-mail { margin:2px 0 0; font-size:.84rem; color:#5b6b85; word-break:break-all; }
.sso-linked-meta { margin:5px 0 0; display:flex; flex-wrap:wrap; gap:6px 12px; font-size:.76rem; color:#8aa0bd; }
.sso-linked-meta .sso-dev { color:#9a3412; background:#ffedd5; border:1px solid #fed7aa; border-radius:999px; padding:1px 8px; font-weight:700; }
.imp-card-note { margin:0 0 12px; font-size:.84rem; color:#5b6b85; line-height:1.6; }

.sso-unlinked .sso-lead { margin:0; font-size:.9rem; color:#13233f; }
.sso-unlinked .sso-lead strong { color:#1d4ed8; word-break:break-all; }
.sso-unlinked .sso-note { margin:6px 0 12px; font-size:.79rem; color:#8aa0bd; line-height:1.6; }
.sso-warn { margin:0; font-size:.82rem; font-weight:600; color:#b45309; background:#fffaeb; border:1px solid #fcd34d; border-radius:9px; padding:.6rem .85rem; }

.sso-btn { cursor:pointer; font-size:.85rem; font-weight:700; padding:.5rem 1.1rem; border-radius:9px; color:#fff; border:1px solid transparent;
    background:linear-gradient(135deg,#2563eb,#3b82f6); box-shadow:0 6px 14px -6px rgba(37,99,235,.65); transition:transform .15s ease, box-shadow .15s ease; }
.sso-btn:hover { transform:translateY(-1px); box-shadow:0 8px 18px -6px rgba(37,99,235,.7); }
.sso-btn.is-ghost { color:#b91c1c; background:#fff; border-color:#fecaca; box-shadow:none; }
.sso-btn.is-ghost:hover { background:#fef2f2; transform:none; }

/* ---- フィールド（全幅オートフィル多カラム） ---- */
.sd-grid { margin:0; display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:0 28px; }
.sd-grid.is-compact { grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); }
.sd-field { min-width:0; padding:9px 2px; }
.sd-field.is-block { grid-column:1 / -1; }
.sd-field dt { font-size:.72rem; font-weight:600; color:#8aa0bd; margin-bottom:3px; }
.sd-field dd { margin:0; font-size:.93rem; font-weight:600; color:#13233f; word-break:break-word; }
.sd-field.is-empty dd { color:#cbd5e1; font-weight:500; }

/* ---- サブグループ（社会保険） ---- */
.sd-subgrid { display:grid; grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); gap:4px 32px; }
.sd-subgroup { min-width:0; }
.sd-subtitle { margin:6px 0 2px; font-size:.8rem; font-weight:700; color:#2563eb; padding-bottom:5px; border-bottom:2px solid #e0ecff; }

/* ---- タグ ---- */
.sd-tags { display:flex; flex-wrap:wrap; gap:6px; padding-top:2px; }
.sd-tag { font-size:.76rem; font-weight:600; padding:4px 10px; border-radius:999px; color:#1d4ed8; background:#e8f0fe; border:1px solid #cfe0fb; }
.sd-tag.is-on { color:#047857; background:#d1fae5; border-color:#a7f3d0; }

/* ---- テーブル ---- */
.sd-wide-2col { display:grid; grid-template-columns:repeat(auto-fit,minmax(340px,1fr)); gap:14px; }
.sd-table-wrap { overflow-x:auto; border:1px solid #eef2f7; border-radius:12px; }
.sd-table { width:100%; border-collapse:collapse; font-size:.85rem; }
.sd-table thead th { text-align:left; font-size:.73rem; font-weight:700; color:#5b7088; background:#f3f7fd; padding:9px 13px; border-bottom:1px solid #e8eef6; white-space:nowrap; }
.sd-table tbody td { padding:9px 13px; border-bottom:1px solid #eef2f7; color:#13233f; }
.sd-table tbody tr:last-child td { border-bottom:0; }
.sd-table tbody tr:hover { background:#f7faff; }
.sd-empty { color:#94a3b8; font-size:.86rem; padding:6px 0 14px; }

@media (max-width: 640px) {
    .sd-grid { grid-template-columns:1fr; }
}

/* ========== 有給管理（台帳） ========== */
.badge-amber { background:#fef3c7; color:#92400e; }
/* 修正依頼の種別バッジ。勤務表の「修正依頼(中)」バッジと同色（枠付きアンバー）。 */
.badge-correction { background:#fef3c7; color:#92400e; border:1px solid #fcd34d; }

/* 現在の有給残（全幅バナー） */
.paid-balance {
    position:relative;
    overflow:hidden;
    border-radius:18px;
    padding:22px 30px;
    margin-bottom:14px;
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px 26px;
    flex-wrap:wrap;
    background:
        radial-gradient(circle at 92% 8%, rgba(125,211,252,.30) 0, transparent 42%),
        radial-gradient(circle at 4% 120%, rgba(99,102,241,.34) 0, transparent 46%),
        linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 55%, #2563eb 100%);
    box-shadow:0 14px 30px rgba(29,78,216,.28);
}
.paid-balance-head { display:flex; align-items:center; gap:13px; }
.paid-balance-ico {
    flex:none; width:50px; height:50px; border-radius:15px;
    display:grid; place-items:center;
    background:rgba(255,255,255,.16); color:#fff;
}
.paid-balance-ico svg { width:26px; height:26px; }
.paid-balance-title { font-size:1.05rem; font-weight:700; color:rgba(219,234,254,.96); letter-spacing:.01em; }
.paid-balance-value { font-size:3rem; font-weight:800; line-height:1; letter-spacing:-.02em; white-space:nowrap; }
.paid-balance-value small { font-size:1.15rem; font-weight:600; margin:0 2px 0 4px; color:rgba(191,219,254,.95); }
.paid-balance-extra { margin-left:10px; }

/* 有給情報（メタ情報の帯） */
.paid-info {
    display:flex;
    flex-wrap:wrap;
    gap:12px 0;
    background:#fff;
    border:1px solid #edf1f7;
    border-radius:14px;
    padding:14px 8px;
    margin-bottom:16px;
    box-shadow:0 1px 2px rgba(15,23,42,.04);
}
.paid-info-item {
    flex:1 1 150px;
    min-width:0;
    padding:0 18px;
    display:flex;
    flex-direction:column;
    gap:3px;
    border-left:1px solid #eef2f7;
}
.paid-info-item:first-child { border-left:0; }
.paid-info-k { font-size:.72rem; font-weight:600; color:#94a3b8; letter-spacing:.02em; }
.paid-info-v { font-size:.95rem; font-weight:700; color:#1e293b; }

/* スマホ: 縦の区切り線(border-left)が折り返しでバラバラに残るため、1項目1行＋上罫線に切替 */
@media (max-width: 640px) {
    .paid-info {
        gap: 0;
        padding: 4px 16px;
    }
    .paid-info-item {
        flex: 1 1 100%;
        padding: 11px 0;
        border-left: 0;
        border-top: 1px solid #eef2f7;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    .paid-info-item:first-child { border-top: 0; }
    .paid-info-v { text-align: right; }
}

/* 指標カード（付与合計〜失効合計） */
.paid-cards {
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(190px, 1fr));
    gap:14px;
    margin-bottom:20px;
}
.paid-card {
    background:#fff;
    border:1px solid #edf1f7;
    border-radius:16px;
    padding:16px 18px;
    display:flex;
    flex-direction:column;
    gap:9px;
    box-shadow:0 1px 2px rgba(15,23,42,.04);
    transition:transform .18s ease, box-shadow .18s ease;
}
.paid-card:hover { transform:translateY(-2px); box-shadow:0 12px 26px rgba(15,23,42,.10); }
.paid-card-head { display:flex; align-items:center; gap:10px; }
.paid-card-ico {
    flex:none; width:38px; height:38px; border-radius:11px;
    display:grid; place-items:center;
    background:#f1f5f9; color:#64748b;
}
.paid-card-ico svg { width:19px; height:19px; }
.paid-card-label { font-size:.82rem; font-weight:700; color:#475569; }
.paid-card-value { font-size:1.6rem; font-weight:800; color:#0f172a; line-height:1.1; letter-spacing:-.01em; white-space:nowrap; }
.paid-card-value small { font-size:.78rem; font-weight:600; color:#94a3b8; margin-left:2px; }
.paid-card-value.is-danger { color:#e11d48; }
.paid-card-plus { font-size:.82rem; font-weight:600; color:#94a3b8; margin-left:3px; }
.paid-card-cap { font-size:.72rem; color:#94a3b8; }

/* 指標アイコンの配色 */
.paid-card.is-granted  .paid-card-ico { background:#eef2ff; color:#4f46e5; }
.paid-card.is-used     .paid-card-ico { background:#ecfdf5; color:#0d9488; }
.paid-card.is-time     .paid-card-ico { background:#fef9c3; color:#ca8a04; }
.paid-card.is-expiring .paid-card-ico { background:#fef3c7; color:#d97706; }
.paid-card.is-lost     .paid-card-ico { background:#fff1f2; color:#e11d48; }

/* 履歴テーブルは高さを抑えて内側スクロール（ヘッダー固定） */
.paid-hist {
    position: relative;
    max-height: 340px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
/* テーブルは全幅のまま角丸・左右枠なし。先頭/末尾セルの余白でタイトル（アイコン）位置に揃える */
.paid-hist-inset {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
}
.paid-hist-inset .sd-table th:first-child,
.paid-hist-inset .sd-table td:first-child {
    padding-left: 18px;
}
.paid-hist-inset .sd-table th:last-child,
.paid-hist-inset .sd-table td:last-child {
    padding-right: 18px;
}
/* 内容幅に収める列（取得日数など） */
.paid-col-min {
    width: 1%;
    white-space: nowrap;
}
/* 有給種類タグ（全日/半日/時間休補充） */
.paid-type-tag {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    background: #f3f4f6;
    color: #6b7280;
}
.paid-type-1 { background: #dbeafe; color: #1e40af; } /* 全日 */
.paid-type-2 { background: #fef3c7; color: #92400e; } /* 半日 */
.paid-type-3 { background: #ccfbf1; color: #0f766e; } /* 時間休補充 */

/* 値なしの「—」プレースホルダ（失効列と同色） */
.paid-dash { color: #cbd5e1; }

/* 履歴が空のときの案内文 */
.paid-empty { text-align: center; padding: 2.5rem; color: #9ca3af; }
/* スマホでは「〜を追加」で登録〜の一文を改行する */
@media (max-width: 640px) {
    .paid-empty-br { display: block; }
}

/* 有効でない付与（失効・付与予定）の行 */
.paid-row-inactive > td { background: #f6f7f9; }
.paid-hist .sd-table tbody tr.paid-row-inactive:hover > td { background: #eef0f3; }

/* 汎用ユーティリティ */
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.paid-hist .sd-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}
/* スクロールバーを常時はっきり表示（スクロール可能の手掛かり） */
.paid-hist::-webkit-scrollbar { width: 10px; height: 10px; }
.paid-hist::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
    border: 2px solid #fff;
}
.paid-hist::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
/* 下にまだ続くときだけ、下端にフェード影を出す */
.paid-hist::after {
    content: "";
    position: sticky;
    bottom: 0;
    left: 0;
    display: block;
    height: 0;
    pointer-events: none;
    box-shadow: 0 -9px 12px -3px rgba(40, 60, 90, .30);
    opacity: 0;
    transition: opacity .15s ease;
    z-index: 3;
}
.paid-hist.is-scrollable:not(.at-end)::after { opacity: 1; }

.paid-panel-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:1rem;
    padding:14px 18px;
    border-bottom:1px solid #eef2f7;
}
.paid-panel-head h2 { font-size:1rem; font-weight:700; color:#0f172a; margin:0; }
.paid-panel-title { display:flex; align-items:center; gap:11px; min-width:0; }
.paid-panel-ico { flex:none; width:36px; height:36px; border-radius:10px; display:grid; place-items:center; }
.paid-panel-ico svg { width:19px; height:19px; }
.paid-panel-ico.is-grant { background:#eef2ff; color:#4f46e5; }
.paid-panel-ico.is-get   { background:#ecfdf5; color:#0d9488; }
.paid-panel-ico.is-time  { background:#fef9c3; color:#ca8a04; }
.paid-panel-titletext { display:flex; flex-direction:column; gap:1px; line-height:1.2; min-width:0; }
.paid-panel-count { font-size:.72rem; font-weight:600; color:#94a3b8; }

.paid-part {
    display:inline-block;
    background:#f1f5f9;
    color:#334155;
    border-radius:6px;
    padding:1px 7px;
    font-size:.76rem;
    margin:1px 4px 1px 0;
    white-space:nowrap;
}

/* 有給台帳ヒーローの管理簿DLフォーム（ラベル｜年｜DL を1つの枠にまとめる） */
.hero-book-form {
    margin: 0;
    display: inline-flex;
    align-items: stretch;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}
.hero-book-label {
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(226, 238, 252, 0.95);
    letter-spacing: .02em;
    white-space: nowrap;
}
.hero-select {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-width='1.5' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding: 11px 28px 11px 14px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}
.hero-select:focus { outline: none; }
.hero-select option { color: #13233f; background: #fff; }
.hero-book-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 11px 16px;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}
.hero-book-btn:hover { background: rgba(255, 255, 255, 0.24); }

/* 有給台帳ヒーローのメタ情報タグ */

/* ========== 有給管理 一覧テーブル ========== */
.paid-table-wrap { overflow-x:auto; }
.paid-table {
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    font-size:.875rem;
    font-variant-numeric:tabular-nums;
}
.paid-table thead th {
    padding:12px 16px;
    text-align:left;
    font-size:.72rem;
    font-weight:700;
    letter-spacing:.04em;
    color:#5b7088;
    background:#f3f7fd;
    border-bottom:1px solid #e3ebf5;
    white-space:nowrap;
    position:sticky;
    top:0;
    z-index:10;
}
.paid-table thead th.num { text-align:right; }
.paid-table thead th:first-child { padding-left:20px; }
.paid-table thead th:last-child  { padding-right:20px; }
.paid-table tbody td {
    padding:13px 16px;
    border-bottom:1px solid #eef2f7;
    vertical-align:middle;
    color:#1f2d3d;
}
.paid-table tbody td:first-child { padding-left:20px; }
.paid-table tbody td:last-child  { padding-right:20px; }
.paid-table tbody tr:last-child td { border-bottom:0; }
.paid-table tbody tr { transition:background .12s ease; }
.paid-table tbody tr:nth-child(even) td { background:#fbfcfe; }
.paid-table tbody tr:hover td { background:#eff5ff; }
/* 行頭アクセント（ホバー時） */
.paid-table tbody td:first-child { position:relative; }
.paid-table tbody tr:hover td:first-child::before {
    content:""; position:absolute; left:0; top:0; bottom:0;
    width:3px; background:#2563eb;
}
.paid-table .num { text-align:right; }
.paid-table .paid-no {
    font-family:ui-monospace, Menlo, monospace;
    font-size:.85rem;
    color:#64748b;
    white-space:nowrap;
}
.paid-table .num.is-lost { color:#dc2626; font-weight:600; }
.paid-table .num.is-zero { color:#cbd5e1; }
.paid-table .col-act { text-align:right; white-space:nowrap; }

/* 残日数チップ */
.paid-remain-chip {
    display:inline-flex; align-items:baseline; gap:1px;
    padding:4px 12px;
    border-radius:99px;
    background:#eaf1ff;
    color:#1d4ed8;
    font-weight:800;
    font-size:.95rem;
}
.paid-remain-chip small { font-size:.7rem; font-weight:600; color:#60a5fa; margin-left:1px; }

/* 台帳ボタン */
.paid-ledger-btn {
    display:inline-flex; align-items:center; gap:4px;
    padding:5px 12px;
    border:1px solid #d6e0ef;
    border-radius:8px;
    background:#fff;
    color:#1f4168;
    font-size:.78rem;
    font-weight:600;
    text-decoration:none;
    white-space:nowrap;
    transition:background .12s ease, border-color .12s ease, color .12s ease;
}
.paid-ledger-btn span { font-size:1rem; line-height:1; transition:transform .12s ease; }
.paid-ledger-btn:hover {
    background:#1f4168; border-color:#1f4168; color:#fff;
}
.paid-ledger-btn:hover span { transform:translateX(2px); }

.paid-form-row { margin-bottom:.9rem; }
.paid-form-row .filter-input,
.paid-form-row .filter-select { width:100%; }
.paid-hint { display:block; margin-top:4px; font-size:.74rem; color:#94a3b8; }
/* 付与履歴の取得（日）/時間休をリンク化（クリックで消化明細モーダル） */
.paid-link { background:none; border:0; padding:0; font:inherit; color:#2563eb; font-weight:700; cursor:pointer; text-decoration:underline; text-underline-offset:2px; }
.paid-link:hover { color:#1d4ed8; }
/* 取得編集時のロック表示（取得日・種類は変更不可、備考のみ） */
.paid-edit-note { margin:0 0 14px; padding:9px 12px; border-radius:8px; background:#eff6ff; border:1px solid #dbeafe; color:#1e40af; font-size:.76rem; line-height:1.5; }
#get-target_date.is-locked, #get-holiday_type.is-locked { pointer-events:none; opacity:.6; }
#get-target_date.is-locked { background:#f1f5f9; color:#64748b; }
/* 日付ピッカーがロック(readonly)のときはカレンダー起動ボタンも無効表示 */
.date-picker-input[readonly] ~ .date-picker-toggle { pointer-events:none; opacity:.4; }

@media (max-width: 720px) {
    .paid-balance { padding:20px 22px; }
    .paid-balance-value { font-size:2.4rem; }
}

/* ========== 申請（修正依頼・時間外） ========== */
/* 一覧ヒーローの閲覧範囲チップ */
.req-scope-chip {
    display: inline-block;
    margin-left: .5rem;
    padding: .15rem .6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: .75rem;
    vertical-align: middle;
}

/* 詳細: 本文 + サイド（ステータス / 申請情報）の2カラム */
.req-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.25rem;
    align-items: start;
}
.req-detail-main { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.req-detail-side { display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 1rem; }
@media (max-width: 900px) {
    .req-detail-grid { grid-template-columns: 1fr; }
    .req-detail-side { position: static; }
}

/* テキストブロック（修正依頼理由 など） */
.req-text-block {
    padding: 1rem 1.25rem;
    white-space: pre-wrap;
    line-height: 1.7;
    color: #1e293b;
}

/* 区分（通常/深夜/休日/時間休）の見出しを勤務表と同色の帯にする */
.scard-head.req-grp {
    margin: -18px -22px 14px;          /* .scard の余白(18px 22px)を打ち消して全幅の帯に */
    padding: 11px 22px;
    border-bottom: 1px solid rgba(15, 23, 42, .06);
    border-radius: 16px 16px 0 0;      /* カード上部の角丸に合わせる */
}
.scard-head.req-grp-normal  { background: #e3edff; } /* 通常 */
.scard-head.req-grp-night   { background: #e6e8fa; } /* 深夜 */
.scard-head.req-grp-holiday { background: #fce0e5; } /* 休日 */
.scard-head.req-grp-timeoff { background: #e1f7ec; } /* 時間休 */

/* 変更箇所の件数（比較テーブルのハイライト色に合わせたチップ） */
.req-changed-count {
    align-self: flex-start;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #b45309;
    border-radius: 999px;
    padding: .3rem .9rem;
    font-size: .85rem;
    font-weight: 600;
}
.req-changed-count strong { font-size: 1.05rem; }

/* 修正依頼の内容確認画面。カードの間隔は申請詳細（.req-detail-main）と揃える */
.work-confirm-body { display: flex; flex-direction: column; gap: 1.25rem; }
/* カード内の比較テーブルは見出しとの間・カード下端との間に余白を持たせる */
.work-confirm-body .scard > .req-compare,
.work-confirm-body .scard > div > .req-compare { margin-bottom: 4px; }

/* 変更前 → 変更後 比較テーブル */
.req-compare th { font-size: .78rem; }
.req-compare td { font-size: .85rem; }
.req-cell-before { color: #64748b; }
.req-cell-after  { color: #1e293b; font-weight: 600; }
.req-row-changed { background: #fff7ed; }            /* 変更あり行を淡いオレンジで強調 */
.req-row-changed .req-cell-after { color: #b45309; }

/* ステータスカード */
.req-status-body { padding: 1rem 0; display: flex; flex-direction: column; gap: 1rem; }
/* ステータスは全幅の色付きボックスで表示 */
.req-status-box {
    width: 100%;
    text-align: center;
    border-radius: 5px;
    padding: .55rem 0;
    font-weight: 700;
    font-size: 1.05rem;
}
.req-status-box-1 { background: #ffe7b3; color: #8a5a00; } /* 申請中 */
.req-status-box-2 { background: #c1ffd8; color: #15673a; } /* 承認 */
.req-status-box-3 { background: #ffd4d4; color: #b3261e; } /* 却下 */
.req-status-box-4 { background: #e5e7eb; color: #475569; } /* 取消 */
/* 操作者・操作日時（誰がいつ承認/却下/取消/差し戻ししたか） */
.req-operator {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35rem .55rem;
    font-size: .82rem;
}
.req-operator-label {
    font-size: .7rem;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    border-radius: 4px;
    padding: .1rem .45rem;
}
.req-operator-name { font-weight: 600; color: #1e293b; }
.req-operator-date { color: #94a3b8; }

/* 却下理由の表示 */
.req-reject-box {
    border: 1px solid #fecaca;
    background: #fef2f2;
    border-radius: 8px;
    padding: .75rem .9rem;
}
.req-reject-label { font-size: .75rem; font-weight: 700; color: #b91c1c; margin-bottom: .25rem; }
.req-reject-text { font-size: .85rem; color: #7f1d1d; white-space: pre-wrap; line-height: 1.6; }

/* 承認・却下・取消アクション */
.req-actions { padding: 1rem 0; display: flex; flex-direction: column; gap: .8rem; }
.req-reject-form { display: block; }
.req-action-btn { width: 100%; }
/* 承認は主操作として大きく・目立たせる */
.req-action-approve { padding-top: 12px; padding-bottom: 12px; font-size: 15px; font-weight: 600; }

/* 承認と却下の区切り（どちらか一方の操作であることを示す） */
.req-or {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #94a3b8;
    font-size: .72rem;
    margin: -.1rem 0;
}
.req-or::before,
.req-or::after { content: ""; flex: 1; height: 1px; background: #e5e9f0; }

/* 却下パネル（理由必須の破壊的操作をひとまとめに） */
.req-reject-panel {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    border: 1px solid #fde0e0;
    background: #fff8f8;
    border-radius: 10px;
    padding: .8rem .85rem;
}
.req-reject-panel-title {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    font-weight: 700;
    color: #b91c1c;
}
.req-reject-field-label { font-size: .74rem; font-weight: 600; color: #64748b; }
.req-required {
    font-size: .62rem;
    font-weight: 700;
    color: #dc2626;
    background: #fee2e2;
    border-radius: 4px;
    padding: .06rem .3rem;
    margin-left: .15rem;
    vertical-align: 1px;
}
.req-reject-panel .form-control { font-size: .85rem; background: #fff; }
.req-action-reject { padding-top: 9px; padding-bottom: 9px; font-size: 14px; margin-top: .1rem; }

.req-field-error { color: #dc2626; font-size: .78rem; margin: .35rem 0 0; }

/* 時間外作成フォーム */
.req-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.req-form-note { font-size: .78rem; color: #94a3b8; margin: .75rem 0 0; }
/* 業務内容テキストエリアは高さのみリサイズ可能 */
.req-content-area { resize: vertical; }

/* エラーのある明細行を強調（どの行かを視覚的に示す） */
.ot-item-row.req-row-error > td { background: #fef2f2; }
.ot-item-row.req-row-error > td:first-child { box-shadow: inset 3px 0 0 #dc2626; }

/* 承認済み（変更不可）の明細行 */
.ot-approved-row > td { background: #f0fdf4; color: #475569; font-size: .85rem; }
.ot-approved-row > td:first-child { box-shadow: inset 3px 0 0 #16a34a; font-weight: 600; }

/* 既存の申請中（編集可）の明細行 */
.ot-pending-row > td { background: #fffbeb; }
.ot-pending-row > td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }

/* 申請明細はhoverで背景色を変えない（各行の状態色を維持する） */
#ot-items-table tbody tr:hover td { background: transparent; }
#ot-items-table tbody tr.ot-approved-row:hover td { background: #f0fdf4; }
#ot-items-table tbody tr.ot-pending-row:hover td { background: #fffbeb; }
#ot-items-table tbody tr.ot-item-row.req-row-error:hover td { background: #fef2f2; }

/* 申請詳細モーダル（ヒーロー=固定ヘッダー / 本文=スクロール領域） */
/* 画面に対して上寄せで表示する */
.req-modal { align-items: flex-start; padding-top: 3vh; }
.req-modal-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #f6f8fb;
    border-radius: 12px;
    width: 80vw;                      /* 画面幅の80%で表示 */
    max-height: 92vh;
    overflow: hidden;                 /* 角丸で子をクリップ。スクロールは本文側 */
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    transform: translateZ(0);         /* 角丸クリップをGPU合成にしてスクロールのカクつきを抑える */
}
/* 固定ヘッダー（スクロールしない）。ヒーローを格納 */
.req-modal-header { flex: 0 0 auto; }
.req-modal-header .detail-hero {
    border-radius: 0;                 /* 角丸を削除してヘッダーとして表示 */
    box-shadow: none;
}
/* 本文（縦スクロール） */
.req-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;     /* スクロール連鎖（背面ページ）を抑える */
    padding: 1.25rem 1.5rem 1.75rem;
}
.req-modal-body .detail-sheet { margin-bottom: 0; }
.req-modal-loading { padding: 3rem; text-align: center; color: #94a3b8; }
.req-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #334155;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.req-modal-close:hover { background: #fff; color: #0f172a; }

/* 時間外作成フォームのヘッダー（申請者 ＋ 対象年月） */
.ot-setup {
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    flex-wrap: wrap;
}
/* 申請者ブロック（アバター＋氏名＋所属）。左半分を埋める */
.ot-setup-person {
    flex: 1 1 260px;
    display: flex;
    align-items: center;
    gap: .9rem;
    min-width: 0;
}
.ot-setup-avatar {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #4f6ef7, #6d5efc);
    overflow: hidden;
}
.ot-setup-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ot-setup-person-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.ot-setup-eyebrow {
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
}
.ot-setup-name { font-size: 1.05rem; font-weight: 700; color: #1e293b; line-height: 1.3; }
.ot-setup-meta { font-size: .82rem; color: #64748b; }
.ot-setup-dot { color: #cbd5e1; margin: 0 .15rem; }

/* 対象年月ブロック（右半分を埋めるパネル。ラベル左・入力右） */
.ot-period {
    flex: 1 1 300px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}
.ot-period-label { font-size: .82rem; font-weight: 600; color: #475569; }
.ot-period-fields { display: flex; align-items: center; gap: .6rem; }
.ot-period-field { display: flex; align-items: center; gap: .35rem; }
.ot-period-field .form-control { width: 92px; }
.ot-period-unit { font-size: .88rem; color: #475569; }
.ot-period-month { width: 96px; }
@media (max-width: 640px) {
    .ot-setup { align-items: flex-start; }
    .ot-period { justify-content: flex-start; gap: 1rem; }
}

/* 申請: セグメントトグル（申請 / 命令、平日 / 休日） */
.seg-toggle {
    display: inline-flex;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.seg-opt { margin: 0; display: inline-flex; }
.seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.seg-opt span {
    display: block;
    padding: .35rem .8rem;
    font-size: .82rem;
    line-height: 1.4;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background .12s, color .12s;
}
.seg-opt + .seg-opt span { border-left: 1px solid #cbd5e1; }
.seg-opt input:checked + span { background: #2563eb; color: #fff; font-weight: 600; }
.seg-opt input:focus-visible + span { outline: 2px solid #93c5fd; outline-offset: -2px; }

/* 共通: 時間ピッカー（手入力テキスト ＋ 補助ドロップダウン） */
.time-picker { position: relative; display: inline-block; }
/* 開始〜終了を1グループでグループ幅いっぱいに（各ピッカーを均等に伸ばす） */
.time-range { width: 100%; flex-wrap: nowrap; }
.time-range .time-picker { flex: 1 1 0; min-width: 0; display: block; }
.time-range .time-picker-input { width: 100%; }
.time-range .field-unit { flex: 0 0 auto; }
.time-picker.is-disabled { opacity: .45; }

/* フィールド直下のインラインエラー（就業時間の逆転など） */
.field-error-inline { display: block; margin-top: 5px; font-size: .78rem; font-weight: 600; color: #dc2626; }
.time-picker.is-disabled .time-picker-input { background: #f1f5f9; cursor: not-allowed; }
.time-picker-input { width: 5.6rem; padding-right: 1.7rem; text-align: center; }
.time-picker-toggle {
    position: absolute;
    right: .35rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: #64748b;
    display: inline-flex;
    align-items: center;
}
.time-picker-toggle:hover { color: #2563eb; }
.time-picker-menu {
    position: fixed;
    z-index: 1000;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
    padding: .35rem;
    max-height: 230px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;          /* スクロールバー分の余白を確保し時刻に重ねない */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px 6px;                       /* 行間3px・列間6px で詰まりを解消 */
}
/* class の display:grid が UA の [hidden]{display:none} を上書きするため明示的に隠す */
.time-picker-menu[hidden] { display: none; }
.time-picker-opt {
    border: none;
    background: none;
    cursor: pointer;
    padding: .38rem .6rem;
    border-radius: 5px;
    font-size: .82rem;
    color: #334155;
    text-align: center;
    white-space: nowrap;
    scroll-margin: 8px;                 /* スクロール時に端で切れず余白を持って表示 */
}
.time-picker-opt:hover { background: #eff6ff; color: #1d4ed8; }
.time-picker-opt.is-current { background: #2563eb; color: #fff; font-weight: 600; }

/* クリアボタン: 2列を跨ぎ、スクロールしても下部に固定表示 */
.time-picker-clear {
    grid-column: 1 / -1;
    position: sticky;
    bottom: -.35rem;                    /* メニューの padding 分だけ下げて端に密着 */
    margin: .25rem -.35rem -.35rem;     /* 左右・下の padding を打ち消して全幅に */
    padding: .4rem .6rem;
    border: none;
    border-top: 1px solid #eef2f7;
    border-radius: 0 0 8px 8px;
    background: #fff;
    color: #64748b;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
}
.time-picker-clear:hover { background: #f8fafc; color: #dc2626; }

/* 共通: 日付ピッカー（読み取り専用テキスト ＋ カレンダー） */
.date-picker { position: relative; display: inline-block; }
.date-picker-block { display: block; }
.date-picker-block .date-picker-input { width: 100%; }
.date-picker-input { padding-right: 2rem; background: #fff; letter-spacing: .05em; }
.date-picker-toggle {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: #64748b;
    display: inline-flex;
    align-items: center;
}
.date-picker-toggle:hover { color: #2563eb; }
.date-picker-menu {
    position: fixed;
    z-index: 1100;                         /* モーダル(1000)より前面に */
    width: 268px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
    padding: .6rem;
}
.date-picker-menu[hidden] { display: none; }
.date-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .4rem;
}
.date-picker-title { font-size: .9rem; font-weight: 700; color: #1e293b; }
.date-picker-nav {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: none; border-radius: 7px;
    cursor: pointer; color: #475569;
}
.date-picker-nav:hover { background: #eff6ff; color: #1d4ed8; }
.date-picker-dow {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 2px;
}
.date-picker-dow span {
    text-align: center;
    font-size: .7rem;
    font-weight: 600;
    color: #94a3b8;
    padding: .2rem 0;
}
.date-picker-dow .is-sun { color: #ef4444; }
.date-picker-dow .is-sat { color: #3b82f6; }
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.date-picker-pad { height: 32px; }
.date-picker-day {
    height: 32px;
    border: none;
    background: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: .82rem;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.date-picker-day.is-sun { color: #ef4444; }
.date-picker-day.is-sat { color: #3b82f6; }
.date-picker-day:hover { background: #eff6ff; color: #1d4ed8; }
.date-picker-day.is-today { box-shadow: inset 0 0 0 1px #93c5fd; }
.date-picker-day.is-selected { background: #2563eb; color: #fff; font-weight: 700; box-shadow: none; }
.date-picker-foot {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px solid #f1f5f9;
}
.date-picker-today,
.date-picker-clear {
    border: none;
    background: none;
    cursor: pointer;
    font-size: .78rem;
    padding: .25rem .5rem;
    border-radius: 6px;
}
.date-picker-today { color: #2563eb; font-weight: 600; }
.date-picker-today:hover { background: #eff6ff; }
.date-picker-clear { color: #94a3b8; }
.date-picker-clear:hover { background: #f8fafc; color: #64748b; }

/* ===== 勤務表（works.index）詳細グリッド ===== */
/* scroll-snap: スクロールを止めたとき、行が固定ヘッダ(2段=64px)の直下にそろう。
   データの無い行が途中まで隠れて隙間に見えるのを防ぐ。 */
.work-sheet-wrap { overflow: auto; scroll-snap-type: y proximity; scroll-padding-top: 64px; }
.work-sheet tbody tr { scroll-snap-align: start; }
/* 末尾の余白（最下部スクロール時に行をヘッダ直下へ揃える余地）。高さはJSでウィンドウ高さに応じて算出 */
.work-sheet-foot { height: 0; }

/* 申請操作後の勤務表 非同期更新スピナー（テーブルに重ねて表示） */
.work-sheet-panel { position: relative; }
.work-spinner {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .62);
    border-radius: inherit;
}
.work-spinner[hidden] { display: none; }
.work-spinner-inner {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem 1.1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .12);
    font-size: .85rem;
    font-weight: 600;
    color: #334155;
}
.work-spinner-mark {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: work-spin .7s linear infinite;
}
@keyframes work-spin { to { transform: rotate(360deg); } }
.work-sheet {
    border-collapse: separate;
    border-spacing: 0;
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
    /* 親パネル幅いっぱいに広げる。余剰幅は空になりがちな備考ではなく、
       データの入るカテゴリ列(通常/深夜/休日/時間休)を伸ばして効率よく吸収する
       （カテゴリ列を width 固定でなく min-width 下限のみにしてあるため）。 */
    width: 100%;
    min-width: 100%;
}
/* 見出し（2段） */
.work-sheet thead th {
    height: 32px;
    box-sizing: border-box;
    padding: 4px 6px;
    font-size: .7rem;
    font-weight: 700;
    color: #5b7088;
    background: #f3f7fd;
    border-bottom: 1px solid #e3ebf5;
    border-right: 1px solid #e8eef6;
    white-space: nowrap;
    text-align: center;
}
.work-sheet thead tr:first-child th { position: sticky; top: 0; z-index: 12; }
.work-sheet thead tr:nth-child(2) th { position: sticky; top: 32px; z-index: 12; }
/* カテゴリ見出しの色分け */
.work-sheet thead th.grp { color: #1f2d3d; }
.work-sheet thead th.grp-normal  { background: #e3edff; }
.work-sheet thead th.grp-night   { background: #e6e8fa; }
.work-sheet thead th.grp-holiday { background: #fce0e5; }
.work-sheet thead th.grp-timeoff { background: #e1f7ec; }

/* カテゴリ区切りの縦線（通常/深夜/休日/時間休/出勤/備考 の各先頭列） */
.work-sheet th.grp-start,
.work-sheet td.grp-start { border-left: 1px solid #d4ddea; }

/* セル */
.work-sheet tbody td {
    padding: 6px 6px;
    border-bottom: 1px solid #eef2f7;
    border-right: 1px solid #f0f3f8;
    text-align: center;
    white-space: nowrap;
    color: #1f2d3d;
    background: #fff;
}
.work-sheet tbody td.brk { color: #64748b; }
/* 範囲・区分列は固定幅を持たせず、内容（無ければ見出し）に合わせて自動縮小させ、全体幅を抑える */
.work-sheet .col-op,
.work-sheet .col-wait { font-weight: 600; color: #334155; }
.work-sheet td.col-const {
    text-align: left;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #334155;
}
/* 出勤・退勤（打刻）セル: 時刻は出さず、ホバーで詳細ポップアップを開くマーカー（位置ピン）のみ */
.work-sheet td.col-punch { text-align: center; vertical-align: middle; white-space: nowrap; }
.work-sheet td.col-punch .punch-pop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    padding: 2px;
    line-height: 0;
    cursor: help;
    color: #94a3b8;
}
.work-sheet td.col-punch .punch-pop:hover { color: #2563eb; }

/* 打刻詳細ポップアップ */
.punch-pop-card {
    position: fixed;
    z-index: 1000;
    min-width: 200px;
    max-width: 340px;
    /* 住所が長く行数が増えてもビューポート外へはみ出して途中で切れないよう、
       高さを画面内に収め、超える場合は内部スクロールにする */
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border: 1px solid #e3ebf5;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
    padding: .6rem .75rem;
    font-size: .8rem;
    color: #1f2d3d;
}
.punch-pop-card .pp-head {
    font-weight: 700;
    margin-bottom: .4rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid #eef2f7;
}
.punch-pop-card .pp-row { display: flex; gap: .6rem; line-height: 1.8; }
.punch-pop-card .pp-row span { color: #94a3b8; min-width: 2.6em; flex: none; }
.punch-pop-card .pp-row b { font-weight: 500; word-break: break-all; }
/* 住所データの出典アイコン（位置の横のⓘ） */
.punch-pop-card .pp-src {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: .3em;
    padding: 0;
    width: 16px;
    height: 16px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: #94a3b8;
    cursor: pointer;
}
.punch-pop-card .pp-src:hover,
.punch-pop-card .pp-src:focus-visible { color: #2563eb; outline: none; }
/* 出典の説明（ⓘのhover/タップで表示） */
.punch-pop-card .pp-attr {
    margin: .1rem 0 .2rem;
    padding: .35rem .5rem;
    background: #f1f5f9;
    border-radius: 6px;
    color: #64748b;
    font-size: .72rem;
    line-height: 1.5;
    word-break: break-all;
}
/* Googleマップを開くリンク（座標があるときだけ表示） */
.punch-pop-card .pp-map-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin-top: .55rem;
    padding: .45rem .6rem;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.punch-pop-card .pp-map-link:hover,
.punch-pop-card .pp-map-link:focus { background: #1d4ed8; }
.punch-pop-card .pp-map-link svg { flex: none; }
.punch-pop-card .pp-note {
    margin-top: .5rem;
    color: #94a3b8;
    font-size: .74rem;
    text-align: center;
}
.work-sheet tbody td.col-note {
    text-align: left;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #475569;
}
.work-sheet td.work-empty { color: #cbd5e1; text-align: center; }

/* 左固定列（日付・曜日） */
.work-sheet .col-date,
.work-sheet .col-dow {
    position: sticky;
    z-index: 5;
    background: #fff;
    font-weight: 600;
    border-right: 1px solid #e3ebf5;
}
.work-sheet .col-date { left: 0;    min-width: 56px; }
.work-sheet .col-dow  { left: 56px; min-width: 40px; }
/* 見出しの左固定セル（角）は最前面。
   .work-sheet thead tr:first-child th の詳細度(0,2,3)に負けないよう
   tr:first-child を含めて詳細度(0,3,3)にし、横スクロールしてくる他ヘッダより上に重ねる */
.work-sheet thead tr:first-child th.col-date,
.work-sheet thead tr:first-child th.col-dow { z-index: 16; background: #f3f7fd; }

/* 編集列（備考の横）。各レコード行の「編集」ボタン */
.work-sheet th.col-act,
.work-sheet td.col-act { width: 1px; white-space: nowrap; text-align: center; }
.work-sheet td.col-act .we-edit {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    font-size: .72rem;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
}
.work-sheet td.col-act .we-edit:hover { background: #2563eb; border-color: #2563eb; color: #fff; }

/* 日付セルの「＋」追加ボタン（その日に勤務を追加）。 */
.work-sheet td.col-date .we-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    margin: 3px auto 0;
    cursor: pointer;
    border-radius: 50%;
    background: #e7edf5;
    color: #5b7088;
    font-size: .72rem;
    line-height: 1;
    text-decoration: none;
}
.work-sheet td.col-date .we-add:hover { background: #2563eb; color: #fff; }

/* 行の交互背景（ゼブラ）は日付単位。同じ日の複数行は同色に揃える（固定列も同色） */
.work-sheet tbody tr.day-even td,
.work-sheet tbody tr.day-even td.col-date,
.work-sheet tbody tr.day-even td.col-dow { background: #f8fafc; }

/* 修正依頼中の行: 淡いアンバーで強調（ゼブラより後に定義して上書き。土日の文字色は別ルールで維持） */
.work-sheet tbody tr.we-row-pending td,
.work-sheet tbody tr.we-row-pending td.col-date,
.work-sheet tbody tr.we-row-pending td.col-dow { background: #fff8ec; }
.work-sheet tbody tr.we-row-pending td.col-act { box-shadow: inset -3px 0 0 #f59e0b; }
/* 修正依頼中の行の「申請内容」ボタン（編集列内） */
.work-sheet td.col-act .we-req-view {
    border-color: #f59e0b;
    color: #92400e;
}
.work-sheet td.col-act .we-req-view:hover { background: #f59e0b; border-color: #f59e0b; color: #fff; }
/* 修正依頼ボタン（青）。修正履歴と一目で区別できるよう色分け。 */
.work-sheet td.col-act .we-request { background: #eff5ff; border-color: #93c5fd; color: #1d4ed8; }
.work-sheet td.col-act .we-request:hover { background: #2563eb; border-color: #2563eb; color: #fff; }
/* 修正履歴ボタン（グレー塗り）。閲覧者全員に表示。編集(白)・修正依頼(青)と区別。 */
.work-sheet td.col-act .we-history { background: #eef1f5; border-color: #dde3ea; color: #5b6877; }
.work-sheet td.col-act .we-history:hover { background: #64748b; border-color: #64748b; color: #fff; }
/* 編集列に複数のリンク（編集/申請内容/修正履歴）が並ぶ場合は縦に積む */
.work-sheet td.col-act .we-edit { display: block; width: fit-content; margin-left: auto; margin-right: auto; }
.work-sheet td.col-act .we-edit + .we-edit { margin-top: 4px; }

/* 修正履歴モーダルの本文 */
.wh-body { padding: 1.25rem 1.5rem; }
.wh-head { margin-bottom: 1rem; }
.wh-title { font-size: 1.1rem; font-weight: 700; color: #1e293b; margin: 0 0 .25rem; }
.wh-sub { font-size: .85rem; color: #64748b; margin: 0; }
.wh-empty { color: #9ca3af; text-align: center; padding: 2.5rem 0; }
.wh-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .85rem; }
.wh-item { border: 1px solid #e5eaf1; border-radius: 8px; background: #fff; overflow: hidden; }
/* 日時を各エントリのヘッダー帯にして「いつの履歴か」を一目で分かるようにする */
.wh-meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .5rem .9rem; background: #eef2f7; border-bottom: 1px solid #e1e7ef; border-left: 3px solid #64748b; }
.wh-date { font-weight: 700; color: #1e293b; font-size: .95rem; letter-spacing: .02em; }
.wh-operator { font-size: .78rem; color: #64748b; margin-left: auto; }
.wh-operator::before { content: '操作者: '; color: #94a3b8; }
.wh-content { white-space: pre-line; font-size: .82rem; color: #334155; line-height: 1.55; padding: .7rem .9rem; }

/* 縦積み（stack）表示: カテゴリ1列の中に勤務/休憩/時間外…を縦に並べる。横スクロールを抑える */
.work-sheet td.stack-cell {
    text-align: left;
    padding: 5px 8px;
    vertical-align: top;
    white-space: nowrap;
    box-sizing: border-box;
}
.work-sheet td.stack-cell > div {
    display: flex;
    gap: 6px;
    align-items: baseline;
    line-height: 1.6;
    padding: 4px 0;   /* 勤務/休憩/時間外 の行間を広げ、数字が近すぎないようにする */
}
/* ラベル幅は最長の3文字（時間外/深夜外）に合わせて固定。値（時刻）の開始位置を全行で揃える */
.work-sheet td.stack-cell .lbl {
    color: #8190a5;
    font-size: .68rem;
    width: 3.2em;
    flex: none;
}
/* 時間休セルのラベルは①②③（1文字）のみ。値（時刻）を近づけるため幅を詰める */
.work-sheet td.stack-cell.stack-timeoff .lbl { width: 1.4em; }
.work-sheet td.stack-cell .val { color: #1f2d3d; }

/* 固定列(日付/曜日/稼働/待機/出勤/退勤)は内容幅に固定（広げない） */
.work-sheet--stack th.col-date,  .work-sheet--stack td.col-date,
.work-sheet--stack th.col-dow,   .work-sheet--stack td.col-dow,
.work-sheet--stack th.col-op,    .work-sheet--stack td.col-op,
.work-sheet--stack th.col-wait,  .work-sheet--stack td.col-wait,
.work-sheet--stack th.col-punch, .work-sheet--stack td.col-punch {
    width: 1px;
    white-space: nowrap;
}

/* カテゴリ列(通常/深夜/休日/時間休)は下限(min-width)だけ与えて伸縮可能にする。
   width 固定にせず max-width も持たせないことで、テーブルを親幅いっぱいに広げた際の
   余剰幅をここが吸収する（空になりがちな備考へ回さず、データ列側で画面を使い切る）。 */
.work-sheet--stack thead th.grp,
.work-sheet--stack td.stack-cell { min-width: 9rem; }
/* 時間休だけ下限を 8rem に（他カテゴリは9remのまま）。9rem ルールの後に定義して上書き。 */
.work-sheet--stack thead th.grp-timeoff,
.work-sheet--stack td.stack-cell.stack-timeoff { min-width: 8rem; }

/* 工事名は内容幅で表示し、上限16remで頭打ち（超過は…で省略）。余剰幅は吸収しない。 */
.work-sheet--stack td.col-const {
    max-width: 16rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 備考も内容幅。空ならヘッダ幅まで縮み、記載があれば折り返して16remで頭打ち。
   （以前は余剰幅を貪欲に吸わせていたが、空でも広がり工事名を圧迫するため廃止） */
.work-sheet--stack th.col-note,
.work-sheet--stack td.col-note {
    max-width: 16rem;
    white-space: normal;
}

/* 勤務表の表示形式トグルの置き場所 */
.work-view-toggle-wrap { display:flex; align-items:flex-end; }

/* 絞り込み行の要素を右端へ寄せる。部署・従業員の絞り込みが出ない権限（自分の分のみ）で
   トグルだけが左に詰まって見えるのを防ぐ */
.filter-push-right { margin-left:auto; }

/* 表示形式トグル（標準/縦積み） */
.view-toggle {
    display: inline-flex;
    height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
}
.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    padding: 0 .85rem;
    font-size: .82rem;
    color: #475569;
    background: #fff;
    text-decoration: none;
    white-space: nowrap;
}
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid #cbd5e1; }
.view-toggle-btn.is-active { background: #2563eb; color: #fff; font-weight: 600; }

/* 稼働=休日の強調バッジ。日付・曜日は曜日色のみにしたため、休日であることは稼働列で示す */
.work-sheet td.col-op .op-holiday-badge {
    display: inline-block;
    padding: 1px 9px;
    border-radius: 999px;
    background: #ffe1e1;
    color: #dc2626;
    font-weight: 700;
    font-size: .72rem;
    white-space: nowrap;
}
/* 稼働の分類タグ（出勤=タグなし、休日=上の専用バッジ）。基本稼働=青/休暇=緑/欠勤=赤。 */
.work-sheet td.col-op .op-tag {
    display: inline-block;
    padding: 1px 9px;
    border-radius: 999px;
    font-weight: 700;
    font-size: .72rem;
    white-space: nowrap;
    border: 1px solid transparent;
}
.work-sheet td.col-op .op-tag-work    { background: #e3edff; color: #1d4ed8; border-color: #c2d6fb; } /* 基本稼働（土出/祝出/休出） */
.work-sheet td.col-op .op-tag-leave   { background: #e1f7ec; color: #047857; border-color: #b6e8cd; } /* 休暇（有休/半休 ほか） */
.work-sheet td.col-op .op-tag-absence { background: #fbe3e3; color: #b91c1c; border-color: #e79a9a; } /* 欠勤（赤・注意。枠線で休日バッジと区別） */

/* 承認済み時間外申請の列（時間休の右隣）。予定時刻チップをホバー/クリックで詳細表示 */
.work-sheet th.col-ot { min-width: 5.5em; }
.work-sheet td.col-ot { text-align: center; white-space: nowrap; vertical-align: middle; }
.work-sheet td.col-ot .wt-ot-mark {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 7px;
    border: 1px solid #e6b25a;
    border-radius: 5px;
    background: #fdf2dc;
    color: #a06a12;
    cursor: pointer;
    font: inherit;
    line-height: 1.4;
}
.work-sheet td.col-ot .wt-ot-mark:hover { background: #fbe6bf; border-color: #d99a3c; }
.work-sheet td.col-ot .wt-ot-chip {
    font-size: .72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
/* 申請中は落ち着いた青系にして、承認済み（アンバー）と一目で区別する */
.work-sheet td.col-ot .wt-ot-mark.wt-ot-pending {
    border-color: #b9cbe6;
    background: #eef4fb;
    color: #35618f;
}
.work-sheet td.col-ot .wt-ot-mark.wt-ot-pending:hover { background: #dfeaf7; border-color: #93b2d6; }

/* 未申請の日に出す「申請」ボタン（自分の勤務表のみ） */
.work-sheet td.col-ot .wt-ot-new {
    padding: 2px 10px;
    border: 1px dashed #c3ccd8;
    border-radius: 5px;
    background: transparent;
    color: #7c899a;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1.6;
    cursor: pointer;
    white-space: nowrap;
}
.work-sheet td.col-ot .wt-ot-new:hover {
    border-style: solid;
    border-color: #2d5a9e;
    background: #eef4fb;
    color: #2d5a9e;
}

/* 単日の時間外申請モーダル */
.ot-req-card {
    max-width: 560px;
    /* .req-modal-card の transform は position:fixed の包含ブロックになり、
       overflow:hidden と併せて時刻ピッカーのドロップダウンを潰してしまう。
       このモーダルは短いフォームで合成もクリップも不要なため無効化する。 */
    transform: none;
    overflow: visible;
}
.ot-req-body { padding: 1.5rem 1.6rem; }
.ot-req-title { margin: 0 0 .25rem; font-size: 1.1rem; font-weight: 700; color: #1f2d3d; }
.ot-req-sub { margin: 0 0 1.1rem; font-size: .85rem; color: #64748b; }
.ot-req-sub b { color: #1f2d3d; font-weight: 700; }
.ot-req-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem 1rem;
}
.ot-req-field { min-width: 0; }
.ot-req-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .78rem;
    font-weight: 700;
    color: #475569;
}
.ot-req-label.required::after { content: ' *'; color: #dc2626; }
/* モーダル内はトグル・時刻ピッカーをフィールド幅いっぱいに広げる（他画面の既定は据え置き） */
.ot-req-card .seg-toggle { display: flex; width: 100%; }
.ot-req-card .seg-opt { flex: 1 1 0; min-width: 0; }
.ot-req-card .seg-opt span {
    flex: 1 1 auto;
    text-align: center;
    padding-left: .4rem;
    padding-right: .4rem;
}
.ot-req-card .time-picker { display: block; width: 100%; }
.ot-req-card .time-picker-input { width: 100%; }

.ot-req-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    margin-top: 1.2rem;
}
.ot-req-actions .btn { width: auto; padding: .55rem 1.4rem; }
@media (max-width: 540px) {
    .ot-req-grid { grid-template-columns: minmax(0, 1fr); }
}

/* 承認済み時間外ポップアップ（punch-pop-card を流用しつつ明細行を追加） */
.ot-pop-card .otp-item { padding: .35rem 0; border-bottom: 1px solid #f1f5f9; }
.ot-pop-card .otp-item:last-child { border-bottom: 0; padding-bottom: 0; }
.ot-pop-card .otp-line { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; line-height: 1.7; }
.ot-pop-card .otp-line b { font-weight: 700; color: #92600b; font-variant-numeric: tabular-nums; }
.ot-pop-card .otp-tag {
    padding: 0 6px;
    border-radius: 4px;
    background: #fdecc8;
    color: #92600b;
    font-weight: 700;
    font-size: .7rem;
}
.ot-pop-card .otp-content { margin-top: .15rem; color: #475569; word-break: break-all; }

/* 土日の色付けは日付・曜日セルの文字色のみ（背景は付けない） */
.work-sheet tbody tr.is-sat td.col-date,
.work-sheet tbody tr.is-sat td.col-dow { color: #2563eb; }
.work-sheet tbody tr.is-sun td.col-date,
.work-sheet tbody tr.is-sun td.col-dow { color: #dc2626; }

/* ツールバー内に置いた検索付きセレクト（_search_select）の余白を詰めて他フィルタと揃える */
.list-toolbar .form-group { margin-bottom: 0; }
.list-toolbar .form-group .form-label { margin-bottom: .35rem; }
/* 検索付きセレクトのドロップダウンがツールバーの overflow:hidden で切れないようにする */
.list-toolbar.work-toolbar { overflow: visible; }

/* 勤務表ヒーロー: サブテキストを省く（左=タイトル / 右=アバター＋氏名）。余白は既定のまま。 */
.work-hero-person { display: flex; align-items: center; gap: 12px; }
.work-hero-avatar {
    flex: 0 0 auto;
    width: 46px; height: 46px;
    border-radius: 50%;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; font-weight: 700; color: #fff;
    background: rgba(255, 255, 255, .16);
    border: 2px solid rgba(255, 255, 255, .45);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
}
.work-hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.work-hero-name { font-size: 1rem; font-weight: 700; color: #fff; white-space: nowrap; }

/* ツールバーの前月/次月ボタン */
.btn.work-nav-btn {
    width: auto;
    padding: 0 .6rem;
    height: 38px;
    line-height: 36px;
    font-size: .85rem;
}
/* 勤務表: スクロールでヘッダーがブラウザ上端に達したら固定表示するフロートヘッダー
   （テーブル全体を複製し thead 高さでクリップ＝列幅を完全一致。横スクロールはJSで同期） */
.work-float-head {
    position: fixed;
    top: 0;
    z-index: 40;
    overflow: hidden;
    display: none;
    pointer-events: none;
    background: #fff;
    box-shadow: 0 8px 14px -8px rgba(15, 23, 42, .3);
}
.work-float-head table { margin: 0; }
/* クローンは本体と同じ position:sticky を活かし、コンテナ(.work-float-head)自身の scrollLeft を
   本体(#table-wrapper)の横スクロールに同期させる（JS）。これで日付・曜日の左固定・列の重なり順が
   本体と完全に一致する（marginLeft/translateX 方式は列レイアウトがずれるため不可）。 */

/* 勤務表の絞り込みバー: select / 検索セレクト / トグル / ナビ の高さを 38px に統一する */
.work-toolbar .filter-select { height: 38px; }
.work-toolbar .search-select-control { height: 38px; min-height: 38px; }

/* 部署を選べない権限で、現在見ている自部署を読み取り専用で示すチップ */
.work-fixed-dept {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 .8rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f3f4f6;
    color: #374151;
    font-size: .92rem;
    font-weight: 600;
    white-space: nowrap;
}
.work-fixed-dept-ico { display: inline-flex; color: #6b7280; }
.work-fixed-dept-ico svg { width: 16px; height: 16px; }

/* 絞り込みバーのラベル(年/月/部署/従業員)は視覚的に隠して高さを詰める。
   （各inputは値やプレースホルダで内容が分かるため。スクリーンリーダーには残す） */
.work-toolbar .filter-label,
.work-toolbar .form-label {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ===== 勤務編集フォーム（works.edit）の時刻区分 ===== */
.we-cats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1rem;
    align-items: start; /* 各カードを内容の高さに（行内で最大高に引き伸ばさない） */
}
.we-cat {
    border: 1px solid #e3ebf5;
    border-radius: 10px;
    overflow: hidden;
}
.we-cat-title {
    padding: 8px 14px;
    font-weight: 700;
    font-size: .82rem;
    color: #1f2d3d;
    border-bottom: 1px solid #e8eef6;
}
.we-cat-title.we-normal  { background: #e3edff; }
.we-cat-title.we-night   { background: #e6e8fa; }
.we-cat-title.we-holiday { background: #fce0e5; }
.we-cat-title.we-timeoff { background: #e1f7ec; }
.we-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 10px 14px;
}
.we-row + .we-row { border-top: 1px dashed #d4ddea; }
.we-row-label {
    flex: none;
    width: 4.5em;
    font-size: .8rem;
    color: #5b7088;
    font-weight: 600;
    white-space: nowrap;
}
.we-range {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: nowrap;
}
.we-tilde { color: #94a3b8; }
/* 区分行の工事名（検索付きセレクト）の余白を稼働・待機と揃える */
.we-const .form-group { margin-bottom: 0; }

/* ============================================================
   勤務実績（results.index）
   ============================================================ */
/* パネル見出しバー（テーブルの上に置くタイトル行） */
.result-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 15px 20px;
    border-bottom: 1px solid #eef2f7;
}
.result-panel-title {
    display: flex;
    align-items: baseline;
    gap: .55rem;
    font-size: .95rem;
    font-weight: 700;
    color: #1f2d3d;
}
.result-panel-sub {
    font-size: .8rem;
    color: #7a8ba0;
    font-weight: 600;
}
.result-hint {
    margin: 0;
    padding: 12px 20px;
    border-top: 1px solid #eef2f7;
    background: #fbfcfe;
    font-size: .78rem;
    color: #8194a8;
}

/* サマリ／明細 共通テーブル */
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .86rem;
    white-space: nowrap;
}
.result-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f4f7fb;
    color: #47607b;
    font-weight: 700;
    font-size: .78rem;
    text-align: right;
    padding: 10px 18px;
    border-bottom: 2px solid #e2e9f2;
    line-height: 1.25;
}
/* 一覧テーブル(.result-table)のヘッダーが画面上端に達したら固定表示（給与管理など）。
   .list-panel(overflow:hidden)/#table-wrapper(overflow:auto) に sticky が閉じ込められるため、
   勤務表と同じく body 直下にヘッダーを複製して固定する。JS: staff_salaries/index。 */
.result-float-head {
    position: fixed;
    top: 0;
    z-index: 40;
    overflow: hidden;
    display: none;
    pointer-events: none;
    background: #fff;
    box-shadow: 0 8px 14px -8px rgba(15, 23, 42, .3);
}
.result-float-head table { margin: 0; }
.result-table thead th:first-child,
.result-table tbody td:first-child,
.result-table tfoot td:first-child { padding-left: 20px; }
.result-table thead th:last-child,
.result-table tbody td:last-child,
.result-table tfoot td:last-child { padding-right: 20px; }
.result-table thead th.rt-name,
.result-table thead th.rd-date,
.result-table thead th.rd-dow,
.result-table thead th.rd-op,
.result-table thead th.rd-wait,
.result-table thead th.rd-const,
.result-table thead th.rd-note { text-align: left; }
.result-table .rt-unit {
    display: inline-block;
    margin-top: 1px;
    font-size: .68rem;
    font-weight: 600;
    color: #9aabbd;
}
/* 実績一覧ヘッダの色分け（勤務表の 通常/深夜/休日 の色合いに合わせる） */
.result-table thead th.th-normal  { background: #e3edff; color: #1f2d3d; }
.result-table thead th.th-night   { background: #e6e8fa; color: #1f2d3d; }
.result-table thead th.th-holiday { background: #fce0e5; color: #1f2d3d; }
.result-table thead th.th-normal .rt-unit,
.result-table thead th.th-night .rt-unit,
.result-table thead th.th-holiday .rt-unit { color: #64748b; }

/* 余った幅は従業員名の列（.rt-name）に割り当てる */
.result-table th.rt-name,
.result-table td.rt-name { width: auto; min-width: 8rem; }

/* 全列に縦線（#d4ddea で統一） */
.result-table th:not(:first-child),
.result-table td:not(:first-child),
.result-table th.grp-start,
.result-table td.grp-start { border-left: 1px solid #d4ddea; }
/* 行の色分け（勤務表の day-even と同じ）。ホバーは色を上書き */
.result-table tbody tr.day-even td { background: #f8fafc; }
.result-table tbody tr.rt-clickable:hover td { background: #f2f7ff; }
.result-table tbody td {
    padding: 12px 18px;
    text-align: right;
    color: #33455a;
    border-bottom: 1px solid #eef2f7;
    font-variant-numeric: tabular-nums;
}
.result-table tbody tr:last-child td { border-bottom: none; }
.result-table tbody td.rt-name,
.result-table tbody td.rd-date,
.result-table tbody td.rd-dow,
.result-table tbody td.rd-op,
.result-table tbody td.rd-wait,
.result-table tbody td.rd-const,
.result-table tbody td.rd-note { text-align: left; }
.result-table .rt-strong { font-weight: 700; color: #16233a; }

/* サマリ: 従業員名セル */
.rt-name-main { font-weight: 600; color: #1f2d3d; }
.rt-name-sub {
    margin-left: .5rem;
    font-size: .72rem;
    color: #94a3b8;
    font-family: ui-monospace, Menlo, monospace;
}
.rt-clickable { cursor: pointer; transition: background .12s; }
.rt-clickable:hover { background: #f2f7ff; }
.rt-empty { text-align: center !important; color: #94a3b8; padding: 28px 12px !important; }

/* 合計行 */
.result-table tfoot .rt-total td {
    background: #eef3fb;
    font-weight: 700;
    color: #1f2d3d;
    border-top: 2px solid #d7e1ee;
    border-bottom: none;
    padding: 13px 18px;
    text-align: right;
}
.result-table tfoot .rt-total td.rt-name,
.result-table tfoot .rt-total td.rd-date { text-align: left; }

/* 個人サマリ: カード */
.result-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.result-card {
    background: #fff;
    border: 1px solid #e6edf5;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(20, 40, 70, .04);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.result-card-label { font-size: .76rem; color: #7286a0; font-weight: 600; }
.result-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #16233a;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.result-card-unit { font-size: .78rem; font-weight: 600; color: #9aabbd; margin-left: 3px; }

/* 日別明細（モーダル内）。見出し・カードは固定し、表だけをスクロールさせて
   thead を上固定・tfoot を下固定にする。#result-detail-body を flex 列にして
   表ラッパーが残り高さいっぱいにスクロールする（内側スクロールなので padding の隙間が出ない）。 */
#result-detail-body { display: flex; flex-direction: column; }
.result-daily-wrap {
    flex: 1 1 auto;
    min-height: 0;      /* flex 子が縮めるようにしてスクロールを有効化 */
    overflow: auto;
}
.result-daily thead th { top: 0; z-index: 3; }
.result-daily tfoot .rt-total td {
    position: sticky;
    bottom: 0;
    z-index: 3;
}
.result-daily tfoot .rt-total td::before {
    /* 下固定時に行の上境界線を描く（tfoot の border-top が sticky で消える対策） */
    content: "";
    position: absolute;
    left: 0; right: 0; top: 0;
    border-top: 2px solid #d7e1ee;
}

/* 日別明細 */
/* 日付・曜日・稼働・待機は内容ぴったりの最小幅（余白は工事名・備考が吸収） */
.result-daily .rd-date,
.result-daily .rd-dow,
.result-daily .rd-op,
.result-daily .rd-wait { width: 1%; white-space: nowrap; }
.result-daily .rd-date { font-variant-numeric: tabular-nums; }
.result-daily .rd-dow  { text-align: center !important; color: #64748b; }
.result-daily thead .rd-dow { text-align: center; }
.result-daily .rd-note { white-space: normal; min-width: 8rem; color: #5b6f86; font-size: .8rem; }
/* 土日・祝日は勤務表と同様、行の背景は付けず日付・曜日の文字色のみ変える */
.result-daily tbody tr.rd-sat .rd-date,
.result-daily tbody tr.rd-sat .rd-dow { color: #2563eb; }
.result-daily tbody tr.rd-sun .rd-date,
.result-daily tbody tr.rd-sun .rd-dow { color: #dc2626; }
.rd-tag {
    display: inline-block;
    padding: 2px 8px;
    margin: 1px 3px 1px 0;
    border-radius: 999px;
    background: #eef2f8;
    color: #40546c;
    font-size: .74rem;
    font-weight: 600;
}
.rd-tag-wait { background: #eaf5ee; color: #2f7a52; }

/* 残業時間列（日別明細の末尾）＋計算方法の説明アイコン */
.result-table thead th.rd-ot { background: #eef2f7; }
.result-daily tfoot .rt-total td.rd-ot { color: #16233a; font-weight: 700; }
.rd-ot-info {
    color: #8aa0b8;
    margin-left: 4px;
    vertical-align: middle;
}
.excess-ico.rd-ot-info svg { width: 13px; height: 13px; }
.rd-ot-info:hover { color: #2f6dba; }

/* 超過（残業時間の警告）アイコン。文言なし・レベルで色分け。hoverで自作ツールチップ表示 */
.result-table th.rt-excess,
.result-table td.rt-excess { text-align: center; white-space: nowrap; }
.excess-ico {
    display: inline-flex;
    cursor: help;
}
.excess-ico svg { width: 18px; height: 18px; display: block; }
.excess-ico:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 4px; }
.excess-caution { color: #eab308; }  /* 注意（黄） */
.excess-warn    { color: #f97316; }  /* 警告（橙） */
.excess-danger  { color: #dc2626; }  /* 危険（赤） */
/* 見出し内のアイコンは行の中央に揃える */
.result-detail-title .excess-ico { margin-left: .4rem; vertical-align: middle; }

/* 自作ツールチップ（body直下・fixed。表のスクロール枠でも見切れない） */
.excess-tip {
    position: fixed;
    z-index: 2000;
    max-width: 260px;
    padding: 8px 11px;
    background: #1f2937;
    color: #f1f5f9;
    font-size: .75rem;
    font-weight: 400;
    line-height: 1.55;
    white-space: pre-line;   /* メッセージ中の改行(\n)を反映 */
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
    pointer-events: none;
}
.excess-tip[hidden] { display: none; }

/* 日別明細モーダルの見出し */
.result-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 16px;
    padding-right: 2.5rem; /* 閉じるボタンと重ならないように */
}
.result-detail-eyebrow {
    margin: 0 0 2px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: #8aa0b8;
}
.result-detail-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #16233a;
}
.result-detail-sub {
    margin: 2px 0 0;
    font-size: .85rem;
    color: #64748b;
}
/* 見出し左側: アバター＋氏名 */
.result-detail-person {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.result-detail-avatar {
    width: 46px;
    height: 46px;
    font-size: 17px;
}
/* 勤務表で見る（アイコン＋別タブ） */
.result-worklink {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    flex: 0 0 auto;
    font-size: .8rem;
    padding: .4rem .9rem;
}
.result-worklink svg { width: 15px; height: 15px; }

/* モーダル内カードは少し小さめに＋勤務表の色合いで色分け */
.result-detail-cards { margin-bottom: 16px; }
.result-detail-cards .result-card { padding: 12px 14px; }
.result-detail-cards .result-card-value { font-size: 1.3rem; }
/* 通常（青）/ 深夜（紫）/ 休日（桃）— .work-sheet の grp 色に合わせる */
.result-detail-cards .rc-normal  { background: #eef4ff; border-color: #dbe6ff; }
.result-detail-cards .rc-normal  .result-card-label { color: #35569c; }
.result-detail-cards .rc-night   { background: #f0f1fb; border-color: #e0e2f6; }
.result-detail-cards .rc-night   .result-card-label { color: #4b4fa0; }
.result-detail-cards .rc-holiday { background: #fdeef1; border-color: #f8d9e0; }
.result-detail-cards .rc-holiday .result-card-label { color: #b03e5c; }

/* 日別明細の本文セルは白背景 */
.result-daily tbody td { background: #fff; }

/* ===== 共通: 操作ボタンエリア（検索エリアの下に置く操作パネル） =====
   給与管理の「生成・お知らせ」、勤務表の「申請・各種DL」などで使う。
   list-panel list-toolbar の中に .op-bar を置き、ボタンに .op-btn を付ける。 */
.op-bar {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
}
/* 画面が狭いときは横並びのまま折り返し、左寄せにして端が揃うようにする */
/* JS有効時は1行に固定して折返しを実測（あふれたら集約メニューへ切替）。
   JS無効時は従来どおり折返し（フォールバック）。 */
.op-bar.op-bar--managed { flex-wrap: nowrap; }
/* 集約メニューは通常は隠し、折返し時（is-collapsed）だけ表示する。
   .op-compact は .op-dropdown でもあるため、後勝ちの display:inline-flex に負けないよう
   `.op-bar` を前置して詳細度を上げる。 */
.op-bar .op-compact { display: none; }
.op-bar.is-collapsed .op-only-wide { display: none; }
.op-bar.is-collapsed .op-compact { display: inline-flex; }
.op-bar.is-collapsed { justify-content: flex-start; }
/* 種類が異なる要素（a / button / span）でも高さを必ず揃える */
.op-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    height: 35px;
    width: auto;
    flex: none;
    white-space: nowrap;
    box-sizing: border-box;
    line-height: 1;
}
.op-btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}
/* 未生成などで押せない操作（<span> または disabled ボタンで出す） */
.op-btn.is-disabled,
.op-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* 操作エリアの区切り（個人の出力 / 全員の出力 などを分ける） */
.op-sep {
    width: 1px;
    height: 24px;
    background: #e2e8f0;
    flex: none;
    margin: 0 .25rem;
}

/* ===== 操作エリアのドロップダウン（勤務表DL・全勤務表DL などの形式/タイプ選択） ===== */
.op-dropdown {
    position: relative;
    display: inline-flex;
    flex: none;
}
/* トグルは op-btn と同じ見た目。右端に開閉キャレットを付ける */
.op-dropdown-caret {
    width: 12px;
    height: 12px;
    flex: none;
    margin-left: .1rem;
    transition: transform .15s ease;
}
.op-dropdown-toggle[aria-expanded="true"] .op-dropdown-caret {
    transform: rotate(180deg);
}
.op-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    padding: 4px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.op-dropdown-menu[hidden] {
    display: none;
}
.op-dropdown-item {
    display: flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
    padding: .4rem .6rem;
    border-radius: 6px;
    font-size: .82rem;
    color: #1e293b;
    text-decoration: none;
    cursor: pointer;
}
.op-dropdown-item:hover {
    background: #f1f5f9;
}
.op-dropdown-item.is-disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}
/* 集約メニュー内の区切り線（申請 / 個人DL / 全勤務表DL を分ける） */
.op-dropdown-sep {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 2px;
}

/* ===== 給与管理: 集計サマリ（金額カード） ===== */
.salary-sum {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    padding: 16px 20px 20px;
}
.salary-sum-card {
    position: relative;
    border: 1px solid #e7edf4;
    border-radius: 12px;
    padding: 14px 16px 14px 18px;
    background: #fbfdff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
}
/* 左端のアクセントバー */
.salary-sum-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: #cbd5e1;
}
.salary-sum-card .salary-sum-label {
    font-size: .8rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: .02em;
}
.salary-sum-card .salary-sum-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2d3d;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.salary-sum-card .salary-sum-cur {
    font-size: .95rem;
    font-weight: 600;
    color: #94a3b8;
    margin-right: 2px;
}
/* 支給=青 / 控除=赤 / 差引=緑（強調） */
.salary-sum-pay::before { background: #3b82f6; }
.salary-sum-ded::before { background: #ef4444; }
.salary-sum-ded .salary-sum-value { color: #b91c1c; }
.salary-sum-net { background: #f0fdf4; border-color: #bbf7d0; }
.salary-sum-net::before { background: #22c55e; }
.salary-sum-net .salary-sum-value { color: #047857; font-size: 1.65rem; }
.salary-sum-net .salary-sum-cur { color: #6ee7b7; }

/* ===== 給与管理: 明細モーダル（閲覧＋手動修正フォーム） ===== */
.salary-detail { font-size: .9rem; color: #1f2d3d; }
.salary-detail-head {
    display: flex;
    align-items: center;
    gap: .8rem;
    flex-wrap: wrap;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef2f7;
    margin-bottom: 14px;
}
.salary-detail-head .list-avatar { width: 44px; height: 44px; font-size: 1rem; }
.salary-detail-head .sd-name { font-size: 1.1rem; font-weight: 700; }
.salary-detail-head .sd-meta { font-size: .8rem; color: #64748b; }
.salary-detail-head .sd-period { margin-left: auto; text-align: right; }
.salary-detail-head .sd-period strong { font-size: 1.05rem; }

/* 前月勤怠の小サマリ */
.salary-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    margin-bottom: 16px;
}
.salary-facts div { font-size: .8rem; color: #475569; }
.salary-facts strong { display: block; color: #1f2d3d; font-size: .95rem; font-variant-numeric: tabular-nums; }

.salary-detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .salary-detail-cols { grid-template-columns: 1fr; } }

.salary-sect-title {
    font-size: .85rem;
    font-weight: 700;
    color: #334155;
    margin: 0 0 8px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e2e8f0;
}
.salary-sect-title.is-pay { border-color: #bfdbfe; }
.salary-sect-title.is-ded { border-color: #fecaca; }

.salary-row {
    display: grid;
    grid-template-columns: 1fr 130px;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}
.salary-row > label { font-size: .82rem; color: #475569; }
.salary-input {
    width: 100%;
    text-align: right;
    padding: 6px 8px;
    border: 1px solid #d7dee8;
    border-radius: 7px;
    font-size: .88rem;
    font-variant-numeric: tabular-nums;
    background: #fff;
}
.salary-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.salary-input:read-only { background: #f1f5f9; color: #64748b; }
.salary-free-row { display: grid; grid-template-columns: 1fr 110px; gap: 8px; padding: 3px 0; }
.salary-free-row .salary-input-title {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d7dee8;
    border-radius: 7px;
    font-size: .82rem;
    background: #fff;
}

.salary-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 18px 0 4px;
    padding-top: 14px;
    border-top: 1px solid #eef2f7;
}
.salary-total-box {
    border: 1px solid #e7edf4;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fbfdff;
}
.salary-total-box .lbl { font-size: .78rem; color: #64748b; font-weight: 600; }
.salary-total-box .val { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.salary-total-net { background: #f0fdf4; border-color: #bbf7d0; }
.salary-total-net .val { color: #047857; }

.salary-detail-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.salary-confirm { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: #334155; }
.salary-memo { width: 100%; min-height: 60px; padding: 8px; border: 1px solid #d7dee8; border-radius: 8px; font-size: .85rem; margin-top: 6px; }

/* ===== 給与管理: 給与明細（紙面レイアウト風・編集可能） ===== */
.slip { font-size: .9rem; color: #1f2d3d; }
/* セクション（勤怠・支給・控除）: 左に縦ラベル帯＋右にグリッド */
.slip-sect {
    display: flex;
    align-items: stretch;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #fff;
}
.slip-sect + .slip-sect { margin-top: 0; }
.slip-sect-label {
    flex: 0 0 30px;
    background: #eef2f7;
    color: #334155;
    font-weight: 700;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: .12em;
    border-right: 1px solid #cbd5e1;
}
.slip-sect-label.is-pay { background: #eaf2fe; color: #1e40af; }
.slip-sect-label.is-ded { background: #fdecec; color: #b91c1c; }
.slip-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
}
.slip-grid.is-kintai { grid-template-columns: repeat(10, 1fr); }
@media (max-width: 680px) {
    .slip-grid { grid-template-columns: repeat(3, 1fr); }
    .slip-grid.is-kintai { grid-template-columns: repeat(5, 1fr); }
}
/* 各セル: 上=ラベル（グレー） / 下=金額 */
.slip-cell {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e6ebf1;
    border-bottom: 1px solid #e6ebf1;
    min-width: 0;
}
.slip-cell-label {
    font-size: .7rem;
    color: #5b6b7f;
    background: #f8fafc;
    padding: 3px 6px;
    border-bottom: 1px solid #eef2f7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
input.slip-money,
.slip-val {
    border: 0;
    border-radius: 0;
    text-align: right;
    height: 40px;
    line-height: 24px;
    padding: 8px 10px;
    box-sizing: border-box;
    display: block;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    width: 100%;
    background: #fff;
    color: #1f2d3d;
    -webkit-appearance: none;
    appearance: none;
}
input.slip-money:focus { outline: none; background: #eff6ff; }
.slip-val { color: #334155; }
/* 自由項目: ラベル自体を入力にする */
.slip-cell input.slip-title {
    font-size: .7rem;
    color: #334155;
    background: #f8fafc;
    border: 0;
    border-bottom: 1px solid #eef2f7;
    padding: 3px 6px;
    width: 100%;
}
.slip-cell input.slip-title:focus { outline: none; background: #eef5ff; }

/* 合計行（総支給額 / 控除合計額 / 自由入力×2 / 通勤手当×2 / 差引支給額 の7列） */
.slip-totals {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    margin: 6px 0 4px;
}
@media (max-width: 680px) { .slip-totals { grid-template-columns: repeat(2, 1fr); } }
/* 承認済みは通勤手当が課税＋非課税の合算1列になるため、6列で幅100%に揃える */
.slip-totals.is-confirmed { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 680px) { .slip-totals.is-confirmed { grid-template-columns: repeat(2, 1fr); } }
.slip-total-cell {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e6ebf1;
    border-bottom: 1px solid #e6ebf1;
}
.slip-total-cell .slip-cell-label { background: #eef2f7; }
.slip-total-cell .slip-money,
.slip-total-cell .slip-val { font-weight: 700; font-size: 1rem; }
/* 合計行の自由入力セルは、支給・控除の自由入力セルと同じ見た目に揃える */
.slip-total-cell.is-free { background: #fcfdff; }
.slip-total-cell input.slip-title {
    height: 40px;
    min-height: 40px;
    box-sizing: border-box;
    display: block;
    text-align: center;
    line-height: 1.2;
    font-size: .82rem;
    font-weight: 400;
    color: #64748b;
    background: #f8fafc;
    border: 0;
    border-bottom: 1px solid #eef2f7;
    padding: 4px 6px;
    width: 100%;
}
.slip-total-cell.is-free .slip-money { font-weight: 400; }
.slip-total-cell input.slip-title:focus { outline: none; background: #eef5ff; }
.slip-total-net { background: #f0fdf4; }
.slip-total-net .slip-cell-label { background: #dcfce7; color: #065f46; }
.slip-total-net .slip-val,
.slip-total-net .slip-money { color: #047857; font-size: 1.1rem; }
/* 合計行の入力欄は白背景で「入力できる」ことを明示（読取セルと区別） */
.slip-total-cell input.slip-money { background: #fff; }
.slip-total-cell input.slip-money:focus { background: #eff6ff; }

/* ===== 給与明細モーダル: 余白・寸法の微調整 ===== */
/* 幅が広すぎるとセル内が間延びするため、給与明細だけ幅を絞る */
#salary-detail-modal .req-modal-card { width: min(980px, 94vw); }
#salary-detail-modal .req-modal-body { padding: 1.1rem 1.25rem 1.4rem; }

/* セルの高さを揃えて行の凸凹をなくす（値は固定高さ40pxで統一） */
.slip-cell { justify-content: flex-start; }
.slip-cell .slip-cell-label,
.slip-cell .slip-title { min-height: 22px; display: flex; align-items: center; }

/* 自由項目セルは薄く色付けして通常項目と区別 */
.slip-cell.is-free { background: #fcfdff; }
.slip-cell.is-free .slip-title { color: #64748b; }

/* セクション間の余白を少し詰める */
.slip-sect { margin-bottom: 10px; }
/* 控除と合計行の間は少し広めに空ける */
.slip-totals { margin-top: 22px; }

/* 合計行のラベルも本体セルと揃える（値は共通の固定高さ40px） */
.slip-total-cell .slip-cell-label { min-height: 22px; display: flex; align-items: center; }

/* ===== 給与明細モーダル: ヘッダ（令和ラベル＋ステータス） ===== */
.salary-detail-head .sd-headmain { min-width: 0; }
.salary-detail-head .sd-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2d3d;
    letter-spacing: .01em;
    margin-bottom: 2px;
}
.salary-detail-head .sd-name { font-size: .95rem; font-weight: 600; }
/* ステータスは右端に寄せつつ、閉じるボタン(×: right14px/幅34px)と被らないよう余白を確保 */
.salary-detail-head .sd-status {
    margin-left: auto;
    align-self: flex-start;
    padding-right: 44px;
}

/* ===== 給与明細モーダル: 前月勤怠のラベルは中央寄せ・大きめ ===== */
.slip-grid.is-kintai .slip-cell-label {
    justify-content: center;
    text-align: center;
    font-size: .82rem;
    font-weight: 600;
    color: #475569;
    white-space: normal;         /* 明示改行（残時間の前）を反映 */
    line-height: 1.25;
    padding: 5px 4px;
    min-height: 40px;            /* 2行分の高さを確保して行を揃える */
}
.slip-grid.is-kintai .slip-val {
    text-align: center;
    justify-content: center;
    height: 34px;                /* ラベルが2行になった分、値側は少し詰める */
    line-height: 24px;
}

/* ===== 給与明細モーダル: 支給・控除のラベルも中央寄せ・大きめ ===== */
.slip-grid:not(.is-kintai) .slip-cell-label {
    justify-content: center;
    text-align: center;
    font-size: .82rem;
    font-weight: 600;
    color: #475569;
    white-space: normal;         /* 「子ども・子育て支援金」等を折り返して省略しない */
    line-height: 1.2;
    min-height: 34px;            /* 2行分の高さを確保して行を揃える */
}
/* 自由項目のラベル入力も中央寄せに合わせる */
.slip-grid:not(.is-kintai) .slip-title { text-align: center; }

/* ===== 給与明細モーダル: 全ラベルの高さを統一（凸凹解消・最終指定） ===== */
.slip-cell .slip-cell-label,
.slip-grid.is-kintai .slip-cell-label,
.slip-grid:not(.is-kintai) .slip-cell-label,
.slip-total-cell .slip-cell-label {
    height: 40px;
    min-height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
    font-size: .82rem;
    font-weight: 600;
    padding: 4px 6px;
    overflow: hidden;
}
/* 自由項目のラベル入力も同じ高さ・中央寄せに */
.slip-cell input.slip-title {
    height: 40px;
    min-height: 40px;
    box-sizing: border-box;
    display: block;
    text-align: center;
    line-height: 1.2;
    font-size: .82rem;
    padding: 4px 6px;
}
/* 値（金額）の高さは全セクション共通の40pxに揃える */
.slip-grid.is-kintai .slip-val { height: 40px; line-height: 24px; }
/* 前月勤怠は編集可能な入力。中央寄せで表示 */
.slip-grid.is-kintai .slip-money.slip-kintai { text-align: center; }

/* ===== 給与明細モーダル: 支給の時間外セル（時間＋金額）・空欄セル ===== */
/* 時間外セルは「ラベル＋勤務時間(読取)＋金額」の3段 */
.slip-cell.is-ot .slip-time {
    height: 24px;
    line-height: 24px;
    text-align: center;
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
    color: #0369a1;
    background: #f0f9ff;
    border-bottom: 1px solid #e0f2fe;
}
.slip-cell.is-ot .slip-time-unit { font-size: .68rem; color: #64748b; margin-left: 1px; }
/* 時間のみのセル（勤務時間など）: 値エリアに時間だけを表示し、金額欄の空白を作らない */
.slip-val-time { text-align: center; color: #0369a1; }
.slip-val-time .slip-time-unit { font-size: .68rem; color: #64748b; margin-left: 1px; }
/* 空欄セル：他セルと同じ構造・値なし・入力不可。値エリアを薄く塗って非活性を示す */
.slip-cell.is-blank .slip-val { background: #f8fafc; }

/* ===== 給与明細モーダル: 承認ロック（fieldset disabled） ===== */
.slip-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
/* 承認済み（disabled）でも値は読めるようにする（グレーアウトしすぎない） */
.slip-fields:disabled input,
.slip-fields:disabled textarea {
    color: #1f2d3d;
    -webkit-text-fill-color: #1f2d3d;
    opacity: 1;
    cursor: not-allowed;
}
.slip-fields:disabled { opacity: .96; }
.slip-locked-note { font-size: .82rem; color: #b45309; font-weight: 600; }
/* 明細フッターの操作説明（再計算・リセットの使い分け） */
.slip-recalc-note { font-size: .78rem; color: #64748b; line-height: 1.6; max-width: 44ch; }

/* ===== 給与一覧: マスタと同じ行選択スタイル（result-table にも適用） ===== */
.result-table tr.selectable { cursor: pointer; }
.result-table tr.selectable:hover td { background: #f0f9ff; }
.result-table tr.row-selected td { background: #eff6ff; }


/* ===== 給与明細モーダル: 賞与 ===== */
.bonus-note {
    font-size: .78rem;
    color: #64748b;
    margin: 4px 2px 12px;
}
/* 賞与の自動計算セル（読取）は薄く色付け */
.slip-cell.is-auto .slip-val { background: #f8fafc; color: #334155; }

/* ===== 給与明細モーダル: 承認(disabled)時と合計自由項目の見た目調整 ===== */
/* 承認済み(編集不可)でも金額入力欄の背景は白にする */
.slip-fields:disabled input.slip-money { background: #fff; }
/* 合計行の自由入力タイトルは、他の合計ラベルと同じ背景色にそろえる */
.slip-total-cell.is-free .slip-title { background: #eef2f7; }

/* ===== 打刻漏れ管理 ===== */
/* ヒーロー右側の件数チップ */
.form-hero-side { flex: 0 0 auto; margin-left: auto; }
.tco-count {
    display: inline-flex;
    align-items: baseline;
    gap: .4rem;
    padding: .5rem .9rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
}
.tco-count.is-alert { background: rgba(248, 113, 113, .18); border-color: rgba(248, 113, 113, .5); }
.tco-count-num   { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.tco-count-label { font-size: .78rem; color: rgba(226, 238, 252, .85); }

/* 一覧テーブル */
.tco-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .84rem;
    font-variant-numeric: tabular-nums;
}
.tco-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px 12px;
    font-size: .72rem;
    font-weight: 700;
    color: #5b7088;
    text-align: left;
    white-space: nowrap;
    background: #f3f7fd;
    border-bottom: 1px solid #e3ebf5;
}
.tco-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid #eef2f7;
    color: #1f2d3d;
    background: #fff;
    vertical-align: middle;
}
.tco-table tbody tr.day-even td { background: #f8fafc; }
.tco-table tbody tr:hover td { background: #f1f6fe; }

.tco-date  { white-space: nowrap; }
.tco-date-md  { font-weight: 700; }
.tco-date-dow { color: #94a3b8; font-size: .78rem; margin-left: .1rem; }
.tco-date.is-sun .tco-date-md { color: #dc2626; }
.tco-date.is-sat .tco-date-md { color: #2563eb; }

.tco-staff-name { font-weight: 600; }
.tco-dept { color: #475569; white-space: nowrap; }

/* 打刻漏れの内容（区分＋どこの出勤か）。退勤漏れ＝赤系／勤務未入力＝グレー系 */
.tco-reason { line-height: 1.7; }
.tco-reason-item {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: 2px 6px 2px 0;
    padding: .16rem .55rem;
    border-radius: 8px;
    font-size: .76rem;
    white-space: nowrap;
}
.tco-reason-item.is-end  { background: #fef2f2; border: 1px solid #fecaca; }
.tco-reason-item.is-none { background: #f1f5f9; border: 1px solid #cbd5e1; }
.tco-reason-cat { font-weight: 700; }
.tco-reason-item.is-end  .tco-reason-cat { color: #dc2626; }
.tco-reason-item.is-none .tco-reason-cat { color: #475569; }
.tco-reason-detail { color: #64748b; font-size: .74rem; }

.tco-elapsed { white-space: nowrap; }
.tco-elapsed-days { color: #64748b; font-size: .8rem; }
.tco-elapsed-days.is-warn { color: #b45309; font-weight: 700; }

.tco-act { text-align: right; white-space: nowrap; }
/* .btn-primary は width:100% のため、そのままだとセル幅いっぱいに伸びる。行内ボタンは文字幅に合わせる */
.tco-act .tco-link { width: auto; padding: .35rem .8rem; font-size: .78rem; }
.tco-act .tco-link + .tco-link { margin-left: .4rem; }
/* 申請中は再申請できないため、ボタンではなく状態表示にする */
.tco-pending {
    display: inline-block;
    margin-right: .4rem;
    padding: .3rem .7rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    color: #0369a1;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
}

.tco-empty {
    padding: 44px 16px !important;
    text-align: center;
    color: #94a3b8;
    background: #fff !important;
}
.tco-empty-ico { display: block; margin: 0 auto .5rem; width: 34px; height: 34px; color: #34d399; }
.tco-empty-ico svg { width: 100%; height: 100%; }

/* ===== 源泉徴収票: ファイルアップロードのカスタム見た目 ===== */
.wh-upload-form { display: flex; gap: .5rem; align-items: center; }
.file-field { display: inline-flex; align-items: center; gap: 8px; }
.file-pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: .34rem .7rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font-size: .78rem;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s, background .15s;
}
.file-pick:hover { border-color: #6366f1; background: #f5f7ff; color: #4338ca; }
.file-pick .file-input {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.file-pick:focus-within { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.file-name {
    font-size: .75rem;
    color: #94a3b8;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-field.has-file .file-name { color: #1f2d3d; font-weight: 600; }

/* ==========================================================================
   給与明細（本人用 my-salary）
   年サマリ → 月/賞与チップで明細を切り替え → 支給/控除を2カラムで表示する。
   ========================================================================== */

/* 年切り替えツールバー */
.ms-toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 16px;
}
.ms-year-form { margin: 0; }
.ms-toolbar .filter-select { height: 38px; min-width: 120px; }

/* 年間サマリ */
.ms-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.ms-sum-card {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e3ebf5;
    border-radius: 12px;
}
.ms-sum-label { font-size: .76rem; color: #94a3b8; font-weight: 600; }
.ms-sum-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1f2d3d;
    font-variant-numeric: tabular-nums;
}
.ms-sum-minus { color: #b91c1c; }
.ms-sum-card-net {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
}
.ms-sum-card-net .ms-sum-label { color: rgba(255, 255, 255, .82); }
.ms-sum-card-net .ms-sum-value { color: #fff; }

.ms-empty { padding: 28px 20px; text-align: center; color: #94a3b8; }
.ms-empty p { margin: 0; }

/* 月／賞与のチップ（明細の切り替え） */
.ms-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}
.ms-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 92px;
    padding: .45rem .7rem;
    border: 1px solid #e3ebf5;
    border-radius: 10px;
    background: #fff;
    color: #1f2d3d;
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.ms-chip:hover { border-color: #bfd4f5; background: #f6f9ff; }
.ms-chip.is-active {
    border-color: #2563eb;
    background: #eff5ff;
    box-shadow: inset 0 0 0 1px #2563eb;
}
.ms-chip.is-empty {
    cursor: default;
    background: #f8fafc;
    color: #cbd5e1;
    border-style: dashed;
}
.ms-chip.is-empty:hover { border-color: #e3ebf5; background: #f8fafc; }
.ms-chip-m { font-size: .78rem; font-weight: 700; }
.ms-chip-v {
    font-size: .74rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}
.ms-chip.is-active .ms-chip-v { color: #2563eb; font-weight: 600; }
.ms-chip.is-empty .ms-chip-v { color: #cbd5e1; }
.ms-chip-bonus .ms-chip-m { color: #b45309; }
.ms-chip-bonus.is-active { border-color: #d97706; background: #fff7ed; box-shadow: inset 0 0 0 1px #d97706; }
.ms-chip-bonus.is-active .ms-chip-v { color: #b45309; }

/* 明細カード */
.ms-slip {
    background: #fff;
    border: 1px solid #e3ebf5;
    border-radius: 12px;
    padding: 18px 20px 20px;
    margin-bottom: 16px;
}
.ms-slip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef2f7;
}
.ms-slip-title { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; }
.ms-slip-period { font-size: 1.05rem; font-weight: 700; color: #1f2d3d; }
.ms-slip-kind {
    font-size: .72rem;
    font-weight: 700;
    color: #2563eb;
    background: #eff5ff;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    padding: .15rem .55rem;
}
.btn.ms-dl { width: auto; flex: none; font-size: .82rem; padding: .45rem .9rem; }

/* 差引支給額（主役） */
.ms-net {
    display: flex;
    align-items: baseline;
    gap: .8rem;
    flex-wrap: wrap;
    padding: 16px 0 18px;
}
.ms-net-label { font-size: .8rem; font-weight: 700; color: #64748b; }
.ms-net-value {
    font-size: 2rem;
    font-weight: 800;
    color: #1d4ed8;
    letter-spacing: .01em;
    font-variant-numeric: tabular-nums;
}
.ms-net-calc { font-size: .76rem; color: #94a3b8; font-variant-numeric: tabular-nums; }

/* 支給／控除の2カラム */
.ms-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.ms-sec {
    border: 1px solid #eef2f7;
    border-radius: 10px;
    padding: 14px 16px;
    background: #fcfdff;
}
.ms-sec-title {
    margin: 0 0 .6rem;
    font-size: .82rem;
    font-weight: 700;
    color: #1f2d3d;
}
.ms-sec-pay .ms-sec-title { color: #1d4ed8; }
.ms-sec-ded .ms-sec-title { color: #b91c1c; }
.ms-sub-title {
    margin: 1rem 0 .4rem;
    font-size: .76rem;
    font-weight: 700;
    color: #64748b;
}
.ms-none { margin: 0; color: #94a3b8; font-size: .8rem; }

/* 項目リスト（ラベル ─ 金額） */
.ms-items { margin: 0; }
.ms-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .8rem;
    padding: .35rem 0;
    border-bottom: 1px dashed #eef2f7;
}
.ms-item:last-child { border-bottom: 0; }
.ms-item dt { font-size: .8rem; color: #5b7088; }
.ms-item dd {
    margin: 0;
    font-size: .86rem;
    font-weight: 600;
    color: #1f2d3d;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* 時間外（区分・時間・金額） */
.ms-ot {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
}
.ms-ot th {
    text-align: right;
    padding: .3rem .4rem;
    color: #94a3b8;
    font-weight: 700;
    border-bottom: 1px solid #eef2f7;
}
.ms-ot th:first-child { text-align: left; }
.ms-ot td {
    padding: .32rem .4rem;
    border-bottom: 1px dashed #eef2f7;
    color: #1f2d3d;
}
.ms-ot tr:last-child td { border-bottom: 0; }
.ms-ot-time,
.ms-ot-amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ms-ot-amount { font-weight: 600; }

/* セクション合計 */
.ms-sec-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .8rem;
    margin-top: .8rem;
    padding-top: .6rem;
    border-top: 2px solid #e3ebf5;
    font-size: .8rem;
    color: #5b7088;
}
.ms-sec-total strong {
    font-size: 1rem;
    color: #1f2d3d;
    font-variant-numeric: tabular-nums;
}
.ms-sec-ded .ms-sec-total strong { color: #b91c1c; }

/* 通勤手当・合計欄の自由項目 */
.ms-extras {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}
.ms-extra {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: .4rem .7rem;
    background: #f6f9ff;
    border: 1px solid #e3ebf5;
    border-radius: 8px;
    font-size: .78rem;
    color: #5b7088;
}
.ms-extra strong { color: #1f2d3d; font-variant-numeric: tabular-nums; }

/* 前月勤怠 */
.ms-sec-att { margin-top: 14px; }
.ms-att {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin: 0;
}
.ms-att-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: .45rem .6rem;
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 8px;
}
.ms-att-item dt { font-size: .7rem; color: #94a3b8; }
.ms-att-item dd {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: #1f2d3d;
    font-variant-numeric: tabular-nums;
}

/* メモ */
.ms-memo {
    margin-top: 14px;
    padding: 12px 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
}
.ms-memo-label { font-size: .72rem; font-weight: 700; color: #b45309; }
.ms-memo p { margin: .25rem 0 0; font-size: .82rem; color: #1f2d3d; white-space: pre-wrap; }

/* 源泉徴収票 */
.ms-gensen {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
}
.ms-gensen-main { display: flex; flex-direction: column; gap: .15rem; }
.ms-gensen-title { font-size: .92rem; font-weight: 700; color: #1f2d3d; }
.ms-gensen-note { font-size: .78rem; color: #94a3b8; }

/* スマホ */
@media (max-width: 720px) {
    .ms-summary { grid-template-columns: 1fr; }
    .ms-grid { grid-template-columns: 1fr; }
    .ms-chip { flex: 1 1 calc(33.333% - 8px); min-width: 0; }
    .ms-slip-head { align-items: flex-start; }
    .btn.ms-dl { width: 100%; }
    .ms-net-value { font-size: 1.6rem; }
}

/* 従業員一覧: 権限セル内に併記する指定部署のチップ */
.staff-auth-depts {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 4px;
}
.staff-auth-dept {
    display: inline-block;
    padding: .05rem .4rem;
    font-size: .68rem;
    line-height: 1.5;
    color: #1f4168;
    background: #eef4fb;
    border: 1px solid #d5e3f3;
    border-radius: 999px;
    white-space: nowrap;
}

/* 従業員一覧: 絞り込み（狭幅時は開閉式にしてテーブル表示領域を確保） */
.staff-filter-body {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.staff-filter-toggle {
    display: none;
    align-items: center;
    gap: .4rem;
    padding: .45rem .8rem;
    border: 1px solid #d5deea;
    border-radius: 8px;
    background: #fff;
    color: #1f2d3d;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.staff-filter-toggle .staff-filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
}
/* フィルタが1行に収まらず2行以上になる幅では、開閉式の絞り込みカードにする（JSが .is-compact を付与） */
.staff-filter.is-compact .staff-filter-toggle { display: inline-flex; }
.staff-filter.is-compact .staff-filter-body { margin-top: 10px; }
.staff-filter.is-compact .staff-filter-body.is-collapsed { display: none; }

/* 年次帳票: 源泉徴収票「登録済」はステータスではなくDL/表示できるボタンとして見せる（緑アクセント） */
.wh-view-btn { color: #047857; border-color: #a7f3d0; }
.wh-view-btn:hover { background: #ecfdf5; border-color: #6ee7b7; color: #065f46; }

/* ダッシュボード: 残業時間超過アラート（当月 25/35/45時間） */
.db-ot-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.db-ot-alert {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-radius: 10px;
    background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
    font-size: .9rem; font-weight: 600;
}
.db-ot-alert svg { width: 18px; height: 18px; flex: none; color: #ea580c; }
.db-ot-alert-admin { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.db-ot-alert-admin svg { color: #dc2626; }
/* クリックで超過者一覧を開く管理者向けアラート（ボタン化） */
.db-ot-alert-btn { width: 100%; text-align: left; cursor: pointer; font-family: inherit; transition: background .15s, border-color .15s; }
.db-ot-alert-btn:hover { background: #fee2e2; border-color: #fca5a5; }
.db-ot-alert-more { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.db-ot-alert-more span { font-size: 1.05rem; line-height: 1; }
/* 残業超過者モーダル（カード型） */
#overtime-modal { align-items: flex-start; }
.otm-card {
    width: min(560px, calc(100vw - 32px));
    margin: max(6vh, 24px) auto;
    background: #fff; border-radius: 18px; overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
    display: flex; flex-direction: column; max-height: 84vh;
}
.otm-head {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #fef2f2, #fff5f5);
    border-bottom: 1px solid #fee2e2;
}
.otm-head-icon {
    flex: none; width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: #fee2e2; color: #dc2626;
}
.otm-head-icon svg { width: 22px; height: 22px; }
.otm-head-text { flex: 1; min-width: 0; }
.otm-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: #7f1d1d; }
.otm-sub { margin: 2px 0 0; font-size: .8rem; color: #b45f5f; }
.otm-close {
    flex: none; border: none; background: transparent; cursor: pointer;
    font-size: 1.6rem; line-height: 1; color: #9ca3af; padding: 0 4px;
    transition: color .15s;
}
.otm-close:hover { color: #4b5563; }
.otm-body { overflow-y: auto; padding: 8px; }
.otm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.otm-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 88px auto;
    align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 12px;
    border: 1px solid #f1f5f9; background: #fff;
    transition: background .15s;
}
.otm-item:hover { background: #f8fafc; }
.otm-avatar {
    flex: none; width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #e2e8f0; color: #475569; font-weight: 700; font-size: .95rem;
    overflow: hidden;
}
.otm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.otm-person { min-width: 0; display: flex; flex-direction: column; }
.otm-name { font-weight: 700; color: #1e293b; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.otm-dept { font-size: .78rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.otm-meter { height: 6px; border-radius: 999px; background: #eef2f6; overflow: hidden; }
.otm-meter-fill { display: block; height: 100%; border-radius: 999px; background: currentColor; }
.otm-hours { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; }
.otm-hours-num { font-weight: 800; font-size: 1.15rem; line-height: 1; color: currentColor; }
.otm-hours-unit { font-size: .68rem; color: #94a3b8; font-weight: 600; margin-left: 1px; }
.otm-badge {
    font-size: .66rem; font-weight: 700; color: #fff; padding: 1px 7px;
    border-radius: 999px;
}
/* レベル別の色（currentColor をレベル色にして数値・メーター色へ波及。バッジ背景は明示） */
.otm-lv25 { color: #ea580c; }
.otm-lv35 { color: #dc2626; }
.otm-lv45 { color: #b91c1c; }
.otm-lv25 .otm-badge { background: #ea580c; }
.otm-lv35 .otm-badge { background: #dc2626; }
.otm-lv45 .otm-badge { background: #b91c1c; }

/* 権限ガイド（システム管理者向けの権限×機能マトリクス） */
.pg-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.pg-table th, .pg-table td { border: 1px solid #e7edf4; padding: 8px 10px; }
.pg-table thead th { background: #f4f7fb; color: #47607b; font-weight: 700; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.pg-table th.pg-feat, .pg-table td.pg-feat { text-align: left; min-width: 220px; }
.pg-table th.pg-auth { text-align: center; }
.pg-auth-id { display: block; font-size: .66rem; font-weight: 600; color: #9aabbd; margin-top: 1px; }
.pg-group-row th { background: #eef2f7; color: #334155; text-align: left; font-weight: 700; font-size: .8rem; }
.pg-cell { text-align: center; white-space: nowrap; }
.pg-cell.is-yes { background: #f0fdf4; }
.pg-cell.is-no  { background: #fafafa; }
.pg-cell.is-scope { background: #f0f9ff; }
.pg-yes { color: #16a34a; font-weight: 700; }
.pg-no  { color: #cbd5e1; }
.pg-scope { color: #0369a1; font-weight: 600; font-size: .8rem; }
.pg-note { display: inline-block; margin-left: 4px; color: #b45309; font-size: .72rem; font-weight: 700; }
.pg-flagnotes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pg-flagnotes li { font-size: .82rem; color: #475569; }
