﻿/*
  File: styles-part-15-calendar-core.css
  Purpose: Calendar dashboard layout, right-panel, source filters, cards, and view-mode styles.
  Loaded before app-core to preserve the original cascade position from styles-part-00.
*/

/* Calendar Dashboard */
.calendar-dashboard-mode .library-panel {
  width: 100%;
  min-height: 0;
}

.calendar-dashboard-mode .data-grid-shell,
.calendar-dashboard-mode .data-grid-scroll {
  min-height: 0;
  height: 100%;
}

/* Calendar schedule scroll contract: the Mantine year view is taller than the app shell. */
.content-grid.calendar-dashboard-mode,
.content-grid.calendar-dashboard-mode .library-panel,
.content-grid.calendar-dashboard-mode .data-grid-shell,
.content-grid.calendar-dashboard-mode .data-grid-scroll,
.content-grid.calendar-dashboard-mode #itemList {
  min-height: 0 !important;
}

.content-grid.calendar-dashboard-mode .library-panel {
  overflow: hidden !important;
}

.content-grid.calendar-dashboard-mode .data-grid-shell {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) !important;
  overflow: hidden !important;
}

.content-grid.calendar-dashboard-mode .data-grid-scroll {
  height: 100% !important;
  max-height: 100% !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  scrollbar-gutter: stable both-edges !important;
}

.content-grid.calendar-dashboard-mode #itemList {
  min-width: 0 !important;
  min-height: max-content !important;
}

.calendar-dashboard-mode .data-grid-toolbar,
.calendar-dashboard-mode .data-grid-scroll > .table-header,
.calendar-dashboard-mode .data-grid-scroll > .column-filter-row {
  display: none !important;
}

.calendar-dashboard-shell {
  --calendar-shadcn-background: #ffffff;
  --calendar-shadcn-foreground: #020617;
  --calendar-shadcn-border: #e2e8f0;
  --calendar-shadcn-muted: #64748b;
  --calendar-shadcn-accent: #f1f5f9;
  --calendar-shadcn-accent-foreground: #0f172a;
  --calendar-shadcn-primary: #020617;
  --calendar-shadcn-primary-foreground: #f8fafc;
  width: 100%;
  min-width: 0;
  padding: 16px;
  color: var(--text, #172033);
  background: var(--calendar-shadcn-background);
  border-radius: 14px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine {
  padding: 0;
  min-height: 100%;
}

/* Calendar AppDataGrid-style page mode: flatten the legacy table shell so
   Calendar owns the visible sections instead of nesting card shells. */
.app-shell .content-grid.calendar-dashboard-mode.calendar-appdatagrid-page-mode,
body[class$="-theme"] .app-shell .content-grid.calendar-dashboard-mode.calendar-appdatagrid-page-mode {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 0 !important;
  min-width: 0 !important;
  grid-template-columns: minmax(0, 1fr) !important;
  overflow: visible !important;
}

.app-shell
  .content-grid.calendar-dashboard-mode.calendar-appdatagrid-page-mode
  > .library-panel.calendar-appdatagrid-page-mode,
body[class$="-theme"]
  .app-shell
  .content-grid.calendar-dashboard-mode.calendar-appdatagrid-page-mode
  > .library-panel.calendar-appdatagrid-page-mode {
  display: block !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  min-width: 0 !important;
  overflow: visible !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"]),
body[class$="-theme"]
  .library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"]) {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  grid-template-rows: none !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 12px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  > .data-grid-toolbar,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  > .scroll-hint,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  > .document-table-pager-footer,
body[class$="-theme"]
  .library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  > .data-grid-toolbar,
body[class$="-theme"]
  .library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  > .scroll-hint,
body[class$="-theme"]
  .library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  > .document-table-pager-footer {
  display: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  > .data-grid-scroll[data-platform-grid-surface="table"],
body[class$="-theme"]
  .library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  > .data-grid-scroll[data-platform-grid-surface="table"] {
  display: block !important;
  grid-row: auto !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  > .data-grid-scroll[data-platform-grid-surface="table"]
  > .item-list,
body[class$="-theme"]
  .library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode)
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  > .data-grid-scroll[data-platform-grid-surface="table"]
  > .item-list {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: visible !important;
}

.data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  .calendar-dashboard-shell,
body[class$="-theme"]
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  .calendar-dashboard-shell {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  min-height: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  .calendar-dashboard-shell.calendar-dashboard-shell-mantine {
  min-height: 0 !important;
}

.calendar-mantine-schedule-root {
  width: 100%;
  min-height: 640px;
  min-width: 0;
}

.paperdesk-mantine-schedule {
  color: var(--calendar-shadcn-foreground);
  font-family: var(--font-sans, "Inter Variable", Inter, ui-sans-serif, system-ui, sans-serif);
  --month-view-max-events: 5;
}

.calendar-mantine-schedule-fallback {
  display: grid;
  place-items: center;
  min-height: 360px;
  gap: 6px;
  color: var(--calendar-shadcn-muted);
  text-align: center;
}

.calendar-mantine-schedule-fallback strong {
  color: var(--calendar-shadcn-foreground);
  font-size: 15px;
}

body.theme-dark .calendar-dashboard-shell,
body[data-theme="dark"] .calendar-dashboard-shell {
  --calendar-shadcn-background: #020617;
  --calendar-shadcn-foreground: #f8fafc;
  --calendar-shadcn-border: #1f2937;
  --calendar-shadcn-muted: #94a3b8;
  --calendar-shadcn-accent: #1e293b;
  --calendar-shadcn-accent-foreground: #f8fafc;
  --calendar-shadcn-primary: #f8fafc;
  --calendar-shadcn-primary-foreground: #020617;
  color: #e8eef8;
  background: var(--calendar-shadcn-background);
}

/* MUI-inspired time-off planner surface for the Calendar menu. */
.calendar-timeoff-panel {
  --calendar-timeoff-left-width: 220px;
  --calendar-timeoff-day-width: 54px;
  --calendar-timeoff-row-height: 58px;
  --calendar-timeoff-row-items: 1;
  --calendar-timeoff-event-margin: 10px 4px;
  --calendar-timeoff-event-font-size: 10px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--calendar-timeoff-grid-line, var(--calendar-shadcn-border));
  border-radius: 16px;
  background: var(--calendar-timeoff-panel-bg, var(--calendar-shadcn-background));
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.calendar-timeoff-panel[data-calendar-timeoff-density="mini"] {
  --calendar-timeoff-left-width: 220px;
  --calendar-timeoff-day-width: 54px;
  --calendar-timeoff-row-height: 58px;
  --calendar-timeoff-event-margin: 10px 4px;
  --calendar-timeoff-event-font-size: 10px;
}

.calendar-timeoff-panel[data-calendar-timeoff-density="hybrid"] {
  --calendar-timeoff-left-width: 220px;
  --calendar-timeoff-day-width: 122px;
  --calendar-timeoff-row-height: 50px;
  --calendar-timeoff-event-margin: 8px 10px;
  --calendar-timeoff-event-font-size: 12px;
}

.calendar-timeoff-panel[data-calendar-timeoff-density="full"] {
  --calendar-timeoff-left-width: 220px;
  --calendar-timeoff-day-width: 148px;
  --calendar-timeoff-row-height: 82px;
  --calendar-timeoff-event-margin: 6px 10px;
  --calendar-timeoff-event-font-size: 11.5px;
}

.calendar-timeoff-header,
.calendar-timeoff-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--calendar-timeoff-grid-line, var(--calendar-shadcn-border));
  background: var(--calendar-timeoff-header-bg, #ffffff);
}

.calendar-timeoff-header h3 {
  margin: 0;
  color: var(--calendar-timeoff-header-text, var(--calendar-shadcn-foreground));
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

.calendar-timeoff-header p {
  margin: 3px 0 0;
  color: var(--calendar-shadcn-muted);
  font-size: 12px;
}

.calendar-timeoff-density {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--calendar-timeoff-grid-line, var(--calendar-shadcn-border));
  border-radius: 10px;
  background: #ffffff;
}

.calendar-timeoff-density button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--calendar-timeoff-grid-line, var(--calendar-shadcn-border));
  background: transparent;
  color: #52525b;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  user-select: none;
}

.calendar-timeoff-density button:last-child {
  border-right: 0;
}

.calendar-timeoff-density button.active {
  background: #f4f4f5;
  color: #18181b;
}

.calendar-timeoff-controls {
  justify-content: flex-start;
  flex-wrap: wrap;
  border-bottom-color: var(--calendar-timeoff-grid-line, rgba(226, 232, 240, 0.82));
}

.calendar-timeoff-chip,
.calendar-timeoff-muted-action,
.calendar-timeoff-month,
.calendar-timeoff-scroll-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--calendar-shadcn-border);
  border-radius: 9px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.calendar-timeoff-chip {
  cursor: pointer;
}

.calendar-timeoff-chip b {
  font-size: 13px;
}

.calendar-timeoff-chip.is-holiday {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.calendar-timeoff-chip.is-vacation {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.calendar-timeoff-chip.is-sick {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.calendar-timeoff-chip.is-task {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.calendar-timeoff-chip.is-meeting {
  border-color: #e9d5ff;
  background: #f5f3ff;
  color: #7e22ce;
}

.calendar-timeoff-chip.is-training {
  border-color: #a5f3fc;
  background: #ecfeff;
  color: #0e7490;
}

.calendar-timeoff-chip.is-routine {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.calendar-timeoff-muted-action {
  cursor: pointer;
}

.calendar-timeoff-month-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.calendar-timeoff-month {
  color: #18181b;
}

.calendar-timeoff-scroll-action {
  width: 32px;
  padding: 0;
  cursor: pointer;
}

.calendar-timeoff-chip:hover,
.calendar-timeoff-muted-action:hover,
.calendar-timeoff-scroll-action:hover {
  filter: brightness(0.98);
}

.calendar-timeoff-chip:not(.is-active) {
  opacity: 0.64;
}

.calendar-timeoff-grid {
  display: grid;
  grid-template-columns: minmax(190px, var(--calendar-timeoff-left-width)) minmax(0, 1fr);
  min-height: 320px;
  max-height: min(460px, calc(100vh - 280px));
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--calendar-timeoff-panel-bg, #ffffff);
  -ms-overflow-style: none;
  scrollbar-gutter: auto;
  scrollbar-width: none;
}

.calendar-timeoff-grid::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.calendar-timeoff-people {
  position: sticky;
  left: 0;
  z-index: 6;
  display: block;
  min-width: 0;
  padding: 0;
  border-right: 1px solid var(--calendar-timeoff-grid-line, var(--calendar-shadcn-border));
  background: var(--calendar-timeoff-header-bg, #ffffff);
}

.calendar-timeoff-people-heading,
.calendar-timeoff-people-subheading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--calendar-timeoff-grid-line, rgba(226, 232, 240, 0.82));
  background: var(--calendar-timeoff-header-bg, #ffffff);
}

.calendar-timeoff-people-heading {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 48px;
  justify-content: space-between;
}

.calendar-timeoff-people-subheading {
  position: sticky;
  top: 48px;
  z-index: 9;
  min-height: 36px;
  box-shadow: 0 1px 0 var(--calendar-timeoff-grid-line, rgba(226, 232, 240, 0.82));
}

.calendar-timeoff-people-heading strong {
  color: var(--calendar-timeoff-header-text, #18181b);
  font-size: 13px;
}

.calendar-timeoff-row-mode {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  background: #f8fafc;
}

.calendar-timeoff-row-mode button {
  min-height: 24px;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 700;
}

.calendar-timeoff-row-mode button.active {
  background: #111827;
  color: #ffffff;
}

.calendar-timeoff-row-mode button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.calendar-timeoff-people-subheading span {
  color: var(--calendar-shadcn-muted);
  font-size: 12px;
}

.calendar-timeoff-person {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  height: var(--calendar-timeoff-row-height);
  min-height: var(--calendar-timeoff-row-height);
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid var(--calendar-timeoff-grid-line, rgba(226, 232, 240, 0.74));
  border-radius: 0;
  background: transparent;
  color: var(--calendar-timeoff-header-text, #18181b);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.calendar-timeoff-panel[data-calendar-timeoff-density="full"] .calendar-timeoff-person {
  height: var(--calendar-timeoff-row-height-current, var(--calendar-timeoff-row-height));
  min-height: var(--calendar-timeoff-row-height-current, var(--calendar-timeoff-row-height));
}

.calendar-timeoff-person:disabled {
  cursor: default;
  opacity: 0.65;
}

.calendar-timeoff-person:not(:disabled):hover {
  background: var(--calendar-timeoff-row-hover-bg, #f7f5ff);
}

.calendar-timeoff-person.is-row-hovered {
  background: var(--calendar-timeoff-row-hover-bg, #f7f5ff);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--calendar-tone, #2563eb) 72%, #ffffff);
}

.calendar-timeoff-avatar {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--calendar-timeoff-avatar-bg, #e0f2fe);
  color: var(--calendar-timeoff-avatar-text, #075985);
  font-size: 11px;
  font-weight: 700;
}

.calendar-timeoff-person b,
.calendar-timeoff-person small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-timeoff-person small {
  color: var(--calendar-shadcn-muted);
  font-size: 11px;
}

.calendar-timeoff-timeline {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

.calendar-timeoff-header-scroll,
.calendar-timeoff-body-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.calendar-timeoff-header-scroll {
  position: sticky;
  top: 0;
  z-index: 8;
  overflow: hidden;
  background: var(--calendar-timeoff-header-bg, #ffffff);
}

.calendar-timeoff-body-scroll {
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  -ms-overflow-style: none;
  scrollbar-gutter: auto;
  scrollbar-width: none;
}

.calendar-timeoff-body-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.calendar-timeoff-days,
.calendar-timeoff-counts,
.calendar-timeoff-row {
  display: grid;
  min-width: max(100%, calc(var(--calendar-timeoff-days) * var(--calendar-timeoff-day-width)));
  grid-template-columns: repeat(var(--calendar-timeoff-days), minmax(var(--calendar-timeoff-day-width), 1fr));
}

.calendar-timeoff-days {
  min-height: 48px;
  border-bottom: 1px solid var(--calendar-timeoff-grid-line, var(--calendar-shadcn-border));
  background: var(--calendar-timeoff-header-bg, #ffffff);
}

.calendar-timeoff-counts {
  min-height: 36px;
  border-bottom: 1px solid var(--calendar-timeoff-grid-line, rgba(226, 232, 240, 0.82));
  background: var(--calendar-timeoff-header-bg, #ffffff);
  box-shadow: 0 1px 0 var(--calendar-timeoff-grid-line, rgba(226, 232, 240, 0.82));
}

.calendar-timeoff-day-button,
.calendar-timeoff-count-cell,
.calendar-timeoff-cell {
  min-width: 0;
  border-right: 1px solid var(--calendar-timeoff-grid-line, rgba(226, 232, 240, 0.82));
}

.calendar-timeoff-day-button {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  color: var(--calendar-timeoff-header-text, #334155);
  cursor: pointer;
}

.calendar-timeoff-count-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  color: var(--calendar-shadcn-muted);
  cursor: pointer;
  font-size: 12px;
}

.calendar-timeoff-days small,
.calendar-timeoff-days em {
  color: var(--calendar-shadcn-muted);
  font-size: 9.5px;
  font-style: normal;
  font-weight: 500;
}

.calendar-timeoff-days b {
  font-size: 12px;
  font-weight: 700;
}

.calendar-timeoff-panel[data-calendar-timeoff-density="hybrid"] .calendar-timeoff-days small,
.calendar-timeoff-panel[data-calendar-timeoff-density="full"] .calendar-timeoff-days small {
  font-size: 12px;
}

.calendar-timeoff-panel[data-calendar-timeoff-density="hybrid"] .calendar-timeoff-days b,
.calendar-timeoff-panel[data-calendar-timeoff-density="full"] .calendar-timeoff-days b {
  font-size: 16px;
}

.calendar-timeoff-row {
  position: relative;
  height: var(--calendar-timeoff-row-height);
  min-height: var(--calendar-timeoff-row-height);
  grid-template-rows: repeat(var(--calendar-timeoff-row-items), minmax(30px, 1fr));
  border-bottom: 1px solid var(--calendar-timeoff-grid-line, rgba(226, 232, 240, 0.74));
  transition: background-color 0.16s ease;
}

.calendar-timeoff-panel[data-calendar-timeoff-density="full"] .calendar-timeoff-row {
  height: var(--calendar-timeoff-row-height-current, var(--calendar-timeoff-row-height));
  min-height: var(--calendar-timeoff-row-height-current, var(--calendar-timeoff-row-height));
}

.calendar-timeoff-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  cursor: pointer;
}

.calendar-timeoff-cell-bg {
  z-index: 1;
  min-height: 100%;
}

.calendar-timeoff-cell-bg.is-drop-target {
  background: color-mix(in srgb, var(--calendar-timeoff-event-bg, #cffafe) 34%, #ffffff);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--calendar-timeoff-event-text, #0e7490) 58%, #ffffff);
}

.calendar-timeoff-event-stack {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  padding: var(--calendar-timeoff-event-margin);
  cursor: pointer;
}

.calendar-timeoff-event-stack.is-full {
  justify-content: flex-start;
  overflow: hidden;
}

.calendar-timeoff-day-button:hover,
.calendar-timeoff-count-cell:hover,
.calendar-timeoff-cell:hover {
  background: color-mix(in srgb, var(--calendar-timeoff-row-hover-bg, #f7f5ff) 62%, #ffffff);
}

.calendar-timeoff-row.is-row-hovered {
  background: var(--calendar-timeoff-row-hover-bg, #f7f5ff);
}

.calendar-timeoff-row.is-row-hovered .calendar-timeoff-cell:not(.calendar-timeoff-event) {
  background: var(--calendar-timeoff-row-hover-bg, #f7f5ff);
}

.calendar-timeoff-row.is-row-hovered .calendar-timeoff-event {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}

.calendar-timeoff-event {
  position: relative;
  display: inline-flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  overflow: hidden;
  --calendar-timeoff-resize-handle-bg: currentColor;
  cursor: grab;
}

.calendar-timeoff-event:active {
  cursor: grabbing;
}

.calendar-timeoff-event.is-dragging {
  opacity: 0.56;
  transform: scale(0.98);
}

.calendar-timeoff-event.is-resizing {
  cursor: ew-resize;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--calendar-timeoff-resize-handle-bg, currentColor) 24%, transparent);
}

.calendar-timeoff-event-span {
  position: relative;
  z-index: 2;
  width: auto;
  min-width: 0;
  margin: var(--calendar-timeoff-event-margin);
  align-self: center;
  justify-self: stretch;
}

.calendar-timeoff-event-span.is-range-continuous {
  box-shadow: inset 0 0 0 1px rgba(14, 116, 144, 0.12), 0 1px 2px rgba(15, 23, 42, 0.08);
}

.calendar-timeoff-event-span.is-range-clipped-start {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.calendar-timeoff-event-span.is-range-clipped-end {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.calendar-timeoff-panel[data-calendar-timeoff-density="full"] .calendar-timeoff-event {
  min-height: 26px;
}

.calendar-timeoff-event-resize-handle {
  position: absolute;
  inset-block: 4px;
  z-index: 3;
  width: 12px;
  border-radius: 999px;
  cursor: ew-resize;
  touch-action: none;
}

.calendar-timeoff-event-resize-handle.is-start {
  left: 3px;
}

.calendar-timeoff-event-resize-handle.is-end,
.calendar-timeoff-event-resize-handle:not(.is-start) {
  right: 3px;
}

.calendar-timeoff-event-resize-handle::before {
  content: "";
  position: absolute;
  inset-block: 3px;
  left: 50%;
  width: 3px;
  border-radius: 999px;
  background: var(--calendar-timeoff-resize-handle-bg, currentColor);
  box-shadow: -3px 0 0 color-mix(in srgb, var(--calendar-timeoff-resize-handle-bg, currentColor) 34%, transparent);
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 120ms ease;
}

.calendar-timeoff-event-resize-handle.is-start::before {
  box-shadow: 3px 0 0 color-mix(in srgb, var(--calendar-timeoff-resize-handle-bg, currentColor) 34%, transparent);
}

.calendar-timeoff-event-resize-handle.is-end::before,
.calendar-timeoff-event-resize-handle:not(.is-start)::before {
  box-shadow: -3px 0 0 color-mix(in srgb, var(--calendar-timeoff-resize-handle-bg, currentColor) 34%, transparent);
}

.calendar-timeoff-event:hover .calendar-timeoff-event-resize-handle::before,
.calendar-timeoff-event:focus-visible .calendar-timeoff-event-resize-handle::before,
.calendar-timeoff-event.is-resizing .calendar-timeoff-event-resize-handle::before {
  opacity: 0.78;
}

.calendar-timeoff-event-label {
  display: inline-flex;
  max-width: calc(100% - 8px);
  min-width: 0;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--calendar-timeoff-event-font-size);
  font-weight: 650;
}

.calendar-timeoff-cell:focus-visible,
.calendar-timeoff-event:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--calendar-timeoff-event-text, #2563eb) 62%, #ffffff);
  outline-offset: -2px;
}

.calendar-timeoff-cell-bg.is-resize-target {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.02)),
    var(--calendar-timeoff-row-hover-bg, #f7f5ff);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.22);
}

body.calendar-timeoff-resizing,
body.calendar-timeoff-resizing * {
  cursor: ew-resize !important;
  user-select: none !important;
}

.calendar-timeoff-tooltip-root {
  position: fixed;
  z-index: 2147483000;
  width: min(350px, calc(100vw - 24px));
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.calendar-timeoff-tooltip-root.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.calendar-timeoff-tooltip-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
  color: #0f172a;
  padding: 14px 16px;
}

.calendar-timeoff-tooltip-card h3 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
}

.calendar-timeoff-tooltip-card p {
  margin: 10px 0 0;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.4;
}

.calendar-timeoff-tooltip-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.calendar-timeoff-tooltip-badge {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: #fee2e2;
  color: #dc2626;
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
  padding: 0 9px;
  text-transform: uppercase;
}

.calendar-timeoff-tooltip-card.is-task .calendar-timeoff-tooltip-badge:first-child {
  border-color: #bfdbfe;
  background: #dbeafe;
  color: #1d4ed8;
}

.calendar-timeoff-tooltip-card.is-meeting .calendar-timeoff-tooltip-badge:first-child {
  border-color: #ddd6fe;
  background: #ede9fe;
  color: #7e22ce;
}

.calendar-timeoff-tooltip-card.is-routine .calendar-timeoff-tooltip-badge:first-child {
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #047857;
}

.calendar-timeoff-tooltip-meta {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 6px 12px;
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.35;
}

.calendar-timeoff-tooltip-meta dt {
  color: #0f172a;
  font-weight: 650;
}

.calendar-timeoff-tooltip-meta dd {
  min-width: 0;
  margin: 0;
  color: #6b7280;
  overflow-wrap: anywhere;
}

.calendar-timeoff-event.is-holiday {
  background: #eff6ff;
  color: #1d4ed8;
}

.calendar-timeoff-event.is-vacation {
  background: #dcfce7;
  color: #047857;
}

.calendar-timeoff-event.is-sick {
  background: #fee2e2;
  color: #b91c1c;
}

.calendar-timeoff-event.is-task {
  --calendar-timeoff-resize-handle-bg: #2563eb;
  border-color: #bfdbfe;
  background: #dbeafe;
  color: #1d4ed8;
}

.calendar-timeoff-event.is-meeting {
  --calendar-timeoff-resize-handle-bg: #7c3aed;
  border-color: #ddd6fe;
  background: #ede9fe;
  color: #7e22ce;
}

.calendar-timeoff-event.is-training {
  --calendar-timeoff-resize-handle-bg: #ef4444;
  border-color: #a5f3fc;
  background: #cffafe;
  color: #0e7490;
}

.calendar-timeoff-event.is-routine {
  --calendar-timeoff-resize-handle-bg: #059669;
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #047857;
}

.calendar-timeoff-panel[data-calendar-timeoff-custom-colors="true"] .calendar-timeoff-event {
  border-color: color-mix(in srgb, var(--calendar-timeoff-event-bg, #cffafe) 78%, #0f172a);
  background: var(--calendar-timeoff-event-bg, #cffafe);
  color: var(--calendar-timeoff-event-text, #0e7490);
}

.calendar-timeoff-panel[data-calendar-timeoff-freeze-header="false"] .calendar-timeoff-people-heading,
.calendar-timeoff-panel[data-calendar-timeoff-freeze-header="false"] .calendar-timeoff-people-subheading,
.calendar-timeoff-panel[data-calendar-timeoff-freeze-header="false"] .calendar-timeoff-header-scroll {
  position: static;
  top: auto;
}

.calendar-timeoff-source-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: flex-end;
}

.calendar-timeoff-source-row {
  align-items: flex-start;
}

.calendar-filter-panel,
.calendar-source-card,
.calendar-year-shell,
.calendar-agenda-shell,
.calendar-day-column {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
  backdrop-filter: blur(18px);
}

body.theme-dark .calendar-filter-panel,
body.theme-dark .calendar-source-card,
body.theme-dark .calendar-year-shell,
body.theme-dark .calendar-agenda-shell,
body.theme-dark .calendar-day-column,
body[data-theme="dark"] .calendar-filter-panel,
body[data-theme="dark"] .calendar-source-card,
body[data-theme="dark"] .calendar-year-shell,
body[data-theme="dark"] .calendar-agenda-shell,
body[data-theme="dark"] .calendar-day-column {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.82);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.calendar-source-card h3,
.calendar-year-shell h3,
.calendar-agenda-shell h3 {
  margin: 0;
  font-family: "Times New Roman", "Khmer OS Battambang", serif;
  font-size: 1.72rem;
  line-height: 1.15;
}

body.theme-dark .calendar-display-mode-tabs,
body[data-theme="dark"] .calendar-display-mode-tabs {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.58);
}

body.theme-dark .calendar-display-mode-tabs button,
body[data-theme="dark"] .calendar-display-mode-tabs button {
  color: #dbe7f6;
}

.calendar-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-view-tabs,
.calendar-view-tabs-group,
.calendar-display-mode-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-view-tabs button,
.calendar-display-mode-tabs button,
.calendar-filter-clear {
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  padding: 8px 12px;
  background: #ffffff;
  color: #183657;
  font-weight: 800;
  cursor: pointer;
}

.calendar-view-tabs,
.calendar-display-mode-tabs {
  flex-wrap: wrap;
  margin: 8px 0;
}

.calendar-view-tabs {
  justify-content: space-between;
  gap: 12px;
}

.calendar-view-tabs-group {
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-width: 0;
}

.calendar-display-mode-tabs {
  width: max-content;
  max-width: 100%;
  margin-top: -6px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.calendar-display-mode-tabs button {
  min-width: 76px;
  padding: 8px 12px;
  border-color: transparent;
  border-radius: 12px;
  background: transparent;
}

.calendar-view-tabs button.active,
.calendar-display-mode-tabs button.active {
  border-color: #2563eb;
  background: linear-gradient(135deg, #1d4ed8, #38bdf8);
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.28);
}

.calendar-view-tabs .calendar-create-schedule-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
  min-height: 38px;
  padding: 0 12px;
  border-color: #111827;
  background: #111827;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.calendar-view-tabs .calendar-create-schedule-button span[aria-hidden="true"] {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 1rem;
  line-height: 1;
}

.calendar-view-tabs .calendar-create-schedule-button:hover,
.calendar-view-tabs .calendar-create-schedule-button:focus-visible {
  background: #020617;
  color: #ffffff;
  transform: translateY(-1px);
}

.shadcn-calendar-card {
  --cell-size: 38px;
  width: fit-content;
  min-width: 320px;
  padding: 12px;
  border: 1px solid var(--calendar-shadcn-border);
  border-radius: 12px;
  background: var(--calendar-shadcn-background);
  color: var(--calendar-shadcn-foreground);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.shadcn-calendar-header {
  position: relative;
  display: grid;
  grid-template-columns: var(--cell-size) minmax(0, 1fr) var(--cell-size);
  align-items: center;
  gap: 4px;
  min-height: var(--cell-size);
  margin-bottom: 14px;
}

.shadcn-calendar-caption {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.shadcn-calendar-caption label {
  position: relative;
  display: inline-flex;
}

.shadcn-calendar-caption select {
  height: 32px;
  max-width: 112px;
  appearance: none;
  padding: 0 24px 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background:
    linear-gradient(45deg, transparent 50%, var(--calendar-shadcn-muted) 50%) right 10px center / 6px 6px no-repeat,
    var(--calendar-shadcn-background);
  color: var(--calendar-shadcn-foreground);
  font: 600 14px/1 var(--pd-english-ui-font, "Inter", "Segoe UI", Arial, sans-serif);
  cursor: pointer;
}

.shadcn-calendar-caption select:hover,
.shadcn-calendar-caption select:focus-visible {
  border-color: var(--calendar-shadcn-border);
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #2563eb) 16%, transparent);
}

.shadcn-calendar-nav {
  display: inline-grid;
  place-items: center;
  width: var(--cell-size);
  min-width: var(--cell-size);
  height: var(--cell-size);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--calendar-shadcn-foreground);
  box-shadow: none;
}

.shadcn-calendar-nav:hover,
.shadcn-calendar-nav:focus-visible {
  background: var(--calendar-shadcn-accent);
  outline: 0;
}

.shadcn-calendar-nav svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shadcn-calendar-weekdays,
.shadcn-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, var(--cell-size));
  gap: 4px;
}

.shadcn-calendar-weekdays {
  margin-bottom: 6px;
}

.shadcn-calendar-weekdays span {
  display: grid;
  place-items: center;
  height: 28px;
  color: var(--calendar-shadcn-muted);
  font: 400 13px/1 var(--pd-english-ui-font, "Inter", "Segoe UI", Arial, sans-serif);
}

.shadcn-calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--cell-size);
  height: var(--cell-size);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--calendar-shadcn-foreground);
  font: 400 15px/1 var(--pd-english-ui-font, "Inter", "Segoe UI", Arial, sans-serif);
  cursor: pointer;
}

.shadcn-calendar-day:hover,
.shadcn-calendar-day:focus-visible {
  background: var(--calendar-shadcn-accent);
  outline: 0;
}

.shadcn-calendar-day.outside {
  color: var(--calendar-shadcn-muted);
}

.shadcn-calendar-day.today {
  background: var(--calendar-shadcn-accent);
  color: var(--calendar-shadcn-accent-foreground);
}

.shadcn-calendar-day.selected {
  background: var(--calendar-shadcn-primary);
  color: var(--calendar-shadcn-primary-foreground);
}

.shadcn-calendar-day small {
  position: absolute;
  right: 4px;
  bottom: 3px;
  display: grid;
  place-items: center;
  min-width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--accent, #2563eb);
  color: #ffffff;
  font: 700 9px/1 var(--pd-english-ui-font, Arial, sans-serif);
}

.shadcn-calendar-day.selected small {
  background: var(--calendar-shadcn-primary-foreground);
  color: var(--calendar-shadcn-primary);
}

/* USER UPDATE: compact Calendar card stack after removing the legacy hero shell. */
.calendar-summary-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0 8px;
}

.calendar-summary-panel .calendar-view-tabs {
  margin: 0;
}

.calendar-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin: 0;
}

/* USER UPDATE: calendar KPI command cards v1.
   The summary buttons use the soft filled, metric-card treatment from the
   provided command-center reference while keeping the existing filter buttons. */
.calendar-kpi {
  position: relative;
  display: grid;
  align-content: start;
  min-height: 96px;
  padding: 14px 52px 14px 16px;
  border: 1px solid var(--calendar-tone-border, rgba(148, 163, 184, 0.34));
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.48)),
    var(--calendar-tone-panel, #ffffff);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.calendar-kpi::after {
  content: var(--calendar-kpi-icon, "");
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--calendar-tone, #2563eb) 28%, #ffffff);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--calendar-tone, #2563eb);
  font-family: var(--pd-english-ui-font, var(--font-sans, "Inter Variable", Inter, "Segoe UI", Arial, sans-serif));
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.calendar-kpi span,
.calendar-kpi small {
  display: block;
  color: color-mix(in srgb, var(--calendar-tone, #2563eb) 54%, #475569);
  font-family: var(--pd-english-ui-font, var(--font-sans, "Inter Variable", Inter, "Segoe UI", Arial, sans-serif));
  font-size: 0.72rem;
  font-weight: 760;
}

.calendar-kpi span {
  text-transform: uppercase;
}

.calendar-kpi strong {
  display: block;
  margin: 7px 0 4px;
  color: var(--calendar-tone, #2563eb);
  font-family: var(--pd-english-ui-font, var(--font-sans, "Inter Variable", Inter, "Segoe UI", Arial, sans-serif));
  font-size: 1.9rem;
  font-weight: 820;
  line-height: 0.95;
}

.calendar-tone-red {
  --calendar-tone: #dc2626;
  --calendar-soft: rgba(220, 38, 38, 0.12);
  --calendar-tone-panel: #fff1f2;
  --calendar-tone-border: #fecdd3;
  --calendar-tone-shadow: rgba(220, 38, 38, 0.14);
}

.calendar-tone-orange {
  --calendar-tone: #ea580c;
  --calendar-soft: rgba(234, 88, 12, 0.13);
  --calendar-tone-panel: #fff7ed;
  --calendar-tone-border: #fed7aa;
  --calendar-tone-shadow: rgba(234, 88, 12, 0.14);
}

.calendar-tone-blue {
  --calendar-tone: #2563eb;
  --calendar-soft: rgba(37, 99, 235, 0.13);
  --calendar-tone-panel: #eff6ff;
  --calendar-tone-border: #bfdbfe;
  --calendar-tone-shadow: rgba(37, 99, 235, 0.14);
}

.calendar-tone-green {
  --calendar-tone: #059669;
  --calendar-soft: rgba(5, 150, 105, 0.13);
  --calendar-tone-panel: #ecfdf5;
  --calendar-tone-border: #a7f3d0;
  --calendar-tone-shadow: rgba(5, 150, 105, 0.14);
}

.calendar-tone-purple {
  --calendar-tone: #7c3aed;
  --calendar-soft: rgba(124, 58, 237, 0.13);
  --calendar-tone-panel: #f5f3ff;
  --calendar-tone-border: #ddd6fe;
  --calendar-tone-shadow: rgba(124, 58, 237, 0.14);
}

.calendar-kpi[data-calendar-summary-filter="today"] { --calendar-kpi-icon: "T"; }
.calendar-kpi[data-calendar-summary-filter="week"] { --calendar-kpi-icon: "W"; }
.calendar-kpi[data-calendar-summary-filter="upcoming7"] { --calendar-kpi-icon: "7D"; }
.calendar-kpi[data-calendar-summary-filter="high"] { --calendar-kpi-icon: "HI"; }
.calendar-kpi[data-calendar-summary-filter="completed"] { --calendar-kpi-icon: "OK"; }
.calendar-kpi[data-calendar-summary-filter="overdue"] { --calendar-kpi-icon: "!"; }

.calendar-kpi:hover,
.calendar-kpi:focus-visible,
.calendar-kpi.active {
  border-color: color-mix(in srgb, var(--calendar-tone, #2563eb) 48%, var(--calendar-tone-border, #cbd5e1));
  box-shadow: 0 16px 34px var(--calendar-tone-shadow, rgba(15, 23, 42, 0.12)), 0 0 0 3px var(--calendar-soft, rgba(37, 99, 235, 0.1));
  transform: translateY(-1px);
}

.calendar-source-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 0;
  padding: 12px 16px;
}

.calendar-source-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.calendar-source-pills span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(248, 250, 252, 0.9);
  color: #334155;
  font-weight: 700;
  font-size: 0.78rem;
}

.calendar-source-pills b {
  color: #1d4ed8;
}

.calendar-filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin: 14px 0;
  padding: 18px;
}

.calendar-filter-panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 800;
}

.calendar-filter-panel input,
.calendar-filter-panel select {
  min-height: 42px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 13px;
  padding: 8px 10px;
  background: #ffffff;
  color: #172033;
}

.calendar-filter-panel .calendar-search {
  grid-column: span 2;
}

.calendar-filter-clear {
  align-self: end;
  min-height: 42px;
}

.calendar-right-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 12px 24px;
  color: var(--text, #172033);
}

.calendar-right-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.calendar-right-heading p,
.calendar-right-heading h2 {
  margin: 0;
}

.calendar-right-heading h2 {
  font-size: 1.55rem;
  line-height: 1.1;
  color: #123255;
}

.calendar-right-heading span {
  color: #64748b;
  font-weight: 700;
}

.calendar-right-date-picker {
  width: 100%;
  min-width: 0;
}

.calendar-right-date-picker .shadcn-calendar-card {
  --cell-size: 34px;
  width: 100%;
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.calendar-right-date-picker .shadcn-calendar-caption {
  gap: 6px;
}

.calendar-right-date-picker .shadcn-calendar-caption select {
  max-width: 96px;
}

.calendar-right-date-picker .shadcn-calendar-weekdays,
.calendar-right-date-picker .shadcn-calendar-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendar-right-date-picker .shadcn-calendar-day {
  width: 100%;
  min-width: 0;
}

.calendar-right-display-mode {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.calendar-right-section-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-right-section-label {
  color: #123255;
  font-size: 0.98rem;
  font-weight: 900;
}

.calendar-right-section-copy p {
  margin: 0;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.35;
}

.calendar-right-panel .calendar-display-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 4px;
}

.calendar-right-panel .calendar-display-mode-tabs button {
  min-width: 0;
  padding: 8px 6px;
  white-space: nowrap;
}

.calendar-source-preferences {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.72));
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.calendar-source-preferences-head {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.calendar-source-preferences-head strong {
  color: #123255;
  font-size: 0.98rem;
}

.calendar-source-preferences-head small {
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.35;
}

.calendar-source-choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-source-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.calendar-source-choice:hover,
.calendar-source-choice.active {
  border-color: rgba(37, 99, 235, 0.48);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.12);
}

.calendar-source-choice input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

.calendar-source-choice span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.calendar-source-choice b {
  color: #172033;
  font-size: 0.9rem;
  line-height: 1.2;
}

.calendar-source-choice small {
  color: #64748b;
  font-size: 0.76rem;
}

.calendar-source-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.calendar-source-actions button {
  min-height: 38px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 12px;
  background: #ffffff;
  color: #17365d;
  font-weight: 800;
  font-size: 0.76rem;
}

.calendar-source-actions button:hover {
  border-color: rgba(37, 99, 235, 0.55);
  color: #1d4ed8;
}

.calendar-right-panel .calendar-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.calendar-right-panel .calendar-filter-panel .calendar-search {
  grid-column: auto;
}

.calendar-right-panel .calendar-filter-panel input,
.calendar-right-panel .calendar-filter-panel select {
  width: 100%;
  min-height: 46px;
}

.calendar-right-panel .calendar-filter-clear {
  width: 100%;
}

.calendar-right-panel .calendar-right-bottom-actions {
  position: sticky;
  inset: auto auto -24px auto;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  justify-content: stretch;
  gap: 0;
  width: auto;
  min-height: 38px;
  margin: auto -12px -24px;
  padding: 0;
  border: 0;
  border-top: 1px solid #e5e7eb;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  overflow: visible;
}

body > .calendar-filter-drawer-shell > [data-calendar-right-panel] .calendar-right-bottom-actions,
.content-grid.calendar-dashboard-mode > .detail-panel.calendar-detail-mode:not([hidden]) [data-calendar-right-panel] .calendar-right-bottom-actions {
  margin-right: -24px;
  margin-left: -24px;
}

.calendar-right-panel .calendar-right-bottom-actions > .right-detail-footer-action {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: stretch;
  gap: 5px;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #475569;
  font: inherit;
  font-family: var(--font-sans, "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "Noto Sans Khmer", sans-serif);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
}

.calendar-right-panel .calendar-right-bottom-actions .right-detail-action-icon,
.calendar-right-panel .calendar-right-bottom-actions .detail-save-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.calendar-right-panel .calendar-right-bottom-actions > .right-detail-footer-action:is(:hover, :focus-visible, :active) {
  background: transparent;
  box-shadow: none;
  color: #2563eb;
  text-decoration: none;
}

.calendar-right-panel .calendar-right-bottom-actions > .right-detail-footer-action:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.34);
  outline-offset: -2px;
}

body.theme-dark .calendar-right-panel,
body[data-theme="dark"] .calendar-right-panel {
  color: #e8eef8;
}

body.theme-dark .calendar-right-heading,
body[data-theme="dark"] .calendar-right-heading {
  border-bottom-color: rgba(148, 163, 184, 0.28);
}

body.theme-dark .calendar-right-heading h2,
body[data-theme="dark"] .calendar-right-heading h2 {
  color: #e8eef8;
}

body.theme-dark .calendar-right-heading span,
body[data-theme="dark"] .calendar-right-heading span {
  color: #b6c5d8;
}

body.theme-dark .calendar-right-display-mode,
body.theme-dark .calendar-source-preferences,
body[data-theme="dark"] .calendar-right-display-mode,
body[data-theme="dark"] .calendar-source-preferences {
  border-color: rgba(148, 163, 184, 0.28);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.82));
}

body.theme-dark .calendar-right-section-label,
body.theme-dark .calendar-source-preferences-head strong,
body.theme-dark .calendar-source-choice b,
body[data-theme="dark"] .calendar-right-section-label,
body[data-theme="dark"] .calendar-source-preferences-head strong,
body[data-theme="dark"] .calendar-source-choice b {
  color: #e8eef8;
}

body.theme-dark .calendar-right-section-copy p,
body.theme-dark .calendar-source-preferences-head small,
body.theme-dark .calendar-source-choice small,
body[data-theme="dark"] .calendar-right-section-copy p,
body[data-theme="dark"] .calendar-source-preferences-head small,
body[data-theme="dark"] .calendar-source-choice small {
  color: #b6c5d8;
}

body.theme-dark .calendar-source-choice,
body[data-theme="dark"] .calendar-source-choice {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.74);
}

body.theme-dark .calendar-source-actions button,
body[data-theme="dark"] .calendar-source-actions button {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.82);
  color: #e8eef8;
}

body.theme-dark .calendar-right-panel .calendar-right-bottom-actions,
body[data-theme="dark"] .calendar-right-panel .calendar-right-bottom-actions {
  border-top-color: rgba(148, 163, 184, 0.26);
  background: #0f172a;
}

body.theme-dark .calendar-right-panel .calendar-right-bottom-actions > .right-detail-footer-action,
body[data-theme="dark"] .calendar-right-panel .calendar-right-bottom-actions > .right-detail-footer-action {
  color: #b6c5d8;
}

body.theme-dark .calendar-right-panel .calendar-right-bottom-actions > .right-detail-footer-action:is(:hover, :focus-visible, :active),
body[data-theme="dark"] .calendar-right-panel .calendar-right-bottom-actions > .right-detail-footer-action:is(:hover, :focus-visible, :active) {
  color: #93c5fd;
}

.calendar-year-shell {
  padding: 18px;
}

.calendar-year-shell > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.calendar-year-shell > header > strong {
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-weight: 900;
}

.calendar-year-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
}

.calendar-year-month-card {
  min-height: 230px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 18px;
  padding: 12px;
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.08), transparent 45%),
    rgba(255, 255, 255, 0.9);
}

.calendar-year-month-card.empty {
  opacity: 0.7;
}

.calendar-year-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(240, 249, 255, 0.84));
  color: #172033;
  cursor: pointer;
}

.calendar-year-month-head span {
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.calendar-year-month-head strong {
  min-width: 34px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #1d4ed8;
  color: #fff;
  text-align: center;
}

.calendar-year-tone-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  margin: 10px 0;
}

.calendar-year-tone-dot {
  min-width: 28px;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--calendar-soft, rgba(37, 99, 235, 0.1));
  color: var(--calendar-tone, #2563eb);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.calendar-year-no-events {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 800;
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--calendar-shadcn-border);
  border-radius: 12px;
  background: var(--calendar-shadcn-background);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.calendar-weekday {
  display: grid;
  place-items: center;
  height: 34px;
  padding: 0;
  color: var(--calendar-shadcn-muted);
  font: 400 0.86rem/1 var(--pd-english-ui-font, "Inter", "Segoe UI", Arial, sans-serif);
  text-align: center;
  text-transform: none;
}

.calendar-day-cell {
  min-height: 136px;
  --calendar-fallback-event-lanes: 5;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px;
  background: transparent;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.calendar-day-cell:hover,
.calendar-day-cell:focus-visible {
  border-color: var(--calendar-shadcn-border);
  background: var(--calendar-shadcn-accent);
  outline: 0;
}

.calendar-day-cell.muted {
  opacity: 1;
  color: var(--calendar-shadcn-muted);
}

.calendar-day-cell.today {
  border-color: var(--calendar-shadcn-border);
  background: var(--calendar-shadcn-accent);
  box-shadow: none;
}

.calendar-day-cell header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.calendar-day-cell header strong {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: 8px;
  font: 500 0.95rem/1 var(--pd-english-ui-font, "Inter", "Segoe UI", Arial, sans-serif);
}

.calendar-day-cell.today header strong {
  background: var(--calendar-shadcn-primary);
  color: var(--calendar-shadcn-primary-foreground);
}

.calendar-day-cell header span,
.calendar-day-count {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  padding: 0 7px;
  border: 0;
  background: var(--calendar-shadcn-accent);
  color: var(--calendar-shadcn-accent-foreground);
  font: 700 0.74rem/24px var(--pd-english-ui-font, "Inter", "Segoe UI", Arial, sans-serif);
  text-align: center;
  cursor: pointer;
}

.calendar-day-count:hover,
.calendar-day-count:focus-visible {
  background: var(--calendar-shadcn-primary);
  color: var(--calendar-shadcn-primary-foreground);
  outline: 2px solid color-mix(in srgb, var(--accent, #2563eb) 24%, transparent);
  outline-offset: 2px;
}

body.theme-dark .calendar-day-count,
body[data-theme="dark"] .calendar-day-count {
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
}

.calendar-day-cell.calendar-display-mini {
  min-height: 78px;
}

.calendar-month-grid.calendar-display-mini {
  align-items: stretch;
}

.calendar-month-grid.calendar-display-full .calendar-day-cell {
  min-height: 194px;
}

.calendar-event-stack {
  display: grid;
  grid-auto-rows: minmax(24px, auto);
  gap: 4px;
}

.calendar-event-chip,
.calendar-event-stack > button,
.calendar-agenda-item {
  border: 1px solid color-mix(in srgb, var(--calendar-tone, #2563eb) 34%, transparent);
  border-left: 4px solid var(--calendar-tone, #2563eb);
  border-radius: 8px;
  background: color-mix(in srgb, var(--calendar-tone, #2563eb) 8%, var(--calendar-shadcn-background));
  color: var(--calendar-shadcn-foreground);
  cursor: pointer;
}

.calendar-event-chip {
  display: grid;
  min-height: 24px;
  --calendar-event-lane: 0;
  gap: 2px;
  padding: 5px 7px;
  text-align: left;
}

.calendar-event-chip.is-range-start {
  margin-inline-end: -9px;
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
}

.calendar-event-chip.is-range-middle {
  margin-inline: -9px;
  border-radius: 0;
  border-left-color: color-mix(in srgb, var(--calendar-tone, #2563eb) 20%, transparent);
  border-right-color: color-mix(in srgb, var(--calendar-tone, #2563eb) 20%, transparent);
}

.calendar-event-chip.is-range-end {
  margin-inline-start: -9px;
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
}

.calendar-event-chip span,
.calendar-event-chip b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-chip span {
  color: var(--calendar-tone, #2563eb);
  font-size: 0.74rem;
  font-weight: 900;
}

.calendar-event-chip b {
  font-size: 0.8rem;
}

.calendar-event-stack > button {
  padding: 8px;
  color: #1d4ed8;
  font-weight: 900;
}

.calendar-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  gap: 12px;
}

.calendar-day-view {
  display: block;
}

.calendar-day-column {
  min-height: 420px;
  padding: 16px;
}

.calendar-day-column > header,
.calendar-agenda-shell > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-day-column > header span {
  color: #1d4ed8;
  font-weight: 900;
}

.calendar-agenda-shell {
  padding: 18px;
}

.calendar-agenda-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calendar-agenda-list.compact {
  max-height: 560px;
  overflow: auto;
}

.calendar-agenda-item {
  display: grid;
  grid-template-columns: 170px minmax(220px, 1fr) 190px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
}

.calendar-agenda-date {
  color: var(--calendar-tone, #2563eb);
  font-weight: 900;
}

.calendar-agenda-main {
  display: grid;
  gap: 4px;
}

.calendar-agenda-main strong {
  font-size: 1rem;
}

.calendar-agenda-main small,
.calendar-agenda-meta small {
  color: #64748b;
}

.calendar-agenda-meta {
  display: grid;
  gap: 4px;
  justify-items: end;
}

.calendar-empty {
  border: 1px dashed rgba(148, 163, 184, 0.55);
  border-radius: 16px;
  padding: 34px;
  color: #64748b;
  text-align: center;
}

.calendar-source-highlight {
  animation: calendarSourcePulse 2.2s ease;
  outline: 3px solid #f59e0b;
  outline-offset: -3px;
}

@keyframes calendarSourcePulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  55% { box-shadow: 0 0 0 12px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* USER UPDATE: calendar enterprise command center v1.
   Calendar keeps the existing data and interaction model, but presents it as a
   compact operations surface with one visual owner for planner, controls, KPIs,
   source summary, and the lower schedule. */
.calendar-dashboard-shell.calendar-dashboard-shell-mantine {
  --calendar-enterprise-border: #dbe4ef;
  --calendar-enterprise-line: #e6edf5;
  --calendar-enterprise-surface: #ffffff;
  --calendar-enterprise-surface-soft: #f8fafc;
  --calendar-enterprise-text: #0f172a;
  --calendar-enterprise-muted: #64748b;
  --calendar-enterprise-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 18px 44px rgba(15, 23, 42, 0.06);
  color: var(--calendar-enterprise-text);
  font-family: var(--pd-english-ui-font, var(--font-sans, "Inter Variable", Inter, "Segoe UI", Arial, sans-serif));
}

.data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  .calendar-dashboard-shell.calendar-dashboard-shell-mantine,
body[class$="-theme"]
  .data-grid-shell.calendar-appdatagrid-mode:not([data-platform-grid-editing="true"])
  .calendar-dashboard-shell.calendar-dashboard-shell-mantine {
  gap: 14px !important;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-panel,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-summary-panel,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-source-card,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-mantine-schedule-root {
  border: 1px solid var(--calendar-enterprise-border);
  border-radius: 12px;
  background: var(--calendar-enterprise-surface);
  box-shadow: var(--calendar-enterprise-shadow);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-panel {
  margin-top: 0;
  overflow: hidden;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-header,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-controls {
  padding: 12px 14px;
  border-bottom-color: var(--calendar-enterprise-line);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-header h3 {
  color: var(--calendar-enterprise-text);
  font-size: 14px;
  font-weight: 780;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-header p {
  margin-top: 2px;
  color: var(--calendar-enterprise-muted);
  font-size: 11.5px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-density {
  gap: 2px;
  padding: 3px;
  border-color: var(--calendar-enterprise-border);
  border-radius: 10px;
  background: var(--calendar-enterprise-surface-soft);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-density button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: #475569;
  font-size: 11px;
  font-weight: 760;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-density button.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-chip,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-muted-action,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-month,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-scroll-action {
  min-height: 30px;
  border-color: var(--calendar-enterprise-border);
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 720;
  box-shadow: none;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-grid {
  min-height: 292px;
  max-height: min(410px, calc(100vh - 310px));
  border-radius: 0;
  background: #ffffff;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-people-heading {
  min-height: 42px;
  padding: 0 12px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-people-subheading {
  top: 42px;
  min-height: 32px;
  padding: 0 12px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-people-heading strong {
  font-size: 12px;
  font-weight: 780;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-row-mode button {
  min-height: 22px;
  padding: 0 6px;
  font-size: 10px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-days {
  min-height: 42px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-counts {
  min-height: 32px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-person {
  padding: 0 12px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-event {
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-summary-panel {
  position: relative;
  gap: 10px;
  margin: 0;
  padding: 12px;
  overflow: hidden;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-summary-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #0f766e 46%, #ea580c);
  pointer-events: none;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-summary-panel .calendar-view-tabs {
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--calendar-enterprise-line);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-view-tabs-group {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--calendar-enterprise-border);
  border-radius: 10px;
  background: var(--calendar-enterprise-surface-soft);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-view-tabs button {
  min-height: 32px;
  padding: 0 10px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 740;
  box-shadow: none;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-view-tabs button:hover,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-view-tabs button:focus-visible {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  outline: 0;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-view-tabs button.active {
  border-color: #0f172a;
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-view-tabs .calendar-create-schedule-button {
  min-height: 36px;
  border-color: #0f172a;
  border-radius: 9px;
  background: #0f172a;
  color: #ffffff;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-kpi-grid {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-kpi {
  display: grid;
  align-content: start;
  min-height: 86px;
  padding: 12px 48px 12px 14px;
  border: 1px solid var(--calendar-tone-border, var(--calendar-enterprise-border));
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.52)),
    var(--calendar-tone-panel, #ffffff);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-kpi::after {
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-kpi span,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-kpi small {
  color: color-mix(in srgb, var(--calendar-tone, #2563eb) 54%, #475569);
  font-size: 11px;
  font-weight: 760;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-kpi strong {
  margin: 6px 0 4px;
  font-family: var(--pd-english-ui-font, var(--font-sans, "Inter Variable", Inter, "Segoe UI", Arial, sans-serif));
  font-size: 26px;
  font-weight: 820;
  line-height: 0.95;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-kpi:hover,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-kpi:focus-visible,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-kpi.active {
  border-color: color-mix(in srgb, var(--calendar-tone, #2563eb) 48%, var(--calendar-tone-border, #cbd5e1));
  box-shadow: 0 14px 28px var(--calendar-tone-shadow, rgba(15, 23, 42, 0.1)), 0 0 0 3px var(--calendar-soft, rgba(37, 99, 235, 0.1));
  transform: translateY(-1px);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-source-card {
  margin: 0;
  padding: 12px 14px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-source-card h3 {
  font-family: var(--pd-english-ui-font, var(--font-sans, "Inter Variable", Inter, "Segoe UI", Arial, sans-serif));
  font-size: 18px;
  font-weight: 760;
  line-height: 1.15;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-eyebrow {
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-source-pills span {
  min-height: 28px;
  padding: 0 10px;
  border-color: var(--calendar-enterprise-border);
  background: var(--calendar-enterprise-surface-soft);
  color: #334155;
  font-size: 11px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-mantine-schedule-root {
  min-height: 520px;
  padding: 12px;
  overflow: hidden;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine .paperdesk-mantine-schedule {
  min-height: 500px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine
  .paperdesk-mantine-schedule
  .paperdesk-calendar-schedule-toolbar {
  gap: 8px;
  margin-block-end: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--calendar-enterprise-line);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine
  .paperdesk-mantine-schedule
  .paperdesk-calendar-schedule-toolbar-control,
.calendar-dashboard-shell.calendar-dashboard-shell-mantine
  .paperdesk-mantine-schedule
  .paperdesk-calendar-schedule-toolbar-title {
  min-height: 32px;
  border-color: var(--calendar-enterprise-border);
  border-radius: 8px;
  box-shadow: none;
  font-size: 12px;
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine
  .paperdesk-mantine-schedule
  .paperdesk-calendar-schedule-view-control[data-active="true"] {
  border-color: #2563eb;
  background-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.calendar-dashboard-shell.calendar-dashboard-shell-mantine
  .paperdesk-mantine-schedule
  .paperdesk-calendar-date-jump {
  min-height: 32px;
  border-color: var(--calendar-enterprise-border);
  border-radius: 8px;
  background: var(--calendar-enterprise-surface-soft);
  box-shadow: none;
}

body.theme-dark .calendar-dashboard-shell.calendar-dashboard-shell-mantine,
body[data-theme="dark"] .calendar-dashboard-shell.calendar-dashboard-shell-mantine {
  --calendar-enterprise-border: #253247;
  --calendar-enterprise-line: #1f2a3d;
  --calendar-enterprise-surface: #0f172a;
  --calendar-enterprise-surface-soft: #111c31;
  --calendar-enterprise-text: #e5edf7;
  --calendar-enterprise-muted: #9aa8bb;
  --calendar-enterprise-shadow: 0 16px 44px rgba(0, 0, 0, 0.22);
}

/* USER UPDATE: calendar agenda tab parity v1.
   Agenda, Overdue, Next 7 days, and Next 30 days use the same enterprise
   segmented toolbar as Year, Month, Week, and Day. */
.calendar-dashboard-shell {
  --calendar-enterprise-border: #dbe4ef;
  --calendar-enterprise-line: #e6edf5;
  --calendar-enterprise-surface: #ffffff;
  --calendar-enterprise-surface-soft: #f8fafc;
  --calendar-enterprise-text: #0f172a;
  --calendar-enterprise-muted: #64748b;
  --calendar-enterprise-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 18px 44px rgba(15, 23, 42, 0.06);
}

.calendar-dashboard-shell .calendar-summary-panel {
  position: relative;
  gap: 10px;
  margin: 0;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--calendar-enterprise-border);
  border-radius: 12px;
  background: var(--calendar-enterprise-surface);
  box-shadow: var(--calendar-enterprise-shadow);
}

.calendar-dashboard-shell .calendar-summary-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #0f766e 46%, #ea580c);
  pointer-events: none;
}

.calendar-dashboard-shell .calendar-summary-panel .calendar-view-tabs {
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--calendar-enterprise-line);
}

.calendar-dashboard-shell .calendar-view-tabs-group {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--calendar-enterprise-border);
  border-radius: 10px;
  background: var(--calendar-enterprise-surface-soft);
}

.calendar-dashboard-shell .calendar-view-tabs button {
  min-height: 32px;
  padding: 0 10px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 740;
  box-shadow: none;
}

.calendar-dashboard-shell .calendar-view-tabs button:hover,
.calendar-dashboard-shell .calendar-view-tabs button:focus-visible {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  outline: 0;
}

.calendar-dashboard-shell .calendar-view-tabs button.active {
  border-color: #0f172a;
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.calendar-dashboard-shell .calendar-view-tabs .calendar-create-schedule-button {
  min-height: 36px;
  border-color: #0f172a;
  border-radius: 9px;
  background: #0f172a;
  color: #ffffff;
}

body.theme-dark .calendar-dashboard-shell,
body[data-theme="dark"] .calendar-dashboard-shell {
  --calendar-enterprise-border: #253247;
  --calendar-enterprise-line: #1f2a3d;
  --calendar-enterprise-surface: #0f172a;
  --calendar-enterprise-surface-soft: #111c31;
  --calendar-enterprise-text: #e5edf7;
  --calendar-enterprise-muted: #9aa8bb;
  --calendar-enterprise-shadow: 0 16px 44px rgba(0, 0, 0, 0.22);
}

@media (max-width: 1200px) {
  .calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-kpi-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .calendar-kpi-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .calendar-filter-panel {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .calendar-week-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .calendar-year-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 900px) {
  .calendar-dashboard-shell {
    padding: 10px;
  }

  .calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-timeoff-header,
  .calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-summary-panel .calendar-view-tabs {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-dashboard-shell.calendar-dashboard-shell-mantine .calendar-source-card {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-view-tabs {
    justify-content: flex-start;
  }

  .calendar-view-tabs .calendar-create-schedule-button {
    margin-left: 0;
  }

  .calendar-kpi-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .calendar-month-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 8px;
  }

  .calendar-day-cell {
    min-height: 92px;
    padding: 5px;
  }

  .calendar-month-grid.calendar-display-full .calendar-day-cell {
    min-height: 112px;
  }

  .calendar-event-chip {
    padding: 5px;
  }

  .calendar-event-chip span {
    display: none;
  }
}

@media (max-width: 560px) {
  .shadcn-calendar-card {
    --cell-size: 34px;
    min-width: 0;
    width: 100%;
  }

  .shadcn-calendar-weekdays,
  .shadcn-calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .shadcn-calendar-day {
    width: 100%;
  }

  .calendar-kpi-grid {
    grid-template-columns: 1fr;
  }

  .calendar-day-cell {
    min-height: 68px;
  }

  .calendar-event-stack {
    display: none;
  }
}

/* Calendar filter drawer uses the shared detail drawer so it inherits resize behavior. */
.content-grid.calendar-dashboard-mode > .detail-panel.calendar-detail-mode:not([hidden]) {
  position: fixed !important;
  top: 14px !important;
  right: 14px !important;
  bottom: 14px !important;
  left: auto !important;
  z-index: 96 !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
  width: min(var(--detail-width, 420px), calc(100vw - 32px)) !important;
  min-width: min(340px, calc(100vw - 32px)) !important;
  max-width: min(920px, calc(100vw - 32px)) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 28px) !important;
  padding: 0 !important;
  border: 1px solid #d8dee8 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28) !important;
  overflow: hidden !important;
}

.content-grid.calendar-dashboard-mode > .detail-panel.calendar-detail-mode:not([hidden]) > #resizeHandle.right-navigation-resize-handle {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.content-grid.calendar-dashboard-mode > .detail-panel.calendar-detail-mode:not([hidden]) > form {
  display: none !important;
}

.content-grid.calendar-dashboard-mode > .detail-panel.calendar-detail-mode:not([hidden]) [data-calendar-right-panel] {
  display: flex !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  padding: 22px 24px 24px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  scrollbar-gutter: stable !important;
  background: #ffffff !important;
}

body.theme-dark .content-grid.calendar-dashboard-mode > .detail-panel.calendar-detail-mode:not([hidden]),
body[data-theme="dark"] .content-grid.calendar-dashboard-mode > .detail-panel.calendar-detail-mode:not([hidden]) {
  border-color: rgba(148, 163, 184, 0.32) !important;
  background: #0f172a !important;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45) !important;
}

body.theme-dark .content-grid.calendar-dashboard-mode > .detail-panel.calendar-detail-mode:not([hidden]) [data-calendar-right-panel],
body[data-theme="dark"] .content-grid.calendar-dashboard-mode > .detail-panel.calendar-detail-mode:not([hidden]) [data-calendar-right-panel] {
  background: #0f172a !important;
}

/* USER UPDATE: Calendar owns one floating right drawer at a time.
   Hide the toolbar date-picker card while the filter drawer is open so the
   page cannot show two right-side floating surfaces. */
body.calendar-filter-drawer-open .content-grid.calendar-dashboard-mode [data-shadcn-calendar-card] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Legacy fallback for older Calendar filter drawer mounts.
   The active Calendar sidebar now uses the shared .detail-panel shell. */
body > .calendar-filter-drawer-shell {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  left: auto;
  z-index: 180;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(360px, calc(100vw - 32px));
  min-width: min(320px, calc(100vw - 32px));
  max-width: min(420px, calc(100vw - 32px));
  min-height: 0;
  border: 1px solid #d8dee8;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

body > .calendar-filter-drawer-shell[hidden] {
  display: none !important;
}

/* USER UPDATE: Calendar filter drawer is toggled by the shared floating
   right-navigation button, matching the document drawer trigger pattern. */
body.calendar-filter-drawer-open #floatingDocumentationButton.shadcn-toggle-bookmark[data-slot="toggle"] {
  z-index: 181 !important;
}

body > .calendar-filter-drawer-shell > [data-calendar-right-panel] {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  padding: 22px 24px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: #ffffff;
}

.content-grid.calendar-dashboard-mode > .detail-panel.calendar-detail-mode {
  display: none !important;
}

body.theme-dark > .calendar-filter-drawer-shell,
body[data-theme="dark"] > .calendar-filter-drawer-shell {
  border-color: rgba(148, 163, 184, 0.32);
  background: #0f172a;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

body.theme-dark > .calendar-filter-drawer-shell > [data-calendar-right-panel],
body[data-theme="dark"] > .calendar-filter-drawer-shell > [data-calendar-right-panel] {
  background: #0f172a;
}

/* USER UPDATE: Calendar filter drawer uses the document right-sidebar footer contract. */
body > .calendar-filter-drawer-shell > [data-calendar-right-panel] {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body > .calendar-filter-drawer-shell > [data-calendar-right-panel] > .calendar-right-panel-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 22px 24px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body > .calendar-filter-drawer-shell > [data-calendar-right-panel] > .calendar-right-bottom-actions {
  --pd-right-detail-footer-icon-size: 14px;
  --pd-right-detail-footer-label-size: 12px;
  position: static !important;
  inset: auto !important;
  z-index: 12 !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-items: stretch !important;
  justify-items: stretch !important;
  gap: 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 42px !important;
  margin: auto 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-top: 1px solid #e5e7eb !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

body > .calendar-filter-drawer-shell > [data-calendar-right-panel] > .calendar-right-bottom-actions > .right-detail-footer-action {
  height: 42px !important;
  min-height: 42px !important;
  gap: 6px !important;
  color: #334155 !important;
  font-size: var(--pd-right-detail-footer-label-size, 12px) !important;
  font-weight: 500 !important;
}

body > .calendar-filter-drawer-shell > [data-calendar-right-panel] > .calendar-right-bottom-actions :is(.right-detail-action-icon, .detail-save-icon) {
  width: var(--pd-right-detail-footer-icon-size, 14px) !important;
  min-width: var(--pd-right-detail-footer-icon-size, 14px) !important;
  height: var(--pd-right-detail-footer-icon-size, 14px) !important;
  min-height: var(--pd-right-detail-footer-icon-size, 14px) !important;
  flex: 0 0 var(--pd-right-detail-footer-icon-size, 14px) !important;
}

body > .calendar-filter-drawer-shell > [data-calendar-right-panel] > .calendar-right-bottom-actions > .right-detail-footer-action:is(:hover, :focus-visible, :active) {
  color: #2563eb !important;
}

body.theme-dark > .calendar-filter-drawer-shell > [data-calendar-right-panel] > .calendar-right-panel-body,
body[data-theme="dark"] > .calendar-filter-drawer-shell > [data-calendar-right-panel] > .calendar-right-panel-body {
  background: #0f172a;
}

body.theme-dark > .calendar-filter-drawer-shell > [data-calendar-right-panel] > .calendar-right-bottom-actions,
body[data-theme="dark"] > .calendar-filter-drawer-shell > [data-calendar-right-panel] > .calendar-right-bottom-actions {
  border-top-color: rgba(148, 163, 184, 0.26) !important;
  background: #0f172a !important;
}
