    /* ── Reset & Base ─────────────────────────── */
    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: 'Inter', 'Noto Sans TC', system-ui, -apple-system, 'Segoe UI', sans-serif;
      font-size: 14px;
      color: #111827;
      background: linear-gradient(135deg, #e8ecf4 0%, #f0f2f5 40%, #e5e9f0 100%);
      min-height: 100vh;
    }

    button {
      cursor: pointer;
      font-family: inherit;
      font-size: inherit;
      border: none;
      background: none;
    }

    input,
    select {
      font-family: inherit;
      font-size: inherit;
    }

    .hidden {
      display: none !important;
    }

    /* ── CSS Variables ────────────────────────── */
    :root {
      --nav-bg: #1e3a5f;
      --nav-active: #2563eb;
      --table-header-bg: #f3f4f6;
      --weekend-bg: #fff1f2;
      --data-cell-bg: #eff6ff;
      --data-cell-text: #1d4ed8;
      --slot-sep: #cbd5e1;
      --label-col-w: 80px;
      --date-col-min: 46px;
      --row-h: 26px;
      --table-fs: 12px;
      --modal-w: 380px;
      --modal-r: 16px;
      --toast-ok-bg: #d1fae5;
      --toast-ok-text: #065f46;
      --toast-err-bg: #fee2e2;
      --toast-err-text: #991b1b;
      --toast-warn-bg: #fef3c7;
      --toast-warn-text: #92400e;
    }

    /* ── Navbar ───────────────────────────────── */
    #navbar {
      background: linear-gradient(135deg, #0f2b4a 0%, #1e3a5f 60%, #1a3358 100%);
      display: flex;
      align-items: center;
      padding: 0 24px;
      height: 56px;
      gap: 4px;
      position: sticky;
      top: 0;
      z-index: 100;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.15);
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .nav-brand {
      color: #fff;
      font-weight: 700;
      font-size: 15px;
      margin-right: 20px;
      white-space: nowrap;
      letter-spacing: 0.02em;
    }

    .nav-tab {
      color: rgba(255, 255, 255, 0.72);
      padding: 8px 18px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 600;
      transition: all 0.2s ease;
      white-space: nowrap;
      letter-spacing: 0.02em;
      position: relative;
    }

    .nav-tab:hover {
      background: rgba(255, 255, 255, 0.12);
      color: #fff;
      transform: translateY(-1px);
    }

    .nav-tab.active {
      background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
      color: #fff;
      box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
    }

    /* ── Page Layout ──────────────────────────── */
    .page {
      padding: 24px;
      max-width: 100%;
      animation: pageIn 0.3s ease-out;
    }

    @keyframes pageIn {
      from {
        opacity: 0;
        transform: translateY(8px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* ── Leave Page ───────────────────────────── */
    .leave-header {
      display: flex;
      align-items: flex-start;
      gap: 16px;
      margin-bottom: 20px;
      flex-wrap: wrap;
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.88));
      backdrop-filter: blur(12px);
      border-radius: 14px;
      padding: 18px 24px;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.8);
      position: relative;
      overflow: hidden;
    }

    .leave-header::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: linear-gradient(90deg, #2563eb, #7c3aed, #2563eb);
      background-size: 200% 100%;
      animation: shimmer 3s ease infinite;
    }

    @keyframes shimmer {

      0%,
      100% {
        background-position: 0% 0;
      }

      50% {
        background-position: 100% 0;
      }
    }

    .leave-title {
      font-size: 18px;
      font-weight: 800;
      color: #0f2b4a;
      line-height: 1.3;
      letter-spacing: -0.01em;
    }

    .leave-cycle-text {
      font-size: 12px;
      color: #6b7280;
      margin-top: 4px;
      font-weight: 500;
    }

    .month-nav {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-left: auto;
      align-self: center;
    }

    .month-nav-btn {
      padding: 6px 16px;
      border: 1.5px solid #d1d5db;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 600;
      background: linear-gradient(135deg, #fff, #f9fafb);
      color: #374151;
      transition: all 0.2s ease;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }

    .month-nav-btn:hover {
      background: linear-gradient(135deg, #eff6ff, #dbeafe);
      border-color: #93c5fd;
      color: #1d4ed8;
      transform: translateY(-1px);
      box-shadow: 0 3px 8px rgba(37, 99, 235, 0.12);
    }

    /* ── Leave Table Container ────────────────── */
    #leave-table-wrap {
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.95));
      border-radius: 14px;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
      overflow: clip;
      border: 1px solid rgba(0, 0, 0, 0.04);
    }

    #leave-table-container {
      overflow-x: auto;
      overflow-y: visible;
    }

    /* ── Leave Table ──────────────────────────── */
    #leave-table {
      border-collapse: collapse;
      table-layout: fixed;
      font-size: var(--table-fs);
      white-space: nowrap;
      min-width: 100%;
    }

    #leave-table th {
      background: linear-gradient(180deg, #edf1f9 0%, #e2e8f4 100%);
      border-right: 1px solid #cdd5e4;
      border-bottom: 2px solid #b8c6df;
      padding: 0 2px;
      font-weight: 700;
      text-align: center;
      position: sticky;
      top: 0;
      z-index: 3;
      user-select: none;
      box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    #leave-table th.label-col {
      width: var(--label-col-w);
      min-width: var(--label-col-w);
      left: 0;
      z-index: 4;
      background: linear-gradient(180deg, #d8e0ef 0%, #ccd5e8 100%);
      border-right: 2px solid #b0bdd6;
    }

    #leave-table th.date-col {
      min-width: var(--date-col-min);
      width: var(--date-col-min);
      line-height: 1.25;
      padding: 5px 2px;
      font-size: 11px;
    }

    #leave-table th.weekend-col {
      background: #f5dde0;
    }

    #leave-table th.today-col {
      background: #1e40af !important;
      color: #fff;
    }

    /* Table body cells */
    #leave-table td {
      border-right: 1px solid #e5e9f0;
      border-bottom: 1px solid #e5e9f0;
      height: var(--row-h);
      padding: 0 3px;
      text-align: center;
      vertical-align: middle;
      overflow: hidden;
      text-overflow: ellipsis;
      background: #fff;
    }

    #leave-table td.label-col {
      width: var(--label-col-w);
      min-width: var(--label-col-w);
      position: sticky;
      left: 0;
      background: #f1f5fb;
      z-index: 2;
      text-align: center;
      font-weight: 700;
      color: #374151;
      padding: 0 4px;
      font-size: 11px;
      letter-spacing: 0.03em;
      border-right: 2px solid #c0cade;
    }

    #leave-table td.weekend-col {
      background: #fef6f7;
    }

    #leave-table td.today-col {
      border-left: 2px solid #3b82f6;
      border-right: 2px solid #3b82f6;
    }

    #leave-table td.today-col:not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy):not(.incomplete) {
      background: #eff6ff;
    }

    #leave-table td.today-col.weekend-col:not(.data-emp):not(.data-shift-colored):not(.data-leave-colored) {
      background: #fef6f7;
    }

    /* Filled data cells */
    #leave-table td.data-emp {
      font-weight: 700;
      font-size: 12px;
      color: #1a1a2e;
      text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.06);
    }

    #leave-table td.data-field {
      background: var(--data-cell-bg);
      color: var(--data-cell-text);
      font-weight: 600;
      font-size: 11px;
    }

    #leave-table td.data-shift-colored {
      font-weight: 700;
      font-size: 11px;
      border-radius: 0;
    }

    #leave-table td.data-leave-colored {
      font-weight: 700;
      font-size: 11px;
      border-radius: 0;
    }

    #leave-table td.data-proxy {
      background: #f0fdf4;
      color: #166534;
      font-size: 11px;
      font-weight: 600;
    }

    #leave-table td.data-no-proxy {
      background: #f9fafb;
      color: #9ca3af;
      font-size: 10px;
      font-style: italic;
    }

    /* ── Slot background tinting (each slot = one leave record) ── */
    /* Slot 0: subtle indigo tint */
    #leave-table tbody tr[data-slot="0"] td:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy) {
      background: #f5f3ff;
    }

    #leave-table tbody tr[data-slot="0"] td.weekend-col:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy) {
      background: #ede9fe;
    }

    /* Slot 1: subtle sky-blue tint */
    #leave-table tbody tr[data-slot="1"] td:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy) {
      background: #f0f9ff;
    }

    #leave-table tbody tr[data-slot="1"] td.weekend-col:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy) {
      background: #e0f2fe;
    }

    /* Slot 2: subtle emerald tint */
    #leave-table tbody tr[data-slot="2"] td:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy) {
      background: #f0fdf4;
    }

    #leave-table tbody tr[data-slot="2"] td.weekend-col:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy) {
      background: #dcfce7;
    }

    /* Slot label accent bars — thicker & more vivid */
    #leave-table td.label-col[data-slot="0"] {
      border-left: 4px solid #6366f1;
      background: linear-gradient(90deg, #eef2ff 0%, #f5f3ff 100%);
      color: #4338ca;
    }

    #leave-table td.label-col[data-slot="1"] {
      border-left: 4px solid #0ea5e9;
      background: linear-gradient(90deg, #e0f4ff 0%, #f0f9ff 100%);
      color: #0369a1;
    }

    #leave-table td.label-col[data-slot="2"] {
      border-left: 4px solid #10b981;
      background: linear-gradient(90deg, #e6faf3 0%, #f0fdf4 100%);
      color: #047857;
    }

    /* Bottom border on row-4 (proxy_lower) = end of a slot group */
    #leave-table tbody tr[data-slot="0"][data-row-end] td,
    #leave-table tbody tr[data-slot="1"][data-row-end] td,
    #leave-table tbody tr[data-slot="2"][data-row-end] td {
      border-bottom: 2px solid rgba(0, 0, 0, 0.12);
    }

    /* Slot separator row — bold coloured divider between cards */
    #leave-table tr.slot-sep td {
      border-top: 0;
      background: #e2e8f0 !important;
      height: 5px;
      padding: 0;
      box-shadow: inset 0 2px 0 #64748b;
    }

    #leave-table tr.slot-sep td.label-col {
      background: #d1dae8 !important;
      box-shadow: inset 0 2px 0 #64748b;
    }

    /* Slot 1 separator: sky accent (slot-after=1) */
    #leave-table tr.slot-sep[data-slot-after="1"] td {
      background: #dbeafe !important;
      box-shadow: inset 0 2px 0 #0ea5e9;
    }

    #leave-table tr.slot-sep[data-slot-after="1"] td.label-col {
      background: #bfdbfe !important;
      box-shadow: inset 0 2px 0 #0ea5e9;
    }

    /* Slot 2 separator: emerald accent (slot-after=2) */
    #leave-table tr.slot-sep[data-slot-after="2"] td {
      background: #d1fae5 !important;
      box-shadow: inset 0 2px 0 #10b981;
    }

    #leave-table tr.slot-sep[data-slot-after="2"] td.label-col {
      background: #a7f3d0 !important;
      box-shadow: inset 0 2px 0 #10b981;
    }

    /* Short leave row */
    #leave-table tr.short-sep td {
      height: 0;
      padding: 0;
      border: none;
      background: transparent !important;
    }

    #leave-table tr.short-sep td.label-col {
      background: transparent !important;
      border: none;
    }

    #leave-table tr.short-row td {
      background: #faf5ff;
      height: auto;
      min-height: 30px;
      padding: 4px 3px;
      border-top: 2px dashed #c4b5fd;
    }

    #leave-table tr.short-row td.label-col {
      background: linear-gradient(90deg, #f3e8ff 0%, #faf5ff 100%);
      border-left: 4px solid #7c3aed;
      border-top: 2px dashed #c4b5fd;
      font-size: 11px;
      font-weight: 700;
      color: #6d28d9;
      letter-spacing: 0.03em;
    }

    .short-chips-cell {
      display: flex;
      flex-wrap: wrap;
      gap: 3px;
      justify-content: center;
      align-items: center;
    }

    .short-chip {
      display: inline-flex;
      flex-direction: column;
      align-items: center;
      gap: 1px;
      padding: 2px 5px;
      border-radius: 8px;
      font-size: 10px;
      font-weight: 700;
      cursor: pointer;
      white-space: nowrap;
      border: 1px solid rgba(0, 0, 0, 0.08);
      line-height: 1.3;
      max-width: 44px;
      overflow: hidden;
    }

    .short-chip .chip-name {
      font-size: 10px;
      font-weight: 700;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
    }

    .short-chip .chip-type {
      font-size: 9px;
      font-weight: 600;
      opacity: 0.85;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
    }

    .short-chip:hover {
      opacity: 0.82;
    }

    .short-add-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: #ede9fe;
      color: #7c3aed;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      border: 1px dashed #7c3aed;
      transition: background 0.15s;
    }

    .short-add-btn:hover {
      background: #ddd6fe;
    }

    /* Clickable cells */
    #leave-table td.clickable {
      cursor: pointer;
    }

    #leave-table td.clickable:hover {
      outline: 2px solid #93c5fd;
      outline-offset: -2px;
      z-index: 1;
      position: relative;
    }

    /* Incomplete / unfilled required field */
    #leave-table td.incomplete {
      color: #f97316;
      font-size: 10px;
      font-style: italic;
      cursor: pointer;
    }

    #leave-table td.incomplete:hover {
      background: #fff7ed;
      outline: 2px solid #fb923c;
      outline-offset: -2px;
    }

    /* ── View Switcher Bar ────────────────────── */
    .leave-view-bar {
      display: flex;
      gap: 4px;
      margin-bottom: 16px;
      background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.88));
      border-radius: 10px;
      padding: 6px;
      box-shadow: 0 1px 6px rgba(0,0,0,0.04);
      border: 1px solid #e0e7ff;
    }
    .lv-view-btn {
      padding: 8px 20px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 600;
      color: #64748b;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .lv-view-btn:hover { background: #f0f4ff; color: #4338ca; }
    .lv-view-btn.active {
      background: linear-gradient(135deg, #4338ca, #6366f1);
      color: #fff;
      box-shadow: 0 2px 10px rgba(67,56,202,0.3);
    }
    .leave-view-panel { animation: pageIn 0.25s ease-out; }

    /* ── Section Labels (vertical left headers) ── */
    #leave-table th.section-col {
      width: 36px;
      min-width: 36px;
      background: linear-gradient(180deg, #0f2b4a 0%, #1e3a5f 100%);
      border-right: 2px solid rgba(255,255,255,0.1);
      position: sticky;
      left: 0;
      z-index: 5;
    }
    #leave-table td.section-label {
      width: 36px;
      min-width: 36px;
      position: sticky;
      left: 0;
      z-index: 3;
      text-align: center;
      vertical-align: middle;
      padding: 8px 4px;
      border-right: 2px solid rgba(0,0,0,0.08);
      writing-mode: vertical-rl;
      text-orientation: upright;
      letter-spacing: 0.15em;
    }
    #leave-table td.section-label .section-label-text {
      writing-mode: vertical-rl;
      text-orientation: upright;
      font-weight: 800;
      font-size: 13px;
      letter-spacing: 0.2em;
      line-height: 1;
    }
    #leave-table td.section-label .section-label-sub {
      writing-mode: vertical-rl;
      text-orientation: upright;
      font-size: 9px;
      font-weight: 600;
      margin-top: 6px;
      opacity: 0.65;
      letter-spacing: 0.05em;
      line-height: 1;
    }
    #leave-table td.section-proxy {
      background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
      color: #92400e;
      border-right: 3px solid #f59e0b;
    }
    #leave-table td.section-noproxy {
      background: linear-gradient(180deg, #ede9fe 0%, #ddd6fe 100%);
      color: #5b21b6;
      border-right: 3px solid #7c3aed;
      border-top: 2px solid #7c3aed;
    }

    /* Adjust label-col sticky left for the section column */
    #leave-table th.label-col {
      left: 36px;
    }
    #leave-table td.label-col {
      left: 36px;
    }

    /* ── Calendar View ────────────────────────── */
    .lv-cal-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 2px;
      background: #e0e7ff;
      border-radius: 14px;
      overflow: hidden;
      box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    }
    .lv-cal-head {
      background: linear-gradient(180deg, #1e3a5f, #162c47);
      color: #fff;
      font-weight: 700;
      font-size: 13px;
      text-align: center;
      padding: 10px 4px;
    }
    .lv-cal-head.lv-cal-wk { background: #3d1a2e; }
    .lv-cal-cell {
      background: #fff;
      min-height: 90px;
      padding: 6px;
      position: relative;
      cursor: default;
      transition: background 0.15s;
    }
    .lv-cal-cell:hover { background: #f5f7ff; }
    .lv-cal-cell.lv-cal-wk { background: #fdf8f9; }
    .lv-cal-cell.lv-cal-today {
      background: #eff6ff;
      box-shadow: inset 0 3px 0 #2563eb;
    }
    .lv-cal-cell.lv-cal-other { background: #f8fafc; opacity: 0.35; min-height: 40px; }
    .lv-cal-day { font-size: 14px; font-weight: 700; color: #374151; margin-bottom: 4px; }
    .lv-cal-cell.lv-cal-today .lv-cal-day { color: #1d4ed8; }
    .lv-cal-count {
      position: absolute; top: 6px; right: 6px;
      background: #ef4444; color: #fff;
      font-size: 9px; font-weight: 800;
      width: 18px; height: 18px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
    }
    .lv-cal-tags { display: flex; flex-direction: column; gap: 2px; }
    .lv-cal-tag {
      display: block;
      padding: 2px 6px;
      border-radius: 4px;
      font-size: 10px;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* ── List View ────────────────────────────── */
    .lv-list-bar {
      display: flex;
      gap: 8px;
      margin-bottom: 12px;
      flex-wrap: wrap;
    }
    .lv-list-bar select, .lv-list-bar input {
      padding: 8px 14px;
      border-radius: 8px;
      border: 1.5px solid #d1d5db;
      font-size: 12px;
      font-family: inherit;
      background: #fff;
      transition: border-color 0.2s;
    }
    .lv-list-bar select:focus, .lv-list-bar input:focus {
      border-color: #6366f1;
      outline: none;
      box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
    }
    .lv-list-tbl {
      width: 100%;
      border-collapse: collapse;
      background: #fff;
      border-radius: 14px;
      overflow: hidden;
      box-shadow: 0 2px 16px rgba(0,0,0,0.06);
      border: 1px solid rgba(0,0,0,0.04);
    }
    .lv-list-tbl th {
      background: linear-gradient(180deg, #f1f5f9, #e2e8f0);
      padding: 10px 12px;
      text-align: left;
      font-size: 12px;
      font-weight: 700;
      color: #475569;
      border-bottom: 2px solid #cbd5e1;
    }
    .lv-list-tbl td {
      padding: 10px 12px;
      font-size: 12px;
      border-bottom: 1px solid #f1f5f9;
    }
    .lv-list-tbl tr:hover td { background: #f5f7ff; }
    .lv-list-emp {
      display: inline-block;
      padding: 3px 10px;
      border-radius: 6px;
      font-weight: 700;
      font-size: 12px;
    }
    .lv-list-warn { color: #d97706; font-weight: 600; }
    .lv-list-status {
      display: inline-block;
      padding: 3px 12px;
      border-radius: 12px;
      font-size: 10px;
      font-weight: 700;
    }
    .lv-st-ok { background: #dcfce7; color: #166534; }
    .lv-st-warn { background: #fef3c7; color: #92400e; }
    .lv-st-pend { background: #f3f4f6; color: #6b7280; }

    /* Calendar legend */
    .lv-cal-legend {
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 12px;
      padding: 10px 16px;
      background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.88));
      border-radius: 10px;
      border: 1px solid #e0e7ff;
      box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    }
    .lv-cal-legend-title { font-size: 14px; font-weight: 800; color: #1e1b4b; }
    .lv-cal-legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: #475569; }
    .lv-cal-legend-dot { width: 10px; height: 10px; border-radius: 3px; }

    /* Calendar personal highlights */
    .lv-cal-cell.lv-cal-myleave { background: #fffbeb !important; box-shadow: inset 0 0 0 2px #f59e0b; }
    .lv-cal-cell.lv-cal-myproxy { background: #eff6ff !important; box-shadow: inset 0 0 0 2px #2563eb; }
    .lv-cal-cell.lv-cal-myleave.lv-cal-myproxy { box-shadow: inset 3px 0 0 #f59e0b, inset -3px 0 0 #2563eb; }

    .lv-cal-tag-leave {
      background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
      color: #92400e !important;
      font-weight: 700;
    }
    .lv-cal-tag-proxy {
      background: linear-gradient(135deg, #dbeafe, #bfdbfe) !important;
      color: #1e40af !important;
      font-weight: 700;
    }
    .lv-cal-tag-pending {
      border: 1.5px dashed #9ca3af;
    }

    .lv-cal-empty {
      text-align: center;
      padding: 30px 20px;
      color: #94a3b8;
      font-size: 14px;
      margin-top: 12px;
    }

    /* List view role badges */
    .lv-list-legend {
      font-size: 15px;
      font-weight: 800;
      color: #1e1b4b;
      margin-bottom: 12px;
      padding: 10px 16px;
      background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.88));
      border-radius: 10px;
      border: 1px solid #e0e7ff;
      box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    }
    .lv-list-role {
      display: inline-block;
      padding: 3px 10px;
      border-radius: 6px;
      font-weight: 700;
      font-size: 11px;
    }
    .lv-role-leave { background: #fef3c7; color: #92400e; }
    .lv-role-proxy { background: #dbeafe; color: #1e40af; }

    .lv-list-stats {
      display: flex;
      gap: 20px;
      margin-top: 12px;
      padding: 10px 16px;
      background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.88));
      border-radius: 10px;
      border: 1px solid #e0e7ff;
      font-size: 13px;
      color: #374151;
      font-weight: 500;
    }
    .lv-list-stats b { color: #1e1b4b; }
    .lv-list-stats-warn { color: #d97706; font-weight: 700; }

    /* ── Proxy Action Buttons (all views) ───── */
    .proxy-action-btns {
      display: inline-flex;
      gap: 2px;
      margin-left: 2px;
      vertical-align: middle;
    }
    .proxy-accept-btn, .proxy-reject-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 18px;
      height: 18px;
      border-radius: 4px;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
      border: none;
      transition: transform 0.1s, box-shadow 0.1s;
      line-height: 1;
    }
    .proxy-accept-btn {
      background: #dcfce7;
      color: #166534;
    }
    .proxy-accept-btn:hover {
      background: #bbf7d0;
      transform: scale(1.15);
      box-shadow: 0 2px 6px rgba(22,101,52,0.2);
    }
    .proxy-reject-btn {
      background: #fee2e2;
      color: #991b1b;
    }
    .proxy-reject-btn:hover {
      background: #fecaca;
      transform: scale(1.15);
      box-shadow: 0 2px 6px rgba(153,27,27,0.2);
    }

    /* Calendar view small action buttons */
    .proxy-accept-btn-sm, .proxy-reject-btn-sm {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 15px;
      height: 15px;
      border-radius: 3px;
      font-size: 9px;
      font-weight: 800;
      cursor: pointer;
      border: none;
      transition: transform 0.1s;
      margin-left: 2px;
      vertical-align: middle;
    }
    .proxy-accept-btn-sm { background: #dcfce7; color: #166534; }
    .proxy-accept-btn-sm:hover { background: #bbf7d0; transform: scale(1.2); }
    .proxy-reject-btn-sm { background: #fee2e2; color: #991b1b; }
    .proxy-reject-btn-sm:hover { background: #fecaca; transform: scale(1.2); }

    /* Calendar two-line tags */
    .lv-cal-tag {
      display: flex;
      flex-direction: column;
      gap: 1px;
      padding: 3px 6px;
    }
    .lv-cal-tag-line1 {
      font-size: 10px;
      font-weight: 700;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .lv-cal-tag-line2 {
      font-size: 9px;
      font-weight: 600;
      opacity: 0.8;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* List view actions column */
    .lv-list-actions {
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
    }
    .lv-list-actions .proxy-accept-btn,
    .lv-list-actions .proxy-reject-btn {
      width: auto;
      height: auto;
      padding: 3px 8px;
      font-size: 11px;
      border-radius: 6px;
      gap: 3px;
    }

    /* ── Cell Picker Popover ──────────────────── */
    .cell-popover {
      position: fixed;
      z-index: 600;
      background: #fff;
      border-radius: 12px;
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);
      border: 1px solid #e5e7eb;
      min-width: 260px;
      max-width: 340px;
      overflow: hidden;
      animation: cpIn 0.13s ease-out;
    }

    @keyframes cpIn {
      from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    .cp-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 9px 12px 7px;
      background: #f8fafc;
      border-bottom: 1px solid #f0f0f0;
    }

    .cp-title {
      font-size: 11px;
      font-weight: 700;
      color: #6b7280;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }

    .cp-close {
      font-size: 14px;
      color: #9ca3af;
      padding: 1px 5px;
      border-radius: 4px;
      line-height: 1;
    }

    .cp-close:hover {
      background: #e5e7eb;
      color: #374151;
    }

    .cp-body {
      padding: 10px 10px 8px;
    }

    .cp-group-label {
      font-size: 10px;
      font-weight: 700;
      color: #9ca3af;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      padding: 4px 2px 2px;
      margin-top: 4px;
      border-top: 1px solid #f3f4f6;
    }

    .cp-group-label:first-child {
      border-top: none;
      margin-top: 0;
    }

    .cp-group-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 4px;
      margin-bottom: 2px;
    }

    .cp-btn {
      padding: 7px 5px;
      border: 2px solid transparent;
      border-radius: 7px;
      font-size: 12px;
      font-weight: 600;
      text-align: center;
      cursor: pointer;
      transition: transform 0.08s, border-color 0.1s, opacity 0.1s;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .cp-btn:hover:not(:disabled) {
      transform: scale(1.04);
    }

    .cp-btn.cp-sel {
      border-color: #1d4ed8 !important;
      box-shadow: 0 0 0 1px #1d4ed8;
    }

    .cp-btn:disabled {
      opacity: 0.28;
      cursor: not-allowed;
      transform: none;
      text-decoration: line-through;
    }

    .cp-shift-btn {
      background: #dbeafe;
      color: #1e40af;
    }

    .cp-leave-btn {
      background: #d1fae5;
      color: #065f46;
    }

    .cp-none-btn {
      background: #f3f4f6;
      color: #374151;
    }

    .cp-none-btn.cp-sel {
      border-color: #6b7280 !important;
      box-shadow: 0 0 0 1px #6b7280;
    }

    .cp-clear-btn {
      background: #fff7ed;
      color: #c2410c;
      grid-column: span 2;
      font-size: 11px;
      border-radius: 6px;
      padding: 5px;
    }

    .cp-clear-btn:hover {
      background: #ffedd5;
    }

    .cp-footer {
      padding: 6px 10px 10px;
      border-top: 1px solid #f3f4f6;
    }

    .cp-del-btn {
      width: 100%;
      padding: 7px;
      background: #fee2e2;
      color: #991b1b;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
    }

    .cp-del-btn:hover {
      background: #fecaca;
    }

    /* Short leave picker extra */
    .cp-hours-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid #f3f4f6;
    }

    .cp-hours-label {
      font-size: 11px;
      color: #6b7280;
      font-weight: 600;
    }

    .cp-hours-input {
      width: 80px;
      padding: 5px 8px;
      border: 1.5px solid #d1d5db;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
      text-align: center;
      outline: none;
    }

    .cp-hours-input:focus {
      border-color: #7c3aed;
      box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
    }

    .cp-save-btn {
      padding: 6px 14px;
      background: #7c3aed;
      color: #fff;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
    }

    .cp-save-btn:hover {
      background: #6d28d9;
    }

    /* ── Modal (overtime + short leave) ──────── */
    #modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.45);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
    }

    #modal-box {
      background: #fff;
      width: var(--modal-w);
      max-width: 95vw;
      border-radius: var(--modal-r);
      max-height: 90vh;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 20px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    }

    .modal-title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-weight: 700;
      font-size: 15px;
      margin-bottom: 16px;
      color: #1e3a5f;
    }

    .modal-close {
      font-size: 20px;
      color: #9ca3af;
      padding: 2px 6px;
      border-radius: 4px;
    }

    .modal-close:hover {
      background: #f3f4f6;
      color: #374151;
    }

    .modal-footer {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 16px;
      padding-top: 12px;
      border-top: 1px solid #e5e7eb;
      align-items: center;
    }

    .btn-delete {
      margin-right: auto;
      background: #fee2e2;
      color: #991b1b;
      padding: 7px 14px;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
    }

    .btn-delete:hover {
      background: #fecaca;
    }

    .btn-cancel {
      background: #f3f4f6;
      color: #374151;
      padding: 7px 14px;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
    }

    .btn-cancel:hover {
      background: #e5e7eb;
    }

    .btn-confirm {
      background: var(--nav-active);
      color: #fff;
      padding: 7px 16px;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
    }

    .btn-confirm:hover {
      background: #1d4ed8;
    }

    .btn-confirm:disabled {
      background: #93c5fd;
      cursor: not-allowed;
    }

    .modal-error {
      color: #ef4444;
      font-size: 12px;
      margin-top: 6px;
      min-height: 16px;
      font-weight: 500;
    }

    /* ── Toast ────────────────────────────────── */
    #toast {
      position: fixed;
      bottom: 28px;
      left: 50%;
      transform: translateX(-50%);
      padding: 10px 24px;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 600;
      z-index: 2000;
      pointer-events: none;
      transition: opacity 0.3s;
      white-space: nowrap;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }

    #toast.ok {
      background: var(--toast-ok-bg);
      color: var(--toast-ok-text);
    }

    #toast.err {
      background: var(--toast-err-bg);
      color: var(--toast-err-text);
    }

    #toast.warn {
      background: var(--toast-warn-bg);
      color: var(--toast-warn-text);
    }

    /* ── Overtime Page ────────────────────────── */
    .ot-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 16px;
      flex-wrap: wrap;
      background: #fff;
      border-radius: 10px;
      padding: 14px 18px;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    }

    .ot-title {
      font-size: 16px;
      font-weight: 700;
      color: #1e3a5f;
    }

    .ot-summary {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 16px;
    }

    .ot-summary-chip {
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 20px;
      padding: 4px 14px;
      font-size: 12px;
      color: #374151;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    .ot-summary-chip.warn {
      background: #fff7ed;
      border-color: #f97316;
      color: #c2410c;
      font-weight: 600;
    }

    .ot-summary-chip.block {
      background: #fee2e2;
      border-color: #ef4444;
      color: #991b1b;
      font-weight: 600;
    }

    .ot-card {
      background: #fff;
      border-radius: 10px;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
      overflow: hidden;
    }

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

    .ot-table {
      border-collapse: collapse;
      width: 100%;
      font-size: 13px;
    }

    .ot-table th {
      background: #e8edf5;
      border: 1px solid #d1d9e6;
      padding: 7px 10px;
      text-align: center;
      font-weight: 700;
      font-size: 12px;
      white-space: nowrap;
    }

    .ot-table td {
      border: 1px solid #e5e7eb;
      padding: 6px 10px;
      vertical-align: middle;
      white-space: nowrap;
    }

    .ot-table tr:nth-child(even) td {
      background: #f9fafb;
    }

    .ot-table tr:hover td {
      background: #eff6ff;
    }

    .ot-table td.ot-empty {
      color: #9ca3af;
      font-style: italic;
    }

    .ot-btn {
      padding: 4px 11px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
    }

    .ot-btn-fill {
      background: #dbeafe;
      color: #1e40af;
    }

    .ot-btn-fill:hover {
      background: #bfdbfe;
    }

    .ot-btn-edit {
      background: #fef3c7;
      color: #92400e;
    }

    .ot-btn-edit:hover {
      background: #fde68a;
    }

    .ot-empty-state {
      text-align: center;
      padding: 48px;
      color: #9ca3af;
      font-size: 14px;
    }

    .ot-modal-info {
      background: #f3f4f6;
      border-radius: 8px;
      padding: 10px 14px;
      font-size: 13px;
      margin-bottom: 14px;
      line-height: 1.8;
      color: #374151;
    }

    .ot-modal-info strong {
      color: #1e3a5f;
    }

    .ot-field {
      margin-bottom: 12px;
    }

    .ot-field label {
      display: block;
      font-size: 12px;
      font-weight: 600;
      color: #374151;
      margin-bottom: 4px;
    }

    .ot-field input {
      width: 100%;
      padding: 7px 10px;
      border: 1px solid #d1d5db;
      border-radius: 6px;
      font-size: 14px;
      outline: none;
      transition: border-color 0.15s;
    }

    .ot-field input:focus {
      border-color: var(--nav-active);
    }

    .ot-comp-preview {
      background: #eff6ff;
      border: 1px solid #bfdbfe;
      border-radius: 6px;
      padding: 8px 14px;
      font-size: 13px;
      margin-bottom: 12px;
    }

    .ot-comp-preview span {
      font-weight: 700;
      color: #1d4ed8;
      font-size: 16px;
    }

    .ot-cap-warn {
      border-radius: 6px;
      padding: 8px 12px;
      font-size: 12px;
      font-weight: 600;
      margin-bottom: 8px;
    }

    .ot-cap-warn.warn {
      background: #fff7ed;
      color: #c2410c;
      border: 1px solid #fed7aa;
    }

    .ot-cap-warn.block {
      background: #fee2e2;
      color: #991b1b;
      border: 1px solid #fca5a5;
    }

    /* ── Admin Page ───────────────────────────── */
    .admin-card {
      background: #fff;
      border-radius: 10px;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
      padding: 20px;
    }

    .admin-tabs {
      display: flex;
      gap: 4px;
      border-bottom: 2px solid #e5e7eb;
      margin-bottom: 20px;
      flex-wrap: wrap;
    }

    .admin-tab-btn {
      padding: 8px 18px;
      font-size: 13px;
      font-weight: 600;
      color: #6b7280;
      border-bottom: 2px solid transparent;
      margin-bottom: -2px;
      border-radius: 4px 4px 0 0;
      transition: color 0.15s;
    }

    .admin-tab-btn:hover {
      color: #374151;
      background: #f3f4f6;
    }

    .admin-tab-btn.active {
      color: var(--nav-active);
      border-bottom-color: var(--nav-active);
    }

    .admin-section-title {
      font-size: 15px;
      font-weight: 700;
      color: #1e3a5f;
      margin-bottom: 16px;
    }

    .admin-list {
      list-style: none;
    }

    .admin-list-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
      border: 1px solid #e5e7eb;
      border-radius: 8px;
      margin-bottom: 6px;
      background: #fafafa;
      transition: background 0.1s;
    }

    .admin-list-item:hover {
      background: #f0f4ff;
    }

    .color-swatch {
      width: 20px;
      height: 20px;
      border-radius: 50%;
      border: 1px solid rgba(0, 0, 0, 0.1);
      flex-shrink: 0;
    }

    .item-name {
      flex: 1;
      font-weight: 500;
      color: #1f2937;
    }

    .item-code {
      background: #e5e7eb;
      border-radius: 4px;
      padding: 2px 8px;
      font-size: 11px;
      color: #374151;
      font-family: monospace;
      font-weight: 600;
    }

    .item-sub {
      font-size: 12px;
      color: #9ca3af;
    }

    .admin-order-btns {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .admin-order-btn {
      font-size: 10px;
      padding: 2px 6px;
      background: #e5e7eb;
      border-radius: 3px;
      color: #374151;
      line-height: 1.4;
    }

    .admin-order-btn:hover {
      background: #d1d5db;
    }

    .admin-order-btn:disabled {
      opacity: 0.3;
      cursor: default;
    }

    .admin-del-btn {
      padding: 4px 12px;
      background: #fee2e2;
      color: #991b1b;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
    }

    .admin-del-btn:hover {
      background: #fecaca;
    }

    .admin-add-row {
      display: flex;
      gap: 8px;
      margin-top: 14px;
      align-items: center;
      flex-wrap: wrap;
      padding-top: 14px;
      border-top: 1px solid #e5e7eb;
    }

    .admin-input {
      flex: 1;
      min-width: 120px;
      padding: 7px 10px;
      border: 1px solid #d1d5db;
      border-radius: 6px;
      font-size: 13px;
      outline: none;
      background: #fff;
    }

    .admin-input:focus {
      border-color: var(--nav-active);
    }

    .admin-add-btn {
      padding: 7px 18px;
      background: var(--nav-active);
      color: #fff;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
    }

    .admin-add-btn:hover {
      background: #1d4ed8;
    }

    /* ── Employee Info Table ─────────────────── */
    .info-table-wrap {
      overflow-x: auto;
    }

    .info-table {
      border-collapse: collapse;
      width: 100%;
      font-size: 13px;
    }

    .info-table th {
      background: #e8edf5;
      border: 1px solid #d1d9e6;
      padding: 8px 12px;
      text-align: left;
      font-weight: 700;
      font-size: 12px;
      white-space: nowrap;
    }

    .info-table td {
      border: 1px solid #e5e7eb;
      padding: 7px 12px;
      vertical-align: middle;
      white-space: nowrap;
    }

    .info-table tr:nth-child(even) td {
      background: #f9fafb;
    }

    .info-table tr:hover td {
      background: #eff6ff;
    }

    /* ── Groups / Drag-and-Drop ──────────────── */
    .grp-pool {
      background: #f8fafc;
      border: 2px dashed #d1d5db;
      border-radius: 10px;
      padding: 14px;
      margin-bottom: 18px;
      min-height: 60px;
      transition: border-color 0.2s, background 0.2s;
    }

    .grp-pool.drag-over {
      border-color: #93c5fd;
      background: #eff6ff;
    }

    .grp-pool-title {
      font-size: 12px;
      font-weight: 700;
      color: #6b7280;
      margin-bottom: 10px;
      letter-spacing: 0.05em;
    }

    .grp-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      min-height: 32px;
    }

    .grp-chip {
      padding: 5px 12px;
      border-radius: 16px;
      font-size: 12px;
      font-weight: 600;
      cursor: grab;
      user-select: none;
      transition: transform 0.1s, box-shadow 0.1s, opacity 0.15s;
      border: 2px solid rgba(0, 0, 0, 0.06);
      color: #1a1a2e;
      position: relative;
    }

    .grp-chip:hover {
      transform: scale(1.05);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    }

    .grp-chip.dragging {
      opacity: 0.4;
      transform: scale(0.95);
    }

    /* In-card chip: sortable within group */
    .grp-card-body .grp-chip {
      cursor: grab;
    }

    .grp-card-body .grp-chip.drag-over-top {
      border-top: 2px solid #2563eb;
    }

    .grp-card-body .grp-chip.drag-over-bot {
      border-bottom: 2px solid #2563eb;
    }

    .grp-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 12px;
      margin-bottom: 16px;
    }

    .grp-card {
      border-radius: 10px;
      border: 2px solid #e5e7eb;
      overflow: hidden;
      transition: border-color 0.2s, background 0.2s;
      background: #fff;
    }

    .grp-card.drag-over {
      border-color: #93c5fd;
      background: #f0f7ff;
    }

    .grp-card-header {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      font-weight: 700;
      font-size: 13px;
      color: #1f2937;
      border-bottom: 1px solid #e5e7eb;
      cursor: grab;
    }

    .grp-card-header:active {
      cursor: grabbing;
    }

    .grp-color-dot {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      border: 1px solid rgba(0, 0, 0, 0.1);
      flex-shrink: 0;
    }

    .grp-card-body {
      padding: 10px 12px;
      min-height: 50px;
    }

    .grp-card-body .grp-chips {
      flex-direction: column;
      align-items: stretch;
    }

    .grp-card-body .grp-chip {
      text-align: center;
    }

    .grp-empty-hint {
      color: #9ca3af;
      font-size: 11px;
      font-style: italic;
      padding: 8px 0;
      text-align: center;
    }

    .grp-card-actions {
      display: flex;
      gap: 4px;
      margin-left: auto;
    }

    .grp-card-action-btn {
      font-size: 11px;
      padding: 2px 8px;
      border-radius: 4px;
      color: #6b7280;
      background: #f3f4f6;
    }

    .grp-card-action-btn:hover {
      background: #e5e7eb;
      color: #374151;
    }

    .grp-card-action-btn.del:hover {
      background: #fee2e2;
      color: #991b1b;
    }

    .grp-add-row {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }

    /* Group card drag-to-reorder */
    .grp-card.grp-drag-over-left {
      border-left: 3px solid #2563eb;
    }

    .grp-card.grp-drag-over-right {
      border-right: 3px solid #2563eb;
    }

    .grp-card.grp-reordering {
      opacity: 0.45;
      box-shadow: none;
    }

    /* ── Types table (假別/班別) ─────────────── */
    .types-table {
      border-collapse: collapse;
      width: 100%;
      font-size: 13px;
    }

    .types-table th {
      background: #e8edf5;
      border: 1px solid #d1d9e6;
      padding: 8px 12px;
      text-align: left;
      font-weight: 700;
      font-size: 12px;
      white-space: nowrap;
    }

    .types-table td {
      border: 1px solid #e5e7eb;
      padding: 6px 10px;
      vertical-align: middle;
    }

    .types-table tr.dragging-row {
      opacity: 0.3;
    }

    .types-table tr.drag-over-top td {
      border-top: 2px solid #2563eb;
    }

    .types-table tr.drag-over-bot td {
      border-bottom: 2px solid #2563eb;
    }

    .types-table tr:nth-child(even) td {
      background: #f9fafb;
    }

    .types-table tr:hover td {
      background: #eff6ff;
    }

    .drag-handle {
      cursor: grab;
      color: #9ca3af;
      font-size: 16px;
      padding: 0 4px;
      user-select: none;
    }

    .drag-handle:active {
      cursor: grabbing;
    }

    .color-pill {
      display: inline-block;
      width: 60px;
      height: 20px;
      border-radius: 4px;
      border: 1px solid rgba(0, 0, 0, 0.1);
      vertical-align: middle;
      cursor: pointer;
    }

    /* ── Sortable info-table headers ─────────── */
    .info-table th.sortable {
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
    }

    .info-table th.sortable:hover {
      background: #dce6f5;
    }

    .sort-arrow {
      margin-left: 4px;
      font-size: 10px;
      opacity: 0.5;
    }

    .info-table th.sort-asc .sort-arrow,
    .info-table th.sort-desc .sort-arrow {
      opacity: 1;
      color: #2563eb;
    }

    /* ── Report ───────────────────────────────── */
    .report-section {
      margin-bottom: 28px;
    }

    .report-subtitle {
      font-size: 13px;
      font-weight: 700;
      color: #374151;
      margin-bottom: 10px;
      padding-bottom: 5px;
      border-bottom: 1px solid #e5e7eb;
    }

    .report-table {
      border-collapse: collapse;
      width: 100%;
      font-size: 13px;
    }

    .report-table th {
      background: #e8edf5;
      border: 1px solid #d1d9e6;
      padding: 6px 12px;
      text-align: left;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
    }

    .report-table td {
      border: 1px solid #e5e7eb;
      padding: 6px 12px;
      vertical-align: middle;
    }

    .report-table tr:nth-child(even) td {
      background: #f9fafb;
    }

    .print-btn {
      padding: 7px 18px;
      background: #374151;
      color: #fff;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
      margin-top: 16px;
    }

    .print-btn:hover {
      background: #1f2937;
    }

    @media print {

      #navbar,
      .admin-tabs,
      .month-nav,
      .print-btn,
      .leave-header,
      .leave-footer {
        display: none !important;
      }

      .page {
        padding: 0;
      }

      body {
        background: #fff;
      }
    }

    /* ── Chart canvas ─────────────────────────── */
    .chart-container {
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 10px;
      padding: 16px;
      margin-bottom: 16px;
    }

    .chart-title {
      font-size: 13px;
      font-weight: 700;
      color: #374151;
      margin-bottom: 12px;
    }

    /* ── Leave Footer — 應休未休時數 ────────────── */
    .leave-footer {
      margin-top: 20px;
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.88));
      backdrop-filter: blur(12px);
      border-radius: 14px;
      padding: 20px 24px;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
      border: 1px solid rgba(0, 0, 0, 0.04);
    }

    .leave-footer-title {
      font-size: 16px;
      font-weight: 800;
      color: #0f2b4a;
      margin-bottom: 6px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .leave-footer-title .icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      background: linear-gradient(135deg, #f0f7ff, #dbeafe);
      border-radius: 8px;
      font-size: 14px;
    }

    .leave-footer-desc {
      font-size: 12px;
      color: #6b7280;
      margin-bottom: 16px;
      line-height: 1.6;
      font-weight: 500;
    }

    .leave-footer-desc code {
      background: #fef3c7;
      color: #92400e;
      padding: 1px 6px;
      border-radius: 4px;
      font-size: 11px;
      font-weight: 700;
    }

    /* Group separator in footer */
    .lf-group-sep {
      font-size: 11px;
      font-weight: 700;
      color: #9ca3af;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      margin-bottom: 8px;
      padding-bottom: 4px;
      border-bottom: 1px solid #e5e7eb;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .lf-group-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    /* 橫向群組排列容器 */
    .lf-groups-row {
      display: flex;
      flex-direction: row;
      flex-wrap: nowrap;
      overflow-x: auto;
      gap: 16px;
      align-items: flex-start;
      padding-bottom: 6px;
    }

    /* 每個群組欄 */
    .lf-group-col {
      display: flex;
      flex-direction: column;
      flex-shrink: 0;
      min-width: 220px;
    }

    /* 同群組的卡片縱向排列 */
    .lf-grid {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .lf-card {
      background: linear-gradient(135deg, #f8fafc, #f1f5f9);
      border: 1.5px solid #e2e8f0;
      border-radius: 10px;
      padding: 12px 14px;
      transition: all 0.2s ease;
      position: relative;
      overflow: hidden;
      min-width: 220px;
      flex-shrink: 0;
    }

    .lf-card:hover {
      border-color: #bfdbfe;
      box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
    }

    .lf-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      width: 3px;
      border-radius: 3px 0 0 3px;
    }

    .lf-card.status-safe::before {
      background: #10b981;
    }

    .lf-card.status-warn::before {
      background: #f59e0b;
    }

    .lf-card.status-danger::before {
      background: #ef4444;
    }

    .lf-card-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 10px;
    }

    .lf-emp-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      border: 1px solid rgba(0, 0, 0, 0.1);
      flex-shrink: 0;
    }

    .lf-emp-name {
      font-weight: 700;
      font-size: 13px;
      color: #1f2937;
    }

    .lf-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 6px;
      font-size: 12px;
    }

    .lf-row:last-child {
      margin-bottom: 0;
    }

    .lf-label {
      color: #6b7280;
      font-weight: 500;
    }

    .lf-value {
      font-weight: 700;
      color: #1f2937;
      font-size: 13px;
    }

    .lf-input-row {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .lf-input {
      width: 70px;
      padding: 4px 8px;
      border: 1.5px solid #d1d5db;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
      text-align: center;
      outline: none;
      transition: border-color 0.2s;
      background: #fff;
    }

    .lf-input:focus {
      border-color: #2563eb;
      box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
    }

    .lf-input.warn {
      border-color: #f59e0b;
      background: #fffbeb;
    }

    .lf-input.danger {
      border-color: #ef4444;
      background: #fef2f2;
    }

    .lf-unit {
      font-size: 11px;
      color: #9ca3af;
      font-weight: 500;
    }

    .lf-total-bar {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid #e5e7eb;
    }

    .lf-total-val {
      font-size: 14px;
    }

    .lf-total-val.safe {
      color: #059669;
    }

    .lf-total-val.warn {
      color: #d97706;
    }

    .lf-total-val.danger {
      color: #dc2626;
    }

    .lf-cap-badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 12px;
      font-size: 10px;
      font-weight: 700;
      margin-left: 6px;
    }

    .lf-cap-badge.safe {
      background: #d1fae5;
      color: #065f46;
    }

    .lf-cap-badge.warn {
      background: #fef3c7;
      color: #92400e;
    }

    .lf-cap-badge.danger {
      background: #fee2e2;
      color: #991b1b;
    }

    /* ── Dashboard Page ───────────────────────── */
    .db-page {
      padding: 24px;
    }

    .db-header {
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.88));
      border-radius: 14px;
      padding: 20px 24px;
      margin-bottom: 20px;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.8);
      position: relative;
      overflow: hidden;
    }

    .db-header::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: linear-gradient(90deg, #7c3aed, #2563eb, #7c3aed);
      background-size: 200% 100%;
      animation: shimmer 3s ease infinite;
    }

    .db-emp-select {
      padding: 8px 14px;
      border: 1.5px solid #d1d5db;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 600;
      background: #fff;
      outline: none;
      min-width: 160px;
      cursor: pointer;
    }

    .db-emp-select:focus {
      border-color: #7c3aed;
      box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
    }

    .db-cycle-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: linear-gradient(135deg, #ede9fe, #ddd6fe);
      color: #5b21b6;
      padding: 6px 14px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 700;
      border: 1px solid #c4b5fd;
    }

    .db-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 16px;
      margin-bottom: 20px;
    }

    .db-stat-card {
      background: #fff;
      border-radius: 12px;
      padding: 18px 20px;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
      border: 1px solid #e5e7eb;
      position: relative;
      overflow: hidden;
    }

    .db-stat-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
    }

    .db-stat-card.purple::before {
      background: linear-gradient(90deg, #7c3aed, #a78bfa);
    }

    .db-stat-card.blue::before {
      background: linear-gradient(90deg, #2563eb, #60a5fa);
    }

    .db-stat-card.green::before {
      background: linear-gradient(90deg, #059669, #34d399);
    }

    .db-stat-card.amber::before {
      background: linear-gradient(90deg, #d97706, #fbbf24);
    }

    .db-stat-label {
      font-size: 11px;
      font-weight: 700;
      color: #9ca3af;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      margin-bottom: 8px;
    }

    .db-stat-value {
      font-size: 28px;
      font-weight: 800;
      color: #1f2937;
      line-height: 1;
    }

    .db-stat-unit {
      font-size: 13px;
      font-weight: 500;
      color: #9ca3af;
      margin-left: 4px;
    }

    .db-stat-sub {
      font-size: 11px;
      color: #6b7280;
      margin-top: 6px;
    }

    /* Payout table */
    .db-payout-section {
      background: #fff;
      border-radius: 12px;
      padding: 20px;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
      border: 1px solid #e5e7eb;
    }

    .db-payout-title {
      font-size: 14px;
      font-weight: 700;
      color: #1e3a5f;
      margin-bottom: 14px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .db-add-payout-btn {
      padding: 6px 14px;
      background: linear-gradient(135deg, #7c3aed, #6d28d9);
      color: #fff;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 600;
      box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
    }

    .db-add-payout-btn:hover {
      background: linear-gradient(135deg, #6d28d9, #5b21b6);
    }

    .db-payout-table {
      border-collapse: collapse;
      width: 100%;
      font-size: 13px;
    }

    .db-payout-table th {
      background: #f5f3ff;
      border: 1px solid #ede9fe;
      padding: 7px 12px;
      text-align: left;
      font-weight: 700;
      font-size: 12px;
    }

    .db-payout-table td {
      border: 1px solid #e5e7eb;
      padding: 6px 12px;
      vertical-align: middle;
    }

    .db-payout-table tr:nth-child(even) td {
      background: #faf5ff;
    }

    .db-payout-del {
      padding: 3px 8px;
      background: #fee2e2;
      color: #991b1b;
      border-radius: 4px;
      font-size: 11px;
      font-weight: 600;
    }

    .db-payout-del:hover {
      background: #fecaca;
    }

    .db-empty {
      text-align: center;
      color: #9ca3af;
      font-size: 13px;
      padding: 24px;
      font-style: italic;
    }

    /* ── Dashboard Tab Panel ───────────────────── */
    .db-tab-panel {
      background: #fff;
      border-radius: 12px;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
      border: 1px solid #e5e7eb;
      margin-top: 16px;
      overflow: hidden;
    }

    .db-tab-bar {
      display: flex;
      border-bottom: 2px solid #e5e7eb;
      background: #f8fafc;
      padding: 0 4px;
      gap: 2px;
    }

    .db-tab-btn {
      padding: 11px 20px;
      font-size: 13px;
      font-weight: 600;
      color: #6b7280;
      border: none;
      background: none;
      border-bottom: 2px solid transparent;
      margin-bottom: -2px;
      border-radius: 6px 6px 0 0;
      cursor: pointer;
      transition: color 0.15s, border-color 0.15s, background 0.15s;
      white-space: nowrap;
    }

    .db-tab-btn:hover {
      color: #374151;
      background: #f0f4ff;
    }

    .db-tab-btn.active {
      color: #2563eb;
      border-bottom-color: #2563eb;
      background: #fff;
    }

    .db-tab-content {
      padding: 20px;
    }

    .db-tab-pane {
      display: none;
    }

    .db-tab-pane.active {
      display: block;
    }

    /* Month navigation (inside tab) */
    .db-tab-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 14px;
      flex-wrap: wrap;
      gap: 8px;
    }

    .db-tab-title {
      font-size: 13px;
      font-weight: 700;
      color: #1e3a5f;
    }

    .db-cal-nav {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .db-cal-nav-btn {
      padding: 3px 10px;
      border: 1.5px solid #d1d5db;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
      background: #f9fafb;
      color: #374151;
      transition: all 0.15s;
    }

    .db-cal-nav-btn:hover {
      background: #eff6ff;
      border-color: #93c5fd;
      color: #1d4ed8;
    }

    .db-cal-month-label {
      font-size: 12px;
      font-weight: 700;
      color: #374151;
      min-width: 80px;
      text-align: center;
    }

    /* Calendar grid */
    .db-cal-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 2px;
      margin-top: 4px;
    }

    .db-cal-dow {
      text-align: center;
      font-size: 10px;
      font-weight: 700;
      color: #9ca3af;
      padding: 4px 0;
      letter-spacing: 0.04em;
    }

    .db-cal-day {
      border-radius: 8px;
      min-height: 52px;
      padding: 3px 4px;
      font-size: 11px;
      position: relative;
      cursor: default;
      transition: background 0.1s;
    }

    .db-cal-day.empty {
      background: transparent;
    }

    .db-cal-day.weekend {
      background: #fff5f5;
    }

    .db-cal-day.today {
      outline: 2px solid #2563eb;
      outline-offset: -2px;
    }

    .db-cal-day:not(.empty):hover {
      background: #f0f7ff;
    }

    .db-cal-day-num {
      font-weight: 700;
      color: #374151;
      font-size: 11px;
      display: block;
      margin-bottom: 2px;
    }

    .db-cal-day.today .db-cal-day-num {
      color: #2563eb;
    }

    .db-cal-pip {
      display: flex;
      flex-direction: column;
      gap: 1px;
    }

    .db-cal-chip {
      border-radius: 3px;
      padding: 1px 4px;
      font-size: 9px;
      font-weight: 700;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
    }

    /* Records list */
    .db-rec-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
      max-height: 440px;
      overflow-y: auto;
    }

    .db-rec-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 13px;
      border-radius: 8px;
      border: 1px solid #e5e7eb;
      font-size: 12px;
      background: #fafafa;
      transition: background 0.1s;
    }

    .db-rec-item:hover {
      background: #f0f7ff;
    }

    .db-rec-date {
      font-weight: 700;
      color: #1e3a5f;
      min-width: 48px;
      font-size: 11px;
    }

    .db-rec-badge {
      padding: 2px 8px;
      border-radius: 10px;
      font-size: 10px;
      font-weight: 700;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .db-rec-desc {
      flex: 1;
      color: #374151;
    }

    .db-rec-hours {
      font-weight: 700;
      font-size: 12px;
      white-space: nowrap;
    }

    .db-rec-empty {
      text-align: center;
      color: #9ca3af;
      font-size: 13px;
      padding: 32px 0;
      font-style: italic;
    }

    /* ── Dashboard Mode Switch ─────────────────── */
    .db-mode-switch {
      display: flex;
      gap: 4px;
      background: #f1f5f9;
      border: 1.5px solid #e2e8f0;
      border-radius: 10px;
      padding: 3px;
      margin-left: auto;
    }

    .db-mode-btn {
      padding: 7px 18px;
      border-radius: 7px;
      font-size: 13px;
      font-weight: 600;
      color: #6b7280;
      background: none;
      border: none;
      cursor: pointer;
      transition: all 0.18s;
      white-space: nowrap;
    }

    .db-mode-btn:hover {
      background: #e2e8f0;
      color: #374151;
    }

    .db-mode-btn.active {
      background: #fff;
      color: #1e3a5f;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }

    /* ── Overview Table ────────────────────────── */
    .ov-section {
      background: #fff;
      border-radius: 12px;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
      border: 1px solid #e5e7eb;
      padding: 20px;
      margin-top: 16px;
    }

    .ov-section-title {
      font-size: 14px;
      font-weight: 700;
      color: #1e3a5f;
      margin-bottom: 16px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .ov-table {
      border-collapse: collapse;
      width: 100%;
      font-size: 13px;
    }

    .ov-table th {
      background: #f0f4fb;
      border: 1px solid #dce3ef;
      padding: 9px 14px;
      text-align: left;
      font-weight: 700;
      font-size: 12px;
      white-space: nowrap;
      color: #374151;
    }

    .ov-table td {
      border: 1px solid #e5e7eb;
      padding: 10px 14px;
      vertical-align: middle;
      white-space: nowrap;
    }

    .ov-table tr:nth-child(even) td {
      background: #f9fafb;
    }

    .ov-table tr:hover td {
      background: #eff6ff;
      cursor: pointer;
    }

    .ov-table tr.grp-header td {
      background: #f1f5f9;
      font-weight: 700;
      font-size: 11px;
      color: #6b7280;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      padding: 6px 14px;
      border-bottom: 2px solid #e2e8f0;
    }

    .ov-name {
      font-weight: 700;
      color: #1f2937;
    }

    .ov-val {
      font-weight: 700;
      color: #1e3a5f;
    }

    .ov-zero {
      color: #9ca3af;
      font-weight: 400;
    }

    /* Status badge */
    .ov-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 3px 10px;
      border-radius: 12px;
      font-size: 11px;
      font-weight: 700;
      white-space: nowrap;
    }

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

    .ov-badge.warn {
      background: #fef3c7;
      color: #92400e;
    }

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

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

    /* Days until settlement */
    .ov-days-bar {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .ov-days-track {
      flex: 1;
      height: 6px;
      background: #e5e7eb;
      border-radius: 3px;
      min-width: 80px;
      overflow: hidden;
    }

    .ov-days-fill {
      height: 100%;
      border-radius: 3px;
      transition: width 0.3s ease;
    }

    .ov-days-fill.soon {
      background: #f59e0b;
    }

    .ov-days-fill.mid {
      background: #3b82f6;
    }

    .ov-days-fill.plenty {
      background: #10b981;
    }

    .ov-days-num {
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
    }

    .ov-days-num.soon {
      color: #d97706;
    }

    .ov-days-num.mid {
      color: #2563eb;
    }

    .ov-days-num.plenty {
      color: #059669;
    }

    /* Remaining bar */
    .ov-remain-bar {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .ov-remain-track {
      width: 80px;
      height: 6px;
      background: #e5e7eb;
      border-radius: 3px;
      overflow: hidden;
    }

    .ov-remain-fill {
      height: 100%;
      border-radius: 3px;
      background: #7c3aed;
    }

    /* 12-cell countdown bar */
    .ov-cells-bar {
      display: flex;
      gap: 2px;
      align-items: center;
    }

    .ov-cell {
      height: 14px;
      border-radius: 3px;
      flex: 1;
      min-width: 0;
      background: #e5e7eb;
      transition: background 0.2s;
    }

    .ov-cell.filled.soon {
      background: #f59e0b;
    }

    .ov-cell.filled.mid {
      background: #3b82f6;
    }

    .ov-cell.filled.plenty {
      background: #10b981;
    }

    .ov-cell.partial.soon {
      background: linear-gradient(to right, #f59e0b var(--p), #e5e7eb var(--p));
    }

    .ov-cell.partial.mid {
      background: linear-gradient(to right, #3b82f6 var(--p), #e5e7eb var(--p));
    }

    .ov-cell.partial.plenty {
      background: linear-gradient(to right, #10b981 var(--p), #e5e7eb var(--p));
    }

    /* Accumulated hours cell: clickable */
    .ov-acc-cell {
      cursor: pointer;
      transition: background 0.15s;
    }

    .ov-acc-cell:hover {
      background: #ede9fe !important;
    }

    .ov-acc-cell .ov-val {
      text-decoration: underline dotted #7c3aed;
      color: #5b21b6;
    }

    .ov-acc-hint {
      font-size: 10px;
      color: #a78bfa;
      display: block;
      margin-top: 1px;
    }
    /* ── Data Backup Panel ─────────────────────── */
    .backup-section {
      background: #f8fafc;
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      padding: 22px 24px;
      margin-bottom: 20px;
    }

    .backup-section-title {
      font-size: 14px;
      font-weight: 700;
      color: #1e3a5f;
      margin-bottom: 6px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .backup-section-desc {
      font-size: 12px;
      color: #6b7280;
      margin-bottom: 16px;
      line-height: 1.6;
    }

    .backup-row {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      margin-bottom: 12px;
    }

    .backup-label {
      font-size: 12px;
      font-weight: 600;
      color: #374151;
      min-width: 80px;
    }

    .backup-radio-group {
      display: flex;
      gap: 16px;
      align-items: center;
    }

    .backup-radio-group label {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 13px;
      color: #374151;
      cursor: pointer;
      font-weight: 500;
    }

    .backup-date-range {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .backup-date-input {
      padding: 5px 10px;
      border: 1.5px solid #d1d5db;
      border-radius: 7px;
      font-size: 13px;
      font-family: inherit;
      outline: none;
      color: #1f2937;
      background: #fff;
      transition: border-color 0.15s;
    }

    .backup-date-input:focus {
      border-color: #2563eb;
      box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
    }

    .backup-date-input:disabled {
      background: #f3f4f6;
      color: #9ca3af;
      cursor: not-allowed;
    }

    .backup-export-btn {
      padding: 9px 22px;
      background: linear-gradient(135deg, #2563eb, #1d4ed8);
      color: #fff;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 700;
      box-shadow: 0 2px 8px rgba(37,99,235,0.25);
      transition: all 0.15s;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .backup-export-btn:hover {
      background: linear-gradient(135deg, #1d4ed8, #1e40af);
      box-shadow: 0 4px 12px rgba(37,99,235,0.35);
      transform: translateY(-1px);
    }

    .backup-import-btn {
      padding: 9px 22px;
      background: linear-gradient(135deg, #059669, #047857);
      color: #fff;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 700;
      box-shadow: 0 2px 8px rgba(5,150,105,0.25);
      transition: all 0.15s;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .backup-import-btn:hover {
      background: linear-gradient(135deg, #047857, #065f46);
      box-shadow: 0 4px 12px rgba(5,150,105,0.35);
      transform: translateY(-1px);
    }

    .backup-import-zone {
      border: 2px dashed #93c5fd;
      border-radius: 10px;
      padding: 20px;
      text-align: center;
      background: #eff6ff;
      cursor: pointer;
      transition: all 0.15s;
      position: relative;
    }

    .backup-import-zone:hover {
      border-color: #2563eb;
      background: #dbeafe;
    }

    .backup-import-zone.drag-over {
      border-color: #2563eb;
      background: #dbeafe;
      box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
    }

    .backup-import-zone input[type=file] {
      position: absolute;
      inset: 0;
      opacity: 0;
      cursor: pointer;
    }

    .backup-import-icon {
      font-size: 28px;
      margin-bottom: 6px;
    }

    .backup-import-hint {
      font-size: 12px;
      color: #6b7280;
      margin-top: 4px;
    }

    .backup-preview {
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 8px;
      padding: 14px 16px;
      margin-top: 12px;
      font-size: 12px;
      color: #374151;
      display: none;
    }

    .backup-preview.show { display: block; }

    .backup-preview-title {
      font-weight: 700;
      color: #1e3a5f;
      margin-bottom: 8px;
      font-size: 13px;
    }

    .backup-stat {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      background: #f3f4f6;
      border-radius: 6px;
      padding: 3px 10px;
      margin: 3px 4px 3px 0;
      font-size: 12px;
      font-weight: 600;
      color: #374151;
    }

    .backup-stat .stat-num {
      color: #2563eb;
    }

    .backup-confirm-btn {
      margin-top: 12px;
      padding: 8px 20px;
      background: #dc2626;
      color: #fff;
      border-radius: 7px;
      font-size: 13px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: background 0.15s;
    }

    .backup-confirm-btn:hover {
      background: #b91c1c;
    }

    .backup-warn {
      background: #fff7ed;
      border: 1px solid #fed7aa;
      border-radius: 8px;
      padding: 10px 14px;
      font-size: 12px;
      color: #c2410c;
      display: flex;
      align-items: flex-start;
      gap: 8px;
      margin-top: 10px;
    }

/* ════════════════════════════════════════════
   ROLE-BASED VISIBILITY
   ════════════════════════════════════════════ */

/* 預設隱藏角色限定元素，由 applyRoleUI() 依角色啟用 */
.admin-only,
.supervisor-only {
  display: none !important;
}

/* 導覽列使用者資訊 */
.nav-user {
  margin-left: auto;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  white-space: nowrap;
}

/* 導覽列登出按鈕 */
.nav-logout {
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  margin-left: 8px;
  transition: background .15s;
}
.nav-logout:hover {
  background: rgba(255,255,255,.2);
}

/* 角色標籤 badge */
.role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 4px;
}
.role-badge-admin      { background: #fef3c7; color: #92400e; }
.role-badge-supervisor { background: #dbeafe; color: #1e40af; }
.role-badge-staff      { background: #f3f4f6; color: #4b5563; }

/* 帳號權限管理頁樣式 */
.roles-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.roles-table th,
.roles-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}
.roles-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}
.roles-table tr:hover td { background: #f9fafb; }
.role-select {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

/* ── Proxy Confirm Modal ───────────────────── */
.proxy-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.proxy-modal-box {
  background: #fff;
  border-radius: 16px;
  width: 380px;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
  overflow: hidden;
}
.proxy-modal-head {
  background: #1e3a5f;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 16px 20px;
}
.proxy-modal-body {
  padding: 20px;
}
.proxy-modal-info {
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.proxy-modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}
.proxy-modal-label { color: #6b7280; }
.proxy-modal-val   { font-weight: 600; color: #111827; }
.proxy-modal-q {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}
.proxy-modal-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  justify-content: flex-end;
}
.proxy-modal-btn {
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.proxy-modal-btn:hover { opacity: 0.85; }
.proxy-modal-accept { background: #22c55e; color: #fff; }
.proxy-modal-reject { background: #ef4444; color: #fff; }
.proxy-modal-cancel { background: #e5e7eb; color: #374151; }
.proxy-modal-save {
  background: #2563eb;
  color: #fff;
}

.proxy-status-modal {
  width: 460px;
}

.proxy-status-board {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.proxy-status-title {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.proxy-status-switch {
  --proxy-switch-width: 100%;
  --proxy-switch-height: 74px;
  --proxy-switch-padding: 6px;
  --proxy-item-width: calc((var(--proxy-switch-width) - (var(--proxy-switch-padding) * 2)) / 3);
  position: relative;
  width: var(--proxy-switch-width);
  height: var(--proxy-switch-height);
  display: flex;
  align-items: center;
  padding: var(--proxy-switch-padding);
  border: 1px solid #1f2937;
  border-radius: 18px;
  background: #0f172a;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.55),
    0 18px 32px -20px rgba(15, 23, 42, 0.85);
  box-sizing: border-box;
  overflow: hidden;
}

.proxy-status-option {
  flex: 1;
  height: 100%;
  position: relative;
  z-index: 2;
}

.proxy-status-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.proxy-status-label {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 13px;
  color: #93a4bb;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
  user-select: none;
}

.proxy-status-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.proxy-status-option input:checked + .proxy-status-label {
  color: #fff;
}

.proxy-status-option input:focus-visible + .proxy-status-label {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

.proxy-status-option:active .proxy-status-label {
  transform: scale(0.96);
}

.proxy-status-highlight {
  position: absolute;
  top: var(--proxy-switch-padding);
  left: var(--proxy-switch-padding);
  width: var(--proxy-item-width);
  height: calc(var(--proxy-switch-height) - (var(--proxy-switch-padding) * 2));
  z-index: 1;
  pointer-events: none;
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.proxy-status-highlight-inner {
  height: 100%;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  box-shadow:
    0 0 20px rgba(0, 240, 255, 0.65),
    inset 0 0 16px rgba(0, 240, 255, 0.18);
}

.proxy-status-switch.is-pending .proxy-status-highlight {
  transform: translateX(0%);
}

.proxy-status-switch.is-accepted .proxy-status-highlight {
  transform: translateX(100%);
}

.proxy-status-switch.is-rejected .proxy-status-highlight {
  transform: translateX(200%);
}

.proxy-status-switch.is-accepted .proxy-status-highlight-inner {
  box-shadow:
    0 0 20px rgba(34, 197, 94, 0.72),
    inset 0 0 16px rgba(34, 197, 94, 0.22);
}

.proxy-status-switch.is-rejected .proxy-status-highlight-inner {
  box-shadow:
    0 0 20px rgba(239, 68, 68, 0.72),
    inset 0 0 16px rgba(239, 68, 68, 0.22);
}

/* ── Design Refresh ─────────────────────────── */
:root {
  --nav-bg: #183552;
  --nav-active: #dce7f5;
  --table-header-bg: #f3f6fa;
  --weekend-bg: #fbf2f4;
  --data-cell-bg: #eef4fb;
  --data-cell-text: #1f4b7a;
  --slot-sep: #d7e0ea;
}

body {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.06), transparent 30%),
    linear-gradient(180deg, #f4f7fb 0%, #eef3f8 100%);
  color: #0f172a;
}

#navbar {
  height: 60px;
  gap: 8px;
  padding: 0 20px;
  background: rgba(24, 53, 82, 0.94);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

.nav-brand {
  margin-right: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

.nav-tab {
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
}

.nav-tab:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.08);
}

.nav-tab.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: none;
}

.nav-spacer {
  flex: 1;
}

.nav-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-right: 10px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background-color 0.18s ease, color 0.18s ease;
}

.nav-icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.nav-notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(24, 53, 82, 0.96);
}

.page,
.db-page {
  padding: 20px 24px 28px;
}

.leave-header,
.db-header,
#leave-table-wrap,
.ot-card,
.admin-card,
.db-payout-section,
.db-tab-panel,
.ov-section,
.lf-card,
.grp-card,
.proxy-modal-box,
#modal-box {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.leave-header,
.db-header,
#leave-table-wrap,
.ot-card,
.admin-card,
.db-payout-section,
.db-tab-panel,
.ov-section,
.lf-card,
.grp-card {
  background: rgba(255, 255, 255, 0.96);
}

.leave-header,
.db-header {
  padding: 18px 22px;
  backdrop-filter: blur(10px);
}

.leave-header::before,
.db-header::before {
  display: none;
}

.leave-title,
.db-title,
.db-payout-title,
.ov-section-title {
  color: #102a43;
}

.leave-cycle-text,
.db-stat-sub,
.db-empty,
.db-rec-empty {
  color: #64748b;
}

.month-nav,
.db-cal-nav {
  gap: 8px;
}

.month-nav-btn,
.db-cal-nav-btn,
.db-add-payout-btn,
.nav-logout {
  border-radius: 10px;
}

.month-nav-btn,
.db-cal-nav-btn {
  padding: 8px 14px;
  background: #f8fafc;
  border: 1px solid #d6dee8;
  color: #334155;
  box-shadow: none;
}

.month-nav-btn:hover,
.db-cal-nav-btn:hover {
  transform: none;
  background: #edf3f9;
  border-color: #bfd0e5;
  color: #183a5d;
  box-shadow: none;
}

.leave-view-bar,
.db-mode-switch {
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #dde6ef;
  box-shadow: none;
}

.leave-footer {
  margin-top: 22px;
  padding: 20px 22px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.leave-footer-title {
  font-size: 15px;
  font-weight: 800;
  color: #102a43;
  margin-bottom: 6px;
}

.leave-footer-desc {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 18px;
}

.leave-footer-desc code {
  background: #f7ead0;
  color: #9a5a00;
  border-radius: 999px;
  padding: 2px 8px;
}

.lf-groups-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  align-items: start;
  overflow: visible;
  padding-bottom: 0;
}

.lf-group-col {
  min-width: 0;
}

.lf-group-sep {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  color: #64748b;
  letter-spacing: 0.04em;
}

.lf-grid {
  display: grid;
  gap: 12px;
}

.lv-view-btn,
.db-mode-btn {
  border-radius: 8px;
  font-weight: 600;
  color: #64748b;
}

.lv-view-btn:hover,
.db-mode-btn:hover {
  background: #eef3f9;
  color: #183a5d;
}

.lv-view-btn.active,
.db-mode-btn.active {
  background: #fff;
  color: #183a5d;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

#leave-table th {
  background: #f3f6fa;
  border-right: 1px solid #dde6ef;
  border-bottom: 1px solid #d3dde8;
  color: #334155;
  box-shadow: none;
}

#leave-table th.label-col {
  background: #edf2f7;
  border-right: 1px solid #d3dde8;
}

#leave-table th.weekend-col {
  background: #f8ecef;
}

#leave-table td {
  border-right: 1px solid #e7edf3;
  border-bottom: 1px solid #e7edf3;
}

#leave-table td.label-col {
  background: #f7fafc;
  border-right: 1px solid #d3dde8;
  color: #475569;
  letter-spacing: 0.01em;
}

#leave-table td.weekend-col {
  background: #fdf7f8;
}

#leave-table td.data-emp {
  color: #102a43;
  text-shadow: none;
}

#leave-table td.data-field {
  background: #eef4fb;
  color: #1f4b7a;
}

#leave-table td.data-proxy {
  background: #f3f8f3;
  color: #305b39;
}

#leave-table td.data-no-proxy {
  background: #f8fafc;
  color: #94a3b8;
}

#leave-table tbody tr[data-slot="0"] td:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy),
#leave-table tbody tr[data-slot="1"] td:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy),
#leave-table tbody tr[data-slot="2"] td:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy) {
  background: #ffffff;
}

#leave-table tbody tr[data-slot="0"] td.weekend-col:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy),
#leave-table tbody tr[data-slot="1"] td.weekend-col:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy),
#leave-table tbody tr[data-slot="2"] td.weekend-col:not(.label-col):not(.data-emp):not(.data-shift-colored):not(.data-leave-colored):not(.data-proxy):not(.data-no-proxy) {
  background: #fdf7f8;
}

#leave-table td.label-col[data-slot="0"],
#leave-table td.label-col[data-slot="1"],
#leave-table td.label-col[data-slot="2"] {
  border-left-width: 3px;
  background: #f7fafc;
}

#leave-table td.label-col[data-slot="0"] {
  border-left-color: #5f7fa5;
  color: #35506d;
}

#leave-table td.label-col[data-slot="1"] {
  border-left-color: #7c93b0;
  color: #35506d;
}

#leave-table td.label-col[data-slot="2"] {
  border-left-color: #8ba694;
  color: #35506d;
}

#leave-table tr.slot-sep td,
#leave-table tr.slot-sep[data-slot-after="1"] td,
#leave-table tr.slot-sep[data-slot-after="2"] td {
  background: #edf2f7 !important;
  box-shadow: inset 0 1px 0 #d7e0ea;
  height: 4px;
}

#leave-table tr.slot-sep td.label-col,
#leave-table tr.slot-sep[data-slot-after="1"] td.label-col,
#leave-table tr.slot-sep[data-slot-after="2"] td.label-col {
  background: #e7edf3 !important;
  box-shadow: inset 0 1px 0 #d7e0ea;
}

#leave-table tr.short-row td {
  background: #fbfcfe;
  border-top: 1px dashed #cbd5e1;
}

#leave-table tr.short-row td.label-col {
  background: #f7fafc;
  border-left: 3px solid #94a3b8;
  border-top: 1px dashed #cbd5e1;
  color: #475569;
}

.short-chip {
  border-radius: 7px;
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: none;
}

.short-add-btn {
  background: #f8fafc;
  color: #35506d;
  border: 1px dashed #bfd0e5;
}

.lv-cal-grid,
.lv-list-tbl {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.lv-cal-grid {
  gap: 1px;
  background: #dde6ef;
}

.lv-cal-head {
  background: #edf2f7;
  color: #334155;
}

.lv-cal-head.lv-cal-wk {
  background: #f3e8ea;
}

.lv-cal-cell,
.lv-cal-cell.lv-cal-other {
  background: #fff;
}

.lv-cal-cell.lv-cal-wk {
  background: #fdf7f8;
}

.lv-cal-cell.lv-cal-today {
  background: #f3f8fd;
  box-shadow: inset 0 3px 0 #4c7bb0;
}

.lv-cal-cell:hover,
.db-rec-item:hover,
.db-cal-day:not(.empty):hover {
  background: #f7fafc;
}

.lv-list-bar select,
.lv-list-bar input,
.db-emp-select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}

.lv-list-bar select:focus,
.lv-list-bar input:focus,
.db-emp-select:focus {
  border-color: #4c7bb0;
  box-shadow: 0 0 0 3px rgba(76, 123, 176, 0.12);
}

.lv-list-tbl th {
  background: #f3f6fa;
  border-bottom: 1px solid #d3dde8;
  color: #475569;
}

.lv-list-tbl td {
  border-bottom: 1px solid #e7edf3;
}

.lf-card {
  background: rgba(255, 255, 255, 0.96);
}

.lf-card::before,
.db-stat-card::before {
  height: 2px;
}

.db-cycle-badge {
  background: #eef4fb;
  color: #1f4b7a;
  border-color: #d5e2f0;
}

.db-stat-card,
.db-tab-panel,
.db-payout-section,
.ov-section {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.db-stat-card.purple::before,
.db-stat-card.blue::before,
.db-stat-card.green::before,
.db-stat-card.amber::before {
  background: #bfd0e5;
}

.db-tab-bar {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 4px;
  gap: 4px;
}

.db-tab-btn {
  padding: 10px 16px;
  margin-bottom: 0;
  border: 0;
  border-radius: 8px;
}

.db-tab-btn:hover {
  background: #eef3f9;
  color: #183a5d;
}

.db-tab-btn.active {
  background: #fff;
  color: #183a5d;
  border-bottom-color: transparent;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.db-cal-day.weekend {
  background: #fdf7f8;
}

.db-cal-day.today {
  outline-color: #4c7bb0;
}

.db-rec-item {
  border-radius: 10px;
  border-color: #e2e8f0;
  background: #fff;
}

#modal-overlay,
.proxy-modal-overlay {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
}

#modal-box,
.proxy-modal-box {
  background: rgba(255, 255, 255, 0.98);
}

.modal-title,
.proxy-modal-head {
  color: #102a43;
}

.proxy-modal-head {
  background: #f3f6fa;
  border-bottom: 1px solid #e2e8f0;
}

.proxy-modal-info,
.ot-modal-info {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.proxy-modal-btn {
  border-radius: 10px;
}

.proxy-modal-accept {
  background: #305b39;
}

.proxy-modal-reject {
  background: #b42318;
}

.proxy-modal-cancel,
.btn-cancel {
  background: #f1f5f9;
  color: #334155;
}

.nav-user {
  margin-left: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  padding: 0 2px;
}

.nav-logout {
  color: #fff;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  padding: 8px 12px;
  font-weight: 600;
}

.nav-logout:hover {
  background: rgba(255,255,255,.14);
}

.lv-cal-legend {
  flex-wrap: wrap;
}

.lv-cal-legend-hint {
  margin-left: auto;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.lv-cal-grid {
  grid-template-columns: repeat(7, minmax(128px, 1fr));
  align-items: stretch;
}

.lv-cal-head {
  padding: 11px 6px;
  font-size: 12px;
  letter-spacing: 0;
}

.lv-cal-cell {
  min-height: 128px;
  padding: 8px;
  cursor: pointer;
}

.lv-cal-cell.lv-cal-other {
  min-height: 128px;
}

.lv-cal-day {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.lv-cal-day span {
  font-size: 16px;
  font-weight: 800;
}

.lv-cal-day small {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
}

.lv-cal-tags {
  gap: 4px;
}

.lv-cal-tag {
  border-radius: 6px;
  padding: 4px 6px;
}

.lv-cal-tag-note {
  background: #fff7ed !important;
  color: #9a3412 !important;
  border: 1px solid #fed7aa;
  font-weight: 700;
  cursor: grab;
}

.lv-cal-tag-note.is-done {
  color: #94a3b8 !important;
  background: #f8fafc !important;
  border-color: #e2e8f0;
  text-decoration: line-through;
}

.lv-cal-tag-note.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.lv-cal-cell.lv-cal-drop-target {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
  background: #eff6ff !important;
}

#modal-box.calendar-event-modal {
  width: min(480px, 94vw);
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
}

.cal-event-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  border-bottom: 1px solid #e2e8f0;
}

.cal-event-kicker {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.cal-event-title {
  color: #102a43;
  font-size: 24px;
  font-weight: 900;
  margin-top: 4px;
}

.cal-event-body {
  padding: 18px 24px 24px;
}

.cal-event-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 3px;
}

.cal-event-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 8px 8px 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
}

.cal-event-row.is-done {
  background: #f8fafc;
}

.cal-event-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cal-event-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cal-event-check span {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid #cbd5e1;
  background: #fff;
}

.cal-event-check input:checked + span {
  border-color: #2563eb;
  background: #2563eb;
  box-shadow: inset 0 0 0 3px #fff;
}

.cal-event-text {
  color: #102a43;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.cal-event-row.is-done .cal-event-text {
  color: #94a3b8;
  text-decoration: line-through;
}

.cal-event-del {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff1f2;
  color: #e11d48;
  font-size: 20px;
  font-weight: 700;
}

.cal-event-del:hover {
  background: #ffe4e6;
}

.cal-event-empty {
  color: #94a3b8;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.cal-event-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 16px;
}

.cal-event-add input {
  height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 14px;
  font: inherit;
  outline: none;
}

.cal-event-add input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.cal-event-add button {
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
}

@media (max-width: 900px) {
  .lv-cal-grid {
    overflow-x: auto;
  }

  .lv-cal-head,
  .lv-cal-cell {
    min-width: 128px;
  }
}

#modal-box.leave-modal-box {
  width: min(980px, 96vw);
  padding: 24px 28px;
  border-radius: 18px;
  max-height: 94vh;
  background: rgba(255, 255, 255, 0.98);
}

.leave-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #102a43;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 22px;
}

.leave-modal-title .modal-close {
  margin-left: auto;
  color: #64748b;
  font-size: 28px;
  font-weight: 300;
}

.leave-title-mark,
.leave-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}

.leave-title-mark {
  width: 50px;
  height: 50px;
  color: #2563eb;
  background: #eef4ff;
}

.leave-icon {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.leave-title-icon {
  width: 31px;
  height: 31px;
  object-fit: contain;
  display: block;
}

.leave-icon-img {
  width: 19px;
  height: 19px;
  object-fit: contain;
  display: block;
}

.leave-icon.blue { color: #2563eb; background: #eff6ff; }
.leave-icon.green { color: #16a34a; background: #f0fdf4; }
.leave-icon.amber { color: #d97706; background: #fffbeb; }

.leave-icon.has-image {
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.leave-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px 22px;
  max-height: none;
  overflow: visible;
  padding: 2px 0 2px;
}

.leave-applicant-card,
.leave-shift-card,
.leave-time-card,
.leave-type-card {
  grid-column: 1;
}

.leave-side-card {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: start;
}

.leave-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 22px 26px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.leave-applicant-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-height: 86px;
}

.leave-section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #102a43;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 18px;
}

.leave-applicant-card .leave-section-label {
  margin-bottom: 0;
}

.leave-static-value {
  color: #102a43;
  font-size: 18px;
  font-weight: 500;
}

.leave-hidden-select {
  display: none;
}

.leave-clean-select {
  width: 100%;
  border: 1px solid #d6dee9;
  border-radius: 8px;
  padding: 11px 14px;
  color: #102a43;
  font: inherit;
  background: #fff;
}

.leave-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.leave-pill,
.leave-proxy-btn {
  min-height: 58px;
  border: 1px solid #d6dee9;
  border-radius: 8px;
  background: #fff;
  color: #102a43;
  font-size: 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s, color 0.15s;
}

.leave-pill:hover,
.leave-proxy-btn:hover:not(:disabled) {
  border-color: #93c5fd;
  color: #1d4ed8;
}

.leave-pill.is-selected,
.leave-proxy-btn.is-selected {
  border-color: #2563eb;
  color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb inset;
}

.leave-proxy-btn:disabled,
.leave-proxy-btn.is-disabled {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.leave-proxy-btn.is-selected:disabled,
.leave-proxy-btn.is-selected.is-disabled {
  border-color: #cbd5e1;
  color: #64748b;
  box-shadow: 0 0 0 1px #cbd5e1 inset;
}

.leave-check {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  background: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.leave-time-row {
  display: grid;
  grid-template-columns: minmax(128px, 156px) auto minmax(128px, 156px) auto;
  gap: 18px;
  align-items: end;
}

.leave-time-field label {
  display: block;
  margin-bottom: 8px;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
}

.leave-time-input {
  width: 100%;
  height: 58px;
  border: 1px solid #d6dee9;
  border-radius: 8px;
  text-align: center;
  font-size: 28px;
  line-height: 1;
  outline: none;
}

.leave-time-input:focus,
.leave-note-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.leave-time-sep,
.leave-duration {
  align-self: center;
  font-size: 18px;
  font-weight: 700;
  padding-top: 24px;
}

.leave-time-sep { color: #102a43; }
.leave-duration { color: #2563eb; }

.leave-info-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 15px;
  font-weight: 700;
}

.leave-info-line span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  background: #3b82f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}

.leave-quota-line {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
  margin-top: 14px;
}

.leave-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 22px 0;
}

.leave-proxy-row {
  display: block;
  margin-bottom: 28px;
}

.leave-proxy-row .leave-section-label {
  margin-bottom: 18px;
}

.leave-proxy-grid {
  display: grid;
  grid-template-columns: repeat(var(--proxy-cols, 1), minmax(0, 1fr));
  gap: 12px;
}

.leave-proxy-btn {
  width: 100%;
  min-height: 48px;
  padding: 0 8px;
  background: var(--proxy-bg, #fff);
  border-color: var(--proxy-border, #d6dee9);
  color: var(--proxy-fg, #102a43);
  font-size: var(--proxy-name-fs, clamp(13px, 1.35vw, 16px));
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.leave-proxy-btn:hover:not(:disabled) {
  border-color: var(--proxy-border, #93c5fd);
  color: var(--proxy-fg, #102a43);
  filter: brightness(0.98);
}

.leave-proxy-btn.is-selected {
  color: var(--proxy-fg, #102a43);
  box-shadow: 0 0 0 2px #2563eb inset;
}

.leave-proxy-btn:disabled,
.leave-proxy-btn.is-disabled {
  background: var(--proxy-bg, #f1f5f9);
  border-color: var(--proxy-border, #e2e8f0);
  color: var(--proxy-fg, #94a3b8);
  opacity: 0.48;
}

.leave-proxy-btn.leave-proxy-none {
  background: #fff;
  border-color: #d6dee9;
  color: #102a43;
  opacity: 1;
}

.leave-proxy-btn.leave-proxy-none.is-selected {
  border-color: #2563eb;
  color: #2563eb;
}

.leave-note-input {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid #d6dee9;
  border-radius: 8px;
  padding: 14px 16px;
  color: #102a43;
  font: inherit;
  outline: none;
}

.leave-note-count {
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  margin-top: 6px;
}

.leave-modal-footer {
  margin-top: 20px;
  padding-top: 18px;
  gap: 18px;
}

.leave-modal-footer .btn-cancel,
.leave-modal-footer .btn-confirm {
  min-width: 120px;
  height: 48px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
}

.leave-modal-footer .btn-confirm {
  background: #2563eb;
}

@media (max-width: 680px) {
  #modal-box.leave-modal-box {
    padding: 18px;
  }

  .leave-modal-title {
    font-size: 22px;
  }

  .leave-card {
    padding: 18px;
  }

  .leave-modal-body {
    grid-template-columns: 1fr;
  }

  .leave-applicant-card,
  .leave-time-row,
  .leave-proxy-row {
    grid-template-columns: 1fr;
  }

  .leave-modal-body,
  .leave-applicant-card,
  .leave-shift-card,
  .leave-time-card,
  .leave-type-card,
  .leave-side-card {
    grid-column: auto;
    grid-row: auto;
  }

  .leave-side-card {
    position: static;
  }

  .leave-time-sep,
  .leave-duration {
    padding-top: 0;
  }

  .leave-choice-grid {
    grid-template-columns: 1fr;
  }

  .leave-proxy-grid {
    grid-template-columns: repeat(var(--proxy-cols, 1), minmax(0, 1fr));
    gap: 8px;
  }

  .leave-proxy-btn {
    min-height: 44px;
    padding: 0 4px;
    font-size: var(--proxy-name-fs, 13px);
  }
}
