/* HR management UI: one product-inspired shell, one alignment and surface system.
   Keep long-form copy and editable fields left-aligned for legibility. */
body.hr-cake-workspace-v1 {
  --cake-sidebar: 252px;
  --hr-ui-canvas: #f5f5f7;
  --hr-ui-surface: #fff;
  --hr-ui-ink: #1d1d1f;
  --hr-ui-muted: #64646a;
  --hr-ui-line: rgba(60, 60, 67, .13);
  --hr-ui-blue: #0071e3;
  --hr-ui-blue-soft: rgba(0, 113, 227, .09);
  --hr-ui-radius: 18px;
  --hr-ui-shadow: 0 1px 2px rgba(0, 0, 0, .025), 0 12px 34px rgba(0, 0, 0, .045);
  color: var(--hr-ui-ink);
  background: var(--hr-ui-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Product-like navigation: a readable width, clear groups and consistent icons. */
@media (min-width: 901px) {
  body.hr-cake-workspace-v1:not(.performance-workspace-v1) .side-panel {
    padding: 18px 12px 14px;
    background: rgba(247, 247, 249, .9);
    border-right: 1px solid var(--hr-ui-line);
    box-shadow: none;
  }
  body.hr-cake-workspace-v1:not(.performance-workspace-v1) .content-panel {
    padding: 22px clamp(18px, 2.2vw, 34px) 36px;
  }
  body.performance-workspace-v1 .sidebar {
    padding: 78px 12px 14px;
    background: rgba(247, 247, 249, .9);
    border-right: 1px solid var(--hr-ui-line);
    box-shadow: none;
  }
}

body.hr-cake-workspace-v1:not(.performance-workspace-v1) .sidebar-brand {
  min-height: 60px;
  grid-template-columns: 42px minmax(0, 1fr) 8px;
  gap: 12px;
  margin: 0 2px 14px;
  padding: 7px 9px;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .sidebar-brand-mark {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(145deg, #111214, #34363a 54%, #0071e3 145%);
  color: #fff;
  box-shadow: inset 0 1px rgba(255,255,255,.18), 0 9px 24px rgba(0,0,0,.14);
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .sidebar-brand-copy strong { font-size: 15px; }
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .sidebar-brand-copy span {
  font-size: 10px;
  letter-spacing: .08em;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .nav-section-label {
  margin: 15px 12px 5px;
  color: #85858b;
  font-size: 10px;
  font-weight: 740;
  letter-spacing: .08em;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .module-nav > :is(button, .module-link) {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 11px;
  border-radius: 11px;
  text-align: left;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .module-nav > :is(button, .module-link) > .app-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  padding: 5px;
  border-radius: 8px;
  background: rgba(60, 60, 67, .07);
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .module-nav > :is(button.active, .module-link.active) > .app-icon {
  background: rgba(0, 113, 227, .13);
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .module-nav > :is(button, .module-link) > .nav-count {
  margin-left: auto;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .module-nav :is(button.active, .module-link.active),
body.performance-workspace-v1 .sidebar .nav-item.active {
  border-color: transparent;
  background: var(--hr-ui-blue-soft);
  color: #0066cc;
  box-shadow: none;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .module-nav :is(button.active, .module-link.active)::before {
  display: none;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .nav-subgroup-title {
  min-height: 42px;
  padding-inline: 11px;
  font-weight: 630;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .nav-subgroup-items {
  margin-left: 24px;
  padding-left: 10px;
  border-left-color: rgba(60, 60, 67, .13);
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .nav-subgroup-items button {
  padding-inline: 12px;
  font-size: 12px;
  text-align: left;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) .nav-health-card {
  margin-top: auto;
  background: #eef6f1;
  border-color: rgba(22, 136, 63, .13);
  box-shadow: none;
}
body.performance-workspace-v1 .sidebar::before {
  background: transparent;
  box-shadow: none;
  font-size: 15px;
}
body.performance-workspace-v1 .sidebar .nav-item {
  min-height: 44px;
  gap: 10px;
  margin-bottom: 3px;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 620;
}
body.performance-workspace-v1 .sidebar .nav-item svg {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  padding: 5px;
  border-radius: 8px;
  background: rgba(60, 60, 67, .07);
}
body.performance-workspace-v1 .sidebar .nav-item.active svg { background: rgba(0, 113, 227, .13); }

/* Shared page hierarchy and centered summary content across management modules. */
body.hr-cake-workspace-v1:not(.performance-workspace-v1) #mainView > .apple-module {
  gap: 16px;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) :is(.panel-header, .apple-page-head, .payroll-calc-header, .report-page-header) {
  min-height: 106px;
  padding: 22px clamp(18px, 2vw, 28px);
  border: 1px solid var(--hr-ui-line);
  border-radius: var(--hr-ui-radius);
  background: var(--hr-ui-surface);
  box-shadow: var(--hr-ui-shadow);
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) :is(.panel-header, .apple-page-head, .payroll-calc-header, .report-page-header) > :first-child {
  min-width: 0;
  text-align: center;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) :is(.panel-header, .apple-page-head, .payroll-calc-header, .report-page-header) > :first-child > :is(p, h1, h2) {
  text-align: center;
}
body.hr-cake-workspace-v1:not(.performance-workspace-v1) :is(.panel-header-actions, .apple-head-actions, .payroll-calc-actions) {
  justify-content: center;
}
body.hr-cake-workspace-v1 :is(.metric-card, .apple-metric, .payroll-calc-kpi, .stat-card, .attendance-stat-card) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  text-align: center;
  border-radius: var(--hr-ui-radius);
}
body.hr-cake-workspace-v1 :is(.metric-card, .apple-metric, .payroll-calc-kpi, .stat-card, .attendance-stat-card) :is(strong, small, span, p) {
  text-align: center;
}
body.hr-cake-workspace-v1 :is(.section-heading, .apple-card-head) > :first-child {
  min-width: 0;
  text-align: center;
}

/* Reading tables become centered and vertically aligned; narrative cells stay readable. */
body.hr-cake-workspace-v1 :is(.table-wrap, .apple-table-wrap, .attendance-table-wrap, .payroll-calc-table-wrap) table > :is(thead, tbody) > tr > :is(th, td) {
  text-align: center;
  vertical-align: middle;
}
body.hr-cake-workspace-v1 :is(.table-wrap, .apple-table-wrap, .attendance-table-wrap) :is(.number, .actions-col) {
  text-align: center;
}
body.hr-cake-workspace-v1 :is(.table-wrap, .apple-table-wrap, .attendance-table-wrap) :is(.table-actions, .person-cell) {
  justify-content: center;
  align-items: center;
}
body.hr-cake-workspace-v1 :is(.table-wrap, .apple-table-wrap) :is(.file-name-cell, .description-cell, .notes-cell) {
  text-align: left;
}
body.hr-cake-workspace-v1 :is(.payroll-register-field, .payslip-register-field, .payroll-card-field) {
  justify-items: center;
  align-items: center;
  text-align: center;
}
body.hr-cake-workspace-v1 :is(.primary, .ghost-button, .mini-button, .payslip-action, .btn) {
  justify-content: center;
  text-align: center;
}

/* Legal-day identity is an annotation, never a rewrite of payroll attendance. */
body.hr-cake-workspace-v1 .attendance-status-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}
body.hr-cake-workspace-v1 .attendance-legal-holiday {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid #f1d9aa;
  border-radius: 8px;
  background: #fff8ea;
  color: #895709;
  font-size: 11px;
  font-weight: 690;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}
body.hr-cake-workspace-v1 .attendance-holiday-load-error {
  margin: 0 0 10px;
  padding: 10px 14px;
  border: 1px solid #f1d9aa;
  border-radius: 11px;
  background: #fff8ea;
  color: #895709;
  text-align: center;
}
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-table :is(th, td):nth-child(13) {
  width: 146px;
  min-width: 146px;
}
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-table .table-actions {
  justify-content: center;
}

/* The separate performance page uses the same neutral canvas and card language. */
body.performance-workspace-v1 {
  --bg: var(--hr-ui-canvas);
  --bg-2: #fbfbfd;
  --ink: var(--hr-ui-ink);
  --muted: var(--hr-ui-muted);
  --line: var(--hr-ui-line);
  --blue: var(--hr-ui-blue);
  --shadow: var(--hr-ui-shadow);
  --shadow-soft: var(--hr-ui-shadow);
  background: var(--hr-ui-canvas);
}
body.performance-workspace-v1 .topbar,
body.performance-workspace-v1 :is(.panel, .department-card, .detail-panel, .toolbar, .metric-card) {
  border-color: var(--hr-ui-line);
  border-radius: var(--hr-ui-radius);
  background: var(--hr-ui-surface);
  box-shadow: var(--hr-ui-shadow);
}
body.performance-workspace-v1 .metric-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
body.performance-workspace-v1 :is(.table-wrap, .department-card) table :is(th, td) {
  text-align: center;
  vertical-align: middle;
}
body.performance-workspace-v1 .side-note {
  background: #eef6f1;
  color: #205a39;
  box-shadow: none;
}
body.performance-workspace-v1 .side-note span { color: #567b65; }

@media (max-width: 900px) {
  body.hr-cake-workspace-v1:not(.performance-workspace-v1) .content-panel { padding: 0 0 24px; }
  body.hr-cake-workspace-v1:not(.performance-workspace-v1) :is(.panel-header, .apple-page-head, .payroll-calc-header, .report-page-header) {
    min-height: 0;
    padding: 18px 14px;
  }
  body.hr-cake-workspace-v1:not(.performance-workspace-v1) :is(.panel-header-actions, .apple-head-actions, .payroll-calc-actions) {
    position: static;
    flex-wrap: wrap;
  }
  body.hr-cake-workspace-v1:not(.performance-workspace-v1) .nav-section-label { margin-top: 10px; }
}

/* Daily attendance: one compact, aligned row per day on desktop. */
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-list {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--hr-ui-line);
  border-radius: 14px;
  background: var(--hr-ui-surface);
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hr-ui-line);
  color: var(--hr-ui-muted);
  font-size: 12px;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-list-toolbar label {
  display: inline-flex;
  width: max-content !important;
  min-width: max-content;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  color: var(--hr-ui-ink);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-list-toolbar input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] :is(.attendance-daily-list-head, .attendance-daily-record-main) {
  display: grid;
  grid-template-columns: 26px 86px minmax(66px, .7fr) minmax(90px, .95fr) minmax(84px, .9fr) minmax(92px, .95fr) minmax(76px, .8fr) minmax(76px, .8fr) minmax(70px, .75fr) minmax(76px, .7fr) minmax(108px, 1fr);
  grid-template-areas: "select date person org shift punch work lateearly leave status actions";
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-list-head {
  min-height: 40px;
  background: #f7f9fc;
  color: #607087;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-record {
  min-width: 0;
  border-top: 1px solid var(--hr-ui-line);
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-record-main {
  min-height: 58px;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-cell {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--hr-ui-ink);
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-cell::before {
  display: none;
  content: attr(data-label);
  color: var(--hr-ui-muted);
  font-size: 10px;
  font-weight: 700;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-cell :is(strong, small) {
  max-width: 100%;
  line-height: 1.3;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-cell small {
  color: var(--hr-ui-muted);
  font-size: 11px;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-date { grid-area: date; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-person { grid-area: person; }
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-org { grid-area: org; }
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-shift { grid-area: shift; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-punch { grid-area: punch; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-work { grid-area: work; }
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-late-early { grid-area: lateearly; }
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-leave { grid-area: leave; }
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-status { grid-area: status; }
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-select { grid-area: select; }
body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-actions { grid-area: actions; }

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-actions .table-actions {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: nowrap;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-actions .mini-button {
  width: auto !important;
  min-width: 0;
  min-height: 30px;
  padding: 0 6px;
  font-size: 11px;
  white-space: nowrap;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 2px;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-pair > span {
  min-width: 0;
  color: var(--hr-ui-muted);
  font-size: 10px;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-pair .attendance-minute-cell {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 2px;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-pair .attendance-minute-cell strong {
  font-size: 12px;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-pair .attendance-minute-cell .unit {
  margin: 0;
  font-size: 10px;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-pair .attendance-minute-cell small {
  flex-basis: 100%;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-leave .attendance-leave-detail {
  display: block;
  max-width: 100%;
  color: var(--hr-ui-ink);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-empty { padding: 16px; }

@media (max-width: 1280px) {
  body.hr-cake-workspace-v1[data-hr-view="attendance"] :is(.attendance-daily-list-head, .attendance-daily-record-main) {
    grid-template-columns: 22px 74px minmax(0, .8fr) minmax(0, 1.05fr) minmax(0, .95fr) minmax(0, 1.05fr) minmax(0, .8fr) minmax(0, .8fr) minmax(0, .8fr) minmax(0, .7fr) minmax(96px, 1fr);
    gap: 2px;
    padding-inline: 6px;
  }
  body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-cell { font-size: 11px; }
  body.hr-cake-workspace-v1[data-hr-view="attendance"] :is(.attendance-daily-shift, .attendance-daily-punch) { white-space: normal; }
  body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-actions .mini-button {
    padding-inline: 4px;
    font-size: 10px;
  }
}

@media (max-width: 760px) {
  body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-list-head { display: none; }
  body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-record-main {
    grid-template-columns: 24px repeat(2, minmax(0, 1fr));
    grid-template-areas: "select date person" ". org shift" ". punch status" ". work lateearly" ". leave actions";
    gap: 6px;
    padding: 10px;
  }
  body.hr-cake-workspace-v1[data-hr-view="attendance"] .attendance-daily-cell::before { display: block; }
}
.attendance-manual-shift-fields { display: none; }
.form-section:has(.attendance-shift-choice-list input[name="shiftRuleId"][value="__manual__"]:checked) .attendance-manual-shift-fields { display: block; }
