
/* Original source: style.css */
:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f1f6fb;
  --ink: #223041;
  --muted: #6b7a90;
  --line: #dbe5ef;
  --primary: #80caff;
  --primary-dark: #2f80b9;
  --primary-soft: #e5f5ff;
  --sidebar: #d9efff;
  --sidebar-ink: #17354d;
  --danger: #dc4c64;
  --warning: #f2a23a;
  --success: #39a96b;
  --purple: #8d72e1;
  --black: #3e4652;
  --shadow: 0 18px 45px rgba(31, 50, 72, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: 'Sarabun', 'Kanit', sans-serif; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--primary-dark); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.full-btn { width: 100%; }
.setup-warning { position: fixed; z-index: 50; top: 14px; left: 50%; transform: translateX(-50%); background: #fff4d8; border: 1px solid #ffd27b; color: #6b4a00; padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.auth-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, #e6f6ff 0, transparent 34%), radial-gradient(circle at 85% 10%, #eaf1ff 0, transparent 28%), var(--bg); }
.auth-card { width: min(560px, 100%); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.8); border-radius: 30px; padding: 34px; box-shadow: var(--shadow); }
.brand-mark { width: 74px; height: 74px; border-radius: 24px; background: #fff; display: grid; place-items: center; margin-bottom: 16px; overflow: hidden; box-shadow: 0 10px 24px rgba(31,80,120,.12); }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.auth-card h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.25; }
.auth-tabs { display: grid; grid-template-columns: minmax(150px, .85fr) minmax(250px, 1.15fr); gap: 8px; background: var(--panel-soft); padding: 6px; border-radius: 18px; margin: 22px 0; }
.auth-tab { border: 0; background: transparent; color: var(--muted); padding: 12px 10px; border-radius: 13px; font-weight: 800; line-height: 1.25; white-space: normal; word-break: keep-all; }
.auth-tab.active { background: #fff; color: var(--primary-dark); box-shadow: 0 4px 14px rgba(31, 50, 72, 0.08); }
.auth-panel { display: none; }
.auth-panel.active { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #344458; font-weight: 700; }
input, select, textarea { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; color: var(--ink); outline: none; min-width: 0; }
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(128,202,255,.22); }
.primary-btn, .ghost-btn, .danger-ghost, .soft-btn { border: 0; border-radius: 15px; min-height: 44px; padding: 10px 16px; font-weight: 800; transition: .18s ease; }
.primary-btn { background: var(--primary); color: #12364f; }
.primary-btn:hover { filter: brightness(.98); transform: translateY(-1px); }
.ghost-btn { background: #fff; color: var(--primary-dark); border: 1px solid var(--line); }
.soft-btn { background: var(--primary-soft); color: var(--primary-dark); }
.danger-ghost { background: #fff; color: var(--danger); border: 1px solid #ffd3dc; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 14px; }
.app-view { display: grid; grid-template-columns: 292px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--sidebar), #eef8ff); border-right: 1px solid rgba(23,53,77,.08); padding: 20px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; color: var(--sidebar-ink); }
.sidebar-head { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.brand-icon { width: 48px; height: 48px; border-radius: 17px; background: #fff; display: grid; place-items: center; overflow: hidden; box-shadow: 0 8px 20px rgba(31,80,120,.1); flex: 0 0 48px; }
.brand-icon img { width: 100%; height: 100%; display: block; object-fit: cover; }
.app-title { font-weight: 900; font-size: 20px; }
.app-subtitle { color: rgba(23,53,77,.68); font-size: 13px; }
.main-nav { display: grid; gap: 6px; overflow: auto; padding-right: 4px; }
.nav-btn { width: 100%; border: 0; background: transparent; color: rgba(23,53,77,.82); display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 17px; font-weight: 800; text-align: left; transition: .18s ease; }
.nav-btn:hover { background: rgba(255,255,255,.55); }
.nav-btn.active { background: #fff; color: #113b58; box-shadow: 0 10px 24px rgba(31, 72, 110, 0.10); }
.nav-emoji { width: 22px; text-align: center; }
.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }
.user-mini { background: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.8); border-radius: 20px; padding: 12px; font-size: 14px; }
.main-panel { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(246,248,251,.86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: 18px 24px; display: flex; align-items: center; gap: 16px; }
.topbar h2 { margin: 0; font-size: 24px; }
.topbar p { margin: 2px 0 0; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sync-status { font-size: 13px; color: var(--muted); }
.page-content { padding: 24px; display: grid; gap: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 10px 24px rgba(31, 50, 72, 0.06); padding: 18px; }
.card h3 { margin: 0 0 12px; font-size: 18px; }
.stat-card { display: grid; gap: 6px; }
.stat-card .num { font-size: 34px; font-weight: 900; color: var(--primary-dark); line-height: 1; }
.stat-card .label { color: var(--muted); font-weight: 700; }
.section-title { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 12px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f6f9fc; font-weight: 900; color: #405169; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 900; background: var(--panel-soft); color: #42546a; white-space: nowrap; }
.badge.green { background: #e5f7ed; color: #19774b; }
.badge.blue { background: #e6f4ff; color: #2370a5; }
.badge.orange { background: #fff0dc; color: #a96100; }
.badge.purple { background: #f0eaff; color: #6750b8; }
.badge.red { background: #ffe9ee; color: #b3354c; }
.badge.yellow { background: #fff7d8; color: #806000; }
.badge.black { background: #eceff3; color: #303946; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tiny-btn { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 7px 10px; font-weight: 800; color: var(--primary-dark); }
.tiny-btn.danger { color: var(--danger); border-color: #ffd3dc; }
.tiny-btn.warn { color: #9b6a00; border-color: #ffd27b; background: #fffaf0; }
.tiny-btn.success { color: #0f7a3b; border-color: #b8e7c6; background: #f2fff6; }
.calendar-shell { display: grid; gap: 14px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(110px,1fr)); gap: 8px; }
.calendar-dayname { color: var(--muted); font-weight: 900; text-align: center; padding: 8px; }
.calendar-cell { min-height: 126px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.calendar-cell.other-month { opacity: .45; }
.calendar-cell.today { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(128,202,255,.18); }
.day-num { font-weight: 900; display: flex; justify-content: space-between; align-items: center; }
.event-pill { border: 0; border-radius: 10px; padding: 5px 7px; font-size: 12px; font-weight: 800; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-leave { background: #e5f7ed; color: #19774b; }
.event-training { background: #e6f4ff; color: #2370a5; }
.event-meeting { background: #fff0dc; color: #a96100; }
.event-noduty { background: #f0eaff; color: #6750b8; }
.event-outing { background: #ffe9ee; color: #b3354c; }
.event-holiday { background: #fff7d8; color: #806000; }
.event-duty { background: #eceff3; color: #303946; }
.week-list, .day-list { display: grid; gap: 10px; }
.timeline-item { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; justify-content: space-between; gap: 12px; }
.roster-board { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.staff-pool { display: grid; gap: 8px; max-height: 68vh; overflow: auto; }
.staff-chip { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 10px; font-weight: 800; display: flex; justify-content: space-between; gap: 8px; }
.staff-chip[draggable="true"] { cursor: grab; }
.roster-table td { min-width: 118px; }
.roster-slot { min-height: 48px; border: 1px dashed #bfd7ea; border-radius: 14px; padding: 8px; background: #fbfdff; display: grid; gap: 5px; }
.roster-slot.drag-over { background: var(--primary-soft); border-color: var(--primary); }
.assigned-name { font-weight: 900; color: #24445d; }
.slot-meta { color: var(--muted); font-size: 12px; }
.locked { opacity: .72; }
.print-only { display: none; }
.empty-state { padding: 24px; border: 1px dashed var(--line); border-radius: 20px; text-align: center; color: var(--muted); background: #fff; }
.modal { position: fixed; inset: 0; background: rgba(17, 30, 43, .36); display: grid; place-items: center; padding: 20px; z-index: 100; }
.modal-card { width: min(760px, 100%); max-height: 88vh; overflow: auto; background: #fff; border-radius: 26px; box-shadow: var(--shadow); padding: 24px; position: relative; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 14px; background: #f2f5f9; font-size: 24px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #203245; color: #fff; padding: 12px 16px; border-radius: 999px; box-shadow: var(--shadow); z-index: 110; }
.mobile-cards { display: none; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .calendar-grid { grid-template-columns: repeat(7, minmax(90px,1fr)); }
  .roster-board { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .auth-card { padding: 24px; }
  .auth-tabs { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app-view { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 300px; max-width: 88vw; z-index: 80; transform: translateX(-105%); transition: .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .topbar { padding: 14px; }
  .topbar-actions { display: none; }
  .page-content { padding: 14px; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .calendar-grid { display: block; }
  .calendar-dayname { display: none; }
  .calendar-cell { min-height: auto; margin-bottom: 8px; }
  .table-wrap.desktop-table { display: none; }
  .mobile-cards { display: grid; gap: 10px; }
  .mobile-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: grid; gap: 8px; }
}
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .toolbar, .actions, .no-print { display: none !important; }
  .app-view { display: block; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-only { display: block; }
  table { min-width: 0; font-size: 12px; }
}

/* V10 refinements */
.field-label { font-weight: 900; margin-bottom: 8px; color: #263746; }
.participant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 18px; padding: 10px; background: #fbfdff; }
.check-pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 9px 10px; font-weight: 800; cursor: pointer; }
.check-pill input { width: auto; }
.check-pill small { color: var(--muted); font-weight: 800; }
.compact-form { grid-template-columns: repeat(4, minmax(0,1fr)); align-items: end; }
.chip-line { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.notice { background: #fff7d8; color: #725800; border: 1px solid #ffe7a3; border-radius: 18px; padding: 12px 14px; font-weight: 800; margin: 10px 0; }
details { margin-top: 12px; }
details summary { cursor: pointer; font-weight: 900; color: var(--primary-dark); }
@media (max-width: 820px) {
  .compact-form { grid-template-columns: 1fr; }
  .participant-grid { grid-template-columns: 1fr 1fr; max-height: 320px; }
}
@media (max-width: 560px) {
  .participant-grid { grid-template-columns: 1fr; }
}

/* V11 daily position eligibility */
.soft-notice { background: #eef7ff; color: #285a7e; border-color: #cce8ff; }
.eligibility-wrap { max-height: 68vh; }
.eligibility-table th, .eligibility-table td { text-align: center; vertical-align: middle; min-width: 112px; }
.eligibility-table th small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.25; }
.eligibility-table .sticky-col { position: sticky; left: 0; z-index: 3; background: #fff; min-width: 170px; text-align: left; box-shadow: 8px 0 16px rgba(15, 35, 52, .06); }
.eligibility-table thead .sticky-col { z-index: 4; background: #f5f8fb; }
.eligibility-cell label { display: inline-flex; align-items: center; gap: 5px; justify-content: center; font-weight: 900; color: var(--primary-dark); }
.eligibility-cell input { width: auto; }
.eligibility-cell.rule-mismatch { background: #fff8f0; }
.eligibility-cell.rule-mismatch label { color: #a86800; }
@media (max-width: 820px) {
  .eligibility-table th, .eligibility-table td { min-width: 96px; font-size: 12px; }
  .eligibility-table .sticky-col { min-width: 130px; }
}

/* V12 navigation groups, staff colors, easier eligibility, audit filter */
.nav-section { display: grid; gap: 6px; margin-bottom: 14px; }
.nav-section-title { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px 4px; color: #496174; font-weight: 900; letter-spacing: .01em; }
.nav-section-title small { color: var(--muted); font-size: 11px; font-weight: 800; }
.staff-color-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; border-radius: 999px; padding: 6px 12px; background: var(--staff-bg, #e8f3ff); color: var(--staff-fg, #203245); border: 1px solid rgba(31,50,69,.14); font-weight: 900; line-height: 1; white-space: nowrap; box-shadow: 0 1px 0 rgba(255,255,255,.55) inset; }
.staff-pill-btn { cursor: pointer; font-family: inherit; font-size: 13px; }
.staff-pill-btn:hover { filter: brightness(.97); transform: translateY(-1px); }
.staff-chip { background: var(--staff-bg, #fff); color: var(--staff-fg, #203245); border-color: rgba(31,50,69,.16); }
.staff-chip .badge { background: rgba(255,255,255,.72); color: #203245; }
.mini-profile .staff-color-pill { margin-bottom: 6px; }
.color-input { width: 52px; height: 34px; padding: 2px; border-radius: 10px; }
.eligibility-page { grid-template-columns: 320px minmax(0,1fr); align-items: start; }
.eligibility-staff-panel { position: sticky; top: 92px; }
.selected-staff-card { margin-top: 14px; border-radius: 22px; padding: 18px; background: var(--staff-bg, #e8f3ff); color: var(--staff-fg, #203245); font-weight: 800; display: grid; gap: 6px; border: 1px solid rgba(31,50,69,.12); }
.big-staff-name { font-size: 28px; font-weight: 900; }
.position-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.position-zone-card { border: 1px solid var(--line); border-radius: 20px; background: #fbfdff; padding: 14px; display: grid; gap: 8px; }
.position-zone-card h4 { margin: 0 0 4px; color: #263746; }
.position-check { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 12px; cursor: pointer; }
.position-check input { width: auto; margin-top: 3px; }
.position-check span { display: grid; gap: 3px; }
.position-check small { color: var(--muted); font-weight: 800; }
.position-check em { color: #4d6075; font-style: normal; font-size: 12px; line-height: 1.35; }
.position-check.checked { border-color: #91d1ff; background: #eef7ff; }
.position-check.rule-mismatch { background: #fff8f0; border-color: #ffdba9; }
.position-check.rule-mismatch small { color: #a86800; }
#auditDateInput { min-width: 180px; }
@media (max-width: 1100px) {
  .eligibility-page { grid-template-columns: 1fr; }
  .eligibility-staff-panel { position: static; }
  .position-card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .nav-section-title { padding-left: 8px; }
  .staff-color-pill { padding: 6px 10px; min-width: 36px; }
}

/* V13 duty rules + readable schedule + monthly position planning */
.event-leave-vacation { background: #e5f7ed; color: #19774b; }
.event-leave-personal { background: #f0eaff; color: #6750b8; }
.event-leave-sick { background: #fff7d8; color: #806000; }
.event-leave-other { background: #e6f4ff; color: #2370a5; }
.event-standard { background: #f0eaff; color: #6750b8; }
.event-code { background: #fff7d8; color: #806000; }
.schedule-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 8px; margin: 12px 0 16px; }
.summary-chip { border-radius: 16px; padding: 10px 12px; background: var(--staff-bg); color: var(--staff-fg); border: 1px solid rgba(31,50,69,.12); display: grid; gap: 2px; box-shadow: 0 1px 0 rgba(255,255,255,.5) inset; }
.summary-chip span { font-size: 12px; font-weight: 800; opacity: .86; }
.schedule-readable { min-width: 980px; font-size: 14px; }
.schedule-readable th { top: 0; z-index: 2; text-align: center; }
.schedule-readable td { text-align: center; vertical-align: middle; }
.schedule-readable .date-cell { text-align: left; min-width: 98px; background: #fbfdff; position: sticky; left: 0; z-index: 1; box-shadow: 8px 0 18px rgba(15, 35, 52, .04); }
.schedule-readable tr.weekend-row td { background: #fcfbff; }
.schedule-readable tr.holiday-row td { background: #fffaf0; }
.month-position-preview table { min-width: 760px; }
.month-position-preview td, .month-position-preview th { vertical-align: middle; }
.monthly-position-page .notice { margin: 12px 0; }
@media (max-width: 820px) {
  .schedule-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-readable { font-size: 12px; }
  .schedule-readable .staff-color-pill { min-width: 34px; padding: 5px 8px; }
}

/* V14 monthly position matrix */
.monthly-position-page .notice { margin: 10px 0; }
.monthly-matrix-wrap { display: grid; gap: 10px; }
.matrix-legend { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; font-weight: 800; }
.legend-box { width: 18px; height: 18px; border-radius: 5px; display: inline-block; border: 1px solid var(--line); }
.legend-box.weekend { background: #d6dbe1; }
.legend-box.outing { background: #ffe9ee; }
.legend-box.leave { background: #fff7d8; }
.month-position-matrix table { min-width: 1500px; border-collapse: separate; border-spacing: 0; }
.month-position-matrix th, .month-position-matrix td { padding: 8px 10px; min-width: 92px; text-align: center; vertical-align: middle; }
.month-position-matrix .sticky-col { position: sticky; left: 0; z-index: 3; box-shadow: 4px 0 10px rgba(31,50,72,.08); }
.month-position-matrix thead .sticky-col { z-index: 5; background: #f6f9fc; }
.month-position-matrix .staff-col { min-width: 150px; text-align: left; }
.month-position-matrix .date-head { font-size: 12px; line-height: 1.2; }
.month-position-matrix .weekend-head, .month-position-matrix .holiday-head { background: #d6dbe1; color: #1f2933; }
.month-position-matrix .outing-head { background: #ffe9ee; color: #b3354c; }
.matrix-cell { font-size: 12px; font-weight: 900; line-height: 1.25; background: #fff; }
.matrix-cell span { display: inline-block; white-space: nowrap; }
.matrix-cell.no-position-day { background: #d6dbe1; color: #4a5562; font-size: 11px; letter-spacing: .04em; }
.matrix-cell.outing-cell { background: #fff1f4; color: #b3354c; }
.matrix-cell.leave-cell { background: #fff7d8; color: #806000; }
.cell-note { margin-top: 4px; font-size: 10px; color: var(--muted); font-weight: 800; }
.staff-color-cell small { opacity: .85; }
@media (max-width: 720px) {
  .month-position-matrix th, .month-position-matrix td { min-width: 82px; padding: 7px 8px; font-size: 11px; }
  .month-position-matrix .staff-col { min-width: 124px; }
}

/* V15 duty trade + clearer roster cells */
.schedule-person-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.trade-btn {
  font-size: 11px;
  padding: 4px 8px;
  opacity: 0.92;
}
.trade-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(120, 145, 170, .18);
}
.trade-panel h3 { margin-bottom: 10px; }
.modal .form-grid textarea { min-height: 92px; }
@media (max-width: 900px) {
  .schedule-person-cell { justify-content: flex-start; }
  .trade-btn { width: 100%; }
}

/* V17: no blank monthly position cells */
.month-position-matrix .needs-review-cell { background: #fff4df; color: #8a5a00; font-weight: 800; }
.month-position-matrix .needs-review-cell span { display: inline-block; padding: 3px 8px; border-radius: 999px; background: rgba(255, 196, 87, .28); }

/* V19 roster usability + monthly position summary */
.roster-board > .card:first-child {
  position: sticky;
  top: 86px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow: auto;
}
.roster-board .table-wrap {
  max-height: calc(100vh - 230px);
  overflow: auto;
}
.roster-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
}
.month-position-summary {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbfdff;
}
.month-position-summary h4 {
  margin: 0 0 6px;
  font-size: 16px;
}
.month-position-summary table {
  min-width: 920px;
}
.month-position-summary td,
.month-position-summary th {
  vertical-align: top;
  text-align: left;
}
.trade-swap-only .hint {
  display: block;
  margin-top: 6px;
}
@media (max-width: 1100px) {
  .roster-board > .card:first-child {
    position: static;
    max-height: none;
  }
  .roster-board .table-wrap {
    max-height: none;
  }
}

/* V20: compact monthly position summary */
.month-position-summary-hint {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fbff;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.month-position-summary-hint .hint { flex: 1 1 420px; }
.staff-summary-trigger {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.staff-summary-trigger span {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.55);
  font-size: 10px;
  font-weight: 900;
}
.staff-summary-trigger:hover span { background: rgba(255,255,255,.82); }
.staff-summary-head {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 14px;
}
.modal-stat-grid { margin: 10px 0; }
.modal-summary-grid { margin-top: 10px; }
.modal-summary-grid .card-lite table,
.compact-detail-table table { width: 100%; min-width: 0; }
.modal-summary-grid .card-lite td,
.compact-detail-table td,
.compact-detail-table th { text-align: left; vertical-align: top; padding: 8px 10px; }
@media (max-width: 720px) {
  .month-position-summary-hint { align-items: flex-start; }
  .modal-summary-grid { grid-template-columns: 1fr; }
}

/* V30 mobile usability fixes */
.sidebar-backdrop { display:none; }
@media (max-width: 820px) {
  body.sidebar-open::after { content:""; position:fixed; inset:0; background:rgba(17,30,43,.28); z-index:70; }
  .sidebar.open { box-shadow: 18px 0 50px rgba(20,40,60,.25); }
  .main-panel { width:100%; overflow-x:hidden; }
  .topbar { align-items:flex-start; }
  .topbar h2 { font-size: 24px; line-height: 1.15; }
  .page-content { overflow-x:hidden; }
  .card { padding:14px; border-radius:22px; overflow:hidden; }
  .toolbar { align-items:stretch; }
  .toolbar > label, .toolbar > button, .toolbar > .soft-btn, .toolbar > .ghost-btn, .toolbar > .primary-btn { width:100%; }
  input, select, textarea, button { font-size:16px; max-width:100%; }
  label { font-size:15px; }
  .grid, .grid-2, .grid-3, .grid-4 { width:100%; }
  .section-title { align-items:flex-start; flex-direction:column; }
  .notice { font-size:14px; line-height:1.5; }

  .desktop-schedule-table, .daily-position-table.desktop-table, .desktop-table { display:none !important; }
  .mobile-schedule-list, .mobile-position-list { display:grid; gap:12px; }
  .schedule-day-card, .position-mobile-card, .mobile-day-card { background:#fff; border:1px solid var(--line); border-radius:20px; padding:14px; display:grid; gap:10px; }
  .schedule-day-card.weekend-row { background:#f4f6f8; }
  .mobile-day-head { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
  .mobile-day-head b { font-size:24px; }
  .mobile-day-head span { color:var(--muted); font-weight:800; }
  .mobile-duty-line { display:grid; grid-template-columns: 72px 1fr auto; gap:8px; align-items:center; padding:8px 0; border-top:1px solid var(--line); }
  .mobile-duty-line:first-of-type { border-top:0; }
  .mobile-duty-line .trade-btn { grid-column: 2 / -1; width:max-content; }
  .position-mobile-card h3 { margin:0; font-size:18px; }
  .position-mobile-card p { margin:0; color:var(--muted); line-height:1.45; }
  .position-mobile-card label { display:grid; gap:8px; }

  .mobile-calendar-tools { display:grid; gap:8px; margin-bottom:10px; }
  .mobile-calendar-list { display:grid; gap:12px; }
  .calendar-shell .toolbar { display:grid; grid-template-columns: 1fr 1fr; }
  .calendar-shell .toolbar b { grid-column:1/-1; margin:0 !important; }
  .calendar-shell .toolbar button { width:100%; }
  .event-pill { white-space:normal; line-height:1.35; }

  .leave .table-wrap, .activities .table-wrap { max-width:100%; }
  .modal { padding:10px; place-items:end center; }
  .modal-card { width:100%; max-height:88vh; border-radius:24px 24px 0 0; padding:18px; }
  .modal-card .form-grid { grid-template-columns:1fr; }
  .trade-panel .table-wrap { display:none; }
  .trade-panel .mobile-cards { display:grid; }
}
@media (min-width: 821px) {
  .mobile-schedule-list, .mobile-position-list, .mobile-calendar-list, .mobile-calendar-tools { display:none; }
}


/* V32 mobile/admin polish */
.modal { align-items:center; justify-items:center; }
.modal.modal-sm .modal-card { width:min(520px, calc(100vw - 32px)); }
.confirm-box h2 { margin-top:0; }
.confirm-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
.gps-help { margin-top:14px; }
.mobile-roster-select { display:none; margin-top:8px; width:100%; }
.audit-mobile-cards, .users-mobile-cards { display:none; }
.user-mobile-card { gap:10px; }

@media (max-width: 820px) {
  html, body { overflow-x:hidden; }
  .modal { padding:14px; place-items:center !important; align-items:center !important; }
  .modal-card { width:min(94vw, 720px) !important; max-height:82vh; border-radius:26px !important; padding:20px !important; }
  .modal.modal-sm .modal-card { width:min(92vw, 500px) !important; }
  .confirm-actions { display:grid; grid-template-columns:1fr 1fr; }
  .ot-page { grid-template-columns:1fr !important; }
  .ot-card .primary-btn { width:100%; min-height:54px; font-size:18px; }
  .audit-page-card .audit-desktop-table { display:none; }
  .audit-mobile-cards { display:grid !important; gap:12px; }
  .audit-toolbar { display:grid; grid-template-columns:1fr 1fr; }
  .audit-toolbar label { grid-column:1/-1; }
  .audit-mobile-card p { margin:4px 0; line-height:1.45; }
  .users-mobile-cards { display:grid !important; gap:12px; }
  .users-mobile-cards + .hint { margin-top:12px; }
  .users-mobile-cards .grid-2 { grid-template-columns:1fr 1fr !important; }
  .mobile-roster-select { display:block; }
  .roster-board { display:block; }
  .staff-pool { display:none; }
  .roster-slot .actions { justify-content:flex-start; }
  .roster-slot { min-width:150px; }
  .roster-table { min-width:760px; }
  .topbar { align-items:flex-start; }
  .topbar h2 { font-size:24px; line-height:1.15; }
  .page-content { padding:16px; }
}

/* V32: stronger app-like modal and mobile pages */
body.modal-open { overflow: hidden; }
.modal { z-index: 9999; background: rgba(17, 30, 43, .48); backdrop-filter: blur(3px); align-items: center !important; justify-items: center !important; place-items: center !important; }
.modal-card { border-radius: 28px !important; box-shadow: 0 28px 80px rgba(20, 35, 52, .32) !important; animation: modalPop .16s ease-out; }
.modal-close { z-index: 2; }
@keyframes modalPop { from { opacity: .5; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.mobile-roster-cards { display: none; }
.ot-mobile-cards { display: none; }

@media (max-width: 820px) {
  .modal { padding: 18px !important; align-items: center !important; justify-items: center !important; place-items: center !important; }
  .modal-card { width: min(94vw, 680px) !important; max-height: 82vh !important; border-radius: 26px !important; padding: 20px !important; }
  .confirm-box p { font-size: 16px; line-height: 1.55; }

  .grid.grid-2:has(#leaveForm), .grid.grid-2:has(#activityForm) { grid-template-columns: 1fr !important; }
  #leaveForm, #activityForm, #newStaffForm, #otForm { grid-template-columns: 1fr !important; }
  .leave-desktop-table, .activity-desktop-table, .users-desktop-table, .audit-desktop-table, .ot-desktop-table, .roster-table-wrap { display: none !important; }
  .mobile-cards, .audit-mobile-cards, .users-mobile-cards, .ot-mobile-cards, .mobile-roster-cards { display: grid !important; gap: 12px; }
  .mobile-card { border-radius: 22px; padding: 16px; box-shadow: 0 8px 22px rgba(31,50,72,.05); }

  .roster-board > .card:first-child { display: none; }
  .roster-board > .card:last-child { padding: 12px; }
  .mobile-roster-slot { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
  .mobile-roster-slot:first-of-type { border-top: 0; padding-top: 0; }
  .mobile-roster-slot select { width: 100%; min-height: 48px; }
  .roster-day-card { background: #fff; }

  .audit-toolbar { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; }
  .audit-toolbar label { grid-column: 1 / -1; }
  .audit-page-card { overflow: hidden; }
  .audit-mobile-card { font-size: 15px; }

  .users-mobile-cards label { font-size: 14px; }
  .users-mobile-cards input, .users-mobile-cards select { min-height: 44px; }

  .ot-card { overflow: visible; }
  .ot-card h3 { font-size: 22px; }
  .ot-card .primary-btn { min-height: 56px; font-size: 18px; }

  .calendar-shell .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .calendar-shell .toolbar label, .calendar-shell .toolbar b { grid-column: 1 / -1; }
  .mobile-calendar-list { max-height: none; }

  .sidebar { max-width: 82vw; }
  body.sidebar-open::after { z-index: 70; }
}

/* V36: Staff Planner brand + mobile monthly roster views */
.app-title { letter-spacing: .2px; }
.mobile-schedule-tabs { display:none; }
.mobile-schedule-view { display:none; }
.mobile-schedule-person-list, .mobile-ot-summary-list { display:grid; gap:12px; }
.schedule-person-card, .ot-summary-card {
  border:1px solid var(--line);
  border-radius:22px;
  padding:14px;
  background:#fff;
  display:grid;
  gap:10px;
  text-align:left;
}
.schedule-person-card .person-card-head, .person-duty-line, .mobile-duty-line {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border-bottom:1px solid var(--line);
  padding-bottom:8px;
}
.schedule-person-card .person-card-head { border-bottom:0; background:var(--staff-bg); color:var(--staff-fg); border-radius:16px; padding:10px 12px; }
.person-duty-line:last-child, .mobile-duty-line:last-child { border-bottom:0; padding-bottom:0; }
.ot-summary-card {
  background:var(--staff-bg);
  color:var(--staff-fg);
  border-color:rgba(20,35,52,.08);
  grid-template-columns:1.2fr .8fr .8fr 1fr;
  align-items:center;
  font-weight:800;
}
.mobile-schedule-matrix-wrap { max-height:72vh; border-radius:20px; }
.schedule-person-matrix { border-collapse:separate; border-spacing:0; min-width:920px; }
.schedule-person-matrix th, .schedule-person-matrix td { min-width:92px; text-align:center; vertical-align:middle; }
.schedule-person-matrix thead th { position:sticky; top:0; z-index:3; background:#f4f8fb; }
.schedule-person-matrix tbody th { position:sticky; left:0; z-index:2; background:var(--staff-bg); color:var(--staff-fg); min-width:126px; }
.schedule-person-matrix td.weekend-cell { background:#d7dde3; color:#425466; font-size:12px; font-weight:800; }
.schedule-person-matrix td.holiday-cell { background:#fff5cf; color:#715600; font-size:12px; font-weight:800; }
.schedule-person-matrix .trade-btn { display:block; margin:6px auto 0; }
@media (max-width: 820px) {
  .desktop-schedule-summary { display:none !important; }
  .mobile-schedule-tabs { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:8px; margin:10px 0 14px; }
  .mobile-schedule-tabs button { min-height:44px; padding:8px 6px; font-size:14px; }
  .desktop-schedule-table { display:none !important; }
  .mobile-schedule-view { display:block; }
  .trade-panel .desktop-table { display:none !important; }
  .trade-mobile-cards { display:grid !important; }
  .schedule-day-card { border-radius:24px; padding:18px; }
  .mobile-duty-line { align-items:flex-start; }
  .mobile-duty-line .trade-btn { margin-left:auto; }
  .ot-summary-card { grid-template-columns:1fr 1fr; gap:6px; }
  .ot-summary-card b { grid-column:1/-1; font-size:18px; }
  .schedule-page-card { padding:14px; }
}

/* V43: wording cleanup + compact filter/profile layout */
.compact-filter { margin-bottom: 12px; }
.compact-filter label { min-width: 210px; }
.hint.compact { line-height: 1.45; margin-top: 6px; }
.compact-summary {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdff;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
#myProfilePage .card > div:not(.section-title),
.profile-info-row {
  line-height: 1.65;
}
#myProfilePage .card b { margin-right: 4px; }
.staff-chip[data-staff-stat] { cursor: pointer; }
.trade-panel .notice { margin-top: 8px; }
@media (max-width: 820px) {
  .compact-filter { display: grid; grid-template-columns: 1fr; }
  .compact-filter label { min-width: 0; width: 100%; }
  .compact-summary { align-items: flex-start; }
  .gps-help.compact { font-size: 13px; }
}
.profile-info-grid { display:grid; gap:10px; margin: 8px 0 18px; }
.profile-info-grid > div { display:grid; grid-template-columns: 110px minmax(0,1fr); gap:12px; align-items:baseline; padding:7px 0; border-bottom:1px solid rgba(120,145,170,.18); }
.profile-info-grid b { word-break: break-word; }
@media (max-width: 560px) {
  .profile-info-grid > div { grid-template-columns: 1fr; gap:2px; }
}

/* V47 calendar/profile/month-position refinements */
.calendar-modal-list { display:grid; gap:10px; }
.calendar-modal-row {
  background: color-mix(in srgb, var(--event-bg, #eef3f8) 34%, #fff);
  border: 1px solid color-mix(in srgb, var(--event-bg, #eef3f8) 70%, #d8e1ea);
  border-left: 8px solid var(--event-bg, #d8e1ea);
  border-radius: 16px;
  padding: 14px 16px;
}
.calendar-modal-row .event-title { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:4px; }
.hr-checked-badge { font-weight:900; font-size:13px; box-shadow: 0 4px 12px rgba(26, 127, 55, .14); }
.event-color-badge { border:1px solid rgba(0,0,0,.06); }
.month-position-select { width: 100%; min-width: 135px; font-size: 12px; padding: 8px 10px; border-radius: 12px; }
.profile-info-grid { display:grid; gap:10px; }
.profile-info-grid > div { display:grid; grid-template-columns: 120px 1fr; gap:10px; padding:10px 0; border-bottom:1px solid var(--line); align-items:center; }
@media (max-width: 820px) {
  .profile-info-grid > div { grid-template-columns:1fr; gap:2px; padding:12px 0; }
  .calendar-modal-row { padding: 12px; border-radius: 14px; }
  .month-position-select { min-width: 120px; }
}

/* V48 users/admin: card layout instead of very wide table */
.users-page-v48 .card { overflow: visible; }
.admin-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 14px;
}
.admin-user-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(31,50,72,.04);
}
.admin-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.admin-user-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 900;
}
.admin-user-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 800;
}
.admin-user-form {
  display: grid;
  grid-template-columns: 88px 1fr 1fr;
  gap: 10px;
  align-items: end;
}
.admin-user-form label {
  font-size: 13px;
  gap: 5px;
}
.admin-user-form input,
.admin-user-form select {
  min-height: 40px;
  padding: 9px 10px;
  border-radius: 12px;
}
.admin-user-form label:nth-child(3),
.admin-user-form label:nth-child(4) { grid-column: span 1; }
.admin-user-form label:nth-child(12),
.admin-user-form label:nth-child(13),
.admin-user-form label:nth-child(14) { grid-column: span 1; }
.user-bottom-save { margin-top: 14px; justify-content: flex-end; }
@media (max-width: 1024px) {
  .admin-user-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .admin-user-form { grid-template-columns: 1fr; }
  .admin-user-head { align-items: flex-start; }
  .users-save-title { display: grid; }
  .users-save-title .primary-btn, .user-bottom-save .primary-btn { width: 100%; }
  .user-bottom-save { justify-content: stretch; }
}

/* V49: ผู้ใช้งานและสิทธิ์แบบเลือกทีละคน คล้ายสิทธิ์ตำแหน่งรายวัน */
.users-page-v49 .eligibility-staff-panel,
.users-page-v49 .eligibility-position-panel { min-width: 0; }
.users-page-v49 .admin-user-single-card { box-shadow: none; }
.users-page-v49 .add-user-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  background: #fff;
}
.users-page-v49 .add-user-details summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--blue-700);
}
.users-page-v49 .add-user-details .form-grid { margin-top: 12px; }
.users-page-v49 .admin-user-form {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}
@media (max-width: 1100px) {
  .users-page-v49 .admin-user-form { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}
@media (max-width: 820px) {
  .users-page-v49 .admin-user-form { grid-template-columns: 1fr; }
  .users-page-v49 .selected-staff-card { margin-bottom: 10px; }
}

/* V51: app-like centered messages for every save/error/confirm */
.app-alert, .app-confirm { text-align:center; padding: 8px 4px 2px; }
.app-alert-icon { width: 58px; height: 58px; border-radius: 22px; display:inline-grid; place-items:center; margin: 0 auto 12px; font-size: 30px; font-weight: 900; background:#dff4e7; color:#14804a; }
.app-alert.error .app-alert-icon { background:#ffe8ea; color:#c6364a; }
.app-alert-icon.warn { background:#fff4d7; color:#9b6a00; }
.app-alert h2, .app-confirm h2 { margin: 4px 0 8px; font-size: 24px; }
.app-alert p, .app-confirm p { margin: 0 auto 18px; color: var(--muted); line-height: 1.55; max-width: 460px; }
.dialog-textarea { width:100%; min-height:96px; border:1px solid var(--line); border-radius:16px; padding:12px 14px; font:inherit; resize:vertical; margin: 8px 0 14px; }
.app-alert .confirm-actions, .app-confirm .confirm-actions { justify-content:center; }
@media (max-width: 720px) {
  .app-alert h2, .app-confirm h2 { font-size: 21px; }
  .app-alert p, .app-confirm p { font-size: 15px; }
}


/* V56 mobile/sidebar/profile polish */
.nav-btn span:last-child { white-space: normal; line-height: 1.25; }
.sidebar { overflow-y: auto; overflow-x: hidden; }
.sidebar-foot { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(217,239,255,.75), #eef8ff 35%); padding-top: 10px; margin-top: 16px; }
.danger-ghost.full-btn, .full-btn { width: 100%; max-width: 100%; }
.profile-info-readable { gap: 12px; }
.profile-info-readable > div { grid-template-columns: 120px minmax(0,1fr); padding: 12px 0; line-height: 1.45; }
.profile-info-readable .muted { display:block; }
.profile-info-readable b { display:block; word-break: break-word; overflow-wrap:anywhere; }
.request-card { line-height: 1.55; }
@media (min-width: 821px) {
  .sidebar.collapsed { width: 86px; padding: 16px 10px; }
  .sidebar.collapsed .brand-text, .sidebar.collapsed .nav-section-title, .sidebar.collapsed .nav-btn span:last-child, .sidebar.collapsed .mini-profile span, .sidebar.collapsed .danger-ghost { display:none; }
  .sidebar.collapsed .nav-btn { justify-content:center; padding: 13px 8px; }
  .sidebar.collapsed .sidebar-head { justify-content:center; }
  body.sidebar-collapsed .app-shell { grid-template-columns: 86px minmax(0,1fr); }
}
@media (max-width: 820px) {
  .sidebar { width: 285px; max-width: 84vw; padding: 16px 14px; }
  .nav-btn { padding: 12px 12px; gap: 10px; font-size: 15px; }
  .sidebar-foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .profile-page-grid { grid-template-columns: 1fr !important; }
  .profile-card-readable { overflow:hidden; }
  .profile-info-readable > div { grid-template-columns: 88px minmax(0,1fr); gap: 8px; padding: 11px 0; align-items:start; }
}
@media (max-width: 560px) {
  .profile-info-readable > div { grid-template-columns: 1fr; gap: 4px; }
}

/* V57 layout polish */
.sidebar { width: 286px; }
.nav-btn { min-height: 46px; padding: 11px 13px; gap: 10px; }
.nav-btn span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.nav-section-title { gap: 8px; }
.sidebar-foot { margin-top: auto; position: sticky; bottom: 0; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
#logoutBtn { width: 100%; box-sizing: border-box; }
.profile-info-list { display: grid; gap: 0; margin: 12px 0 18px; }
.profile-info-list > div { display: grid; grid-template-columns: 130px minmax(0,1fr); gap: 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); line-height: 1.45; }
.profile-info-list span { color: var(--muted); }
.profile-info-list b { overflow-wrap: anywhere; word-break: break-word; }
.v57-profile-page .compact-form { gap: 12px; }
.v57-profile-page .two-cols { grid-template-columns: repeat(2, minmax(0,1fr)); }
.v57-request-card { padding: 16px; display: grid; gap: 8px; }
.request-head, .activity-row-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.v57-request-list { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.activity-list-card { max-height: calc(100vh - 150px); overflow: auto; }
.activity-card-list { display: grid; gap: 12px; }
.activity-row-card { border:1px solid var(--line); border-radius:18px; background:#fff; padding:14px; display:grid; gap:8px; }
.activity-row-detail { display:grid; grid-template-columns:92px minmax(0,1fr); gap:10px; }
.activity-row-detail span { color: var(--muted); }
.activity-row-detail b { overflow-wrap:anywhere; }
@media (min-width:821px) {
  .sidebar.collapsed { width: 84px; }
  body.sidebar-collapsed .app-shell { grid-template-columns: 84px minmax(0,1fr); }
}
@media (max-width: 1100px) {
  .activities-v57 { grid-template-columns: 1fr; }
  .activity-list-card { max-height: none; }
}
@media (max-width: 820px) {
  .sidebar { width: 292px; max-width: 86vw; display:flex; flex-direction:column; max-height: 100dvh; }
  .nav-btn { font-size: 15px; min-height: 44px; }
  .nav-btn span:last-child { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .profile-info-list > div { grid-template-columns: 96px minmax(0,1fr); gap: 10px; padding: 11px 0; }
  .v57-profile-page .two-cols { grid-template-columns: 1fr; }
  .v57-request-list { grid-template-columns: 1fr; }
  .activity-row-detail { grid-template-columns: 82px minmax(0,1fr); }
  .sidebar-foot { flex-shrink: 0; }
}
@media (max-width: 520px) {
  .profile-info-list > div { grid-template-columns: 1fr; gap: 3px; }
}

/* V59 hotfix: simple centered status modal */
.modal-status-icon {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px auto;
  font-size: 34px;
  font-weight: 900;
}
.modal-status-icon.error {
  background: #ffe8ea;
  color: #d9485f;
}
.modal-message {
  text-align: center;
  color: #6b7a90;
  font-size: 16px;
  line-height: 1.55;
  margin: 4px 0 10px;
}


/* V64: ลดความแน่นบนจอคอม โดยไม่กระทบ layout มือถือ */
@media (min-width: 821px) {
  html, body { font-size: 15px; }
  .app-view { grid-template-columns: 286px minmax(0, 1fr); }
  body.sidebar-collapsed .app-view { grid-template-columns: 84px minmax(0, 1fr); }
  .topbar { padding: 14px 22px; }
  .topbar h2 { font-size: 22px; line-height: 1.2; }
  .page-content { padding: 20px 22px; gap: 16px; }
  .card { padding: 16px; }
  .card h3 { font-size: 17px; }
  label { gap: 6px; }
  input, select, textarea { padding: 10px 12px; border-radius: 13px; }
  .primary-btn, .ghost-btn, .danger-ghost, .soft-btn { min-height: 40px; padding: 8px 14px; }
  .nav-btn { font-size: 15px; min-height: 42px; padding: 9px 12px; }
  .nav-section-title small { font-size: 11px; }
  .user-mini { font-size: 13px; padding: 10px; }
  th, td { padding: 10px 12px; }
  .profile-info-list > div { padding: 10px 0; }
}


/* V68 sidebar real hide fallback */
body.cnmi-sidebar-hidden .sidebar{display:none!important;width:0!important;min-width:0!important;max-width:0!important;padding:0!important;margin:0!important;border:0!important;overflow:hidden!important;}
body.cnmi-sidebar-hidden .app-view{display:grid!important;grid-template-columns:minmax(0,1fr)!important;}
body.cnmi-sidebar-hidden .main-panel{grid-column:1 / -1!important;width:100%!important;max-width:none!important;margin-left:0!important;}
body.cnmi-sidebar-hidden .topbar{left:0!important;}
body.cnmi-sidebar-hidden .page-content{max-width:none!important;}

/* V69 sidebar-only fix: keep drawer behavior clean and remove old collapsed strip */
body.cnmi-sidebar-hidden #sidebar.sidebar{display:none!important;width:0!important;min-width:0!important;max-width:0!important;padding:0!important;margin:0!important;border:0!important;overflow:hidden!important;}
body.cnmi-sidebar-hidden #appView.app-view{display:grid!important;grid-template-columns:minmax(0,1fr)!important;}
body.cnmi-sidebar-hidden .main-panel{grid-column:1 / -1!important;width:100%!important;max-width:none!important;margin-left:0!important;}
@media (max-width:820px){
  body:not(.sidebar-open):not(.cnmi-sidebar-hidden) #sidebar.sidebar:not(.open){transform:translateX(-105%)!important;pointer-events:none!important;}
  body.sidebar-open #sidebar.sidebar.open{transform:translateX(0)!important;pointer-events:auto!important;}
}

/* V70 sidebar-only: intermediate desktop/tablet must use drawer, not permanent column */
@media (max-width: 1180px) and (min-width: 821px) {
  #appView.app-view {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #sidebar.sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: 292px !important;
    max-width: 86vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    z-index: 80 !important;
    transform: translateX(-105%) !important;
    transition: transform .22s ease !important;
    box-shadow: none !important;
  }
  body.sidebar-open #sidebar.sidebar {
    transform: translateX(0) !important;
    box-shadow: 18px 0 50px rgba(20,40,60,.25) !important;
  }
  #appView .main-panel {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  body.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(17,30,43,.28);
    z-index: 70;
  }
  body.cnmi-sidebar-hidden #sidebar.sidebar {
    display: none !important;
  }
}
/* v135 regression final fix: clickable tabs, compact schedule grid, Ch4 admin consistency */
.v135-schedule-tabs,
.mobile-schedule-tabs {
  position: relative;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
  pointer-events: auto !important;
}
.v135-schedule-tabs button,
.mobile-schedule-tabs button,
.v135-tab {
  cursor: pointer !important;
  position: relative;
  z-index: 60;
  pointer-events: auto !important;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 800;
}
.v135-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.loading-overlay, .busy-overlay, .screen-overlay, .route-guard-overlay { pointer-events: none !important; }

.v135-grid-wrap { max-width: 100%; overflow: auto; border-radius: 14px; }
.v135-schedule-grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 1120px; font-size: 12px; }
.v135-schedule-grid th,
.v135-schedule-grid td { padding: 3px 4px !important; line-height: 1.15; min-width: 42px; height: 28px; vertical-align: middle; text-align: center; border-bottom: 1px solid #edf1f5; }
.v135-schedule-grid thead th { position: sticky; top: 0; z-index: 20; background: #f8fafc; font-weight: 900; }
.v135-schedule-grid .v135-sticky-name,
.v135-schedule-grid .v135-name-cell { position: sticky; left: 0; z-index: 25; min-width: 118px; width: 118px; max-width: 118px; box-shadow: 5px 0 10px rgba(15,35,52,.06); }
.v135-schedule-grid .v135-sticky-name { background: #fff; }
.v135-name-cell { background: var(--staff-bg) !important; color: var(--staff-fg) !important; text-align: left !important; }
.v135-name-cell button { all: unset; cursor: pointer; display: block; width: 100%; font-weight: 900; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v135-schedule-grid tr.zebra td:not(.v135-day-off-cell) { background: #fcfdff; }
.v135-day-off-col,
.v135-day-off-cell { background: #eef1f4 !important; }
.v135-cell-stack { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 20px; }
.v135-shift-pill { border: 0; border-radius: 999px; padding: 2px 6px; min-height: 18px; font-size: 11px; font-weight: 900; line-height: 1.1; background: var(--staff-bg); color: var(--staff-fg); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.v135-shift-pill:hover { filter: brightness(.96); transform: translateY(-1px); }
.v135-status { display: inline-block; border-radius: 999px; padding: 1px 5px; font-size: 10px; font-weight: 900; line-height: 1.2; background: #f3f4f6; color: #4b5563; border: 1px solid #d7dce2; white-space: nowrap; }
.v135-status.no-duty { background: #fff4e5; color: #9a5b00; border-color: #ffd79a; }
.v135-status.maternity { background: #f3e8ff; color: #6d28d9; border-color: #dbc2ff; }
.v135-status.leave { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

.v135-day-cards, .v135-person-list { display: grid; gap: 10px; }
.v135-day-card { border: 1px solid var(--line); border-radius: 16px; padding: 10px; background: #fff; }
.v135-day-card.dayoff { background: #f4f6f8; }
.v135-day-head, .v135-day-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.v135-day-head { padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.v135-day-line { padding: 4px 0; }
.v135-person-list { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.v135-person-card { text-align: left; border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; background: var(--staff-bg); color: var(--staff-fg); cursor: pointer; display: grid; gap: 3px; }
.v135-person-card small { opacity: .85; }

.v135-roster-admin { table-layout: fixed; min-width: 1080px; }
.v135-roster-admin th,
.v135-roster-admin td { padding: 4px 5px !important; line-height: 1.15; }
.v135-roster-admin .roster-slot { padding: 5px !important; min-height: 54px; }
.v135-roster-admin .slot-meta { font-size: 10px; }
.v135-roster-admin-wrap { max-height: 74vh; }
.v135-admin-dayoff-row td { background: #f5f6f8; }

@media (max-width: 820px) {
  .v135-schedule-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .v135-schedule-grid { min-width: 980px; font-size: 11px; }
  .v135-schedule-grid th, .v135-schedule-grid td { min-width: 38px; padding: 2px 3px !important; }
  .v135-shift-pill { font-size: 10px; padding: 2px 5px; }
}

@media print {
  .v135-schedule-tabs, .no-print, .trade-panel, .sidebar, .topbar { display: none !important; }
  .v135-grid-wrap { overflow: visible !important; border: 0 !important; }
  .v135-schedule-grid { min-width: 0 !important; width: 100% !important; font-size: 7px !important; table-layout: fixed !important; }
  .v135-schedule-grid th, .v135-schedule-grid td { padding: 1px 2px !important; height: auto !important; min-width: 0 !important; word-break: break-word; white-space: normal; }
  .v135-schedule-grid .v135-sticky-name, .v135-schedule-grid .v135-name-cell { position: static !important; width: 64px !important; min-width: 64px !important; max-width: 64px !important; box-shadow: none !important; }
  .v135-shift-pill, .v135-status, .v135-name-cell, .v135-day-off-cell, .v135-day-off-col { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* v136 final UI consistency: compact sticky tabs, compact admin grid, stable visual mapping */
.v136-schedule-page { position: relative; }
.v136-schedule-tabs {
  position: sticky;
  top: 0;
  z-index: 120;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 0;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e8edf3;
  pointer-events: auto !important;
}
.v136-tab {
  border: 1px solid #dbe4ee;
  background: #fff;
  color: #25364a;
  border-radius: 12px;
  min-height: 36px;
  padding: 6px 8px;
  font-weight: 900;
  cursor: pointer !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 121;
  line-height: 1.15;
}
.v136-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.loading-overlay, .busy-overlay, .screen-overlay, .route-guard-overlay { pointer-events: none !important; }

.v136-grid-wrap { max-width: 100%; overflow: auto; border: 1px solid #e7edf4; border-radius: 14px; }
.v136-schedule-grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 1080px; width: max-content; font-size: 11px; background: #fff; }
.v136-schedule-grid th,
.v136-schedule-grid td { padding: 2px 3px !important; line-height: 1.1 !important; min-width: 34px; max-width: 46px; height: 24px !important; vertical-align: middle; text-align: center; border-bottom: 1px solid #edf2f7; border-right: 1px solid #f1f4f7; }
.v136-schedule-grid thead th { position: sticky; top: 0; z-index: 30; background: #f8fafc; font-weight: 900; }
.v136-schedule-grid .v136-sticky-name,
.v136-schedule-grid .v136-name-cell { position: sticky; left: 0; z-index: 40; min-width: 112px !important; width: 112px !important; max-width: 112px !important; box-shadow: 5px 0 10px rgba(15,35,52,.06); }
.v136-schedule-grid .v136-sticky-name { background: #fff !important; }
.v136-name-cell { background: var(--staff-bg) !important; color: var(--staff-fg) !important; text-align: left !important; }
.v136-name-cell button { all: unset; cursor: pointer; display: block; width: 100%; font-weight: 900; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v136-schedule-grid tr.zebra td:not(.v136-dayoff-cell) { background: #fcfdff; }
.v136-dayoff-col, .v136-dayoff-cell { background: #eceff3 !important; }
.v136-cell-stack { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 18px; }
.v136-shift-pill { border: 0; border-radius: 999px; padding: 1px 5px; min-height: 16px; font-size: 10px; font-weight: 900; line-height: 1.1; background: var(--staff-bg); color: var(--staff-fg); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); white-space: nowrap; }
.v136-shift-pill:hover { filter: brightness(.96); transform: translateY(-1px); }
.v136-status { display: inline-block; border-radius: 999px; padding: 1px 4px; font-size: 9px; font-weight: 900; line-height: 1.15; background: #f3f4f6; color: #4b5563; border: 1px solid #d7dce2; white-space: nowrap; }
.v136-status.no-duty { background: #fff4e5; color: #9a5b00; border-color: #ffd79a; }
.v136-status.maternity { background: #f3e8ff; color: #6d28d9; border-color: #dbc2ff; }
.v136-status.leave { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

.v136-calendar-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.v136-day-card { border: 1px solid #e1e8f0; border-radius: 16px; padding: 9px; background: #fff; }
.v136-day-card.dayoff { background: #f4f6f8; }
.v136-day-head, .v136-day-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.v136-day-head { padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px solid #e8edf3; }
.v136-day-line { padding: 3px 0; }
.v136-person-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.v136-person-card { text-align: left; border: 1px solid #dbe4ee; border-radius: 16px; padding: 10px 12px; background: var(--staff-bg); color: var(--staff-fg); cursor: pointer; display: grid; gap: 2px; }
.v136-person-card small { opacity: .85; }
.v136-balance-table th, .v136-balance-table td { padding: 7px 8px !important; }
.v136-balance-status { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 900; }
.v136-balance-status.ok { background:#dcfce7; color:#166534; }
.v136-balance-status.warn { background:#fef3c7; color:#92400e; }
.v136-balance-status.over { background:#fee2e2; color:#991b1b; }
.v136-balance-status.exempt { background:#ede9fe; color:#5b21b6; }

.v136-roster-admin-wrap { max-height: 74vh; max-width: 100%; overflow: auto; border-radius: 14px; }
.v136-roster-admin { table-layout: fixed !important; min-width: 1080px; width: max-content; font-size: 12px; }
.v136-roster-admin th,
.v136-roster-admin td { padding: 3px 4px !important; line-height: 1.1 !important; vertical-align: middle; }
.v136-roster-admin .v136-admin-date-col,
.v136-roster-admin .v136-admin-date { width: 100px !important; min-width: 100px !important; max-width: 100px !important; }
.v136-roster-admin .roster-slot { padding: 4px !important; min-height: 44px !important; gap: 3px !important; }
.v136-roster-admin .slot-meta { display: none !important; }
.v136-roster-admin .assigned-name small,
.v136-roster-admin .staff-color-pill small { display: none !important; }
.v136-roster-admin select { padding: 5px 6px !important; min-height: 30px !important; font-size: 12px !important; }
.v136-roster-admin .actions { gap: 3px !important; }
.v136-roster-admin .tiny-btn { min-height: 24px !important; padding: 3px 6px !important; font-size: 11px !important; }
.v136-admin-dayoff-row td { background: #f4f6f8; }

@media (max-width: 820px) {
  .v136-schedule-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); top: 0; }
  .v136-tab { font-size: 12px; }
  .v136-schedule-grid { min-width: 960px; font-size: 10px; }
  .v136-schedule-grid th, .v136-schedule-grid td { padding: 2px !important; }
  .v136-shift-pill { font-size: 9px; padding: 1px 4px; }
  .v136-calendar-cards { grid-template-columns: 1fr; }
}
@media print {
  .v136-schedule-tabs, .v136-toolbar, .no-print, .trade-panel, .sidebar, .topbar { display: none !important; }
  .v136-grid-wrap { overflow: visible !important; border: 0 !important; }
  .v136-schedule-grid { min-width: 0 !important; width: 100% !important; font-size: 7px !important; table-layout: fixed !important; }
  .v136-schedule-grid th, .v136-schedule-grid td { padding: 1px 2px !important; height: auto !important; min-width: 0 !important; max-width: none !important; word-break: break-word; white-space: normal; }
  .v136-schedule-grid .v136-sticky-name, .v136-schedule-grid .v136-name-cell { position: static !important; width: 64px !important; min-width: 64px !important; max-width: 64px !important; box-shadow: none !important; }
  .v136-shift-pill, .v136-status, .v136-name-cell, .v136-dayoff-cell, .v136-dayoff-col { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}


/* v141: Force-visible Admin Long-term Leave UI */
.long-leave-field select {
  border-color: #f2b84b;
  background: #fffaf0;
}
.long-leave-admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed #f2b84b;
  border-radius: 14px;
  background: #fffaf0;
}
.long-leave-admin-actions .warning,
.v141-long-leave-actions .warning {
  border-color: #f2b84b;
  background: #fff4d6;
  color: #7a4b00;
}
.v141-long-leave-inline-note {
  display:block;
  margin-top:4px;
  color:#8a5a00;
  font-size:12px;
}

/* V150 clean components: schedule / OT / month position fixes */
.clean-schedule-tabs{
  position: sticky;
  top: 0;
  z-index: 40;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  background:#fff;
  padding:8px 0;
  margin:8px 0 12px;
  border-bottom:1px solid #e5e7eb;
}
.clean-calendar-cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:10px;
}
.clean-day-card,.clean-person-card{
  border:1px solid #e5e7eb;
  border-radius:14px;
  background:#fff;
  padding:10px;
}
.clean-day-card.is-offday{background:#f8fafc;}
.clean-day-head,.clean-day-line,.clean-person-duty{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.clean-day-head{margin-bottom:8px;}
.clean-day-line,.clean-person-duty{
  padding:5px 0;
  border-top:1px dashed #e5e7eb;
}
.clean-person-list{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:10px;
}
.clean-person-card{
  background:var(--staff-bg,#fff);
  color:var(--staff-fg,#111827);
}
.clean-person-head{
  width:100%;
  border:0;
  background:transparent;
  color:inherit;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:0 0 8px;
  cursor:pointer;
}
.clean-grid-wrap{overflow:auto;}
.clean-schedule-grid,.clean-balance-table{
  border-collapse:collapse;
  width:max-content;
  min-width:100%;
  table-layout:fixed;
}
.clean-schedule-grid th,.clean-schedule-grid td,.clean-balance-table th,.clean-balance-table td{
  border:1px solid #e5e7eb;
  padding:4px 6px;
  vertical-align:top;
  font-size:12px;
}
.clean-schedule-grid thead th{
  position:sticky;
  top:0;
  z-index:15;
  background:#f8fafc;
}
.clean-sticky-col{
  position:sticky!important;
  left:0;
  z-index:20!important;
}
.clean-staff-cell{
  background:var(--staff-bg,#fff)!important;
  color:var(--staff-fg,#111827)!important;
  min-width:110px;
  max-width:130px;
}
.clean-staff-cell button{
  all:unset;
  cursor:pointer;
  font-weight:800;
}
.offday-col{background:#f1f5f9!important;}
.clean-cell-stack{
  min-height:22px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
}
.clean-shift-pill{
  border:0;
  border-radius:999px;
  background:#dbeafe;
  color:#1e3a8a;
  font-weight:800;
  font-size:11px;
  line-height:1.1;
  padding:3px 7px;
  cursor:pointer;
}
.mini-status{
  display:inline-block;
  border:1px solid #fdba74;
  background:#fff7ed;
  color:#9a3412;
  border-radius:999px;
  padding:1px 5px;
  font-size:10px;
  font-weight:800;
}
.clean-balance-dashboard .notice{margin-bottom:10px;}
.ot-approval-filter{
  display:flex;
  flex-wrap:wrap;
  align-items:end;
  gap:10px;
  margin:8px 0 12px;
}
.ot-approval-filter label{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin:0;
  min-width:180px;
}
.ot-approval-filter input,.ot-approval-filter select{width:100%;}
.month-position-matrix .holiday-cell,.month-position-matrix .weekend-cell{background:#f1f5f9!important;color:#334155;font-weight:800;}
.month-position-matrix .no-position-day span{display:inline-block;border-radius:999px;background:#e5e7eb;padding:4px 8px;}
@media(max-width:700px){
  .ot-approval-filter{align-items:stretch;}
  .ot-approval-filter label{width:100%;min-width:0;}
  .clean-schedule-grid th,.clean-schedule-grid td{font-size:10px;padding:3px 4px;}
  .clean-staff-cell{min-width:96px;}
}

/* V151 clean requirement fixes */
.clean-balance-table th:first-child,
.clean-balance-table td:first-child{
  position:sticky;
  left:0;
  z-index:12;
  background:#fff;
  box-shadow:1px 0 0 #e5e7eb;
}
.clean-balance-table thead th:first-child{z-index:18;background:#f8fafc;}
.clean-grid-wrap{max-width:100%;}
.clean-schedule-grid{
  width:max-content;
  min-width:max-content;
  table-layout:fixed;
}
.clean-schedule-grid th:not(.clean-sticky-col),
.clean-schedule-grid td{width:54px;min-width:54px;max-width:54px;}
.clean-schedule-grid .clean-sticky-col{width:auto;min-width:92px;max-width:none;white-space:nowrap;}
.clean-staff-cell button{white-space:nowrap;}
.clean-shift-pill{
  background:var(--staff-bg,#dbeafe);
  color:var(--staff-fg,#1e3a8a);
  width:100%;
  max-width:48px;
  overflow:hidden;
}
.person-filter-mobile{display:none;margin-bottom:10px;}
.clean-person-mobile-result{display:none;}
.person-filter-mobile label{display:flex;flex-direction:column;gap:6px;}
.person-filter-mobile select{width:100%;}
.ot-approval-filter{
  display:flex;
  flex-wrap:wrap;
  align-items:flex-end;
  gap:10px;
}
.ot-approval-filter label{flex:1 1 180px;}
.ot-approval-filter label:first-child{flex:2 1 260px;}
@media(max-width:700px){
  .person-filter-mobile,.clean-person-mobile-result{display:block;}
  .clean-person-list{display:none;}
  .clean-schedule-grid th:not(.clean-sticky-col),
  .clean-schedule-grid td{width:48px;min-width:48px;max-width:48px;}
  .clean-shift-pill{max-width:42px;padding:3px 4px;}
}

/* V152 SRS clean fixes: roster-only staff, leave colors, compact grid, full sidebar hide */
body.cnmi-sidebar-hidden #sidebar.sidebar{
  display:none!important;
  width:0!important;
  min-width:0!important;
  max-width:0!important;
  padding:0!important;
  margin:0!important;
  border:0!important;
  overflow:hidden!important;
}
body.cnmi-sidebar-hidden #appView.app-view{
  grid-template-columns:minmax(0,1fr)!important;
}
body.cnmi-sidebar-hidden .main-panel{
  grid-column:1 / -1!important;
  width:100%!important;
  max-width:none!important;
  margin-left:0!important;
}
body.cnmi-sidebar-hidden .page-content{max-width:none!important;}

.clean-grid-wrap,.clean-balance-dashboard .table-wrap{overflow:auto;max-width:100%;}
.clean-schedule-grid{
  width:max-content!important;
  min-width:max-content!important;
  table-layout:fixed!important;
}
.clean-schedule-grid th:not(.clean-sticky-col),
.clean-schedule-grid td{
  width:52px!important;
  min-width:52px!important;
  max-width:52px!important;
  padding:3px 4px!important;
}
.clean-schedule-grid .clean-sticky-col{
  width:auto!important;
  min-width:max-content!important;
  max-width:none!important;
  white-space:nowrap!important;
  left:0!important;
}
.clean-staff-cell button{white-space:nowrap!important;overflow:visible!important;text-overflow:clip!important;}
.clean-shift-pill{
  background:var(--staff-bg,#dbeafe)!important;
  color:var(--staff-fg,#1e3a8a)!important;
  width:auto!important;
  min-width:38px;
  max-width:none!important;
  white-space:nowrap;
}
.clean-balance-table th:first-child,
.clean-balance-table td:first-child{
  position:sticky!important;
  left:0!important;
  z-index:12!important;
  background:#fff!important;
  box-shadow:1px 0 0 #e5e7eb;
  white-space:nowrap;
}
.clean-balance-table thead th:first-child{z-index:18!important;background:#f8fafc!important;}

.mini-status.leave-personal,.matrix-cell.leave-personal{background:#ede9fe!important;color:#5b21b6!important;border-color:#c4b5fd!important;}
.mini-status.leave-sick,.matrix-cell.leave-sick{background:#fef3c7!important;color:#92400e!important;border-color:#fcd34d!important;}
.mini-status.leave-vacation,.matrix-cell.leave-vacation{background:#dcfce7!important;color:#166534!important;border-color:#86efac!important;}
.mini-status.leave-no-duty,.matrix-cell.leave-no-duty{background:#e5e7eb!important;color:#374151!important;border-color:#cbd5e1!important;}
.mini-status.leave-other,.matrix-cell.leave-other{background:#e0f2fe!important;color:#075985!important;border-color:#7dd3fc!important;}
.mini-status{font-weight:900;white-space:nowrap;}
.month-position-matrix .holiday-cell,
.month-position-matrix .weekend-cell{
  background:#f1f5f9!important;
  color:#334155!important;
  font-weight:900!important;
  pointer-events:none;
}

@media(max-width:700px){
  .person-filter-mobile,.clean-person-mobile-result{display:block!important;}
  .clean-person-list{display:none!important;}
  .clean-schedule-grid th:not(.clean-sticky-col),
  .clean-schedule-grid td{width:46px!important;min-width:46px!important;max-width:46px!important;}
}

/* V153 targeted UI fixes */
.mini-status.leave-maternity,
.matrix-cell.leave-maternity,
.clean-schedule-grid td.leave-maternity{
  background:#fce7f3!important;
  color:#9d174d!important;
  border-color:#f9a8d4!important;
}
.clean-schedule-grid td.leave-personal{background:#ede9fe!important;}
.clean-schedule-grid td.leave-sick{background:#fef3c7!important;}
.clean-schedule-grid td.leave-vacation{background:#dcfce7!important;}
.clean-schedule-grid td.leave-no-duty{background:#e5e7eb!important;}
.clean-schedule-grid td.leave-other{background:#e0f2fe!important;}
.clean-schedule-grid .clean-cell-stack{gap:2px!important;align-items:center!important;justify-content:center!important;}
.clean-schedule-grid .mini-status{font-size:9px!important;line-height:1.05!important;padding:2px 4px!important;white-space:nowrap!important;}
.month-position-matrix .matrix-cell.leave-maternity{background:#fce7f3!important;color:#9d174d!important;}
.month-position-matrix .matrix-cell.needs-review-cell:empty{background:#fff!important;}
.v153-position-matrix .matrix-legend .leave::after{content:'';}
@media (min-width:821px){
  body.cnmi-sidebar-hidden #appView.app-view{grid-template-columns:minmax(0,1fr)!important;width:100%!important;}
  body.cnmi-sidebar-hidden #sidebar.sidebar{display:none!important;visibility:hidden!important;position:absolute!important;left:-9999px!important;}
  body.cnmi-sidebar-hidden .main-panel{grid-column:1 / -1!important;width:100%!important;max-width:100%!important;}
  body.cnmi-sidebar-hidden .topbar,
  body.cnmi-sidebar-hidden .page-content{width:100%!important;max-width:none!important;}
  body:not(.cnmi-sidebar-hidden) #appView.app-view{grid-template-columns:286px minmax(0,1fr)!important;}
  body:not(.cnmi-sidebar-hidden) #sidebar.sidebar{display:flex!important;position:sticky!important;}
}

/* V158 grouped averages + compact monthly-position staff column + missing roles tracker */
.grouped-balance-dashboard{
  display:grid;
  gap:14px;
}
.balance-group-section{
  border:1px solid #e5e7eb;
  border-radius:18px;
  padding:12px;
  background:#fff;
}
.balance-group-title{
  align-items:center;
  gap:10px;
  margin-bottom:8px;
}
.v158-position-matrix .staff-color-cell{
  padding:5px 8px!important;
  min-width:112px!important;
  max-width:132px!important;
  line-height:1.1!important;
}
.v158-position-matrix .compact-staff-summary{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
  min-height:0;
}
.v158-position-matrix .compact-staff-summary b{
  font-size:12px;
  line-height:1.05;
  white-space:nowrap;
}
.v158-position-matrix .compact-staff-summary span{
  margin-top:0;
  padding:0;
  background:transparent;
  font-size:10px;
  line-height:1.05;
  text-decoration:underline;
  opacity:.92;
}
.v158-position-matrix .compact-staff-summary:hover span{
  background:transparent;
  opacity:1;
}
.v158-position-matrix .missing-role-row th{
  position:sticky;
  top:0;
  z-index:4;
  border-top:0;
  vertical-align:top;
}
.v158-position-matrix .missing-role-head{
  background:#f8fafc!important;
  color:#64748b;
  font-size:11px;
  font-weight:900;
}
.v158-position-matrix .missing-role-cell{
  min-width:108px;
  max-width:128px;
  padding:4px 5px!important;
  font-size:10px;
  line-height:1.15;
  white-space:normal;
}
.v158-position-matrix .missing-role-cell span{
  display:block;
  margin:2px 0;
  padding:2px 5px;
  border-radius:999px;
  background:#fff7ed;
  color:#9a3412;
  border:1px solid #fed7aa;
  font-weight:900;
  white-space:nowrap;
}
.v158-position-matrix .missing-role-cell.complete{
  background:#ecfdf5;
  color:#047857;
  font-weight:900;
}
.v158-position-matrix .missing-role-cell.no-position-day{
  background:#f1f5f9;
  color:#64748b;
  font-weight:900;
}
@media(max-width:720px){
  .v158-position-matrix .staff-color-cell{min-width:96px!important;max-width:112px!important;}
  .v158-position-matrix .missing-role-cell{min-width:92px;max-width:106px;font-size:9px;}
}

/* V159: compact monthly-position staff columns, roster swap DnD, leave filters */
.leave-filter-bar{
  display:flex;
  gap:10px;
  align-items:flex-end;
  flex-wrap:wrap;
  margin:0 0 12px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#f8fbff;
}
.leave-filter-bar label{flex:1 1 160px;min-width:150px;}
.leave-filter-bar select{width:100%;}
.roster-slot.has-staff[draggable="true"]{cursor:grab;}
.roster-slot.has-staff[draggable="true"]:active{cursor:grabbing;}
.roster-slot.dragging{opacity:.62;border-style:solid;}
.roster-slot.drag-over{outline:2px solid rgba(128,202,255,.65);outline-offset:2px;}
.v159-position-matrix{--month-staff-col-width:112px;--month-summary-col-width:72px;}
.v159-position-matrix .month-position-matrix table{min-width:1580px;}
.v159-position-matrix .staff-col{
  min-width:var(--month-staff-col-width)!important;
  max-width:var(--month-staff-col-width)!important;
  width:var(--month-staff-col-width)!important;
}
.v159-position-matrix .summary-col{
  position:sticky;
  left:var(--month-staff-col-width);
  z-index:4;
  min-width:var(--month-summary-col-width)!important;
  max-width:var(--month-summary-col-width)!important;
  width:var(--month-summary-col-width)!important;
  box-shadow:4px 0 10px rgba(31,50,72,.06);
}
.v159-position-matrix thead .summary-col{z-index:6;background:#f6f9fc;}
.v159-position-matrix tbody .summary-col{background:#ffffff;}
.v159-position-matrix .staff-color-cell{
  padding:4px 7px!important;
  line-height:1.05!important;
}
.v159-position-matrix .matrix-staff-name{
  display:flex;
  align-items:center;
  gap:6px;
  min-height:24px;
  white-space:nowrap;
}
.v159-position-matrix .matrix-staff-name b{font-size:12px;line-height:1;}
.v159-position-matrix .matrix-staff-name small{font-size:9px;line-height:1;opacity:.88;}
.v159-position-matrix .summary-action-cell{padding:4px 6px!important;text-align:center!important;}
.v159-position-matrix .summary-action-cell .staff-summary-trigger{
  width:auto;
  min-width:54px;
  padding:4px 8px;
  border-radius:999px;
  background:#eff6ff;
  color:#1d4e89;
  border:1px solid #bfdbfe;
  font-size:10px;
  text-decoration:none;
}
.v159-position-matrix .summary-action-cell .staff-summary-trigger:hover{background:#dbeafe;}
.v159-position-matrix .matrix-cell{padding-top:5px!important;padding-bottom:5px!important;}
.v159-position-matrix .cell-note{display:none!important;}
@media(max-width:720px){
  .leave-filter-bar{display:grid;grid-template-columns:1fr;}
  .leave-filter-bar label{min-width:0;width:100%;}
  .v159-position-matrix{--month-staff-col-width:96px;--month-summary-col-width:62px;}
  .v159-position-matrix .matrix-staff-name{gap:4px;}
  .v159-position-matrix .summary-action-cell .staff-summary-trigger{min-width:48px;padding:3px 6px;font-size:9px;}
}

/* V160 targeted responsive UI patch */
.calendar-card-grid .calendar-card-cell{appearance:none;border:1px solid var(--line);text-align:left;cursor:pointer;transition:.15s;}
.calendar-card-grid .calendar-card-cell:hover{transform:translateY(-1px);box-shadow:0 10px 24px rgba(31,50,72,.10);}
.calendar-card-grid .fake-btn{pointer-events:none;}
@media(max-width:820px){
  .calendar-card-grid{display:grid;grid-template-columns:repeat(7,minmax(96px,1fr));overflow-x:auto;padding-bottom:8px;}
  .calendar-card-grid .calendar-dayname{position:sticky;top:0;z-index:2;min-width:96px;}
  .calendar-card-grid .calendar-card-cell{min-width:96px;min-height:118px;padding:8px;}
  .calendar-card-grid .event-pill{font-size:10px;padding:4px 6px;}
}
.clean-balance-dashboard .table-wrap{overflow:auto!important;}
.clean-balance-table th:first-child,.clean-balance-table td:first-child{position:sticky!important;left:0!important;z-index:20!important;background:#fff!important;box-shadow:2px 0 0 #e5e7eb;}
.clean-balance-table thead th:first-child{z-index:25!important;background:#f8fafc!important;}
.v160-schedule-grid .clean-summary-head,.v160-schedule-grid .clean-summary-cell{position:sticky!important;left:112px!important;z-index:19!important;background:#fff!important;min-width:70px!important;width:70px!important;max-width:70px!important;box-shadow:2px 0 0 #e5e7eb;}
.v160-schedule-grid thead .clean-summary-head{z-index:24!important;background:#f8fafc!important;}
.v160-schedule-grid .clean-staff-head,.v160-schedule-grid .clean-staff-cell{left:0!important;min-width:112px!important;width:112px!important;max-width:112px!important;}
.v160-schedule-grid .clean-staff-cell{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.v160-position-matrix .staff-col{left:0!important;}
.v160-position-matrix .summary-col{left:var(--month-staff-col-width)!important;}
@media(max-width:700px){
  .clean-balance-table th:first-child,.clean-balance-table td:first-child{min-width:110px!important;max-width:130px!important;}
  .v160-schedule-grid .clean-staff-head,.v160-schedule-grid .clean-staff-cell{min-width:96px!important;width:96px!important;max-width:96px!important;}
  .v160-schedule-grid .clean-summary-head,.v160-schedule-grid .clean-summary-cell{left:96px!important;min-width:62px!important;width:62px!important;max-width:62px!important;}
}

/* V161 force first-login setup */
.force-setup-shell{max-width:760px;margin:24px auto;}
.force-setup-card{border:1px solid rgba(59,130,246,.22);box-shadow:0 16px 45px rgba(59,130,246,.12);}
.compact-info{margin:12px 0 16px;}
.nav-force-note{padding:12px;margin:8px;border-radius:14px;background:#fff7ed;color:#9a3412;font-size:.9rem;font-weight:700;line-height:1.4;}

/* V162: single login form + safer table rendering */
.auth-tabs.hidden,
#setupPasswordForm.hidden { display:none!important; }
.login-helper-text{
  margin-top:10px;
  padding:10px 12px;
  border:1px solid #bfdbfe;
  border-radius:14px;
  background:#eff6ff;
  color:#1e3a8a;
  line-height:1.55;
  font-weight:600;
}
.v162-account-settings .profile-info-list b{word-break:break-word;}
.v162-position-matrix .month-position-matrix table{table-layout:auto;}
.v162-position-matrix .summary-col{
  min-width:72px!important;
  max-width:72px!important;
  width:72px!important;
  background:#fff;
  box-shadow:2px 0 0 #e5e7eb;
}
.v162-position-matrix thead .summary-col{background:#f6f9fc;z-index:4;}
.v162-position-matrix .staff-col{left:0!important;}
.v162-position-matrix .matrix-cell .cell-note{display:none!important;}
.v162-position-matrix .matrix-cell{contain:layout paint;}
.v162-daily-position-table table{min-width:920px;}
.error-notice{border-color:#fecaca;background:#fef2f2;color:#991b1b;}
@media(max-width:720px){
  .v162-position-matrix .summary-col{min-width:62px!important;max-width:62px!important;width:62px!important;}
  .login-helper-text{font-size:.92rem;}
}
.v162-position-matrix .summary-col{position:static!important;left:auto!important;}
.v162-schedule-grid .clean-summary-head,
.v162-schedule-grid .clean-summary-cell{position:static!important;left:auto!important;min-width:70px!important;width:70px!important;max-width:70px!important;background:#fff!important;box-shadow:2px 0 0 #e5e7eb;}
.v162-schedule-grid thead .clean-summary-head{background:#f8fafc!important;}
.v162-schedule-grid .clean-staff-head,
.v162-schedule-grid .clean-staff-cell{left:0!important;}

/* V163 Account/Profile merge + OT attendance form */
.v163-profile-page .account-settings-card,
.v163-profile-page .profile-card-readable { min-width: 0; }
.v163-ot-page .attendance-form { margin-top: 10px; }
.v163-ot-page .admin-checkin-fields {
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(128, 202, 255, 0.10);
  border-radius: 14px;
  padding: 10px;
}
.v163-ot-page .admin-checkin-fields label { min-width: 0; }
@media (max-width: 820px) {
  .v163-ot-page .form-grid.two-cols,
  .v163-ot-page .admin-checkin-fields { grid-template-columns: 1fr; }
}


/* V165 Responsive fixes: OT attendance form + profile/account spacing */
.v165-ot-page .ot-card { min-width: 0; }
.v165-attendance-form {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 16px !important;
  align-items: stretch !important;
}
.v165-checkin-fields,
.v165-admin-checkin-fields {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 14px !important;
  width: 100%;
  min-width: 0;
}
.v165-admin-checkin-fields {
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(128, 202, 255, 0.10);
  border-radius: 16px;
  padding: 14px;
}
.v165-attendance-form label,
.v165-ot-extra-form label,
.v165-account-form label,
.v165-profile-change-form label {
  display: grid;
  gap: 8px;
  min-width: 0;
  align-content: start;
  font-weight: 800;
}
.v165-attendance-form input,
.v165-attendance-form select,
.v165-ot-extra-form input,
.v165-ot-extra-form select,
.v165-account-form input,
.v165-profile-change-form input,
.v165-profile-change-form select,
.v165-profile-change-form textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.v165-attendance-form .primary-btn { justify-self: start; min-width: min(100%, 280px); }
.v165-profile-page { align-items: start; }
.v165-profile-page .card { padding: 22px; }
.v165-profile-info { gap: 2px; margin-top: 16px; }
.v165-profile-info > div {
  grid-template-columns: minmax(130px, 170px) minmax(0, 1fr);
  gap: 18px;
  padding: 13px 0;
}
.v165-account-settings-card .section-title,
.v165-request-card .section-title { margin-bottom: 18px; }
.v165-account-form,
.v165-profile-change-form {
  grid-template-columns: 1fr !important;
  gap: 16px !important;
  align-items: stretch !important;
}
.v165-account-form .hint { margin-top: 0; line-height: 1.45; }
.v165-profile-change-form .two-cols {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 14px !important;
}
@media (min-width: 980px) {
  .v165-account-form { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .v165-account-form label:first-child { grid-column: 1 / -1; }
  .v165-account-form .wide { grid-column: 1 / -1; justify-self: start; min-width: 280px; }
}
@media (max-width: 820px) {
  .v165-checkin-fields,
  .v165-admin-checkin-fields { grid-template-columns: 1fr !important; }
  .v165-attendance-form .primary-btn { width: 100%; }
  .v165-profile-page .card { padding: 18px; }
  .v165-profile-info > div { grid-template-columns: 105px minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 520px) {
  .v165-profile-info > div { grid-template-columns: 1fr; gap: 5px; }
}


/* V166 Login input height + show/hide password */
input, select {
  min-height: 46px;
  line-height: 1.5;
}
textarea {
  line-height: 1.5;
}
.auth-card label {
  gap: 8px;
}
.auth-card input {
  min-height: 52px;
  padding-top: 14px;
  padding-bottom: 14px;
  line-height: 1.5;
}
.password-field {
  position: relative;
  display: block;
  width: 100%;
}
.password-field input {
  width: 100%;
  padding-right: 50px !important;
  box-sizing: border-box;
}
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: #eef6ff;
  color: #1e3a8a;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
}
.password-toggle:hover {
  filter: brightness(.97);
}
.admin-user-head .user-password-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.admin-user-head .danger-soft-btn {
  border-color: #fecaca;
  background: #fff5f5;
  color: #991b1b;
}
@media (max-width: 640px) {
  .admin-user-head { align-items: stretch; }
  .admin-user-head .user-password-actions { justify-content: flex-start; }
}

/* V167 Global Role Switcher */
.view-as-wrap { position: relative; }
.view-as-toggle { width: 100%; border: 0; background: rgba(255,255,255,.72); border-radius: 18px; padding: 10px; display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; align-items: center; text-align: left; color: var(--sidebar-ink); cursor: pointer; }
.view-as-toggle:hover { background: #fff; box-shadow: 0 8px 20px rgba(31,72,110,.10); }
.view-as-user { min-width: 0; display: grid; gap: 3px; font-weight: 900; }
.view-as-user small { color: rgba(23,53,77,.68); font-weight: 800; line-height: 1.25; }
.view-as-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 900; white-space: nowrap; }
.view-as-badge.staff { background: #e5f7ed; color: #19774b; }
.view-as-badge.admin { background: #ffe9ee; color: #b3354c; }
.view-as-chevron { color: rgba(23,53,77,.62); font-weight: 900; }
.view-as-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 120; display: grid; gap: 6px; padding: 8px; border: 1px solid rgba(23,53,77,.12); border-radius: 18px; background: rgba(255,255,255,.98); box-shadow: 0 18px 50px rgba(20,40,60,.20); }
.view-as-menu.hidden { display: none !important; }
.view-as-option { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 10px; display: grid; gap: 3px; text-align: left; color: var(--ink); cursor: pointer; }
.view-as-option:hover { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(128,202,255,.16); }
.view-as-option.active { background: var(--primary-soft); border-color: var(--primary); }
.view-as-option small { color: var(--muted); font-weight: 700; line-height: 1.25; }
@media (max-width: 820px) {
  .view-as-menu { bottom: calc(100% + 10px); }
}

/* V169 Monthly Position Overview + QC Rotation Tracker */
.modal.modal-lg .modal-card {
  width: min(1280px, calc(100vw - 32px)) !important;
  max-height: 90vh !important;
}
.v169-overview-modal,
.v169-qc-modal {
  display: grid;
  gap: 14px;
}
.v169-overview-modal .section-title,
.v169-qc-modal .section-title {
  padding-right: 44px;
  align-items: flex-start;
}
.overview-block {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbfdff;
  padding: 14px;
}
.overview-block h4 {
  margin: 0 0 8px;
  color: #203245;
}
.v169-overview-table {
  max-height: 58vh;
  border-radius: 16px;
}
.v169-overview-table table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 880px;
}
.v169-overview-table th,
.v169-overview-table td {
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
  min-width: 92px;
}
.v169-overview-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f6f9fc;
}
.v169-overview-table .sticky-name-col {
  position: sticky;
  left: 0;
  z-index: 5;
  min-width: 180px;
  max-width: 220px;
  text-align: left;
  background: #fff;
  box-shadow: 8px 0 18px rgba(15, 35, 52, .08);
}
.v169-overview-table thead .sticky-name-col {
  z-index: 6;
  background: #f6f9fc;
}
.v169-overview-table .num-cell {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.v169-overview-table .has-count {
  color: #0f5d86;
  background: rgba(128,202,255,.10);
}
.v169-overview-table .zero-count {
  color: transparent;
}
.v169-overview-table .total-cell {
  color: #1f3b57;
  background: #eef7ff;
}
.position-summary-table table {
  min-width: 1400px;
}
.position-summary-table th:not(.sticky-name-col),
.position-summary-table td:not(.sticky-name-col) {
  min-width: 118px;
  max-width: 190px;
  white-space: normal;
  line-height: 1.25;
}
.qc-rotation-btn {
  border-color: #bfe7d3;
  background: #effbf4;
  color: #19774b;
}
.qc-staff-table .total-cell {
  min-width: 110px;
  font-size: 16px;
}
.qc-week-cell {
  text-align: left !important;
  min-width: 170px !important;
}
.qc-week-cell span {
  display: block;
  border-radius: 999px;
  padding: 4px 8px;
  margin: 2px 0;
  background: #eef7ff;
  color: #1f4f78;
  font-weight: 800;
}
.qc-empty {
  color: var(--muted);
  background: #fbfdff;
}
.qc-detail-table table {
  min-width: 780px;
}
.qc-detail-table th:first-child {
  min-width: 120px;
}
.qc-detail-table td {
  text-align: left;
  min-width: 250px;
  white-space: normal;
}
.qc-detail-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 3px 0;
}
@media (max-width: 720px) {
  .modal.modal-lg .modal-card {
    width: min(96vw, 100%) !important;
    padding: 16px !important;
  }
  .v169-overview-table .sticky-name-col {
    min-width: 135px;
  }
  .v169-overview-table th,
  .v169-overview-table td {
    min-width: 82px;
    font-size: 12px;
  }
}


/* V170 OT cross-day end date layout */
.v170-checkin-fields {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
  gap: 14px !important;
  width: 100%;
}
.v170-checkin-fields label {
  min-width: 0;
}
.v170-checkin-fields input {
  width: 100%;
  min-width: 0;
}
@media (max-width: 820px) {
  .v170-checkin-fields { grid-template-columns: 1fr !important; }
}

/* V171: tighter sticky staff-name column for overview/QC tables */
.v169-overview-table .sticky-name-col {
  width: 136px !important;
  min-width: 136px !important;
  max-width: 152px !important;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v169-overview-table .sticky-name-col .staff-color-pill {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 10px;
  padding-right: 10px;
}
.v169-overview-table tbody .sticky-name-col {
  z-index: 7;
  background: #fff;
}
.v169-overview-table thead .sticky-name-col {
  z-index: 9;
  background: #f6f9fc;
}
@media (max-width: 720px) {
  .v169-overview-table .sticky-name-col {
    width: 118px !important;
    min-width: 118px !important;
    max-width: 132px !important;
  }
}

/* V175: force freeze first column in Position Overview + QC Rotation modals */
.v169-overview-table {
  overflow-x: auto !important;
  overflow-y: auto !important;
  position: relative !important;
  background: #fff !important;
}
.v169-overview-table table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: max-content !important;
  min-width: 100% !important;
}
.v169-overview-table table > thead > tr > th:first-child,
.v169-overview-table table > tbody > tr > th:first-child,
.v169-overview-table table > tbody > tr > td:first-child,
.v169-overview-table .sticky-name-col {
  position: sticky !important;
  left: 0 !important;
  background: #fff !important;
  z-index: 10 !important;
  box-shadow: 8px 0 18px rgba(15, 35, 52, .10) !important;
}
.v169-overview-table table > thead > tr > th:first-child,
.v169-overview-table thead .sticky-name-col {
  top: 0 !important;
  background: #f6f9fc !important;
  z-index: 11 !important;
}
.v169-overview-table table > tbody > tr > th:first-child,
.v169-overview-table table > tbody > tr > td:first-child,
.v169-overview-table tbody .sticky-name-col {
  background: #fff !important;
  z-index: 10 !important;
}
.v169-overview-table .sticky-name-col .staff-color-pill,
.v169-overview-table table > tbody > tr > th:first-child .staff-color-pill,
.v169-overview-table table > tbody > tr > td:first-child .staff-color-pill {
  position: relative;
  z-index: 12;
}

/* V178: freeze staff-name first column in Position Overview modal
   Scope: Popup "ภาพรวมจัดตำแหน่ง" only. Prevents the first column from disappearing during horizontal scroll. */
.v169-overview-modal .v169-overview-table {
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-width: 100% !important;
  position: relative !important;
  isolation: isolate !important;
  background: #ffffff !important;
}

.v169-overview-modal .v169-overview-table table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: max-content !important;
  min-width: 100% !important;
}

.v169-overview-modal .v169-overview-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
  background: #f6f9fc !important;
}

.v169-overview-modal .v169-overview-table table > thead > tr > th:first-child,
.v169-overview-modal .v169-overview-table table > tbody > tr > th:first-child,
.v169-overview-modal .v169-overview-table table > tbody > tr > td:first-child,
.v169-overview-modal .v169-overview-table .sticky-name-col {
  position: sticky !important;
  left: 0 !important;
  z-index: 40 !important;
  background: #ffffff !important;
  border-right: 1px solid rgba(23, 53, 77, .14) !important;
  box-shadow: 10px 0 20px rgba(15, 35, 52, .10) !important;
  transform: translateZ(0);
}

.v169-overview-modal .v169-overview-table table > thead > tr > th:first-child,
.v169-overview-modal .v169-overview-table thead .sticky-name-col {
  top: 0 !important;
  z-index: 60 !important;
  background: #f6f9fc !important;
}

.v169-overview-modal .v169-overview-table table > tbody > tr > th:first-child,
.v169-overview-modal .v169-overview-table table > tbody > tr > td:first-child,
.v169-overview-modal .v169-overview-table tbody .sticky-name-col {
  z-index: 45 !important;
  background: #ffffff !important;
}

.v169-overview-modal .v169-overview-table .sticky-name-col .staff-color-pill,
.v169-overview-modal .v169-overview-table table > tbody > tr > th:first-child .staff-color-pill,
.v169-overview-modal .v169-overview-table table > tbody > tr > td:first-child .staff-color-pill {
  position: relative;
  z-index: 70;
}

/* V179: hard fix for sticky first column in Position Overview / QC modal tables */
.v169-overview-modal,
.v169-qc-modal,
.v169-overview-modal .overview-block,
.v169-qc-modal .overview-block {
  min-width: 0 !important;
  max-width: 100% !important;
}

.v169-overview-modal .overview-block,
.v169-qc-modal .overview-block {
  overflow: visible !important;
}

.v179-freeze-table,
.table-responsive.v169-overview-table,
.v169-overview-modal .v169-overview-table,
.v169-qc-modal .v169-overview-table {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  position: relative !important;
  background: #ffffff !important;
  -webkit-overflow-scrolling: touch;
}

.v179-freeze-table table,
.table-responsive.v169-overview-table table,
.v169-overview-modal .v169-overview-table table,
.v169-qc-modal .v169-overview-table table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: max-content !important;
  min-width: 100% !important;
}

.v179-freeze-table th:first-child,
.v179-freeze-table td:first-child,
.table-responsive.v169-overview-table th:first-child,
.table-responsive.v169-overview-table td:first-child,
.v169-overview-modal .v169-overview-table th:first-child,
.v169-overview-modal .v169-overview-table td:first-child,
.v169-qc-modal .v169-overview-table th:first-child,
.v169-qc-modal .v169-overview-table td:first-child,
.v179-sticky-first-col {
  position: sticky !important;
  left: 0 !important;
  background-color: #ffffff !important;
  z-index: 70 !important;
  box-shadow: 10px 0 20px rgba(15, 35, 52, .10) !important;
  border-right: 1px solid rgba(23, 53, 77, .14) !important;
}

.v179-freeze-table thead th,
.table-responsive.v169-overview-table thead th,
.v169-overview-modal .v169-overview-table thead th,
.v169-qc-modal .v169-overview-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 80 !important;
  background: #f6f9fc !important;
}

.v179-freeze-table thead th:first-child,
.table-responsive.v169-overview-table thead th:first-child,
.v169-overview-modal .v169-overview-table thead th:first-child,
.v169-qc-modal .v169-overview-table thead th:first-child,
thead .v179-sticky-first-col {
  top: 0 !important;
  z-index: 90 !important;
  background-color: #f6f9fc !important;
}

/* V180 HR Dummy Export + Admin OT compact forms */
.v180-ot-page .section-title { align-items: flex-start; gap: 12px; }
.v180-admin-card .form-grid { align-items: end; }
.v180-admin-attendance-form,
.v180-admin-ot-extra-form { gap: 12px; }
.v180-admin-attendance-form .v180-calculated-hours {
  font-weight: 700;
  background: #eef8ff;
  border-color: rgba(63, 150, 205, .45);
}
.v180-admin-ot-extra-form textarea {
  min-height: 86px;
  resize: vertical;
}
.v180-ot-page [data-export-ot-hr-excel] {
  white-space: nowrap;
}
@media (max-width: 720px) {
  .v180-ot-page .section-title { align-items: stretch; }
  .v180-ot-page [data-export-ot-hr-excel] { width: 100%; }
}

/* V181 OT Claim History */
.v181-claim-history .section-title,
.v181-claim-batch .section-title { gap: 12px; align-items: flex-start; }
.v181-pending-summary table th,
.v181-pending-summary table td { white-space: nowrap; }
.danger-btn {
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}
.danger-btn:hover { filter: brightness(.98); }
.v181-admin-card textarea { width: 100%; resize: vertical; }
@media (max-width: 780px) {
  .v181-ot-page .section-title { align-items: stretch; }
  .v181-ot-page .section-title .actions { width: 100%; display: grid; grid-template-columns: 1fr; }
}

/* V182 Dynamic Position Management */
.position-management-page { display: grid; gap: 16px; }
.position-management-page .position-master-zone { margin-top: 14px; }
.position-management-page .position-master-zone:first-child { margin-top: 0; }
.position-management-page .compact-table table td, .position-management-page .compact-table table th { vertical-align: top; }
.position-management-page .inactive-row { opacity: .62; }
.position-management-page .inactive-row td { background: #f8fafc; }
.position-management-page .position-master-form-card textarea { resize: vertical; min-height: 96px; }
.position-management-page .position-master-note-card code, .position-management-page code, .v182-eligibility-page code { background: #eef6ff; border: 1px solid #d7eaff; border-radius: 6px; padding: 1px 6px; }
.position-management-page .position-master-note-card .profile-info-list { margin-top: 10px; }
.v182-eligibility-page .position-check small { display: block; }
.v182-position-matrix .month-position-select { min-width: 120px; }

/* V183 OT approval date range filter */
.v183-ot-date-filter .ot-filter-actions{
  display:flex;
  flex:0 0 auto;
  gap:8px;
  align-items:flex-end;
  flex-wrap:wrap;
}
.v183-ot-date-filter .ot-filter-hint{
  flex:1 0 100%;
  margin:0;
}
@media(max-width:700px){
  .v183-ot-date-filter .ot-filter-actions{
    width:100%;
  }
  .v183-ot-date-filter .ot-filter-actions button{
    flex:1 1 auto;
  }
}


/* V184 Restore monthly position matrix styling
   Scope: only the monthly position matrix rendered by V182. */
.v182-position-matrix {
  --month-staff-col-width: 112px;
  --month-summary-col-width: 72px;
  --month-day-col-width: 108px;
  --month-row-height: 46px;
}
.v182-position-matrix .matrix-legend {
  margin-bottom: 10px;
}
.v182-position-matrix .month-position-matrix {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.v182-position-matrix .month-position-matrix table {
  table-layout: fixed !important;
  border-collapse: separate;
  border-spacing: 0;
  min-width: calc(var(--month-staff-col-width) + var(--month-summary-col-width) + (31 * var(--month-day-col-width)));
  width: max-content;
  background: #fff;
}
.v182-position-matrix .month-position-matrix th,
.v182-position-matrix .month-position-matrix td {
  box-sizing: border-box;
  height: var(--month-row-height);
  min-height: var(--month-row-height);
  padding: 7px 8px !important;
  text-align: center;
  vertical-align: middle;
  border-right: 1px solid #eef2f7;
  border-bottom: 1px solid #e5eaf0;
  overflow: hidden;
}
.v182-position-matrix .month-position-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f8fafc;
  font-weight: 900;
}
.v182-position-matrix .month-position-matrix thead .missing-role-row th {
  top: 46px;
  z-index: 19;
}
.v182-position-matrix .month-position-matrix .staff-col {
  position: sticky !important;
  left: 0 !important;
  z-index: 30;
  width: var(--month-staff-col-width) !important;
  min-width: var(--month-staff-col-width) !important;
  max-width: var(--month-staff-col-width) !important;
  text-align: left;
  box-shadow: 4px 0 10px rgba(31, 50, 72, .08);
}
.v182-position-matrix .month-position-matrix thead .staff-col {
  z-index: 40;
  background: #f8fafc !important;
}
.v182-position-matrix .month-position-matrix .summary-col {
  position: sticky !important;
  left: var(--month-staff-col-width) !important;
  z-index: 28;
  width: var(--month-summary-col-width) !important;
  min-width: var(--month-summary-col-width) !important;
  max-width: var(--month-summary-col-width) !important;
  background: #fff;
  box-shadow: 4px 0 10px rgba(31, 50, 72, .05);
}
.v182-position-matrix .month-position-matrix thead .summary-col {
  z-index: 38;
  background: #f8fafc !important;
}
.v182-position-matrix .month-position-matrix .date-head,
.v182-position-matrix .month-position-matrix .missing-role-cell,
.v182-position-matrix .month-position-matrix .matrix-cell {
  width: var(--month-day-col-width) !important;
  min-width: var(--month-day-col-width) !important;
  max-width: var(--month-day-col-width) !important;
}
.v182-position-matrix .date-head {
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}
.v182-position-matrix .date-head b,
.v182-position-matrix .date-head span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v182-position-matrix .staff-color-cell {
  padding: 5px 8px !important;
  line-height: 1.05 !important;
}
.v182-position-matrix .matrix-staff-name {
  display: grid;
  gap: 2px;
  align-content: center;
  min-height: 30px;
  overflow: hidden;
}
.v182-position-matrix .matrix-staff-name b,
.v182-position-matrix .matrix-staff-name small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v182-position-matrix .matrix-staff-name b {
  font-size: 12px;
  line-height: 1.1;
}
.v182-position-matrix .matrix-staff-name small {
  font-size: 9px;
  line-height: 1.05;
  opacity: .88;
}
.v182-position-matrix .summary-action-cell {
  padding: 5px 6px !important;
  text-align: center !important;
}
.v182-position-matrix .summary-action-cell .staff-summary-trigger {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v182-position-matrix .matrix-cell {
  font-size: 12px;
  font-weight: 900;
  line-height: 1.18;
  background: #fff;
}
.v182-position-matrix .matrix-cell > span,
.v182-position-matrix .no-position-day span,
.v182-position-matrix .needs-review-cell span {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v182-position-matrix .matrix-cell span br {
  display: none;
}
.v182-position-matrix .cell-note {
  display: none !important;
}
.v182-position-matrix .month-position-select {
  display: block;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 32px;
  padding: 5px 7px !important;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v182-position-matrix .missing-role-cell {
  padding: 4px 5px !important;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap !important;
}
.v182-position-matrix .missing-role-cell span {
  display: inline-block;
  max-width: calc(100% - 6px);
  margin: 0;
  padding: 2px 5px;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.v182-position-matrix .missing-role-cell span + span {
  display: none;
}
.v182-position-matrix .holiday-cell,
.v182-position-matrix .weekend-cell,
.v182-position-matrix .holiday-head,
.v182-position-matrix .weekend-head {
  background: #f1f5f9 !important;
  color: #334155 !important;
}
.v182-position-matrix .outing-cell,
.v182-position-matrix .outing-head {
  background: #ffe9ee !important;
  color: #b3354c !important;
}
.v182-position-matrix .needs-review-cell {
  background: #fff4df !important;
  color: #8a5a00 !important;
}
.v182-position-matrix tbody tr:nth-child(even) .matrix-cell:not(.holiday-cell):not(.weekend-cell):not(.outing-cell):not(.leave-cell):not(.needs-review-cell) {
  background: #fcfdff;
}
@media (max-width: 720px) {
  .v182-position-matrix {
    --month-staff-col-width: 96px;
    --month-summary-col-width: 62px;
    --month-day-col-width: 96px;
    --month-row-height: 44px;
  }
  .v182-position-matrix .month-position-matrix table {
    min-width: calc(var(--month-staff-col-width) + var(--month-summary-col-width) + (31 * var(--month-day-col-width)));
  }
  .v182-position-matrix .month-position-matrix thead .missing-role-row th {
    top: 44px;
  }
  .v182-position-matrix .month-position-matrix th,
  .v182-position-matrix .month-position-matrix td {
    padding: 5px 6px !important;
    font-size: 11px;
  }
  .v182-position-matrix .month-position-select {
    height: 30px;
    font-size: 10px;
  }
}


/* V185 Position monthly matrix layout/order fix
   Intentional scoped overrides only for monthly position matrix and position management page. */
.v182-position-matrix {
  --month-staff-col-width: 112px;
  --month-summary-col-width: 72px;
  --month-day-col-width: 108px;
  --month-header-height: 38px;
  --month-missing-height: 34px;
  --month-row-height: 36px;
}
.v182-position-matrix .month-position-matrix {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}
.v182-position-matrix .month-position-matrix table {
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: calc(var(--month-staff-col-width) + var(--month-summary-col-width) + (31 * var(--month-day-col-width))) !important;
  min-width: calc(var(--month-staff-col-width) + var(--month-summary-col-width) + (31 * var(--month-day-col-width))) !important;
}
.v182-position-matrix .month-position-matrix th,
.v182-position-matrix .month-position-matrix td {
  box-sizing: border-box;
  height: var(--month-row-height);
  min-height: var(--month-row-height);
  max-height: var(--month-row-height);
  padding: 4px 6px !important;
  overflow: hidden !important;
  vertical-align: middle !important;
  white-space: nowrap;
}
.v182-position-matrix .month-position-matrix thead tr:first-child th {
  height: var(--month-header-height);
  min-height: var(--month-header-height);
  max-height: var(--month-header-height);
  position: sticky !important;
  top: 0 !important;
  z-index: 40;
  background: #f8fafc !important;
}
.v182-position-matrix .month-position-matrix thead .missing-role-row th {
  height: var(--month-missing-height);
  min-height: var(--month-missing-height);
  max-height: var(--month-missing-height);
  position: sticky !important;
  top: var(--month-header-height) !important;
  z-index: 39;
  background: #fff !important;
}
.v182-position-matrix .month-position-matrix .staff-col {
  position: sticky !important;
  left: 0 !important;
  z-index: 50 !important;
  width: var(--month-staff-col-width) !important;
  min-width: var(--month-staff-col-width) !important;
  max-width: var(--month-staff-col-width) !important;
  background-clip: padding-box;
}
.v182-position-matrix .month-position-matrix .summary-col {
  position: sticky !important;
  left: var(--month-staff-col-width) !important;
  z-index: 49 !important;
  width: var(--month-summary-col-width) !important;
  min-width: var(--month-summary-col-width) !important;
  max-width: var(--month-summary-col-width) !important;
  background: #fff !important;
  background-clip: padding-box;
}
.v182-position-matrix .month-position-matrix thead .staff-col {
  z-index: 70 !important;
  background: #f8fafc !important;
}
.v182-position-matrix .month-position-matrix thead .summary-col {
  z-index: 69 !important;
  background: #f8fafc !important;
}
.v182-position-matrix .month-position-matrix thead .missing-role-row .staff-col,
.v182-position-matrix .month-position-matrix thead .missing-role-row .summary-col {
  background: #ffffff !important;
}
.v182-position-matrix .month-position-matrix .date-head,
.v182-position-matrix .month-position-matrix .missing-role-cell,
.v182-position-matrix .month-position-matrix .matrix-cell {
  width: var(--month-day-col-width) !important;
  min-width: var(--month-day-col-width) !important;
  max-width: var(--month-day-col-width) !important;
}
.v182-position-matrix .date-head,
.v182-position-matrix .date-head b,
.v182-position-matrix .date-head span,
.v182-position-matrix .matrix-cell,
.v182-position-matrix .matrix-cell span,
.v182-position-matrix .missing-role-cell,
.v182-position-matrix .missing-role-cell span,
.v182-position-matrix .matrix-staff-name b,
.v182-position-matrix .matrix-staff-name small {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
.v182-position-matrix .matrix-cell {
  font-size: 11px;
  line-height: 1.1;
  font-weight: 900;
}
.v182-position-matrix .matrix-cell > span {
  display: block;
  max-width: 100%;
}
.v182-position-matrix .matrix-cell br,
.v182-position-matrix .cell-note {
  display: none !important;
}
.v182-position-matrix .staff-color-cell {
  padding: 4px 7px !important;
}
.v182-position-matrix .matrix-staff-name {
  display: block;
  min-height: 0;
  max-height: calc(var(--month-row-height) - 8px);
}
.v182-position-matrix .matrix-staff-name b {
  display: block;
  font-size: 12px;
  line-height: 1.05;
}
.v182-position-matrix .matrix-staff-name small {
  display: block;
  font-size: 9px;
  line-height: 1.05;
  margin-top: 1px;
}
.v182-position-matrix .summary-action-cell {
  padding: 4px 5px !important;
  text-align: center !important;
}
.v182-position-matrix .summary-action-cell .staff-summary-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-width: 52px;
  height: 24px;
  padding: 3px 8px !important;
  border-radius: 999px !important;
  border: 1px solid #b9dcff !important;
  background: #e8f4ff !important;
  color: #1769aa !important;
  font-size: 10px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}
.v182-position-matrix .month-position-select {
  height: 28px !important;
  min-height: 28px !important;
  padding: 3px 6px !important;
  border-radius: 9px !important;
  font-size: 10px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}
.v182-position-matrix .missing-role-cell {
  padding: 3px 4px !important;
  font-size: 9px !important;
  line-height: 1 !important;
}
.v182-position-matrix .missing-role-cell span {
  display: inline-block;
  max-width: 100%;
  padding: 2px 5px;
  border-radius: 999px;
}
.v182-position-matrix .missing-role-cell span + span {
  display: none !important;
}
.v182-position-matrix .missing-role-cell.complete {
  background: #eefdf3 !important;
  color: #166534 !important;
}
.v182-position-matrix .missing-role-cell.has-missing {
  background: #fff7ed !important;
  color: #9a3412 !important;
}
.v182-position-matrix .missing-role-cell.no-position-day {
  background: #eef2f7 !important;
  color: #475569 !important;
}

.position-management-page {
  display: grid;
  gap: 14px;
}
.position-management-page .position-management-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.position-management-page .position-collapse-card {
  display: block;
  padding: 0;
  overflow: hidden;
}
.position-management-page .position-collapse-card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}
.position-management-page .position-collapse-card > summary::-webkit-details-marker {
  display: none;
}
.position-management-page .position-collapse-card > summary::after {
  content: "⌄";
  flex: 0 0 auto;
  font-weight: 900;
  color: #64748b;
}
.position-management-page .position-collapse-card[open] > summary::after {
  transform: rotate(180deg);
}
.position-management-page .position-collapse-card > summary span {
  display: grid;
  gap: 3px;
}
.position-management-page .position-collapse-card > summary small {
  color: #64748b;
  font-weight: 600;
}
.position-management-page .position-master-form-card form,
.position-management-page .position-master-form-card > p,
.position-management-page .position-master-note-card .profile-info-list,
.position-management-page .position-master-note-card > p {
  margin: 0 18px 18px;
}
.position-management-page .position-advanced-options {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fafc;
}
.position-management-page .position-advanced-options > summary {
  cursor: pointer;
  font-weight: 800;
  color: #334155;
}
.position-management-page .position-master-list-card .position-master-zone + .position-master-zone {
  margin-top: 18px;
}
.position-management-page .compact-table table {
  table-layout: auto;
}
.position-management-page .compact-table th,
.position-management-page .compact-table td {
  white-space: normal;
}
@media (max-width: 720px) {
  .v182-position-matrix {
    --month-staff-col-width: 96px;
    --month-summary-col-width: 62px;
    --month-day-col-width: 96px;
    --month-header-height: 36px;
    --month-row-height: 34px;
  }
  .position-management-page .position-management-actions,
  .position-management-page .position-collapse-card > summary {
    align-items: stretch;
    flex-direction: column;
  }
}

/* V190 HR Rate Normalization */
.v190-ot-table th:nth-child(4),
.v190-ot-table th:nth-child(5),
.v190-ot-table td:nth-child(4),
.v190-ot-table td:nth-child(5),
.v190-pending-summary th:nth-child(2),
.v190-pending-summary th:nth-child(3),
.v190-pending-summary td:nth-child(2),
.v190-pending-summary td:nth-child(3) {
  text-align: right;
  white-space: nowrap;
}
.v190-ot-table .badge.yellow,
.v190-ot-cards .badge.yellow {
  margin-top: 3px;
  display: inline-flex;
}

/* V191 OT approval RBAC + Admin edit/delete */
.v191-ot-table th:last-child,
.v191-ot-table td:last-child { min-width: 210px; }
.v191-ot-actions {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  justify-content:flex-start;
}
.v191-ot-actions .tiny-btn { white-space:nowrap; }
.v191-ot-actions .icon-btn { min-width:32px; padding:4px 7px; line-height:1; }
.v191-status-actions {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  padding-left:6px;
  border-left:1px solid rgba(0,0,0,.08);
}
.v191-ot-edit-modal .notice { margin: 8px 0 14px; }
.v191-ot-edit-modal .form-grid label textarea { width:100%; }
.v191-approval-reset { display:flex; gap:8px; align-items:flex-start; padding:10px 12px; border-radius:12px; background:#fff8d7; }
.v191-approval-reset input { margin-top:3px; }
@media (max-width: 760px) {
  .v191-ot-actions, .v191-status-actions { width:100%; }
  .v191-status-actions { border-left:0; padding-left:0; }
}


/* V193: centered OT edit modal with dimmed overlay and smooth transition */
.modal.modal-ot-edit-v193 {
  position: fixed !important;
  inset: 0 !important;
  display: block !important;
  width: 100vw !important;
  height: 100vh !important;
  padding: 0 !important;
  background: rgba(15, 23, 42, .48) !important;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 12000 !important;
  opacity: 1;
  transition: opacity .18s ease;
}
.modal.modal-ot-edit-v193.modal-closing {
  opacity: 0;
  pointer-events: none;
}
.modal.modal-ot-edit-v193 .modal-card {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  width: min(720px, calc(100vw - 32px)) !important;
  max-height: min(86vh, 780px) !important;
  overflow: auto !important;
  border-radius: 28px !important;
  padding: 24px !important;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .34) !important;
  transform: translate(-50%, -50%) scale(1);
  animation: otEditModalCenterInV193 .18s cubic-bezier(.2,.85,.25,1) both !important;
  will-change: opacity, transform;
}
.modal.modal-ot-edit-v193.modal-closing .modal-card {
  animation: none !important;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 10px)) scale(.985) !important;
  transition: opacity .18s ease, transform .18s ease;
}
.modal.modal-ot-edit-v193 .v191-ot-edit-modal h2 {
  margin-top: 0;
  padding-right: 34px;
}
.modal.modal-ot-edit-v193 .v191-ot-edit-modal .modal-form-actions {
  position: sticky;
  bottom: -24px;
  background: linear-gradient(180deg, rgba(255,255,255,.80), #fff 42%);
  padding-top: 14px;
  margin-top: 4px;
}
@keyframes otEditModalCenterInV193 {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 12px)) scale(.975);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}
@media (max-width: 760px) {
  .modal.modal-ot-edit-v193 .modal-card {
    width: min(94vw, 720px) !important;
    max-height: 88vh !important;
    padding: 20px !important;
    border-radius: 24px !important;
  }
  .modal.modal-ot-edit-v193 .v191-ot-edit-modal .form-grid {
    grid-template-columns: 1fr !important;
  }
  .modal.modal-ot-edit-v193 .v191-ot-edit-modal .modal-form-actions {
    bottom: -20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .modal.modal-ot-edit-v193,
  .modal.modal-ot-edit-v193 .modal-card,
  .modal.modal-ot-edit-v193.modal-closing .modal-card {
    animation: none !important;
    transition: none !important;
  }
}

/* V198 Mobile-only responsive UX fixes */
@media (max-width: 820px) {
  /* 1) Calendar กลาง: compact card, show main events only, keep popup by data-day-detail */
  .compact-calendar-list.mobile-calendar-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .compact-calendar-card.mobile-day-card {
    min-width: 0;
    border-radius: 14px;
    padding: 8px;
    gap: 5px;
    overflow: hidden;
  }
  .compact-calendar-card .mobile-day-head {
    gap: 5px;
    margin: 0;
  }
  .compact-calendar-card .mobile-day-head b { font-size: 16px; }
  .compact-calendar-card .mobile-day-head span { font-size: 11px; }
  .compact-calendar-card .tiny-btn {
    min-height: 22px;
    padding: 2px 6px;
    font-size: 10px;
  }
  .compact-calendar-card .event-pill {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    padding: 3px 6px;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-more-count {
    border: 0;
    background: transparent;
    color: #2563eb;
    font-weight: 800;
    font-size: 11px;
    text-align: left;
    padding: 2px 0 0;
  }
  .mobile-calendar-tools { gap: 6px; align-items: center; }
  .mobile-calendar-tools .hint { font-size: 11px; }

  /* 2) ตารางทั้งเดือน: shrink ดูสรุป / staff summary buttons only on mobile */
  .staff-summary-trigger,
  .v159-position-matrix .summary-action-cell .staff-summary-trigger,
  .v182-position-matrix .summary-action-cell .staff-summary-trigger {
    min-width: 44px !important;
    max-width: 64px !important;
    padding: 2px 5px !important;
    font-size: 9px !important;
    line-height: 1.15 !important;
    border-radius: 8px !important;
  }
  .staff-summary-trigger span,
  .v159-position-matrix .summary-action-cell .staff-summary-trigger span,
  .v182-position-matrix .summary-action-cell .staff-summary-trigger span {
    font-size: 8px !important;
    padding: 1px 4px !important;
    margin-top: 2px !important;
  }

  /* 3) ตารางเวรประจำเดือน > ดูตามวัน: single day control */
  .single-day-control {
    display: flex;
    align-items: end;
    gap: 8px;
    margin: 6px 0 10px;
  }
  .single-day-control label {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    font-size: 12px;
  }
  .single-day-control input { width: 100%; }
  .single-day-cards.clean-calendar-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .single-day-cards .clean-day-card { padding: 10px; }

  /* 4) ดูสมดุลเวร: first column stays useful but not too wide */
  .clean-balance-dashboard .table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .clean-balance-table {
    width: max-content !important;
    min-width: max-content !important;
    table-layout: auto !important;
  }
  .clean-balance-table th,
  .clean-balance-table td {
    font-size: 10px !important;
    padding: 4px 5px !important;
    white-space: nowrap;
  }
  .clean-balance-table th:first-child,
  .clean-balance-table td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 22 !important;
    min-width: 72px !important;
    width: 72px !important;
    max-width: 72px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    background: #fff !important;
    box-shadow: 2px 0 0 #e5e7eb !important;
  }
  .clean-balance-table thead th:first-child {
    z-index: 26 !important;
    background: #f8fafc !important;
  }
  .clean-balance-table td:first-child .staff-pill,
  .clean-balance-table td:first-child button,
  .clean-balance-table td:first-child span {
    max-width: 62px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 420px) {
  .compact-calendar-list.mobile-calendar-list { grid-template-columns: 1fr 1fr; }
  .compact-calendar-card .event-pill { font-size: 9.5px; }
}
@media (max-width: 820px) {
  .clean-summary-cell .tiny-btn,
  .clean-summary-head,
  .clean-schedule-grid .clean-summary-cell button[data-staff-stat] {
    font-size: 9px !important;
    line-height: 1.1 !important;
    padding: 2px 4px !important;
    min-height: 22px !important;
    min-width: 42px !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
  }
}

/* V201 Mobile calendar grid + balance table horizontal scroll */
@media (max-width: 820px) {
  /* ตารางสรุปสมดุลเวร: ให้ตารางเลื่อนซ้าย-ขวาในกรอบของตัวเอง ไม่ดันหน้าจอหลัก */
  .clean-schedule-content,
  .clean-balance-dashboard,
  .grouped-balance-dashboard,
  .balance-group-section {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .balance-group-section {
    overflow: hidden !important;
  }
  .clean-balance-dashboard .table-wrap,
  .grouped-balance-dashboard .table-wrap,
  .balance-group-section .table-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
  }
  .clean-balance-table {
    width: max-content !important;
    min-width: 780px !important;
    table-layout: auto !important;
  }
  .clean-balance-table th,
  .clean-balance-table td {
    white-space: nowrap !important;
  }

  /* Calendar กลาง: บังคับเป็น Grid 7 วันพอดีจอมือถือ */
  .calendar-shell {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }
  .calendar-grid.calendar-card-grid.calendar-mobile-seven {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    gap: 4px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: visible !important;
    padding: 0 !important;
  }
  .calendar-grid.calendar-card-grid.calendar-mobile-seven .calendar-dayname {
    display: block !important;
    min-width: 0 !important;
    padding: 2px 0 4px !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
    text-align: center !important;
    position: static !important;
  }
  .calendar-grid.calendar-card-grid.calendar-mobile-seven .calendar-card-cell {
    min-width: 0 !important;
    width: auto !important;
    max-width: 100% !important;
    min-height: 104px !important;
    border-radius: 12px !important;
    padding: 5px 4px !important;
    gap: 3px !important;
    overflow: hidden !important;
  }
  .calendar-grid.calendar-card-grid.calendar-mobile-seven .day-num {
    justify-content: flex-start !important;
    gap: 0 !important;
    font-size: 14px !important;
    line-height: 1 !important;
    min-width: 0 !important;
  }
  .calendar-grid.calendar-card-grid.calendar-mobile-seven .fake-btn {
    display: none !important;
  }
  .calendar-grid.calendar-card-grid.calendar-mobile-seven .event-pill {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 2px 4px !important;
    border-radius: 8px !important;
    font-size: 9px !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .calendar-grid.calendar-card-grid.calendar-mobile-seven .hint {
    display: block !important;
    margin: 1px 0 0 !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

@media (max-width: 420px) {
  .calendar-grid.calendar-card-grid.calendar-mobile-seven {
    gap: 3px !important;
  }
  .calendar-grid.calendar-card-grid.calendar-mobile-seven .calendar-card-cell {
    min-height: 98px !important;
    border-radius: 11px !important;
    padding: 4px 3px !important;
  }
  .calendar-grid.calendar-card-grid.calendar-mobile-seven .event-pill {
    font-size: 8.4px !important;
    padding: 2px 3px !important;
  }
}

/* V205 OT Summary + Partial Trade */
.v205-pending-summary table { min-width: 1080px; }
.v205-pending-summary th:nth-child(4),
.v205-pending-summary td:nth-child(4),
.v205-pending-summary th:nth-child(5),
.v205-pending-summary td:nth-child(5) { white-space: nowrap; }
#tradeEstimateV205 { line-height: 1.7; }
@media (max-width: 820px) {
  .v205-pending-summary table { min-width: 980px; }
}

/* V206 My Duty Today / Month checklist */
.my-duty-today-card .section-title { align-items: flex-start; }
.my-duty-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.my-duty-detail > div {
  border: 1px solid var(--border, #dfe8f3);
  background: #f8fbff;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.my-duty-detail b { font-size: 1.02rem; }
.my-duty-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px dashed var(--border, #dfe8f3);
  border-radius: 14px;
  background: #f8fbff;
  margin: 10px 0;
}
.my-duty-month-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.my-duty-month-filter input { min-width: 150px; }
.my-duty-month-table td { vertical-align: top; }
.my-duty-month-cards { display: none; }
.v206-schedule-page .toolbar { gap: 10px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .my-duty-detail { grid-template-columns: 1fr; }
  .my-duty-month-table { display: none; }
  .my-duty-month-cards { display: grid; }
  .my-duty-month-section .section-title { align-items: stretch; }
  .my-duty-month-filter { width: 100%; justify-content: space-between; }
  .my-duty-month-filter input { width: 160px; }
}

/* V209: ช4 / งานปั่นเลือด confirmation flow */
.ch4-duty-today-box {
  margin-top: 12px;
}
.ch4-duty-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.ch4-duty-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(23, 53, 77, .10);
  border-radius: 14px;
  background: rgba(255,255,255,.72);
}
.ch4-duty-item .actions,
.ch4-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.v209-admin-ch4-card table td,
.v209-admin-ch4-card table th {
  white-space: nowrap;
}
.v209-ch4-cover-modal textarea {
  width: 100%;
  resize: vertical;
}
@media (max-width: 768px) {
  .ch4-duty-item {
    align-items: stretch;
    flex-direction: column;
  }
  .ch4-duty-item .actions,
  .ch4-actions {
    justify-content: stretch;
  }
  .ch4-actions button {
    flex: 1 1 140px;
  }
}

/* V215 Weekly Position Copy */
.week-copy-source-v215,
.week-copy-checkbox-v215 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.week-copy-source-v215 input[type="date"] {
  min-width: 145px;
}
.week-copy-checkbox-v215 input {
  width: auto;
}
.week-copy-btn-v215 {
  border-color: #bae6fd;
  background: #eff6ff;
}
.week-copy-cell-v215 {
  background: #e8f7ff !important;
  box-shadow: inset 0 0 0 2px #bae6fd;
}
.week-copy-cell-v215 select {
  background: #f0fbff !important;
  border-color: #7dd3fc !important;
}
@media (max-width: 768px) {
  .week-copy-source-v215,
  .week-copy-checkbox-v215,
  .week-copy-btn-v215 {
    width: 100%;
    justify-content: flex-start;
  }
  .week-copy-source-v215 input[type="date"] {
    width: 100%;
  }
}

/* V219 OT repair + compact daily position UX */
.v219-ot-page .v219-ot-card .hint,
.v219-positions-page .hint { line-height: 1.35; }
.v219-duty-detail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 10px 0 12px; }
.v219-duty-detail > div { border: 1px solid var(--line, #e5edf5); background: #f8fbff; border-radius: 12px; padding: 10px 12px; min-height: 58px; }
.v219-duty-detail span { display:block; font-size: 12px; margin-bottom: 4px; }
.v219-duty-detail b { display:block; font-size: 14px; }
.v219-ot-actions { margin-top: 10px; }
.v219-ot-repair-panel .actions { margin-top: 8px; }
.v219-position-toolbar { align-items: end; gap: 8px; }
.v219-position-note { margin: 10px 0; }
.v219-daily-position-table th:nth-child(6),
.v219-daily-position-table td:nth-child(6) { min-width: 170px; }
.v219-daily-position-table td { vertical-align: middle; }
.v219-position-select { min-width: 160px; width: 100%; max-width: 240px; }
.v219-job-short { display:block; margin-top: 4px; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v219-position-card .actions { margin-top: 8px; }
@media (max-width: 760px) {
  .v219-duty-detail { grid-template-columns: 1fr; }
  .v219-position-select { max-width: none; }
  .v219-position-toolbar { align-items: stretch; }
}

/* V228 weekly leave-aware monthly position plan */
.v228-position-matrix {
  --month-header-height: 38px;
  --month-count-height: 30px;
  --month-missing-height: 32px;
  --month-row-height: 34px;
}
.v228-position-matrix .month-position-matrix thead .count-role-row th {
  height: var(--month-count-height) !important;
  min-height: var(--month-count-height) !important;
  max-height: var(--month-count-height) !important;
  position: sticky !important;
  top: var(--month-header-height) !important;
  z-index: 39;
  background: #fff7ed !important;
}
.v228-position-matrix .month-position-matrix thead .missing-role-row th {
  top: calc(var(--month-header-height) + var(--month-count-height)) !important;
}
.v228-position-matrix .count-role-cell {
  width: var(--month-day-col-width) !important;
  min-width: var(--month-day-col-width) !important;
  max-width: var(--month-day-col-width) !important;
  padding: 3px 4px !important;
  font-size: 10px !important;
  line-height: 1.05 !important;
  background: #fff7ed !important;
  color: #9a3412 !important;
  white-space: nowrap !important;
}
.v228-position-matrix .count-role-cell.complete {
  background: #f0fdf4 !important;
  color: #166534 !important;
}
.v228-position-matrix .count-role-cell.no-position-day {
  background: #eef2f7 !important;
  color: #475569 !important;
}
.v228-position-matrix .leave-note-v228 {
  display: block !important;
  max-width: 100%;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 8px;
  line-height: 1;
  opacity: .9;
}
.v228-position-matrix .matrix-cell.leave-cell > span {
  display: block;
}
.v228-position-matrix .matrix-cell.leave-cell .month-position-select {
  border-color: #f9c74f !important;
  background: rgba(255,255,255,.92) !important;
}

/* =========================
   V234 OT Admin / CH4 / HR Export UI
   ========================= */
.v234-ot-page .wide-card,
.v234-admin-follow-card,
.v234-ch4-shared-card { min-width: 0; }
.v234-admin-filters,
.v234-hr-filter { gap: 10px; align-items: end; }
.v234-statline { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.v234-follow-table table th,
.v234-follow-table table td,
.v234-ot-summary-table table th,
.v234-ot-summary-table table td { vertical-align: top; }
.link-btn.v234-staff-link { border: 0; background: transparent; padding: 0; cursor: pointer; color: inherit; text-decoration: none; }
.link-btn.v234-staff-link:hover { text-decoration: underline; }
.v234-staff-detail { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border, #e5e7eb); scroll-margin-top: 90px; }
.v234-ch4-actions { gap: 6px; flex-wrap: wrap; }
.v234-ch4-actions .tiny-btn { white-space: nowrap; }
.v234-hr-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 10px 0 12px; }
.v234-hr-cards .mini-stat { border: 1px solid var(--border, #e5e7eb); border-radius: 14px; padding: 12px; background: #fff; }
.v234-hr-cards .mini-stat span { display: block; font-size: 0.85rem; color: var(--muted, #64748b); }
.v234-hr-cards .mini-stat b { display: block; font-size: 1.45rem; margin-top: 4px; }
.v234-hr-cards .mini-stat.ready { background: #ecfdf5; }
.v234-hr-cards .mini-stat.overdue { background: #fff7ed; }
.v234-summary-block { margin-top: 14px; }
.v234-summary-block h4 { margin: 0 0 8px; }
.v234-admin-card .hint.compact,
.v234-hr-summary .hint.compact { margin-top: 6px; }

@media (max-width: 720px) {
  .v234-hr-cards { grid-template-columns: 1fr; }
  .v234-statline { justify-content: flex-start; }
  .v234-admin-filters label,
  .v234-hr-filter label { width: 100%; }
  .v234-ch4-actions .tiny-btn { width: 100%; }
}

/* =========================
   V236 OT / CH4 tracking readability fix
   ========================= */
.v236-note-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 240px;
  max-width: 560px;
  line-height: 1.35;
}
.v236-note-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid #e5edf7;
  border-radius: 10px;
  background: #fbfdff;
  word-break: break-word;
}
.v236-note-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #075985;
}
.v236-note-status.green { background: #dcfce7; color: #166534; }
.v236-note-status.orange { background: #ffedd5; color: #9a3412; }
.v236-note-status.red { background: #fee2e2; color: #991b1b; }
.v236-note-status.black { background: #e5e7eb; color: #374151; }
.v236-note-status.blue { background: #dbeafe; color: #1d4ed8; }
.v236-ch4-month-table {
  max-height: 430px;
  overflow: auto;
  border-radius: 14px;
}
.v234-admin-follow-card {
  scroll-margin-top: 88px;
}
.v234-admin-follow-card .v234-statline .badge.blue:first-child {
  margin-right: 4px;
}
.v234-follow-table th:nth-child(5),
.v234-follow-table td:nth-child(5) {
  min-width: 300px;
}
.v234-ch4-shared-card th:nth-child(6),
.v234-ch4-shared-card td:nth-child(6) {
  min-width: 280px;
}
@media (max-width: 720px) {
  .v236-note-cell { min-width: 220px; max-width: none; }
  .v236-note-line { font-size: .9rem; }
  .v236-ch4-month-table { max-height: 360px; }
}

/* V241 OT single-menu sub tabs */
.v241-ot-page { display:block; }
.v241-ot-menu-card { margin-bottom:16px; }
.v241-ot-tabs { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.v241-ot-tab { border:1px solid #d7e7f7; background:#fff; color:#2d4b68; border-radius:999px; padding:10px 14px; font-weight:700; cursor:pointer; box-shadow:0 4px 12px rgba(31,82,126,.06); }
.v241-ot-tab.active { background:#75c3f7; color:#12334b; border-color:#75c3f7; }
.v241-ot-content > .v241-export-history, .v241-ot-content > .v241-export-batch { grid-column:1/-1; }
.v241-ot-summary .section-title { align-items:flex-start; }
.v241-logic-notice { border:1px solid #b8dcff; background:#eef7ff; color:#17446b; }
.v241-summary-block { margin-top:14px; }
.v241-separator { border:0; border-top:1px dashed #d7e7f7; margin:18px 0; }
.v241-month-filter, .v241-hr-filter { margin:10px 0 12px; }
.v241-export-history { display:grid; grid-template-columns:1fr; gap:14px; width:100%; }
.v241-export-batch { width:100%; }
@media (max-width: 720px) {
  .v241-ot-tabs { gap:8px; }
  .v241-ot-tab { width:100%; text-align:left; border-radius:16px; }
}


/* V268 Monthly daytime-position matrix: fixed widths + two sticky columns.
   Scope is limited to the latest V265 matrix renderer so scheduling logic is untouched. */
.v265-position-matrix {
  --v268-staff-col-width: 128px;
  --v268-summary-col-width: 84px;
  --v268-day-col-width: 108px;
  --v268-head-row-height: 42px;
  --v268-count-row-height: 36px;
  --v268-missing-row-height: 36px;
  min-width: 0;
  max-width: 100%;
}
.v265-position-matrix .month-position-matrix {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  isolation: isolate;
}
.v265-position-matrix .month-position-matrix table {
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: max-content !important;
  min-width: max-content !important;
  margin: 0;
}
.v265-position-matrix .month-position-matrix th,
.v265-position-matrix .month-position-matrix td {
  box-sizing: border-box !important;
  position: static;
  min-width: 0;
  padding: 6px 9px !important;
  vertical-align: middle !important;
  border-right: 1px solid #e5eaf0;
  background-clip: padding-box !important;
}
.v265-position-matrix .month-position-matrix .staff-col {
  position: sticky !important;
  left: 0 !important;
  width: var(--v268-staff-col-width) !important;
  min-width: var(--v268-staff-col-width) !important;
  max-width: var(--v268-staff-col-width) !important;
  text-align: left !important;
  z-index: 32 !important;
  box-shadow: 1px 0 0 #d9e2ec, 5px 0 10px rgba(31, 50, 72, .07) !important;
}
.v265-position-matrix .month-position-matrix .summary-col {
  position: sticky !important;
  left: var(--v268-staff-col-width) !important;
  width: var(--v268-summary-col-width) !important;
  min-width: var(--v268-summary-col-width) !important;
  max-width: var(--v268-summary-col-width) !important;
  text-align: center !important;
  z-index: 31 !important;
  background: #fff !important;
  box-shadow: 1px 0 0 #d9e2ec, 5px 0 10px rgba(31, 50, 72, .06) !important;
}
.v265-position-matrix .month-position-matrix .date-head,
.v265-position-matrix .month-position-matrix .count-role-cell,
.v265-position-matrix .month-position-matrix .missing-role-cell,
.v265-position-matrix .month-position-matrix .matrix-cell {
  width: var(--v268-day-col-width) !important;
  min-width: var(--v268-day-col-width) !important;
  max-width: var(--v268-day-col-width) !important;
}
.v265-position-matrix .month-position-matrix thead th {
  position: sticky !important;
  background: #f8fafc !important;
}
.v265-position-matrix .month-position-matrix thead tr:first-child th {
  top: 0 !important;
  height: var(--v268-head-row-height) !important;
  z-index: 40 !important;
}
.v265-position-matrix .month-position-matrix thead .count-role-row th {
  top: var(--v268-head-row-height) !important;
  height: var(--v268-count-row-height) !important;
  z-index: 39 !important;
}
.v265-position-matrix .month-position-matrix thead .missing-role-row th {
  top: calc(var(--v268-head-row-height) + var(--v268-count-row-height)) !important;
  height: var(--v268-missing-row-height) !important;
  z-index: 38 !important;
}
.v265-position-matrix .month-position-matrix thead .staff-col {
  z-index: 62 !important;
  background: #f8fafc !important;
}
.v265-position-matrix .month-position-matrix thead .summary-col {
  z-index: 61 !important;
  background: #f8fafc !important;
}
.v265-position-matrix .month-position-matrix tbody .staff-col {
  overflow: hidden;
  background-color: #fff;
}
.v265-position-matrix .month-position-matrix .matrix-staff-name,
.v265-position-matrix .month-position-matrix .matrix-staff-name b,
.v265-position-matrix .month-position-matrix .matrix-staff-name small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v265-position-matrix .month-position-matrix .summary-action-cell .staff-summary-trigger {
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;
  padding: 5px 6px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v265-position-matrix .month-position-matrix .month-position-select {
  display: block;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

/* The longer menu/header wording must wrap instead of overflowing on tablets and phones. */
.nav-btn > span:last-child,
#pageTitle,
.readonly-month-position-page .section-title h3 {
  overflow-wrap: anywhere;
}
@media (max-width: 760px) {
  .v265-position-matrix {
    --v268-staff-col-width: 108px;
    --v268-summary-col-width: 72px;
    --v268-day-col-width: 96px;
    --v268-head-row-height: 40px;
    --v268-count-row-height: 34px;
    --v268-missing-row-height: 34px;
  }
  .v265-position-matrix .month-position-matrix th,
  .v265-position-matrix .month-position-matrix td {
    padding: 5px 7px !important;
    font-size: 10px !important;
  }
  .nav-btn > span:last-child {
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
  }
  #pageTitle {
    min-width: 0;
    font-size: clamp(18px, 5vw, 22px);
    line-height: 1.25;
  }
  .readonly-month-position-page .section-title h3 {
    font-size: 16px;
    line-height: 1.3;
  }
}
@media (max-width: 420px) {
  .v265-position-matrix {
    --v268-staff-col-width: 100px;
    --v268-summary-col-width: 68px;
    --v268-day-col-width: 92px;
  }
}


/* V342: external app switcher — Inventory */
.inventory-app-link{
  display:flex;align-items:center;gap:10px;text-decoration:none;color:#0f4f4a;
  background:linear-gradient(135deg,#e5f7f4,#ffffff);border:1px solid #b9e5df;
  border-radius:16px;padding:10px 12px;min-height:50px;box-shadow:0 6px 16px rgba(15,118,110,.08);
}
.inventory-app-link:hover{background:#fff;transform:translateY(-1px)}
.inventory-app-link-icon{width:32px;height:32px;border-radius:10px;display:grid;place-items:center;background:#0f766e;color:#fff;font-size:18px;flex:0 0 auto}
.inventory-app-link span:last-child{display:grid;line-height:1.18}
.inventory-app-link small{font-size:11px;color:#5a7471;margin-top:3px;font-weight:600}
@media(min-width:821px){
  .sidebar.collapsed .inventory-app-link span:last-child{display:none}
  .sidebar.collapsed .inventory-app-link{justify-content:center;padding:9px}
}
@media print{.inventory-app-link{display:none!important}}
/* V394 training workflow */
.training-import-box{border:1px solid #cfe0ef;border-radius:16px;padding:14px;background:#f7fbff}.training-import-box legend{font-weight:700;color:#174e7c;padding:0 6px}.check-row{display:flex;gap:10px;align-items:flex-start;padding:9px 0;font-weight:600}.check-row input{width:18px;height:18px}.participant-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-height:250px;overflow:auto;border:1px solid #dce8f1;border-radius:14px;padding:10px}.participant-check{display:flex;gap:8px;align-items:center;border:1px solid #e0ebf3;border-radius:12px;padding:10px;background:#fff}.participant-check small{display:block;color:#71839a}.training-record-list{display:grid;gap:16px}.training-record-card{border:1px solid #d8e6f1;border-radius:18px;padding:16px;background:#fff}.training-meta{display:grid;grid-template-columns:120px minmax(0,1fr);gap:7px 12px;margin:12px 0;color:#52677e}.training-meta b{color:#163553}.training-record-form{display:grid;gap:12px}.training-record-form textarea{min-height:90px}.signature-wrap{border:1px solid #d8e6f1;border-radius:14px;padding:12px;background:#fbfdff}.signature-canvas{display:block;width:100%;height:160px;background:#fff;border:1px dashed #7ea5c2;border-radius:10px;touch-action:none;margin:8px 0}.training-admin-table{overflow:auto}.training-admin-table table{min-width:900px}.training-admin-page .actions{flex-wrap:wrap}.empty-state{border:1px dashed #c8d9e7;border-radius:14px;padding:28px;text-align:center;color:#71839a}.activities-v394 .activity-list-card{max-height:calc(100vh - 170px);overflow:auto}@media(max-width:820px){.participant-grid{grid-template-columns:1fr}.training-meta{grid-template-columns:100px minmax(0,1fr)}.training-admin-page .section-title{align-items:flex-start}.training-admin-table table{min-width:760px}}


/* Original source: patch-v489-dashboard-compact-density.css */
/* CNMI Staff Planner V489
 * Dashboard compact density — desktop/tablet landscape only.
 * Keeps mobile readability unchanged while reducing vertical space for
 * Physician Consult and Daytime Position cards/status badges.
 */
@media (min-width: 901px) {
  /* Physician Consult */
  .v452-physician-card{
    padding:14px 16px!important;
    margin-bottom:10px!important;
  }
  .v452-physician-card .v452-card-head{
    gap:8px!important;
    margin-bottom:7px!important;
  }
  .v452-physician-card .v452-card-head h3,
  .v452-physician-card .section-title h3{
    font-size:16px!important;
    line-height:1.2!important;
  }
  .v452-physician-card .v452-card-head>div:first-child span,
  .v452-physician-card .section-title>span{
    font-size:10px!important;
  }
  .v452-physician-card .v452-ready,
  .v452-physician-card .v452-version{
    padding:3px 7px!important;
    font-size:9px!important;
  }
  .v452-physician-card .v452-dashboard-table-wrap{
    border-radius:10px!important;
  }
  .v452-physician-card .v452-dashboard-table th,
  .v452-physician-card .v452-dashboard-table td{
    padding:6px 8px!important;
    font-size:10px!important;
    line-height:1.2!important;
  }
  .v452-physician-card .v452-dashboard-table th{
    font-size:9px!important;
  }
  .v452-physician-card .v452-doctor-pill{
    padding:3px 7px!important;
    font-size:10px!important;
    line-height:1.1!important;
  }
  .v452-physician-card .v488-training-shortage{
    gap:4px!important;
    margin-top:3px!important;
  }
  .v452-physician-card .v488-training-shortage .badge{
    padding:3px 6px!important;
    font-size:9px!important;
    line-height:1!important;
  }

  /* Daytime positions */
  .v434-daytime-card{
    padding:14px 16px!important;
    margin-bottom:10px!important;
  }
  .v434-title{
    gap:8px!important;
    margin-bottom:7px!important;
  }
  .v434-title h3{
    font-size:16px!important;
    line-height:1.2!important;
  }
  .v434-title .hint{
    font-size:9.5px!important;
  }
  .v434-head-actions,
  .v434-summary-badges{
    gap:4px!important;
  }
  .v434-vacancy-badge,
  .v434-complete-badge,
  .v434-assigned-count{
    padding:3px 7px!important;
    font-size:9px!important;
  }
  .v434-groups{
    gap:7px!important;
  }
  .v434-zone-group{
    padding:7px!important;
    border-radius:10px!important;
  }
  .v434-zone-head{
    gap:6px!important;
    padding:0 1px 5px!important;
    font-size:10px!important;
  }
  .v471-room-title{
    gap:1px!important;
  }
  .v471-room-title b,
  .v434-zone-head b{
    font-size:11px!important;
    line-height:1.15!important;
  }
  .v471-room-title small{
    font-size:8px!important;
    line-height:1.15!important;
  }
  .v445-zone-count b{
    font-size:10px!important;
    line-height:1.1!important;
  }
  .v445-zone-count small{
    font-size:8.5px!important;
    line-height:1.1!important;
  }
  .v434-position-grid{
    gap:4px!important;
  }
  .v434-position-item{
    gap:5px!important;
    padding:5px 7px!important;
    min-height:35px!important;
    border-radius:9px!important;
  }
  .v434-position-code{
    font-size:9.5px!important;
    line-height:1.15!important;
  }
  .v434-position-staff .staff-color-pill{
    padding:4px 7px!important;
    font-size:9.5px!important;
    line-height:1!important;
    max-width:76px!important;
  }
  .v434-vacant-pill,
  .v434-staff-fallback{
    font-size:9px!important;
  }
  .v434-vacant-pill{
    padding:3px 6px!important;
  }
  .v434-position-item .v488-training-shortage{
    grid-column:1/-1!important;
    gap:4px!important;
    margin-top:2px!important;
  }
  .v434-position-item .v488-training-shortage .badge,
  .v434-position-item .badge:not(.staff-color-pill){
    padding:3px 6px!important;
    font-size:9px!important;
    line-height:1!important;
  }
  .v471-effective-note{
    padding:2px 5px!important;
    margin-left:4px!important;
    font-size:8px!important;
  }
}

/* Medium landscape/tablet: compact a little, but not as aggressively as desktop. */
@media (min-width: 761px) and (max-width: 900px) {
  .v452-physician-card .v452-dashboard-table th,
  .v452-physician-card .v452-dashboard-table td{
    padding:7px 8px!important;
  }
  .v488-training-shortage .badge{
    font-size:10.5px!important;
    padding:4px 7px!important;
  }
}


/* Original source: pwa-install-v303.css */
/* CNMI Staff Planner install UI — V303 */
.pwa-install-auth-wrap { margin: 12px 0 14px; }
.pwa-install-btn {
  width: 100%; min-height: 48px; border: 1px solid #99cef3; border-radius: 16px;
  padding: 11px 14px; background: #eef8ff; color: #175b8d; font: inherit;
  font-weight: 800; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px;
}
.pwa-install-btn:hover { background: #dff1ff; }
.pwa-install-btn:disabled { opacity: .65; cursor: wait; }
.pwa-install-btn.hidden { display: none !important; }
.pwa-install-btn--menu { margin-bottom: 10px; }
.pwa-install-note { margin: 7px 0 0; color: #6c7d91; font-size: 13px; text-align: center; }
.pwa-install-modal { position: fixed; inset: 0; z-index: 20050; display: grid; place-items: center; padding: 18px; background: rgba(20,35,52,.48); backdrop-filter: blur(3px); }
.pwa-install-modal.hidden { display: none !important; }
.pwa-install-dialog { width: min(440px,100%); max-height: 86vh; overflow: auto; border-radius: 26px; background: #fff; box-shadow: 0 28px 80px rgba(20,35,52,.30); padding: 24px; position: relative; }
.pwa-install-dialog h3 { margin: 0 42px 10px 0; font-size: 22px; }
.pwa-install-dialog p { margin: 8px 0; line-height: 1.6; color: #53657a; }
.pwa-install-dialog ol { margin: 12px 0 0; padding-left: 24px; line-height: 1.8; }
.pwa-install-dialog strong { color: #203245; }
.pwa-install-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 13px; background: #f1f5f8; color: #203245; font-size: 24px; cursor: pointer; }
@media (display-mode: standalone) { .pwa-install-btn,.pwa-install-note,.pwa-install-auth-wrap { display: none !important; } }


/* Original source: donor-helper-v327.css */
/* CNMI Staff Planner V326 — Donor helper module */
.donor-helper-page-v324{display:grid;gap:16px}
.donor-helper-hero{display:flex;align-items:center;justify-content:space-between;gap:18px;background:linear-gradient(135deg,#eef9ff,#f9fdff)}
.donor-helper-hero h3{margin:4px 0 6px;font-size:1.25rem}
.donor-helper-hero p{margin:0;color:var(--muted,#64748b)}
.donor-helper-kicker{display:inline-flex;font-weight:700;color:#0f6c9d;background:#dff3ff;border-radius:999px;padding:5px 10px;font-size:.82rem}
.donor-helper-hero-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.donor-helper-link-btn{text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
.donor-helper-ot-note{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.donor-helper-toolbar{display:flex;align-items:end;gap:12px;flex-wrap:wrap}
.donor-helper-toolbar label{min-width:190px}
.donor-helper-counts{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-right:auto}
.donor-helper-weekend-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.donor-helper-day-card{padding:14px}
.donor-helper-day-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid #e5eef5}
.donor-helper-day-head>div{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.donor-helper-day-head span:first-child{color:#64748b}
.donor-helper-day-head b{font-size:1.05rem}
.donor-helper-slots{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.donor-helper-slot{min-height:132px;border:1px solid #dbe7f0;border-radius:14px;padding:11px;background:#fff;display:flex;flex-direction:column;gap:5px}
.donor-helper-slot.empty{border-style:dashed;background:#fbfdff;align-items:flex-start;justify-content:center}
.donor-helper-slot.status-confirmed{border-color:#bfe7ca;background:#f5fff8}
.donor-helper-slot.status-cancel_requested{border-color:#ffd69b;background:#fffaf0}
.donor-helper-slot.status-completed{border-color:#b8ddff;background:#f5fbff}
.donor-helper-slot.status-no_show{border-color:#ffc5c5;background:#fff7f7}
.donor-helper-slot-name{font-weight:700}
.donor-helper-empty-text{color:#94a3b8}
.donor-helper-slot-head{display:flex;align-items:flex-start;justify-content:space-between;gap:6px;flex-wrap:wrap}
.donor-helper-slot-head>span:first-child{font-weight:700;color:#334155}
.donor-helper-person{font-weight:700;font-size:1rem;color:#0f172a}
.donor-helper-unit,.donor-helper-phone{font-size:.88rem;color:#64748b}
.donor-helper-cancel-reason{margin-top:3px;padding:7px 8px;border-radius:9px;background:#fff1d6;font-size:.84rem;color:#7c4a03}
.compact-actions{margin-top:auto;gap:5px;flex-wrap:wrap}
.compact-actions .tiny-btn{font-size:.75rem;padding:5px 7px}
.donor-helper-history{margin-top:2px}
.donor-helper-error{border-color:#ffb4b4;background:#fff5f5}
.donor-helper-loading{text-align:center;color:#64748b}
@media (max-width:1100px){
  .donor-helper-weekend-grid{grid-template-columns:1fr}
}
@media (max-width:820px){
  .donor-helper-hero{align-items:stretch;flex-direction:column}
  .donor-helper-hero-actions{justify-content:stretch}
  .donor-helper-hero-actions>*{flex:1 1 180px}
  .donor-helper-toolbar{align-items:stretch}
  .donor-helper-toolbar label{min-width:0;flex:1 1 190px}
  .donor-helper-slots{grid-template-columns:1fr}
  .donor-helper-slot{min-height:0}
  .donor-helper-day-head{align-items:flex-start}
}

.donor-helper-unit-select{width:100%;min-height:42px;border:1px solid #cbdbe7;border-radius:10px;padding:9px 11px;background:#fff;color:#0f172a;font:inherit}

/* V327 — internal booking / duty and holiday guards */
.donor-helper-page-v327 .donor-helper-my-profile{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:14px 16px;background:#f8fcff}
.donor-helper-page-v327 .donor-helper-my-profile>div{display:grid;gap:3px}
.donor-helper-page-v327 .donor-helper-my-profile span{font-size:.8rem}
.donor-helper-page-v327 .donor-helper-my-profile b{font-size:.95rem}
.donor-helper-empty-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.donor-helper-empty-reason{font-size:.8rem;color:#64748b;margin-top:4px}
.donor-helper-self-btn{background:#1677a8;color:#fff;border-color:#1677a8}
.donor-helper-self-btn.blocked{background:#fff4e5;color:#8a4d00;border-color:#f2c477}
.donor-helper-slot.mine{box-shadow:inset 0 0 0 2px #8b5cf6}
.donor-helper-mine-label{align-self:flex-start;font-size:.75rem;font-weight:700;color:#6b21a8;background:#f3e8ff;padding:4px 7px;border-radius:999px}
.donor-helper-day-closed{border-color:#ffc7c7;background:#fffafa}
.donor-helper-holiday-banner,.donor-helper-duty-warning{display:flex;flex-direction:column;gap:2px;padding:9px 11px;border-radius:11px;margin:-2px 0 10px;font-size:.84rem}
.donor-helper-holiday-banner{background:#fff0f0;color:#991b1b;border:1px solid #ffcaca}
.donor-helper-duty-warning{background:#fff8e8;color:#7c4a03;border:1px solid #f5d69b}
.donor-helper-slot.holiday-closed{background:#f8f8f8;border-color:#d7dde3;color:#64748b}
.donor-helper-confirm-profile{display:grid;gap:8px;padding:12px;border:1px solid #dce8f0;border-radius:12px;background:#f8fbfd}
.donor-helper-confirm-profile>div{display:grid;grid-template-columns:95px 1fr;gap:8px}
.donor-helper-confirm-profile span{color:#64748b}
.donor-helper-ack{display:flex!important;grid-template-columns:auto 1fr!important;align-items:flex-start;gap:8px!important;font-weight:500!important}
.donor-helper-ack input{width:auto!important;margin-top:4px}
@media(max-width:820px){
  .donor-helper-page-v327 .donor-helper-my-profile{grid-template-columns:1fr}
  .donor-helper-confirm-profile>div{grid-template-columns:1fr;gap:2px}
}

/* V328 donor helper cancel clarity */
.contact-card, .slot-cancel-history, .donor-helper-slot-history{margin-top:10px;padding:10px 12px;border:1px solid #fde68a;background:#fffbeb;border-radius:14px;color:#7c4a03;font-size:.92rem;line-height:1.55}
.slot-cancel-history b,.donor-helper-slot-history b{color:#78350f}


/* V344 — ปุ่มรีเควสขอยกเลิกสำหรับคนในหน่วย */
.donor-helper-my-bookings{padding:14px 16px;border-color:#cfe5f4;background:linear-gradient(135deg,#f7fcff,#fff)}
.donor-helper-my-bookings-head{margin-bottom:10px;align-items:center}
.donor-helper-my-bookings-head h3{margin:2px 0 0;font-size:1rem}
.donor-helper-my-booking-list{display:grid;gap:8px}
.donor-helper-my-booking-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border:1px solid #dbeaf4;border-radius:12px;background:#fff}
.donor-helper-my-booking-row.pending{border-color:#f3d39a;background:#fffaf1}
.donor-helper-my-booking-row>div:first-child{display:grid;gap:2px}
.donor-helper-my-booking-row>div:first-child span{font-size:.84rem;color:#64748b}
.donor-helper-my-booking-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.donor-helper-request-cancel-btn{font-weight:700;white-space:nowrap}
.donor-helper-pending-note{font-size:.78rem;color:#8a4d00}
@media(max-width:820px){
  .donor-helper-my-booking-row{align-items:stretch;flex-direction:column}
  .donor-helper-my-booking-actions{justify-content:flex-start}
  .donor-helper-request-cancel-btn{width:100%}
}


/* Original source: patch-v494-donor-app-events.css */
/* v494 — CNMI Donor App synchronized events */
.donor-sync-card{margin-top:16px;border:1px solid #efd9dc;background:linear-gradient(180deg,#fff 0%,#fffafa 100%)}
.donor-sync-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}
.donor-sync-head h3{margin:0}.donor-sync-head p{margin:4px 0 0}
.donor-sync-badge{display:inline-flex;align-items:center;gap:6px;padding:5px 9px;border-radius:999px;background:#fff0f2;color:#a92f3d;font-size:12px;font-weight:700;white-space:nowrap}
.donor-sync-list{display:grid;gap:10px}
.donor-sync-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;padding:12px 14px;border:1px solid #edf0f2;border-radius:14px;background:#fff}
.donor-sync-item-main{min-width:0}.donor-sync-item-title{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:5px}.donor-sync-item-title b{font-size:15px}
.donor-sync-meta{display:flex;gap:8px 14px;flex-wrap:wrap;color:#65727a;font-size:13px;line-height:1.5}.donor-sync-meta a{color:inherit;text-decoration:none;font-weight:600}.donor-sync-meta a:hover{text-decoration:underline}
.donor-sync-type{display:inline-flex;padding:3px 8px;border-radius:999px;font-size:11px;font-weight:700;background:#f2f5f7;color:#58656d}.donor-sync-type.platelet{background:#fff0f2;color:#ad3040}.donor-sync-type.group{background:#edf8f2;color:#29744f}.donor-sync-type.mobile{background:#edf6fa;color:#2c6f89}
.donor-sync-open{align-self:center;white-space:nowrap}
.donor-sync-empty{padding:16px;border:1px dashed #dfe5e8;border-radius:14px;color:#7b878e;text-align:center;background:#fbfcfc}
.event-pill[data-donor-sync="platelet"]{background:#fff0f2!important;color:#9e3040!important}.event-pill[data-donor-sync="group"]{background:#edf8f2!important;color:#276d4c!important}.event-pill[data-donor-sync="mobile"]{background:#edf6fa!important;color:#286985!important}
@media(max-width:820px){.donor-sync-item{grid-template-columns:1fr}.donor-sync-open{justify-self:start}.donor-sync-meta{display:grid;gap:4px}.donor-sync-head{align-items:center}}


/* Original source: patch-v495-donor-dashboard-selected-date.css */
/* v495 — selected-date donor event card */
.v495-donor-dashboard{margin-top:16px}
.v495-dashboard-item .donor-sync-item-title b{font-size:14px}
.v495-dashboard-item .donor-sync-meta{font-size:12.5px}
@media(max-width:820px){.v495-donor-dashboard{margin-top:12px}}


/* Original source: patch-v520-whole-app-ui-refresh.css */
/* CNMI Staff Planner V520 — Whole App UI/UX Refresh
   Presentation only: consistent hierarchy, compact controls, mobile-first spacing.
   No business rules / DB schema changes. */

:root{
  --v520-bg:#f5f7fa;
  --v520-surface:#ffffff;
  --v520-surface-soft:#f8fafc;
  --v520-ink:#1e3345;
  --v520-muted:#6d8091;
  --v520-line:#dbe5ed;
  --v520-line-strong:#cbd9e4;
  --v520-primary:#5daee0;
  --v520-primary-strong:#2f7fac;
  --v520-primary-soft:#edf7fd;
  --v520-danger:#c94b61;
  --v520-shadow:0 5px 18px rgba(35,66,91,.055);
  --v520-radius:16px;
  --v520-radius-sm:11px;
}

/* ---------- App shell / hierarchy ---------- */
body.v520-ui-refresh{background:var(--v520-bg);color:var(--v520-ink);font-size:15px;line-height:1.45}
body.v520-ui-refresh .app-view{grid-template-columns:256px minmax(0,1fr)}
body.v520-ui-refresh .sidebar{padding:16px 14px;background:#eef7fc;border-right:1px solid #dbe8f0}
body.v520-ui-refresh .sidebar-head{margin-bottom:12px;padding:0 4px}
body.v520-ui-refresh .brand-icon{width:42px;height:42px;flex-basis:42px;border-radius:13px;box-shadow:none;border:1px solid #e1ebf2}
body.v520-ui-refresh .app-title{font-size:18px;letter-spacing:-.01em}
body.v520-ui-refresh .app-subtitle{font-size:12px}
body.v520-ui-refresh .main-nav{gap:2px;padding-right:2px}
body.v520-ui-refresh .nav-section{gap:3px;margin-bottom:10px}
body.v520-ui-refresh .nav-section-title{padding:8px 9px 3px;font-size:12px;letter-spacing:.02em;color:#728594;text-transform:none}
body.v520-ui-refresh .nav-section-title small{display:none}
body.v520-ui-refresh .nav-btn{min-height:40px;padding:9px 10px;border-radius:11px;gap:9px;font-size:14px;font-weight:700}
body.v520-ui-refresh .nav-btn:hover{background:rgba(255,255,255,.72)}
body.v520-ui-refresh .nav-btn.active{background:#fff;color:#1f5879;box-shadow:0 2px 9px rgba(31,72,110,.07);border:1px solid #dce9f1}
body.v520-ui-refresh .nav-emoji{width:18px;font-size:15px;filter:grayscale(.75);opacity:.78}
body.v520-ui-refresh .sidebar-foot{gap:8px}
body.v520-ui-refresh .user-mini{padding:9px 10px;border-radius:13px;background:rgba(255,255,255,.78);font-size:12px}
body.v520-ui-refresh .v520-version-chip{display:inline-flex;align-items:center;justify-content:center;width:max-content;margin:0 3px;padding:2px 7px;border-radius:999px;background:#e2f2fb;color:#4e738a;font-size:10px;font-weight:700;letter-spacing:.04em}

body.v520-ui-refresh .topbar{padding:13px 20px;gap:12px;background:rgba(245,247,250,.94);border-bottom:1px solid #e1e8ee;backdrop-filter:blur(9px)}
body.v520-ui-refresh .topbar h2{font-size:20px;line-height:1.25;letter-spacing:-.01em}
body.v520-ui-refresh .topbar p{font-size:12px;margin-top:1px}
body.v520-ui-refresh .topbar-actions{gap:7px}
body.v520-ui-refresh .sync-status{font-size:11px}
body.v520-ui-refresh .page-content{padding:18px 20px 28px;gap:14px;width:100%;max-width:1680px;margin:0 auto}

/* ---------- Cards / groups ---------- */
body.v520-ui-refresh .card{border:1px solid var(--v520-line);border-radius:var(--v520-radius);box-shadow:var(--v520-shadow);padding:16px;background:var(--v520-surface)}
body.v520-ui-refresh .card h3{font-size:17px;margin:0 0 10px;line-height:1.3}
body.v520-ui-refresh .card h4{line-height:1.3}
body.v520-ui-refresh .section-title{gap:8px;margin-bottom:10px;align-items:flex-start}
body.v520-ui-refresh .section-title h3{margin:0}
body.v520-ui-refresh .grid-2,
body.v520-ui-refresh .grid-3,
body.v520-ui-refresh .grid-4{gap:12px}
body.v520-ui-refresh .toolbar{gap:8px}
body.v520-ui-refresh .hint{font-size:12px;line-height:1.35;margin-top:5px;color:var(--v520-muted);font-weight:400}
body.v520-ui-refresh .muted{color:var(--v520-muted)}
body.v520-ui-refresh .notice{padding:10px 12px;border-radius:12px;margin:8px 0;font-size:13px;box-shadow:none}
body.v520-ui-refresh .empty-state,
body.v520-ui-refresh .empty{padding:18px;border-radius:13px;background:#fafcfd}

/* ---------- Forms ---------- */
body.v520-ui-refresh label{gap:5px;font-size:14px;font-weight:700;color:#30485b}
body.v520-ui-refresh input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
body.v520-ui-refresh select,
body.v520-ui-refresh textarea{min-height:42px;border:1px solid var(--v520-line-strong);border-radius:11px;padding:9px 11px;background:#fff;color:var(--v520-ink);box-shadow:none}
body.v520-ui-refresh textarea{min-height:76px;line-height:1.5}
body.v520-ui-refresh input:focus,
body.v520-ui-refresh select:focus,
body.v520-ui-refresh textarea:focus{border-color:#73b9df;box-shadow:0 0 0 3px rgba(93,174,224,.14)}
body.v520-ui-refresh input::placeholder,
body.v520-ui-refresh textarea::placeholder{color:#91a0ad;opacity:1}
body.v520-ui-refresh input[type="checkbox"],
body.v520-ui-refresh input[type="radio"]{accent-color:#4d9fd0}
body.v520-ui-refresh .form-grid{gap:11px 12px}
body.v520-ui-refresh .field-label{font-size:14px;margin-bottom:6px}

/* ---------- Buttons ---------- */
body.v520-ui-refresh .primary-btn,
body.v520-ui-refresh .ghost-btn,
body.v520-ui-refresh .danger-ghost,
body.v520-ui-refresh .soft-btn{min-height:40px;border-radius:10px;padding:8px 13px;font-size:14px;font-weight:700;transition:background .15s,border-color .15s,transform .15s,box-shadow .15s}
body.v520-ui-refresh .primary-btn{background:#70b9e3;color:#173e57}
body.v520-ui-refresh .primary-btn:hover{background:#64b1dd;box-shadow:0 3px 10px rgba(47,127,172,.12);transform:none}
body.v520-ui-refresh .ghost-btn{border-color:#d7e3eb;background:#fff;color:#39789e}
body.v520-ui-refresh .ghost-btn:hover{background:#f6fafc;border-color:#c7dbe7}
body.v520-ui-refresh .soft-btn{background:#edf7fc;color:#39789e}
body.v520-ui-refresh .danger-ghost{border-color:#f1d2d9;color:#b6455a;background:#fff}
body.v520-ui-refresh .tiny-btn{border-radius:8px!important;min-height:31px!important;padding:5px 9px!important;font-size:12px!important}
body.v520-ui-refresh .icon-btn{width:40px;height:40px;border-radius:10px;box-shadow:none}

/* ---------- Tables / data density ---------- */
body.v520-ui-refresh .table-wrap{border-color:var(--v520-line);border-radius:13px;box-shadow:none}
body.v520-ui-refresh table{font-size:13px}
body.v520-ui-refresh th,
body.v520-ui-refresh td{padding:9px 10px;border-bottom-color:#e6edf2;line-height:1.35}
body.v520-ui-refresh th{background:#f7fafc;color:#526a7d;font-size:12px;font-weight:800}
body.v520-ui-refresh tbody tr:hover>td{background-color:rgba(241,247,251,.48)}
body.v520-ui-refresh .badge{padding:3px 8px;font-size:11px;font-weight:800;box-shadow:none}
body.v520-ui-refresh .staff-color-pill{padding:5px 9px;min-width:34px;font-size:12px;box-shadow:none;border-color:rgba(31,50,69,.1)}
body.v520-ui-refresh .summary-chip{border-radius:11px;padding:8px 10px;box-shadow:none}

/* ---------- Modal ---------- */
body.v520-ui-refresh .modal{background:rgba(24,43,58,.32);padding:16px}
body.v520-ui-refresh .modal-card{width:min(720px,100%);max-height:90vh;border-radius:18px;padding:20px;box-shadow:0 18px 46px rgba(23,48,67,.18)}
body.v520-ui-refresh .modal-close{width:34px;height:34px;border-radius:9px;font-size:21px;background:#f3f6f8}

/* ---------- Activity page: fix the current visual problems ---------- */
body.v520-ui-refresh[data-cnmi-page="activities"] .v397-activities-layout{grid-template-columns:minmax(0,1fr) minmax(360px,.78fr)!important;gap:14px!important;align-items:start}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-activity-entry-card{padding:15px!important;overflow:visible}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-form-section{margin:0 0 10px;padding:13px 14px;border:1px solid #e0e8ee;border-radius:13px;background:#fbfcfd}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-section-head{margin-bottom:9px;gap:8px}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-section-head h4{font-size:15px;color:#29475c}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-section-head span{font-size:11px;color:#8696a3}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-section-grid{gap:9px 12px}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-readonly-person{min-height:42px;padding:8px 11px;border-radius:10px;border-color:#dce6ed;background:#f5f8fa;justify-content:flex-start}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-readonly-person small{display:none}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-participant-tools{grid-template-columns:minmax(200px,1fr) auto auto;gap:7px;margin:6px 0 4px}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-selected-count{grid-column:1/-1;justify-self:start;font-size:11px;color:#6f8291;margin-top:-1px}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-selected-chips{margin:3px 0 7px;min-height:24px;gap:5px}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-chip{padding:3px 7px;font-size:11px;background:#edf7fc;border-color:#cae3f0}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-no-selection{font-size:11px;color:#8b99a5}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-participant-wrap .v396-participants{grid-template-columns:repeat(auto-fill,minmax(118px,1fr));gap:7px;max-height:215px;padding:1px;border:0;background:transparent;overflow:auto}
body.v520-ui-refresh[data-cnmi-page="activities"] .v396-participant{display:flex;align-items:center;gap:8px;min-height:46px;padding:7px 9px;border:1px solid #dce6ed;border-radius:10px;background:#fff;cursor:pointer;overflow:hidden}
body.v520-ui-refresh[data-cnmi-page="activities"] .v396-participant:hover{border-color:#b9d9ea;background:#f8fcfe}
body.v520-ui-refresh[data-cnmi-page="activities"] .v396-participant:has(input:checked){border-color:#85bedc;background:#eef8fd;box-shadow:inset 0 0 0 1px rgba(93,174,224,.1)}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-activity-form .v396-participant input[type="checkbox"],
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-activity-form .v396-training-check input[type="checkbox"]{width:18px!important;height:18px!important;min-width:18px!important;max-width:18px!important;flex:0 0 18px;padding:0!important;margin:0!important;box-shadow:none!important}
body.v520-ui-refresh[data-cnmi-page="activities"] .v396-participant span{display:block;min-width:0}
body.v520-ui-refresh[data-cnmi-page="activities"] .v396-participant b{display:block;font-size:13px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.v520-ui-refresh[data-cnmi-page="activities"] .v396-participant small{display:none!important}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-tool-btn{min-height:36px!important;padding:6px 10px!important;font-size:12px!important}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-optional-section .v396-training-check,
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-optional-section .v405-training-field{padding:9px 10px;border-radius:10px}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-form-actions{gap:7px;padding-top:1px}
body.v520-ui-refresh[data-cnmi-page="activities"] .v518-form-actions button{min-width:112px}
body.v520-ui-refresh[data-cnmi-page="activities"] .activity-row-card{border-radius:12px!important;box-shadow:none!important}
body.v520-ui-refresh[data-cnmi-page="activities"] .activity-row-detail{font-size:12px}

/* ---------- Dashboard / calendar / leave / OT cards ---------- */
body.v520-ui-refresh[data-cnmi-page="dashboard"] .card{padding:14px}
body.v520-ui-refresh[data-cnmi-page="dashboard"] .v518-dashboard-activity{padding:10px 11px!important;border-radius:11px!important}
body.v520-ui-refresh[data-cnmi-page="dashboard"] .v518-activity-info span{padding:6px 7px;border-radius:8px;background:#f7fafb}
body.v520-ui-refresh[data-cnmi-page="dashboard"] .v518-created-rank{display:none}
body.v520-ui-refresh .calendar-cell{border-radius:12px!important;box-shadow:none!important}
body.v520-ui-refresh .timeline-item{border-radius:12px;padding:10px 12px;box-shadow:none}
body.v520-ui-refresh .mobile-card{border-radius:12px;padding:11px 12px;box-shadow:none}
body.v520-ui-refresh .roster-slot{border-radius:10px;padding:7px}

/* ---------- Admin / management surfaces ---------- */
body.v520-ui-refresh[data-cnmi-page="users"] .card,
body.v520-ui-refresh[data-cnmi-page="audit"] .card,
body.v520-ui-refresh[data-cnmi-page="eligibility"] .card,
body.v520-ui-refresh[data-cnmi-page="positions"] .card{box-shadow:none}
body.v520-ui-refresh .position-zone-card,
body.v520-ui-refresh .position-check,
body.v520-ui-refresh .selected-staff-card{border-radius:12px;box-shadow:none}
body.v520-ui-refresh .position-check{padding:9px 10px}
body.v520-ui-refresh .big-staff-name{font-size:22px}

/* Keep formal / audit contexts detailed. Nickname compaction only applies to operational activity picker. */
body.v520-ui-refresh[data-cnmi-page="activities"] .v396-participant[data-v520-full-name]{position:relative}

/* ---------- Authentication ---------- */
body.v520-ui-refresh .auth-view{background:#f5f8fa;padding:18px}
body.v520-ui-refresh .auth-card{width:min(500px,100%);padding:28px;border:1px solid #dfe8ee;border-radius:20px;box-shadow:0 10px 32px rgba(31,60,82,.08);backdrop-filter:none}
body.v520-ui-refresh .brand-mark{width:64px;height:64px;border-radius:17px;box-shadow:none;border:1px solid #e4ebf0}
body.v520-ui-refresh .auth-card h1{font-size:24px}

/* ---------- Responsive ---------- */
@media(max-width:1080px){
  body.v520-ui-refresh .app-view{grid-template-columns:232px minmax(0,1fr)}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v397-activities-layout{grid-template-columns:1fr!important}
}
@media(max-width:820px){
  body.v520-ui-refresh .app-view{grid-template-columns:1fr}
  body.v520-ui-refresh .sidebar{width:288px;max-width:86vw;padding:14px 12px}
  body.v520-ui-refresh .topbar{padding:11px 12px}
  body.v520-ui-refresh .topbar h2{font-size:18px}
  body.v520-ui-refresh .page-content{padding:12px 10px 22px;gap:10px}
  body.v520-ui-refresh .card{padding:12px;border-radius:13px}
  body.v520-ui-refresh .grid-2,
  body.v520-ui-refresh .grid-3,
  body.v520-ui-refresh .grid-4,
  body.v520-ui-refresh .form-grid{gap:9px}
  body.v520-ui-refresh .modal-card{padding:16px 13px;border-radius:15px}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-activity-entry-card{padding:11px!important}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-form-section{padding:10px 9px;margin-bottom:8px}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-section-head{display:flex;flex-direction:row;align-items:baseline;justify-content:space-between;gap:6px}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-section-head span{display:none}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-participant-tools{grid-template-columns:1fr 1fr}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-participant-tools input{grid-column:1/-1}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-selected-count{grid-column:1/-1}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-participant-wrap .v396-participants{grid-template-columns:repeat(2,minmax(0,1fr));max-height:240px}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v396-participant{min-height:44px;padding:7px 8px}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-form-actions{position:sticky;bottom:max(0px,env(safe-area-inset-bottom));background:rgba(255,255,255,.95);padding:7px 0 2px;backdrop-filter:blur(6px)}
}
@media(max-width:460px){
  body.v520-ui-refresh{font-size:14px}
  body.v520-ui-refresh .page-content{padding-left:8px;padding-right:8px}
  body.v520-ui-refresh .card{padding:10px}
  body.v520-ui-refresh input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
  body.v520-ui-refresh select,
  body.v520-ui-refresh textarea{min-height:40px;padding:8px 10px;border-radius:10px}
  body.v520-ui-refresh .primary-btn,
  body.v520-ui-refresh .ghost-btn,
  body.v520-ui-refresh .danger-ghost,
  body.v520-ui-refresh .soft-btn{min-height:38px;padding:7px 10px;font-size:13px}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-participant-wrap .v396-participants{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v396-participant b{font-size:12px}
  body.v520-ui-refresh[data-cnmi-page="activities"] .v518-form-actions{grid-template-columns:1fr 1fr;gap:6px}
}

/* Print/export are intentionally left to the existing document/export styles. */
@media print{
  body.v520-ui-refresh .v520-version-chip{display:none!important}
}


/* Original source: patch-v521-mobile-ui-clarity-polish.css */
/* CNMI Staff Planner V521 — Mobile UI clarity polish
   Refines V520: stronger icon visibility, less helper-text noise, placeholder-first fields,
   and tighter mobile spacing. No business logic / DB changes. */

:root{
  --v521-accent:#5caee0;
  --v521-accent-strong:#337fa9;
  --v521-accent-soft:#eef7fd;
  --v521-line:#d6e3ec;
  --v521-muted:#75889a;
  --v521-surface-soft:#f8fbfd;
}

body.v521-ui-clarity .nav-emoji{
  filter:none!important;
  opacity:.98!important;
  color:inherit;
}
body.v521-ui-clarity .nav-btn{
  gap:10px;
}
body.v521-ui-clarity .hint,
body.v521-ui-clarity .muted,
body.v521-ui-clarity .v521-helper-compact{
  color:var(--v521-muted);
}
body.v521-ui-clarity .v521-helper-short{font-size:12px!important}
body.v521-ui-clarity .v521-dense-card > .hint,
body.v521-ui-clarity .v521-dense-card > .muted{max-width:82ch}

/* subtle icon cue for common buttons without relying on faded emoji */
body.v521-ui-clarity [data-v521-icon]{position:relative;padding-left:34px!important}
body.v521-ui-clarity [data-v521-icon]::before{
  content:'';
  position:absolute;left:12px;top:50%;width:14px;height:14px;transform:translateY(-50%);
  border-radius:50%;background:var(--v521-accent-soft);
  box-shadow:inset 0 0 0 1px #cfe5f2;
}
body.v521-ui-clarity [data-v521-icon="search"]::after,
body.v521-ui-clarity [data-v521-icon="save"]::after,
body.v521-ui-clarity [data-v521-icon="clear"]::after,
body.v521-ui-clarity [data-v521-icon="refresh"]::after,
body.v521-ui-clarity [data-v521-icon="download"]::after{
  position:absolute;left:15px;top:50%;transform:translateY(-53%);font-size:10px;font-weight:900;color:var(--v521-accent-strong)
}
body.v521-ui-clarity [data-v521-icon="search"]::after{content:'⌕'}
body.v521-ui-clarity [data-v521-icon="save"]::after{content:'✓'}
body.v521-ui-clarity [data-v521-icon="clear"]::after{content:'×'}
body.v521-ui-clarity [data-v521-icon="refresh"]::after{content:'↻'}
body.v521-ui-clarity [data-v521-icon="download"]::after{content:'↓'}

/* more obvious chips / badges */
body.v521-ui-clarity .badge,
body.v521-ui-clarity .summary-chip,
body.v521-ui-clarity .staff-color-pill{filter:none}

/* generic compact form look */
body.v521-ui-clarity input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
body.v521-ui-clarity select,
body.v521-ui-clarity textarea{
  border-color:var(--v521-line);
  background:#fff;
}
body.v521-ui-clarity .v521-placeholder-driven::placeholder{color:#7e90a1}

/* desktop polish on key operational pages */
body.v521-ui-clarity[data-cnmi-route="leave"] .card,
body.v521-ui-clarity[data-cnmi-route="activities"] .card,
body.v521-ui-clarity[data-cnmi-route="ot"] .card,
body.v521-ui-clarity[data-cnmi-route="hr-check"] .card,
body.v521-ui-clarity[data-cnmi-route="dashboard"] .card{box-shadow:none}
body.v521-ui-clarity[data-cnmi-route="leave"] .notice,
body.v521-ui-clarity[data-cnmi-route="hr-check"] .notice,
body.v521-ui-clarity[data-cnmi-route="dashboard"] .notice{border-radius:12px}

/* Activities page: simpler search/form balance */
body.v521-ui-clarity[data-cnmi-route="activities"] .v397-activities-layout{gap:12px!important}
body.v521-ui-clarity[data-cnmi-route="activities"] .v518-section-head span{font-size:10px!important}
body.v521-ui-clarity[data-cnmi-route="activities"] .v518-participant-wrap .v396-participants{max-height:240px!important}
body.v521-ui-clarity[data-cnmi-route="activities"] .v396-participant{min-height:42px!important}

/* OT page list buttons were too tall */
body.v521-ui-clarity[data-cnmi-route="ot"] .card h3,
body.v521-ui-clarity[data-cnmi-route="ot"] .card h4{margin-bottom:8px}
body.v521-ui-clarity[data-cnmi-route="ot"] .card .ghost-btn,
body.v521-ui-clarity[data-cnmi-route="ot"] .card .soft-btn,
body.v521-ui-clarity[data-cnmi-route="ot"] .card .primary-btn{
  min-height:54px;
  align-items:center;
}

/* Dashboard: compress oversized stat blocks on mobile and desktop */
body.v521-ui-clarity[data-cnmi-route="dashboard"] .summary-chip{padding:6px 9px}
body.v521-ui-clarity[data-cnmi-route="dashboard"] .card h3{margin-bottom:8px}

/* Mobile-first tightening */
@media (max-width:820px){
  body.v521-ui-clarity .sidebar{width:278px;max-width:84vw;padding:12px 10px}
  body.v521-ui-clarity .sidebar-head{margin-bottom:8px}
  body.v521-ui-clarity .brand-icon{width:38px;height:38px;flex-basis:38px}
  body.v521-ui-clarity .app-title{font-size:17px}
  body.v521-ui-clarity .nav-section-title{padding:6px 8px 2px;font-size:11px}
  body.v521-ui-clarity .nav-btn{min-height:36px;padding:8px 10px;font-size:13px;border-radius:10px}
  body.v521-ui-clarity .nav-emoji{font-size:16px;width:18px}
  body.v521-ui-clarity .user-mini{padding:8px 9px;border-radius:12px}
  body.v521-ui-clarity .topbar{padding:10px 12px}
  body.v521-ui-clarity .topbar h2{font-size:17px}
  body.v521-ui-clarity .topbar p{display:none}
  body.v521-ui-clarity .sync-status{display:none}
  body.v521-ui-clarity .page-content{padding:10px 8px 18px;gap:9px}
  body.v521-ui-clarity .card{padding:10px;border-radius:13px}
  body.v521-ui-clarity .card h3{font-size:16px;margin-bottom:7px}
  body.v521-ui-clarity .card h4{font-size:14px}
  body.v521-ui-clarity .grid-2,
  body.v521-ui-clarity .grid-3,
  body.v521-ui-clarity .grid-4,
  body.v521-ui-clarity .form-grid{gap:8px}
  body.v521-ui-clarity .hint,
  body.v521-ui-clarity .muted,
  body.v521-ui-clarity .v521-helper-compact{font-size:11px;line-height:1.35}
  body.v521-ui-clarity .v521-helper-compact{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
  body.v521-ui-clarity input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
  body.v521-ui-clarity select,
  body.v521-ui-clarity textarea{min-height:38px;padding:8px 10px;font-size:14px}
  body.v521-ui-clarity textarea{min-height:68px}
  body.v521-ui-clarity .field-label,
  body.v521-ui-clarity label{font-size:13px}
  body.v521-ui-clarity .primary-btn,
  body.v521-ui-clarity .ghost-btn,
  body.v521-ui-clarity .soft-btn,
  body.v521-ui-clarity .danger-ghost{min-height:36px;font-size:13px;padding:7px 10px}

  /* hide repeated labels when placeholder already says the same thing */
  body.v521-ui-clarity .v521-hide-label-on-mobile{display:none!important}

  /* dashboard compactness */
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .card{padding:10px 11px}
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .summary-chip{padding:5px 8px;font-size:12px}
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .v518-dashboard-activity{padding:8px 9px!important}
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .v518-activity-info{gap:5px!important}
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .v518-activity-info span{padding:4px 6px;font-size:11px}
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .big-number,
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .summary-number{font-size:34px!important;line-height:1}
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .mobile-card{padding:10px 11px}

  /* leave page */
  body.v521-ui-clarity[data-cnmi-route="leave"] .notice{padding:9px 10px;font-size:12px}
  body.v521-ui-clarity[data-cnmi-route="leave"] .card .toolbar,
  body.v521-ui-clarity[data-cnmi-route="leave"] .card .grid-2,
  body.v521-ui-clarity[data-cnmi-route="leave"] .card .grid-3{gap:8px}

  /* hr-check page */
  body.v521-ui-clarity[data-cnmi-route="hr-check"] table{font-size:12px}
  body.v521-ui-clarity[data-cnmi-route="hr-check"] th,
  body.v521-ui-clarity[data-cnmi-route="hr-check"] td{padding:8px 8px}

  /* activities page */
  body.v521-ui-clarity[data-cnmi-route="activities"] .v397-activities-layout{grid-template-columns:1fr!important}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v518-activity-entry-card{padding:10px!important}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v518-form-section{padding:9px 9px!important;margin-bottom:7px!important}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v518-section-head{margin-bottom:6px!important}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v518-section-head h4{font-size:14px!important}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v518-section-head span{display:none!important}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v518-participant-tools{grid-template-columns:1fr 1fr!important;gap:6px!important}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v518-participant-tools input{grid-column:1/-1}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v518-selected-count{font-size:11px}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v518-participant-wrap .v396-participants{grid-template-columns:repeat(2,minmax(0,1fr))!important;max-height:200px!important;gap:6px!important}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v396-participant{padding:6px 7px!important;min-height:40px!important;border-radius:10px!important}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v396-participant b{font-size:12px!important}
  body.v521-ui-clarity[data-cnmi-route="activities"] .v518-form-actions{position:sticky;bottom:max(0px,env(safe-area-inset-bottom));padding-top:6px;background:rgba(255,255,255,.96)}

  /* OT page */
  body.v521-ui-clarity[data-cnmi-route="ot"] .card .primary-btn,
  body.v521-ui-clarity[data-cnmi-route="ot"] .card .ghost-btn,
  body.v521-ui-clarity[data-cnmi-route="ot"] .card .soft-btn{min-height:34px;padding:7px 10px}
  body.v521-ui-clarity[data-cnmi-route="ot"] .card h3{font-size:15px}

  /* mobile sidebar/user card */
  body.v521-ui-clarity .sidebar-foot{gap:7px}
  body.v521-ui-clarity .v520-version-chip{font-size:10px;padding:2px 7px}
}

@media (max-width:520px){
  body.v521-ui-clarity .topbar .icon-btn{width:38px;height:38px}
  body.v521-ui-clarity .topbar-actions .ghost-btn{min-height:34px;padding:6px 10px}
  body.v521-ui-clarity .sidebar{max-width:82vw}
  body.v521-ui-clarity .main-nav{padding-right:0}
  body.v521-ui-clarity .nav-btn{min-height:34px;padding:7px 9px}
  body.v521-ui-clarity .user-mini{font-size:11px}
  body.v521-ui-clarity [data-v521-icon]{padding-left:30px!important}
  body.v521-ui-clarity [data-v521-icon]::before{left:10px;width:13px;height:13px}
  body.v521-ui-clarity [data-v521-icon]::after{left:13px;font-size:9px}

  body.v521-ui-clarity[data-cnmi-route="dashboard"] .big-number,
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .summary-number{font-size:30px!important}
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .card .grid-2,
  body.v521-ui-clarity[data-cnmi-route="dashboard"] .card .grid-3{gap:7px}
}


/* Original source: patch-v522-ot-submenu-mobile-navigation.css */
/* CNMI Staff Planner V522 — OT Submenu Mobile Navigation */
body.v520-ui-refresh .v369-menu-grid.v522-grouped-menu{
  display:block!important;
  width:100%;
  min-width:0;
}
.v522-group-tabs{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:9px;
}
.v522-group-btn{
  min-width:0;
  min-height:66px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid #d6e4ee;
  border-radius:14px;
  background:#fff;
  color:#29485f;
  font:inherit;
  text-align:left;
  cursor:pointer;
  box-shadow:none;
}
.v522-group-btn:hover{background:#f8fcfe;border-color:#abd4ea}
.v522-group-btn.active{background:#eaf6fd;border-color:#78bae0;color:#205f85;box-shadow:inset 0 0 0 1px rgba(92,174,224,.08)}
.v522-group-icon{
  width:36px;height:36px;flex:0 0 36px;
  display:grid;place-items:center;
  border-radius:11px;
  background:#edf7fd;
  color:#3986b2;
}
.v522-group-btn.active .v522-group-icon{background:#d9effb;color:#2778a6}
.v522-group-copy{display:grid;gap:1px;min-width:0}
.v522-group-copy b{font-size:14px;line-height:1.2;white-space:normal}
.v522-group-copy small{font-size:11px;line-height:1.25;color:#7c8e9d;white-space:normal}
.v522-submenu{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
  margin-top:9px;
  padding-top:9px;
  border-top:1px solid #e4ebf0;
}
.v522-submenu-btn{
  min-height:36px;
  padding:7px 12px;
  border:1px solid #d7e3eb;
  border-radius:10px;
  background:#fff;
  color:#356f93;
  font:inherit;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  white-space:normal;
  text-align:center;
}
.v522-submenu-btn:hover{background:#f6fafc;border-color:#bcd9e9}
.v522-submenu-btn.active{background:#66b5df;border-color:#66b5df;color:#173e57}
.v522-submenu-chooser{
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px;
  border:1px dashed #cfe0eb;
  border-radius:13px;
  background:#f9fcfe;
  color:#587083;
}
.v522-submenu-chooser .v522-chooser-icon{
  width:38px;height:38px;flex:0 0 38px;display:grid;place-items:center;
  border-radius:11px;background:#edf7fd;color:#3986b2;
}
.v522-submenu-chooser span:last-child{display:grid;gap:2px}
.v522-submenu-chooser b{font-size:14px;color:#34566e}
.v522-submenu-chooser small{font-size:12px;color:#7a8d9b}
.v369-ot-content.v522-await-submenu{display:none!important}
.v369-ot-menu-card .v522-top-hint{font-size:12px!important;line-height:1.3!important;margin-top:2px!important}
.v369-ot-menu-card .v369-month-label{font-size:13px!important;gap:4px!important}
.v369-ot-menu-card .v369-month-label input{min-height:40px!important}

@media(max-width:760px){
  .v369-ot-page{gap:9px!important}
  .v369-ot-menu-card{padding:10px!important;gap:9px!important}
  .v369-ot-menu-head{gap:8px!important}
  .v369-ot-menu-head h3{font-size:16px!important;margin:0!important}
  .v369-ot-menu-card .v522-top-hint{display:none!important}
  .v369-ot-menu-card .v369-month-label{font-size:12px!important}
  .v369-ot-menu-card .v369-month-label input{font-size:15px!important;min-height:38px!important;padding:7px 9px!important}
  .v522-group-tabs{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
  .v522-group-btn{
    min-height:72px;
    padding:8px 5px;
    border-radius:12px;
    gap:5px;
    flex-direction:column;
    justify-content:center;
    text-align:center;
  }
  .v522-group-icon{width:30px;height:30px;flex-basis:30px;border-radius:9px}
  .v522-group-icon svg{width:19px;height:19px}
  .v522-group-copy{justify-items:center}
  .v522-group-copy b{font-size:12px;line-height:1.18}
  .v522-group-copy small{display:none}
  .v522-submenu{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:6px;
    margin-top:7px;
    padding-top:7px;
  }
  .v522-submenu-btn{
    min-height:38px!important;
    padding:7px 7px!important;
    border-radius:10px;
    font-size:12px!important;
    line-height:1.25;
  }
  .v522-submenu-chooser{padding:11px;border-radius:11px}
  .v522-submenu-chooser .v522-chooser-icon{width:34px;height:34px;flex-basis:34px}
  .v522-submenu-chooser .v522-chooser-icon svg{width:20px;height:20px}
  .v522-submenu-chooser b{font-size:13px}
  .v522-submenu-chooser small{font-size:11px}
}

@media(max-width:390px){
  .v522-group-btn{min-height:68px;padding:7px 4px}
  .v522-group-copy b{font-size:11px}
  .v522-submenu{grid-template-columns:1fr 1fr}
  .v522-submenu-btn{font-size:11.5px!important}
}


/* Original source: patch-v523-sidebar-tree-submenu.css */
/* CNMI Staff Planner V523 — Sidebar Tree Submenu */

body.v520-ui-refresh .v523-nav-tree{display:grid;gap:2px;min-width:0}
body.v520-ui-refresh .v523-nav-parent{position:relative;padding-right:34px!important}
body.v520-ui-refresh .v523-nav-parent .v523-parent-label{min-width:0;flex:1}
body.v520-ui-refresh .v523-caret{
  position:absolute;right:11px;top:50%;transform:translateY(-50%);display:grid;place-items:center;
  width:20px;height:20px;border-radius:7px;color:#718697;font-size:22px;line-height:1;transition:transform .18s ease,background .18s ease,color .18s ease
}
body.v520-ui-refresh .v523-nav-parent[aria-expanded="true"] .v523-caret{transform:translateY(-50%) rotate(90deg);color:#2f7fac;background:#e9f5fc}

body.v520-ui-refresh .v523-nav-submenu{
  display:none;overflow:hidden;
  margin:0 0 0 20px;padding:0 0 0 12px;border-left:1.5px solid #cfdeea;
}
body.v520-ui-refresh .v523-nav-submenu.open{display:grid;gap:1px;margin-top:2px;margin-bottom:4px;padding-top:2px;padding-bottom:2px}
body.v520-ui-refresh .v523-subitem{
  position:relative;display:flex;align-items:center;gap:8px;width:100%;min-height:34px;padding:7px 9px 7px 8px;
  border:0;border-radius:9px;background:transparent;color:#536b7d;text-align:left;font:inherit;font-size:12px;font-weight:700;cursor:pointer
}
body.v520-ui-refresh .v523-subitem::before{
  content:'';position:absolute;left:-13px;top:50%;width:10px;height:1.5px;background:#cfdeea
}
body.v520-ui-refresh .v523-subitem:hover{background:rgba(255,255,255,.7);color:#2d6688}
body.v520-ui-refresh .v523-subitem.active{background:#fff;color:#1f678f;box-shadow:0 2px 8px rgba(41,94,127,.06)}
body.v520-ui-refresh .v523-subitem.active::before{background:#69b9e5}
body.v520-ui-refresh .v523-branch-icon{display:grid;place-items:center;width:17px;height:17px;flex:0 0 17px;color:#6d9fbe}
body.v520-ui-refresh .v523-branch-icon svg{width:15px;height:15px}
body.v520-ui-refresh .v523-subitem.active .v523-branch-icon{color:#2e8bc0}

/* Once sidebar owns OT navigation, keep only the shared month control on the page. */
body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v522-group-tabs,
body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v522-submenu,
body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v522-submenu-chooser{display:none!important}
body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v369-ot-menu-card.v523-month-only-card{padding:11px 13px!important;margin-bottom:10px;box-shadow:none}
body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v369-ot-menu-card .v369-ot-menu-head{display:block!important;margin:0!important}
body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v369-ot-menu-head>div:first-child{display:none!important}
body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v369-month-label{display:grid!important;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:10px;width:100%;max-width:460px;margin:0;font-size:12px;color:#647b8c}
body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v369-month-label input{min-height:38px}
body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v369-ot-content{margin-top:0!important}
body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v369-ot-content>.card:first-child{margin-top:0}

/* Hide V522's page-level grouping even if it momentarily renders before V523 decorates the page. */
body.v520-ui-refresh[data-cnmi-route="ot"] .v522-group-tabs,
body.v520-ui-refresh[data-cnmi-route="ot"] .v522-submenu{display:none!important}

@media(max-width:820px){
  body.v520-ui-refresh .v523-nav-tree{gap:1px}
  body.v520-ui-refresh .v523-nav-parent{min-height:36px!important;padding-right:32px!important}
  body.v520-ui-refresh .v523-nav-submenu{margin-left:18px;padding-left:12px}
  body.v520-ui-refresh .v523-subitem{min-height:35px;padding:7px 8px;font-size:12px;border-radius:8px}
  body.v520-ui-refresh .v523-branch-icon{width:16px;height:16px;flex-basis:16px}
  body.v520-ui-refresh .v523-branch-icon svg{width:14px;height:14px}
  body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v369-ot-menu-card.v523-month-only-card{padding:9px 10px!important;margin-bottom:8px}
  body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v369-month-label{grid-template-columns:1fr;gap:4px;max-width:none;font-size:11px}
  body.v520-ui-refresh .v369-ot-page.v523-sidebar-driven .v369-month-label input{width:100%;min-height:38px}
}

@media(min-width:821px){
  /* Keep tree readable when desktop sidebar is manually collapsed. */
  body.cnmi-sidebar-hidden .v523-nav-submenu,
  .sidebar.collapsed .v523-nav-submenu{display:none!important}
  .sidebar.collapsed .v523-caret{display:none}
}


/* Original source: patch-v524-unified-sidebar-tree-navigation.css */
/* CNMI Staff Planner V524 — Unified Sidebar Tree Navigation */

body.v520-ui-refresh .v524-nav-tree{display:grid;gap:2px;min-width:0}
body.v520-ui-refresh .v524-nav-parent{position:relative;padding-right:34px!important}
body.v520-ui-refresh .v524-parent-label{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.v520-ui-refresh .v524-caret{
  position:absolute;right:11px;top:50%;transform:translateY(-50%);display:grid;place-items:center;
  width:20px;height:20px;border-radius:7px;color:#718697;font-size:22px;line-height:1;
  transition:transform .18s ease,background .18s ease,color .18s ease
}
body.v520-ui-refresh .v524-nav-parent[aria-expanded="true"] .v524-caret{transform:translateY(-50%) rotate(90deg);color:#2f7fac;background:#e9f5fc}

body.v520-ui-refresh .v524-nav-submenu{
  display:none;overflow:hidden;margin:0 0 0 20px;padding:0 0 0 12px;border-left:1.5px solid #cfdeea
}
body.v520-ui-refresh .v524-nav-submenu.open{display:grid;gap:1px;margin-top:2px;margin-bottom:4px;padding-top:2px;padding-bottom:2px}
body.v520-ui-refresh .v524-subitem{
  position:relative;display:flex;align-items:center;gap:8px;width:100%;min-height:34px;padding:7px 9px 7px 8px;
  border:0;border-radius:9px;background:transparent;color:#536b7d;text-align:left;font:inherit;font-size:12px;font-weight:700;cursor:pointer
}
body.v520-ui-refresh .v524-subitem::before{content:'';position:absolute;left:-13px;top:50%;width:10px;height:1.5px;background:#cfdeea}
body.v520-ui-refresh .v524-subitem:hover{background:rgba(255,255,255,.72);color:#2d6688}
body.v520-ui-refresh .v524-subitem.active{background:#fff;color:#1f678f;box-shadow:0 2px 8px rgba(41,94,127,.06)}
body.v520-ui-refresh .v524-subitem.active::before{background:#69b9e5}
body.v520-ui-refresh .v524-branch-icon{display:grid;place-items:center;width:17px;height:17px;flex:0 0 17px;color:#6d9fbe}
body.v520-ui-refresh .v524-branch-icon svg{width:15px;height:15px}
body.v520-ui-refresh .v524-subitem.active .v524-branch-icon{color:#2e8bc0}

/* Screens that used to show separate tasks side-by-side now expose one task at a time. */
body.v520-ui-refresh .v524-panel-hidden{display:none!important}
body.v520-ui-refresh .v524-single-view-layout{grid-template-columns:minmax(0,1fr)!important;gap:0!important;align-items:start}
body.v520-ui-refresh .v524-leave-form-panel,
body.v520-ui-refresh .v524-activity-create-panel{width:100%;max-width:980px}
body.v520-ui-refresh .v524-leave-history-panel,
body.v520-ui-refresh .v524-activity-search-panel{width:100%;max-width:1180px}
body.v520-ui-refresh .v524-intern-grid{grid-template-columns:minmax(0,1fr)!important;gap:0!important}
body.v520-ui-refresh .v524-grid-hidden{display:none!important}
body.v520-ui-refresh .v524-intern-single-view [data-v524-intern-panel]{width:100%;max-width:1120px}

/* Remove the feeling of an empty second desktop column on converted pages. */
body.v520-ui-refresh[data-cnmi-route="activities"] .v524-activity-layout,
body.v520-ui-refresh[data-cnmi-route="leave"] .v524-leave-layout{max-width:1220px}

@media(max-width:820px){
  body.v520-ui-refresh .v524-nav-tree{gap:1px}
  body.v520-ui-refresh .v524-nav-parent{min-height:36px!important;padding-right:32px!important}
  body.v520-ui-refresh .v524-nav-submenu{margin-left:18px;padding-left:12px}
  body.v520-ui-refresh .v524-subitem{min-height:35px;padding:7px 8px;font-size:12px;border-radius:8px}
  body.v520-ui-refresh .v524-branch-icon{width:16px;height:16px;flex-basis:16px}
  body.v520-ui-refresh .v524-branch-icon svg{width:14px;height:14px}
  body.v520-ui-refresh .v524-leave-form-panel,
  body.v520-ui-refresh .v524-leave-history-panel,
  body.v520-ui-refresh .v524-activity-create-panel,
  body.v520-ui-refresh .v524-activity-search-panel,
  body.v520-ui-refresh .v524-intern-single-view [data-v524-intern-panel]{max-width:none}
}

@media(min-width:821px){
  body.cnmi-sidebar-hidden .v524-nav-submenu,
  .sidebar.collapsed .v524-nav-submenu{display:none!important}
  .sidebar.collapsed .v524-caret{display:none}
}

/* Additional converted task pages */
body.v520-ui-refresh .v524-profile-main-panel{width:100%;max-width:980px}
body.v520-ui-refresh .v524-profile-requests-panel{width:100%;max-width:1100px}
body.v520-ui-refresh .users-page-v49.v524-users-layout.v524-single-view-layout{grid-template-columns:minmax(0,1fr)!important}
body.v520-ui-refresh .users-page-v49.v524-users-layout:has(.v479-new-user-panel:not(.v524-panel-hidden)){
  grid-template-columns:minmax(0,1fr)!important
}
body.v520-ui-refresh .users-page-v49.v524-users-layout .v479-new-user-panel:not(.v524-panel-hidden){grid-column:1/-1!important;max-width:1180px;width:100%}
body.v520-ui-refresh .v524-physician-single-view .v452-form-grid{grid-template-columns:minmax(0,1fr)!important}
body.v520-ui-refresh .v524-physician-single-view #v452DaytimeForm,
body.v520-ui-refresh .v524-physician-single-view #v452OncallForm,
body.v520-ui-refresh .v524-physician-single-view #v452OverrideForm,
body.v520-ui-refresh .v524-physician-single-view > .card:not(.v452-intro){max-width:1120px;width:100%}
body.v520-ui-refresh .v524-physician-intro{padding:10px 12px!important}
body.v520-ui-refresh .v524-physician-intro .hint{margin-bottom:0}

@media(max-width:820px){
  body.v520-ui-refresh .v524-profile-main-panel,
  body.v520-ui-refresh .v524-profile-requests-panel,
  body.v520-ui-refresh .users-page-v49.v524-users-layout .v479-new-user-panel:not(.v524-panel-hidden),
  body.v520-ui-refresh .v524-physician-single-view #v452DaytimeForm,
  body.v520-ui-refresh .v524-physician-single-view #v452OncallForm,
  body.v520-ui-refresh .v524-physician-single-view #v452OverrideForm,
  body.v520-ui-refresh .v524-physician-single-view > .card:not(.v452-intro){max-width:none}
  body.v520-ui-refresh .v524-physician-intro .section-title span,
  body.v520-ui-refresh .v524-physician-intro .hint{display:none}
}


/* Original source: patch-v525-ot-payday-tracker.css */
/* CNMI Staff Planner V525 — OT payday tracker */
.v525-payday-panel{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:0 0 14px;padding:13px 14px;border:1px solid #bfe0f0;border-radius:14px;background:#f2f9fd;box-shadow:none}
.v525-payday-loading,.v525-payday-main{display:flex;align-items:center;gap:12px;min-width:0}
.v525-payday-icon{display:grid;place-items:center;flex:0 0 42px;width:42px;height:42px;border-radius:12px;background:#dff1fb;color:#2e81ad}
.v525-payday-icon svg{width:23px;height:23px}
.v525-payday-copy{display:flex;flex-direction:column;gap:2px;min-width:0;color:#5d7486}
.v525-payday-copy .v525-eyebrow{font-size:11px;font-weight:700;color:#6f8798}
.v525-payday-copy strong{font-size:18px;line-height:1.25;color:#173f58}
.v525-payday-copy>span:last-child{font-size:12px}
.v525-payday-copy>span:last-child b{color:#2d759d}
.v525-payday-admin{display:flex;align-items:end;gap:8px;flex:0 0 auto}
.v525-payday-admin label{display:flex;flex-direction:column;gap:4px;font-size:11px;color:#6e8291}
.v525-payday-admin input[type="date"]{min-width:155px!important;min-height:38px!important;padding:7px 9px!important}
.v525-payday-admin button{min-height:38px!important;white-space:nowrap}
.v525-payday-main.is-warning .v525-payday-icon{background:#fff1dc;color:#a86a16}
@media(max-width:820px){
  .v525-payday-panel{align-items:stretch;flex-direction:column;gap:10px;margin-bottom:10px;padding:11px 12px}
  .v525-payday-icon{width:38px;height:38px;flex-basis:38px;border-radius:11px}
  .v525-payday-icon svg{width:21px;height:21px}
  .v525-payday-copy strong{font-size:16px}
  .v525-payday-admin{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;width:100%}
  .v525-payday-admin label{min-width:0}
  .v525-payday-admin input[type="date"]{width:100%!important;min-width:0!important}
}
@media(max-width:460px){
  .v525-payday-panel{border-radius:12px;padding:10px}
  .v525-payday-copy strong{font-size:15px}
  .v525-payday-copy>span:last-child{font-size:11px}
  .v525-payday-admin{grid-template-columns:1fr}
  .v525-payday-admin button{width:100%}
}


/* Original source: patch-v527-ot-adjustment-ledger.css */
/* V527 OT Adjustment Ledger */
.v527-mode-card{grid-column:1/-1!important;padding:10px 12px!important}.v527-mode-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.v527-mode-btn{min-height:44px;border:1px solid #d5e3ed;border-radius:12px;background:#fff;color:#29485e;font-weight:800;padding:9px 12px;cursor:pointer}.v527-mode-btn.active{background:#eaf6fd;border-color:#69bcea;color:#155b83}.v527-mode-note{margin:8px 2px 0;color:#75889a;font-size:12px}.v527-hidden{display:none!important}
.v527-adjustment-card,.v527-activity-card,.v527-summary-card{grid-column:1/-1!important}.v527-form{display:grid;gap:10px}.v527-adjust-preview{border:1px dashed #bdd9e9;background:#f5fbff;border-radius:11px;padding:9px 11px;color:#4d6577}.v527-ledger-slot{margin-top:14px}.v527-ledger-summary{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0 10px}.v527-ledger-summary span{background:#f4f8fb;border:1px solid #dbe6ed;border-radius:999px;padding:6px 9px;font-size:12px}.v527-positive{color:#147a49}.v527-negative{color:#b64250}.v527-ledger-table small{font-size:10px}
.v527-participant-heading{margin:5px 0 0}.v527-participant-tools{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:7px;align-items:center}.v527-participant-count{font-size:12px;color:#6c8293}.v527-participant-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;max-height:300px;overflow:auto;padding:2px}.v527-person{display:flex!important;align-items:flex-start!important;gap:8px;border:1px solid #dbe6ed;border-radius:11px;padding:8px!important;background:#fff;min-width:0}.v527-person>input{width:18px!important;height:18px!important;flex:0 0 18px!important;margin:1px 0 0!important}.v527-person-main{min-width:0;display:grid;gap:4px}.v527-person-main b{font-size:13px}.v527-person-main small{display:flex;gap:4px;flex-wrap:wrap;font-size:10px}.v527-status-chip{background:#eef6fb;border-radius:999px;padding:2px 5px;color:#547184}.v527-filtered{display:none!important}.v527-activity-save{margin-top:4px}
@media(max-width:900px){.v527-participant-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:680px){.v527-mode-tabs{grid-template-columns:1fr}.v527-mode-btn{text-align:left;min-height:38px}.v527-participant-tools{grid-template-columns:1fr 1fr}.v527-participant-tools input{grid-column:1/-1}.v527-participant-grid{grid-template-columns:repeat(2,minmax(0,1fr));max-height:260px}.v527-ledger-table{min-width:760px}}


/* Original source: patch-v528-ot-sidebar-subtree-leave-status.css */
/* CNMI Staff Planner V528 — OT Sidebar Subtree + Leave Status */
body.v520-ui-refresh .v527-mode-card.v528-hidden-mode-tabs{display:none!important}

body.v520-ui-refresh .v528-extra-tree{display:grid;gap:1px;min-width:0}
body.v520-ui-refresh .v528-extra-parent{padding-right:28px!important}
body.v520-ui-refresh .v528-extra-parent-label{min-width:0;flex:1}
body.v520-ui-refresh .v528-extra-caret{position:absolute;right:7px;top:50%;transform:translateY(-50%);font-size:18px;color:#7c91a1;transition:transform .16s ease}
body.v520-ui-refresh .v528-extra-parent[aria-expanded="true"] .v528-extra-caret{transform:translateY(-50%) rotate(90deg);color:#2f84b2}
body.v520-ui-refresh .v528-extra-parent.active-parent{color:#1e688f}

body.v520-ui-refresh .v528-extra-submenu{display:none;margin:1px 0 3px 19px;padding-left:11px;border-left:1.5px solid #d7e4ed}
body.v520-ui-refresh .v528-extra-submenu.open{display:grid;gap:1px}
body.v520-ui-refresh .v528-extra-item{position:relative;display:flex;align-items:center;gap:7px;width:100%;min-height:32px;padding:6px 8px;border:0;border-radius:8px;background:transparent;color:#667d8e;text-align:left;font:inherit;font-size:11px;font-weight:700;cursor:pointer}
body.v520-ui-refresh .v528-extra-item::before{content:'';position:absolute;left:-12px;top:50%;width:9px;height:1.5px;background:#d7e4ed}
body.v520-ui-refresh .v528-extra-item:hover{background:rgba(255,255,255,.72);color:#2e6d91}
body.v520-ui-refresh .v528-extra-item.active{background:#fff;color:#17678f;box-shadow:0 2px 7px rgba(41,94,127,.06)}
body.v520-ui-refresh .v528-extra-item.active::before{background:#65b9e7}
body.v520-ui-refresh .v528-extra-icon{display:grid;place-items:center;width:15px;height:15px;flex:0 0 15px;color:#78a7c2}
body.v520-ui-refresh .v528-extra-icon svg{width:14px;height:14px}
body.v520-ui-refresh .v528-extra-item.active .v528-extra-icon{color:#2d8abd}

body.v520-ui-refresh .v528-leave-chip{background:#fff0f3!important;color:#a94a61!important;border:1px solid #f3ced8!important}
body.v520-ui-refresh .v527-person-main small{align-items:center}

@media(max-width:820px){
  body.v520-ui-refresh .v528-extra-submenu{margin-left:17px;padding-left:10px}
  body.v520-ui-refresh .v528-extra-item{min-height:33px;padding:6px 7px;font-size:11px}
  body.v520-ui-refresh .v528-extra-parent{min-height:34px!important}
}
@media(min-width:821px){
  body.cnmi-sidebar-hidden .v528-extra-submenu,.sidebar.collapsed .v528-extra-submenu{display:none!important}
}


/* Original source: patch-v529-ot-adjustment-visibility.css */
/* V529 OT adjustment visibility */
.v529-adjust-card{grid-column:1/-1;border:1px solid #d9e7ef;background:#fff}.v529-summary-chips{display:flex;flex-wrap:wrap;gap:7px;margin:0 0 10px}.v529-summary-chips>span{display:inline-flex;align-items:center;gap:5px;border:1px solid #dfe9f0;border-radius:999px;padding:6px 9px;background:#f8fbfd;font-size:12px}.v529-plus{color:#08784e}.v529-minus{color:#c43d4f}.v529-table{width:100%;border-collapse:collapse;font-size:13px}.v529-table th,.v529-table td{padding:9px 10px;border-bottom:1px solid #edf2f5;text-align:left;vertical-align:top}.v529-table th{background:#f7fafc;color:#536b7e;font-size:11px}.v529-table td small{display:block;margin-top:3px;color:#7c8e9e;line-height:1.3}.v529-status{display:inline-flex;border-radius:999px;padding:4px 8px;font-size:11px;font-weight:800;white-space:nowrap}.v529-status.pending{background:#fff1d9;color:#a36300}.v529-status.exported{background:#e4f7ec;color:#19724d}.v529-empty{padding:12px!important}.v529-staff-visible{border-color:#cfe5f2!important}
@media(max-width:720px){.v529-summary-chips{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.v529-summary-chips>span{justify-content:space-between}.v529-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}.v529-table{min-width:640px}.v529-adjust-card{padding:10px!important}.v529-adjust-card .section-title h3{font-size:15px}.v529-adjust-card .section-title .hint{font-size:11px}}


/* Original source: patch-v533-hr-pdf-reconciliation.css */
/* CNMI Staff Planner V533 — HR PDF reconciliation */
.v533-claim-preview{border-color:#cfe3f1;background:#fbfdff}.v533-preview-table td small,.v533-pdf-table td small{display:block;color:#718298;margin-top:3px}.v533-pos{color:#087c4d}.v533-neg{color:#bd3546!important}.v533-ok{color:#087c4d!important}.v533-warn{color:#9a6500!important}.v533-locked-own{margin-top:12px;border:1px solid #bfe2cd;background:#f2fbf5;border-radius:12px;padding:12px;display:flex;align-items:center;gap:12px;flex-wrap:wrap}.v533-locked-own>div:first-child{display:flex;flex-direction:column;gap:3px}.v533-locked-own b{font-size:17px}.v533-history-warning{background:#fff5e9;border:1px solid #f0d7b5;border-radius:9px;padding:7px 10px;color:#8a5600}.v533-pdf-review-root{display:grid;gap:12px}.v533-pdf-head{margin-top:4px}.v533-pdf-batch{padding:0;overflow:hidden}.v533-pdf-batch>summary{cursor:pointer;list-style:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;background:#fff}.v533-pdf-batch>summary::-webkit-details-marker{display:none}.v533-pdf-batch>summary span:first-child{display:flex;flex-direction:column;gap:3px}.v533-pdf-batch>summary small{color:#75879a;font-weight:400}.v533-pdf-body{border-top:1px solid #e3edf5;padding:16px;display:grid;gap:14px}.v533-file-row{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.v533-file-label{display:inline-flex;align-items:center;gap:8px;border:1px dashed #bdd7e8;border-radius:10px;padding:8px 10px;background:#f8fcff}.v533-file-label input{max-width:280px}.v533-review-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.v533-review-actions span{font-size:12px;color:#718298}.v533-pdf-table input{min-width:130px}.v533-extra-box{border:1px solid #dbe8f1;border-radius:12px;padding:12px;background:#fcfeff}.v533-extra-row{display:grid;grid-template-columns:minmax(180px,1fr) 180px auto;gap:8px;margin-top:8px}.v533-reconcile-summary{display:flex;gap:8px;flex-wrap:wrap}.v533-reconcile-summary>span{border:1px solid #dbe8f1;background:#f8fbfd;border-radius:999px;padding:6px 9px;font-size:12px}.v533-review-meta{grid-template-columns:minmax(220px,.6fr) minmax(260px,1.4fr)}.v533-pdf-batch .success{background:#20a66a;border-color:#20a66a;color:#fff}.v533-pdf-batch .badge.red{background:#feecee;color:#b62e3f}.v533-preview-wrap{margin-top:4px}
@media(max-width:760px){.v533-preview-table,.v533-pdf-table{min-width:720px}.v533-file-row{align-items:stretch}.v533-file-label{width:100%;justify-content:space-between}.v533-file-label input{max-width:58%}.v533-extra-row{grid-template-columns:1fr 130px auto}.v533-review-meta{grid-template-columns:1fr}.v533-pdf-body{padding:12px}.v533-pdf-batch>summary{padding:12px}}


/* Original source: patch-v534-manual-hr-pdf-check.css */
/* CNMI Staff Planner V534 — Simple HR claim + manual PDF check */
.v534-simple-claim{grid-column:1/-1;border:1px solid #d8e7f2!important;background:#fff!important}
.v534-simple-claim .section-title{margin-bottom:12px}
.v534-simple-claim .section-title h3{margin:0;color:#173650}
.v534-my-claim-grid{display:grid;grid-template-columns:1fr 1fr 1.45fr 1fr;gap:10px;align-items:stretch}
.v534-mini,.v534-primary{border:1px solid #dbe8f2;border-radius:14px;padding:14px 16px;background:#f9fcfe;display:flex;flex-direction:column;gap:4px;min-width:0}
.v534-mini>span,.v534-primary>span{font-size:12px;color:#6b8193;font-weight:700}
.v534-mini>b{font-size:18px;color:#203b51}.v534-mini small{color:#6b8193}
.v534-primary{background:#eaf7ef;border-color:#bfe3ca;justify-content:center}
.v534-primary>b{font-size:21px;color:#17653b}.v534-primary>strong{font-size:26px;color:#123e2a;line-height:1.1}
.v534-pos{color:#117a45!important}.v534-neg{color:#bd3040!important}.v534-ok{color:#117a45!important}
.v534-locked{margin-top:10px;border:1px solid #bfe3ca;background:#f3fbf5;border-radius:12px;padding:10px 12px;display:flex;gap:8px 14px;align-items:center;flex-wrap:wrap}.v534-locked b{color:#17653b}.v534-locked small{width:100%;color:#6a7c89}
.v534-calc-detail,.v534-legacy-details,.v534-optional-details{margin-top:10px;border:1px solid #dfeaf2;border-radius:12px;background:#fbfdff}
.v534-calc-detail summary,.v534-legacy-details>summary,.v534-optional-details>summary{cursor:pointer;padding:11px 13px;font-weight:700;color:#42627b;list-style:none}.v534-calc-detail summary::-webkit-details-marker,.v534-legacy-details>summary::-webkit-details-marker,.v534-optional-details>summary::-webkit-details-marker{display:none}
.v534-calc-detail>div{padding:0 13px 12px;color:#6b8193;font-size:13px}
.v534-simple-staff-summary{display:block!important}.v534-simple-staff-summary>#v534SimpleClaimCard{margin-bottom:12px}.v534-legacy-details{grid-column:1/-1;background:#fff}.v534-legacy-body{padding:0 10px 10px}.v534-legacy-body>.card{margin:0!important}
.v534-admin-claim-wrap{overflow:auto}.v534-admin-claim{width:100%;border-collapse:collapse;min-width:760px}.v534-admin-claim th,.v534-admin-claim td{padding:10px 12px;border-bottom:1px solid #e7eef4;text-align:left;vertical-align:middle}.v534-admin-claim th{font-size:12px;color:#6b8193;background:#f6fafc}.v534-admin-claim td small{display:block;font-size:11px;margin-top:2px;color:inherit}
#v533PdfReviewCard .v533-pdf-head h3{margin-bottom:3px}#v533PdfReviewCard .v533-pdf-head .hint{max-width:900px}
#v533PdfReviewCard .v533-file-row{background:#f8fbfd;border:1px dashed #d2e1ec;border-radius:12px;padding:10px 12px}
#v533PdfReviewCard .soft-notice{font-size:13px}
#v533PdfReviewCard .v533-pdf-table th,#v533PdfReviewCard .v533-pdf-table td{vertical-align:middle}
#v533PdfReviewCard [data-v533-pdf-amount]{max-width:150px}
.v534-match-btn{white-space:nowrap}.v534-row-result{display:inline-block;margin-left:7px;font-size:12px;font-weight:700;white-space:nowrap}.v534-row-result.is-pending{color:#8b98a3}.v534-row-result.is-ok{color:#11824b}.v534-row-result.is-bad{color:#c13243}.v534-row-result.is-warn{color:#a16400}
.v534-manual-summary{margin-top:12px;padding:11px 13px;border-radius:12px;background:#f5f9fc;border:1px solid #dce8f1;display:flex;gap:10px 18px;flex-wrap:wrap;color:#536b7e}.v534-manual-summary span{white-space:nowrap}
.v534-optional-details{margin:12px 0}.v534-optional-details>.v533-extra-box,.v534-optional-details>.v533-review-meta{margin:0!important;padding:0 12px 12px}
#v533PdfReviewCard .actions [data-v534-confirm-review]:disabled{opacity:.48;cursor:not-allowed}
@media(max-width:900px){.v534-my-claim-grid{grid-template-columns:1fr 1fr}.v534-primary{grid-column:1/-1;order:-1}.v534-admin-claim{min-width:680px}}
@media(max-width:560px){.v534-my-claim-grid{grid-template-columns:1fr}.v534-primary{grid-column:auto}.v534-primary>strong{font-size:24px}.v534-mini,.v534-primary{padding:12px 13px}#v533PdfReviewCard .v533-pdf-table{min-width:720px}.v534-manual-summary{display:grid;grid-template-columns:1fr 1fr}.v534-legacy-details>summary{font-size:14px}}


/* Original source: patch-v569-centered-feedback.css */
/* Keep short acknowledge/confirm dialogs centered on narrow screens too. */
.modal.modal-sm {
  position: fixed !important;
  inset: 0 !important;
  display: grid;
  place-items: center !important;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)) !important;
}
.modal.modal-sm.hidden { display: none !important; }
.modal.modal-sm .modal-card {
  margin: auto !important;
  width: min(500px, 100%) !important;
  max-height: min(82vh, 82dvh) !important;
  overflow-y: auto;
  border-radius: 20px !important;
}
.cnmi-alert-backdrop-v569 {
  position: fixed;
  inset: 0;
  z-index: 2147483010;
  display: grid;
  place-items: center;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background: rgba(17, 30, 43, .48);
}
.cnmi-alert-card-v569 {
  box-sizing: border-box;
  width: min(500px, 100%);
  max-height: min(82vh, 82dvh);
  overflow-y: auto;
  padding: 26px 24px 22px;
  border-radius: 20px;
  background: #fff;
  color: #17344f;
  box-shadow: 0 18px 46px rgba(23, 48, 67, .22);
  text-align: center;
}
.cnmi-alert-card-v569 h2 { margin: 0 0 12px; font-size: 22px; }
.cnmi-alert-card-v569 p { margin: 0 0 20px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.cnmi-alert-card-v569 button { min-width: 130px; min-height: 44px; }
@media (prefers-reduced-motion: reduce) {
  .cnmi-alert-card-v569 { animation: none; }
}


/* V570 Admin temporary password reset */
[data-reset-user-email],[data-reset-default-password-staff]{display:none!important}
.v570-password-btn{white-space:nowrap}
.v570-reset-box{display:grid;gap:12px}
.v570-reset-box h2{margin:0}
.v570-reset-note{margin:0;padding:10px 12px;border-radius:12px;background:#f5f9ff;color:#36506b;font-size:.92rem;line-height:1.55}
.v570-password-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:stretch;margin-top:6px}
.v570-password-row input{min-width:0;width:100%}
.v570-password-row .v570-eye{min-width:64px}
@media(max-width:640px){.v570-password-row{grid-template-columns:minmax(0,1fr) 58px}.v570-reset-box .confirm-actions{display:grid;grid-template-columns:1fr 1fr}}


/* V573 — Admin temp-password modal readability */
.modal-v573-password .modal-card{width:min(720px,calc(100vw - 32px));max-width:720px;padding:28px 30px 24px}
.modal-v573-password .v573-reset-box{gap:16px}
.modal-v573-password .v573-reset-box h2{font-size:1.45rem;line-height:1.25;padding-right:38px}
.modal-v573-password .v570-reset-note{font-size:.98rem;line-height:1.65;padding:14px 16px;background:#f3f8ff;border:1px solid #dceafa}
.modal-v573-password .v573-password-form{display:grid;grid-template-columns:1fr;gap:16px;margin-top:2px}
.modal-v573-password .v573-password-form>label{display:block;font-weight:700;color:#19324d;min-width:0}
.modal-v573-password .v570-password-row{display:grid;grid-template-columns:minmax(0,1fr) 72px;gap:10px;align-items:stretch;margin-top:8px}
.modal-v573-password .v570-password-row input{height:44px;font-size:1rem;padding:0 13px;border-radius:10px}
.modal-v573-password .v570-password-row .v570-eye{min-width:72px;height:44px;padding:0 10px}
.modal-v573-password .confirm-actions{display:grid;grid-template-columns:1fr 1.35fr;gap:12px;margin-top:2px}
.modal-v573-password .confirm-actions button{min-height:44px;white-space:normal;line-height:1.25}
.modal-v573-password .v573-audit-hint{margin:0;padding-top:2px;line-height:1.5}
@media(max-width:640px){
  .modal-v573-password .modal-card{width:calc(100vw - 20px);padding:22px 18px 20px}
  .modal-v573-password .v573-reset-box h2{font-size:1.25rem}
  .modal-v573-password .v570-password-row{grid-template-columns:minmax(0,1fr) 62px;gap:8px}
  .modal-v573-password .v570-password-row .v570-eye{min-width:62px}
  .modal-v573-password .confirm-actions{grid-template-columns:1fr}
}
