:root {
  --hrm-color-holiday: var(--oc-blue-8);
  --hrm-font-user-type-sm: 85%;
  --hrm-font-user-type: 90%;
}

/* Tabler calendar-check as a theme-aware CSS mask (follows text color) */
#attendance-approval legend::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin-right: 4px;
  background-color: currentcolor;
  mask: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M11.5%2021h-5.5a2%202%200%200%201%20-2%20-2v-12a2%202%200%200%201%202%20-2h12a2%202%200%200%201%202%202v6%22%2F%3E%3Cpath%20d%3D%22M16%203v4%22%2F%3E%3Cpath%20d%3D%22M8%203v4%22%2F%3E%3Cpath%20d%3D%22M4%2011h16%22%2F%3E%3Cpath%20d%3D%22M15%2019l2%202l4%20-4%22%2F%3E%3C%2Fsvg%3E') center / contain no-repeat;
}

div.avatar-picture-block {
  width: 250px;
  height: 250px;
  border: 1px var(--oc-gray-4) solid;
}

/* reporting overview table styles */

body.controller-hrm_reports table.list th { text-align: left; }
body.controller-hrm_reports table.list td.name { padding: 4px; }

body.controller-reporting_reports table.list td.number {
  width: 20px !important;
  padding: 2px !important;
}

.controller-hrm_reports.action-show table.list td.name {
  padding: 4px;
}

/* table width */
.controller-hrm_users .checkbox { width: 45px; }

#hrm {
  background: var(--oc-gray-2);
  border: 1px solid var(--a-color-input-border);
  padding: 10px;
  margin-bottom: 20px;
}

.controller-hrm_users.action-show td.checkbox,
.controller-hrm_users.action-show th.checkbox {
  width: 45px !important;
  text-align: left;
  padding-left: 4px;
}

.controller-hrm_users.action-show tr.user td {
  width: auto;
}

.custom-submenu-item input[type='text'] {
  background-color: var(--oc-grape-1);
}

.hrm-resources ul li {
  display: block;
  border-bottom: 1px solid var(--a-color-border-light);
  padding: 5px;
  list-style: none;
}

.hrm-issue-resource-problems .value li {
  list-style: none;
}

.hrm-resources ul li:hover {
  background-color: var(--a-color-highlight);
  border-radius: 4px;
}

.hrm-issue-resource-problems .value ul {
  padding-left: 0;
}

.hrm-issue-resource-problems .label {
  font-weight: bold;
}

.hrm-issue-resource-problems .resource-problem-info {
  color: var(--a-color-default);
}

.hrm-issue-resource-problems .resource-problem-warning {
  color: var(--a-color-alert);
}

.hrm-resources p:first-child {
  font-weight: 400;
}

.hrm-resources ul li:last-child {
  border-bottom: 0;
}

/* User top style */

.use.details .subject_header .subject_info li {
  line-height: 20px;
  white-space: nowrap;
  min-height: 20px;
}

div.user.details table.subject_header td.subject_info {
  border-left: 1px solid var(--a-color-border-light);
  padding-right: 15px;
  padding-left: 15px;
  min-width: 200px;
  width: 200px;
}

div#user-tab-links ul li {
  display: inline;
}

#user-tab-links ul li a {
  border: 1px solid var(--a-color-list-border);
  background: var(--a-color-even);
  padding: 5px 8px;
  text-decoration: none;
  border-radius: 3px;
  margin-right: 5px;
}

a.group-link {
  margin-right: 5px;
}

/* admin marker: Tabler settings icon as a theme-aware CSS mask */
a.user.admin::after,
.controller-users span.user.admin::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 2px;
  vertical-align: middle;
  background-color: currentcolor;
  mask: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M10.325%204.317c.426%20-1.756%202.924%20-1.756%203.35%200a1.724%201.724%200%200%200%202.573%201.066c1.543%20-.94%203.31%20.826%202.37%202.37a1.724%201.724%200%200%200%201.065%202.572c1.756%20.426%201.756%202.924%200%203.35a1.724%201.724%200%200%200%20-1.066%202.573c.94%201.543%20-.826%203.31%20-2.37%202.37a1.724%201.724%200%200%200%20-2.572%201.065c-.426%201.756%20-2.924%201.756%20-3.35%200a1.724%201.724%200%200%200%20-2.573%20-1.066c-1.543%20.94%20-3.31%20-.826%20-2.37%20-2.37a1.724%201.724%200%200%200%20-1.065%20-2.572c-1.756%20-.426%20-1.756%20-2.924%200%20-3.35a1.724%201.724%200%200%200%201.066%20-2.573c-.94%20-1.543%20.826%20-3.31%202.37%20-2.37c1%20.608%202.296%20.07%202.572%20-1.065%22%2F%3E%3Cpath%20d%3D%22M9%2012a3%203%200%201%200%206%200a3%203%200%200%200%20-6%200%22%2F%3E%3C%2Fsvg%3E') center / contain no-repeat;
}

a.user.active-admin::after,
.controller-users span.user.active-admin::after {
  background-color: var(--a-color-alert);
}

#sidebar ul li span.label {
  font-weight: bold;
  margin-right: 3px;
  line-height: 1.3em;
}

/* attendance leave-type clock: stroke (outline) or fill (filled) follow the
   positive/negative color set on the icon */
svg.icon-svg.hrm-leave-icon {
  stroke: currentcolor;
}

svg.icon-svg-filled.hrm-leave-icon {
  fill: currentcolor;
  stroke: none;
}

.controller-hrm_calendars p.buttons,
.controller-hrm_user_performances p.buttons {
  margin-top: unset;
}

/* Kalender Farben */

#hrm-calendar .hrm-attendance.tooltip {
  background: var(--oc-blue-1);
  border: 1px solid var(--hrm-color-holiday);
  border-left: 4px solid var(--hrm-color-holiday) !important;
  padding: 2px 6px;
  border-radius: 5px;
  margin-top: 1px;
  margin-bottom: 1px;
}

/* Calendar issue chips: neutral card instead of the core yellow issue-box look
   (core div.issue reuses the issue-detail-page style, incl. its 16px padding).
   Scoped to the HRM calendars so the issue detail page and core calendars stay
   unchanged; the left accent (project color) stays via the inline border-left. */
#hrm-calendar div.issue {
  background: var(--oc-gray-1);
  border: 1px solid var(--oc-gray-3);
  border-radius: 5px;
  padding: 6px 8px;
  font-size: var(--a-font-size-sm);
  line-height: 1.35;
}

/* Calendar issue chip content: mute the project link and emphasize the issue
   reference (matching the resource popover ticket style). Open issues only -
   closed issues keep the core gray + line-through untouched. */
#hrm-calendar div.issue > a:not(.issue) {
  display: block;
  margin-block-end: 2px;
  color: var(--oc-gray-6);
  font-size: var(--a-font-size-xs);
}

#hrm-calendar div.issue a.issue:not(.closed) {
  color: var(--oc-indigo-7);
  font-weight: 600;
}

#hrm-calendar .today .day-num {
  border-top: 2px solid var(--a-color-orange);
}

/* === Resource tooltip box (plugin-wide) ===
   The jQuery UI tooltip (hrm_tooltips.js, tooltipClass "resource-tooltip") is
   used on the resource view and on the working-/absence-calendar pages. Its box
   is styled here - not in the resource-only hrm_resources.css - so it looks the
   same everywhere: the floating-card look of the resource click popover (opaque,
   subtle border, soft directional shadow) instead of the old translucent box
   with a diffuse glow. Scoped with .ui-tooltip so the open-color border wins
   over jQuery UI's hardcoded .ui-widget-content border. */
.ui-tooltip.resource-tooltip {
  max-width: 320px;
  padding: 10px 12px;
  font-size: var(--a-font-size-sm);
  color: var(--oc-gray-9);
  text-align: left;
  background: var(--a-color-white);
  border: 1px solid var(--oc-gray-3);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
}

.hrm-attendances svg.icon-svg.hrm-info-icon,
.resource-tooltip svg.icon-svg.hrm-info-icon,
#hrm-calendar .hrm-attendance.tooltip svg.icon-svg.hrm-info-icon {
  stroke: var(--oc-pink-7);
}

.controller-calendars .tooltip span.tip,
#hrm-calendar .hrm-attendance.tooltip:hover span.tip {
  border-radius: 3px;
  box-shadow: 2px 3px 14px var(--oc-gray-7);
  font-size: 100% !important;
  padding: 10px;
}

.hrm-calendar-holiday {
  background-color: var(--oc-blue-0);
}

.hrm-calendar-holiday p.day-num {
  border-top: 2px solid var(--hrm-color-holiday) !important;
  color: var(--hrm-color-holiday) !important;
}

.hrm-calendar-holiday .calendar-holiday {
  margin-bottom: 2px;
}

#hrm-calendar .holiday {
  background-color: var(--hrm-color-holiday) !important;
  opacity: 0.8;
  color: var(--a-color-white);
  border-radius: 3px;
  padding: 0 2px;
}

/* resources query totals */

.attendances-query-totals { text-align: right; }
.attendances-query-totals > span:not(:first-child) { margin-left: 0.6em; }
.attendances-query-totals .value { font-weight: bold; }

.resources-query-totals,
.attendances-query-totals {
  padding: 5px 0 0;
  margin-bottom: 5px;
}

.resources-query-totals .value,
.attendances-query-totals .value {
  margin-right: 8px;
}

.resources-query-totals dt,
.resources-query-totals dd,
.attendances-query-totals dt,
.attendances-query-totals dd {
  display: inline;
  margin-left: 2px;
}

select#month,
select#year {
  margin-left: 3px;
}

.resources-query-totals dt::after {
  content: ':';
}

.attendances-query-totals dt::after {
  content: ':';
}

/* Modern KPI-card look for the attendance totals, leaning on the resource card
   (.resources-query-totals). Applies in both modes (default and the extra
   column-sums mode) so the HRM totals block looks consistent either way. The
   dl-prefix keeps specificity above the plain base rules above and avoids a
   duplicate-selector clash with them. */
dl.attendances-query-totals {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;

  /* cancel the negative margin-top .query-totals uses to sit on the buttons
     row - as a full-width card it must drop below the buttons instead. */
  margin-top: 0;
  margin-bottom: 1.1rem;
  text-align: left;
  background: var(--a-color-white);
  border: 1px solid var(--oc-gray-2);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgb(33 37 41 / 5%);
}

dl.attendances-query-totals dt {
  margin: 0;
  font-size: var(--a-font-size-sm);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--oc-gray-6);
}

dl.attendances-query-totals dt:not(:first-of-type) {
  margin-left: 1rem;
}

dl.attendances-query-totals dd.value {
  margin: 0;
  font-size: var(--a-font-size-lg);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--oc-gray-8);
}

/* Availability meter bar in the totals card - the fill width is data-driven
   (set inline in _totals.html.slim). Neutral indigo while under target, green
   once availability reaches 100 %. */
.attendances-query-totals .avail-bar {
  display: inline-block;
  width: 64px;
  height: 8px;
  margin-right: 0.45rem;
  overflow: hidden;
  vertical-align: middle;
  background: var(--oc-gray-2);
  border-radius: 999px;
}

.attendances-query-totals .avail-bar i {
  display: block;
  height: 100%;
  background: var(--oc-indigo-5);
  border-radius: 999px;
}

.attendances-query-totals .avail-bar.full i {
  background: var(--oc-green-6);
}

svg.icon-svg.hrm-version-start-color,
svg.icon-svg.hrm-version-end-color {
  stroke: currentcolor;
  vertical-align: middle;
  filter: drop-shadow(0 0 2px var(--a-color-white));
}

.hrm-version-start-color {
  color: var(--a-color-success);
}

.hrm-version-end-color {
  color: var(--a-color-alert);
}

.hrm-icon-version {
  padding-left: 2px;
}

.hrm-left-border-tooltip {
  border-left-width: 4px;
  border-left-style: solid;
  padding-left: 4px;
}

.list.hrm-performance-summary {
  margin-bottom: 16px;
}

.hrm-legend-info {
  padding-bottom: 10px;
  font-size: var(--a-font-size-xs);
}

.hrm-legend-item {
  display: inline-flex;
  margin-right: 15px;
}

.legend-box {
  min-width: 30px;
  height: 14px;
  font-size: var(--a-font-size-xs);
  padding: 2px;
  border: 1px solid var(--a-color-input-border);
  text-align: center;
  margin-right: 3px;
  border-radius: 3px;
}

.legend-box.working-day {
  font-weight: 600;
}

.legend-box.non-working-day {
  font-style: italic;
  color: var(--a-color-muted);
}

/* User tabs */

#tab-placeholder-timelog dl dt {
  margin-left: 2em !important;
}

#tab-placeholder-timelog dl dd {
  padding-bottom: 4px;
}

#tab-placeholder-timelog dl span.description {
  display: block;
  color: var(--a-color-info);
}

body.controller-users.action-show div#activity dd {
  margin-bottom: 1em;
  padding-top: 2px;
  padding-left: 0;
  margin-left: 0;
}

div.user.details {
  background: var(--oc-gray-2);
  padding: 6px;
  margin-bottom: 6px;
  border: 1px solid var(--a-color-list-border);
  border-radius: 5px;
}

div.user.details table.subject_header td.name {
  vertical-align: top;
}

div.user.details table.subject_header {
  width: 100%;
}

div.user.details table.subject_header h1 {
  margin-bottom: 0;
}

div.user.details table.subject_header td.avatar {
  vertical-align: top;
  text-align: right;
  width: 70px;
}

.user.details .labeled-list .line {
  padding-left: 0;
  margin: 0;
  white-space: nowrap;
  color: var(--a-color-info);
}

.user.details .labeled-list .line.attendance {
  color: var(--a-color-dark);
  font-weight: bold;
}

/* Only used for custom style in absence calendar */
div.hrm-attendance.absence.tag {
  margin: 2px;
  padding: 2px 6px;
  border-radius: 5px;
}

.tab-placeholder {
  display: none;
}

.tab-placeholder.active {
  display: block !important;
}

#user-tab-links ul {
  margin-left: 0;
  padding-left: 0;
  margin-top: 20px;
  list-style: none;
}

#attendance-range select {
  width: auto;
}

.hrm-user-performance-chart {
  height: 200px;
}

/* Dashboard block: holidays */

#block-holidays ul.reporting-list li {
  display: flex;
  gap: 8px;
}

.holiday-date {
  color: var(--a-color-text-muted);
  white-space: nowrap;
}

.holiday-name {
  flex: 1;
}

/* Dashboard block: resources */

p.allocated-hours {
  display: flex;
  justify-content: space-between;
}

.ph-label {
  color: var(--a-color-text-muted);
}

.ph-value {
  font-weight: 600;
}

/* Account menu: set the HRM self-link group (registered above core's items in
 * init.rb) apart from the core account items, using the same separator core
 * draws before "Abmelden". :has() keeps the line out when no HRM link is
 * present, so the menu looks the same with and without HRM. */
#account .dropdown-content ul:has(.hrm-my-attendance) .my-profile {
  border-block-start: 1px solid var(--oc-gray-2);
}
