    :root {
      --bg: #0b0d12;
      --panel: #0f1320;
      --muted: #9aa3af;
      --text: #e5e7eb;
      --brand: #60a5fa;
      --accent: #22d3ee;
      --warn: #f59e0b;
      --danger: #f87171;
      --ok: #34d399;
      --border: #1f2636;
      --card: #0f1423;
      --chip: #182032;
      --input: #0e1220;
      --focus: #2563eb;
    }

    * {
      box-sizing: border-box
    }

    html,
    body {
      height: 100%
    }

    body {
      margin: 0;
      background: linear-gradient(180deg, #0b0d12, #0a0f1c 40%, #0b0d12);
      color: var(--text);
      font: 14px/1.6 system-ui, -apple-system, Segoe UI, Roboto, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif
    }

    a {
      color: var(--brand);
      text-decoration: none
    }

    a:hover {
      text-decoration: underline
    }

    /* Layout */
    .app {
      display: grid;
      grid-template-columns: 260px 1fr;
      grid-template-rows: 56px 1fr;
      grid-template-areas: "sidebar header" "sidebar main";
      height: 100%
    }

    header {
      grid-area: header;
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 16px;
      border-bottom: 1px solid var(--border);
      background: rgba(15, 20, 35, .6);
      backdrop-filter: blur(6px);
      position: sticky;
      top: 0;
      z-index: 10
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      font-weight: 700
    }

    .brand .logo {
      width: 24px;
      height: 24px;
      border-radius: 6px;
      background: linear-gradient(135deg, var(--brand), var(--accent));
      box-shadow: 0 0 0 2px #ffffff12 inset
    }

    .grow {
      flex: 1
    }

    aside {
      grid-area: sidebar;
      border-right: 1px solid var(--border);
      background: radial-gradient(1200px 400px at -200px -200px, #0f1a33, #0e1220 40%, #0b0d12 70%);
      padding: 14px 10px;
      overflow: auto
    }

    .nav h4 {
      margin: 8px 10px;
      color: #c7d2fe;
      font-size: .88rem;
      letter-spacing: .04em
    }

    .nav a {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 10px;
      color: var(--text)
    }

    .nav a:hover {
      background: #ffffff10
    }

    .nav a.active {
      background: linear-gradient(180deg, #111a2b, #0d1424);
      outline: 1px solid #ffffff14
    }

    .nav .icon {
      width: 18px;
      height: 18px;
      opacity: .9
    }

    main {
      grid-area: main;
      overflow: auto
    }

    .container {
      padding: 16px 18px 28px;
      max-width: 1200px
    }

    .panel {
      background: linear-gradient(180deg, #0e1422, #0d1322);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 14px
    }

    .panel+.panel {
      margin-top: 14px
    }

    .row {
      display: flex;
      gap: 12px;
      flex-wrap: wrap
    }

    .col {
      flex: 1;
      min-width: 260px
    }

    /* Controls */
    label {
      display: block;
      font-size: .88rem;
      color: var(--muted);
      margin-bottom: 6px
    }

    input[type="text"],
    input[type="number"],
    input[type="time"],
    input[type="date"],
    input[type="file"],
    select {
      width: 100%;
      padding: 10px 12px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--input);
      color: var(--text);
      outline: none
    }

    input:focus,
    select:focus,
    textarea:focus {
      border-color: #294bff99;
      box-shadow: 0 0 0 3px #1f3cff33
    }

    textarea {
      width: 100%;
      min-height: 100px;
      padding: 10px 12px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--input);
      color: var(--text)
    }

    .btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 9px 12px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: linear-gradient(180deg, #12182a, #0e1424);
      color: var(--text);
      cursor: pointer
    }

    .btn:hover {
      filter: brightness(1.08)
    }

    .btn.primary {
      background: linear-gradient(180deg, #1a2a55, #132042);
      border-color: #2a3a66;
      color: #eaf2ff
    }

    .btn.ghost {
      background: transparent
    }

    .btn.warn {
      background: linear-gradient(180deg, #45320b, #2a1f0a);
      border-color: #7a5b12;
      color: #ffe9b6
    }

    .btn.danger {
      background: linear-gradient(180deg, #3a1215, #250b0d);
      border-color: #5e1d23;
      color: #ffd7db
    }

    .btn.sm {
      padding: 6px 9px;
      border-radius: 8px;
      font-size: .92rem
    }

    .chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: var(--chip);
      border: 1px solid var(--border);
      border-radius: 999px;
      padding: 4px 8px;
      font-size: .85rem;
      color: #d1d5db
    }

    table {
      width: 100%;
      border-collapse: collapse;
      border: 1px solid var(--border);
      overflow: hidden;
      border-radius: 12px
    }

    th,
    td {
      border-bottom: 1px solid var(--border);
      padding: 10px 12px;
      text-align: left
    }

    th {
      background: #0f1628;
      color: #cbd5e1;
      font-weight: 600
    }

    tr:hover td {
      background: #0e1423
    }

    td.editable[role="button"] {
      cursor: pointer;
    }

    .calendar {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 8px
    }

    /* ---- Calendar responsive columns ---- */
    /* PC: 7列 / タブレット: 4列 / スマホ: 2 → 1列 */
    @media (max-width: 1200px) {
      .calendar {
        grid-template-columns: repeat(4, 1fr);
      }
    }

    @media (max-width: 880px) {
      .calendar {
        grid-template-columns: repeat(2, 1fr);
      }
    }

    @media (max-width: 520px) {
      .calendar {
        grid-template-columns: 1fr;
        gap: 10px;
      }

      .day {
        min-height: auto;
        padding: 10px;
      }

      .day .actions {
        flex-wrap: wrap;
      }

      .day .actions .btn {
        flex: 1 1 calc(50% - 6px);
        /* 2列で並べる */
        min-width: 140px;
      }

      .day .date .right {
        float: none;
        margin-left: 6px;
      }
    }

    .day {
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 8px 8px 12px;
      background: var(--card);
      min-height: 108px;
      display: flex;
      flex-direction: column
    }

    .day .date {
      font-weight: 700
    }

    .day .meta {
      margin-top: auto;
      color: var(--muted);
      font-size: .85rem
    }

    .day.holiday {
      outline: 1px solid #fca5a5aa;
      box-shadow: 0 0 0 3px #ef44441a inset
    }

    .day.today {
      outline: 1px solid #60a5faaa
    }

    .day .actions {
      display: flex;
      gap: 6px;
      margin-top: 8px
    }

    .toolbar {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap
    }

    .spacer {
      flex: 1
    }

    dialog {
      border: none;
      border-radius: 14px;
      padding: 0;
      background: #0c1222;
      color: var(--text);
      width: min(720px, 96vw)
    }

    dialog::backdrop {
      background: rgb(0 0 0 / .5)
    }

    .modal-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--border);
      padding: 12px 14px
    }

    .modal-body {
      padding: 14px
    }

    .modal-foot {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
      border-top: 1px solid var(--border);
      padding: 12px 14px
    }

    .kpi {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 10px;
      margin-top: 15px
    }

    .kpi .card {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 12px
    }

    .kpi .title {
      color: var(--muted);
      font-size: .9rem
    }

    .kpi .value {
      font-size: 1.3rem;
      font-weight: 700
    }

    .doW {
      display: flex;
      gap: 6px;
      flex-wrap: wrap
    }

    .doW label {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: var(--chip);
      border: 1px solid var(--border);
      border-radius: 999px;
      padding: 6px 10px;
      color: #d1d5db
    }

    .doW input {
      accent-color: #60a5fa
    }

    .help {
      color: var(--muted);
      font-size: .9rem
    }

    .empty {
      color: var(--muted);
      padding: 16px;
      text-align: center
    }

    .badge {
      display: inline-flex;
      align-items: center;
      background: #1c253e;
      border: 1px solid #2a3659;
      border-radius: 999px;
      padding: 2px 8px;
      font-size: .82rem;
      color: #c7d2fe
    }

    .switch {
      display: inline-flex;
      align-items: center;
      gap: 8px
    }

    .switch input {
      accent-color: var(--brand)
    }

    .notice {
      border: 1px solid #334155;
      background: #0b1222;
      padding: 10px 12px;
      border-radius: 12px;
      color: #cbd5e1
    }

    .right {
      float: right
    }

    /* Accordion (非表示スタッフ) */
    .accordion {
      margin-top: 10px;
      border: 1px solid var(--border);
      border-radius: 12px;
      overflow: hidden
    }

    .acc-head {
      background: #0f1628;
      padding: 10px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      cursor: pointer
    }

    .acc-body {
      max-height: 0;
      overflow: hidden;
      transition: max-height .25s ease
    }

    .accordion.open .acc-body {
      max-height: 480px
    }

    /* 画像プレビュー */
    .avatar {
      width: 40px;
      height: 40px;
      border-radius: 8px;
      background: #111;
      object-fit: cover;
      border: 1px solid #1f2636
    }

    /* モバイル：オフキャンバスメニュー */
    .menu-btn {
      display: none;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: linear-gradient(180deg, #12182a, #0e1424);
      color: var(--text);
      cursor: pointer;
      font-size: 18px
    }

    .scrim {
      position: fixed;
      inset: 0;
      background: rgb(0 0 0 / .5);
      opacity: 0;
      visibility: hidden;
      transition: opacity .2s ease;
      z-index: 15
    }

    @media (max-width:880px) {
      .app {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas: "header" "main"
      }

      aside {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        width: min(82vw, 320px);
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 20;
        display: block;
        border-right: 1px solid var(--border);
        background: radial-gradient(1200px 400px at -200px -200px, #0f1a33, #0e1220 40%, #0b0d12 70%);
        padding: 14px 10px;
        overflow: auto
      }

      .app.aside-open aside {
        transform: translateX(0)
      }

      .app.aside-open .scrim {
        opacity: 1;
        visibility: visible
      }

      header .menu-btn {
        display: inline-flex
      }
    }

    /* === STAFF 並び替え（DnD）最小スタイル ===================== */

    /* ハンドル（⋮⋮）を掴みやすく */
    .drag-handle {
      width: 28px;
      text-align: center;
      cursor: grab;
      user-select: none;
      -webkit-user-select: none;
      touch-action: none;
      color: #9aa0a6;
      /* うっすらグレー */
      font-weight: 600;
      font-size: 16px;
      line-height: 1;
      padding: 6px 0;
    }

    .drag-handle:hover {
      color: #6b7280;
    }

    /* hoverで少し濃く */
    .drag-handle:active {
      cursor: grabbing;
    }

    /* 行の視覚効果（ドラッグ中は半透明＆薄い強調背景） */
    #staffT tr[data-id] {
      transition: background-color .12s ease, opacity .12s ease;
    }

    #staffT tr.dragging {
      opacity: .55;
      background: rgba(59, 130, 246, .08);
      /* ごく薄い青 (fallback可) */
    }

    /* ついでにフォーカス見やすく（Enter/Spaceでファイルピッカー等の操作も想定） */
    #staffT .drag-handle:focus {
      outline: 2px solid var(--color-primary, #3b82f6);
      outline-offset: 2px;
      border-radius: 6px;
    }

    /* テーブルの見栄え微調整（任意） */
    #staffT td {
      vertical-align: middle;
    }

    #staffT img.avatar {
      vertical-align: middle;
    }

    #staffT tr.drop-before {
      box-shadow: inset 0 2px 0 var(--color-primary, #3b82f6);
    }


    /* --- ヘッダーのスタッフピッカー（PC用・見切れ対策） --- */
    #staffPickerBtn {
      max-width: 260px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }


    /* PC専用：スタッフ選択ボタンを“セレクト風”に & でかい∨ */
    @media (min-width: 881px) {
      #staffPickerBtn {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 8px;

        /* 見やすさ／幅 */
        font-size: 1rem;
        /* ←文字を少し大きく */
        height: 40px;
        /* ←背を高く */
        padding: 0 40px 0 14px;
        /* 右は∨ぶんの余白を確保 */
        min-width: 260px;
        /* ←幅を広げる（お好みで 260–420px 程度） */
        max-width: 420px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      /* 右端の∨（擬似要素） */
      #staffPickerBtn::after {
        content: "▾";
        /* or "∨" / "⌄" */
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 18px;
        /* ←∨を大きく */
        line-height: 1;
        opacity: .9;
        pointer-events: none;
        /* クリックを邪魔しない */
      }

      /* メニュー展開中は∨を反転（アクセント） */
      #staffPickerBtn[aria-expanded="true"]::after {
        transform: translateY(-50%) rotate(180deg);
      }
    }

    .picker-menu {
      position: fixed;
      /* ビューポート固定＝見切れ/クリッピング回避 */
      z-index: 1000;
      min-width: 220px;
      max-width: 320px;
      max-height: 60vh;
      overflow: auto;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
    }

    .picker-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 10px;
      cursor: pointer;
    }

    .picker-item:hover,
    .picker-item[aria-selected="true"] {
      background: #ffffff12;
    }

    .picker-item img {
      width: 24px;
      height: 24px;
      border-radius: 6px;
      object-fit: cover;
      border: 1px solid var(--border);
    }

    /* 画面幅で切替：PCはボタン、モバイルはネイティブselect */
    @media (min-width: 881px) {
      #staffSelect.nativeStaffSelect {
        display: none;
      }
    }

    @media (max-width: 880px) {
      #staffPickerBtn {
        display: none;
      }

      #staffSelect.nativeStaffSelect {
        display: inline-block;
      }
    }

    /* パネル内の固定ツールバー */
    .panel .toolbar.sticky {
      position: sticky;
      top: 0;
      /* パネルのスクロール先頭に張り付く */
      z-index: 6;
      /* テーブル見出し(th)より前面 */
      background: linear-gradient(180deg, #0e1422, #0d1322);
      box-shadow: 0 1px 0 0 var(--border);
      /* 下境界の線 */
    }

    /* sticky thead（ツールバーの高さ分ずらす）*/
    .panel {
      --toolbar-h: 48px;
      position: relative;
    }

    .table-sticky {
      border-collapse: separate;
      border-spacing: 0;
      overflow: visible;
      /* ← グローバルの overflow:hidden を打ち消す */
    }

    .table-sticky thead th {
      position: sticky;
      top: var(--toolbar-h);
      z-index: 5;
      /* ツールバー <6> より下、tbodyより上 */
      background: #0f1628;
    }

    /* 角丸と罫線が綺麗に見えるよう微調整 */
    .table-sticky thead th:first-child {
      border-top-left-radius: 12px;
    }

    .table-sticky thead th:last-child {
      border-top-right-radius: 12px;
    }

    /* トースト通知：常に画面中央（PC/スマホ共通） */
    #toast {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      /* 縦横センター */
      margin: 0;
      box-sizing: border-box;

      /* はみ出し防止（左右に12pxずつの安全余白想定） */
      max-width: min(520px, calc(100vw - 24px));
      width: max-content;
      /* 内容に応じて広がるが上限あり */

      /* 右余白は × ボタン分 */
      padding: 10px 36px 10px 12px;
      border-radius: 10px;
      /* 任意の見た目 */
    }

    /* スマホでも中央のまま、横幅だけ画面に合わせる */
    @media (max-width: 480px) {
      #toast {
        width: calc(100vw - 24px);
        /* 画面幅−左右12px */
        max-width: none;
      }
    }

    /* 強制折返し（長い英数やURLでもはみ出さない） */
    #toast #toastMsg {
      white-space: normal;
      overflow-wrap: anywhere;
    }

    /* 閉じるボタン：控えめ（小さめ、半透明、影なし） */
    #toast .toast-close {
      position: absolute;
      top: 6px;
      right: 8px;
      width: 22px;
      height: 22px;
      display: flex;
      align-items: center;
      justify-content: center;

      background: transparent;
      border: none;
      cursor: pointer;

      color: rgba(255, 255, 255, .8);
      /* 白だけど少し控えめ */
      font-size: 16px;
      font-weight: 600;
      line-height: 1;
      z-index: 2;
    }

    #toast .toast-close:hover {
      background: rgba(255, 255, 255, .08);
      border-radius: 6px;
    }

    #toast .toast-close:focus {
      outline: 2px solid rgba(255, 255, 255, .6);
      outline-offset: 2px;
    }

    /* 背景を暗くしない */
    #toast::backdrop {
      background: transparent;
    }

    /* ブルー・メタリック調ボタン */
    .btn-metal {
      background: linear-gradient(180deg, #61b0ff 0%, #228aff 60%, #0f5fe0 100%);
      border: 1px solid #1b5bd6;
      color: #fff;
      text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 8px rgba(0, 0, 0, .18);
      border-radius: 10px;
      padding: 10px 16px;
      font-weight: 700;
      cursor: pointer;
    }

    .btn-metal:hover {
      filter: brightness(1.05);
    }

    .btn-metal:active {
      transform: translateY(1px);
      box-shadow: inset 0 2px 6px rgba(0, 0, 0, .25);
    }

    .btn-metal:disabled {
      opacity: .6;
      cursor: default;
      transform: none;
    }