/* Load after styles.css / mobile.css. Explicit surfaces only: never round all
   buttons/children. No generic clipping or SVG path/interaction overrides.
   classic emits no host radius overrides; removing custom color restores CSS.
   Calendar cells, avatars, logos, badges and icon-button circles stay intact. */
html[data-tajofy-preset="soft"],
html[data-tajofy-preset="contrast"] {
  --tajofy-card-radius: 14px;
  --tajofy-button-radius: 10px;
}

html:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .panel-section, .metric, .attendance-banner, .notification-panel,
  .annual-month, .calendar, .mobile-section, .profile-head, .profile-details,
  .profile-security, .document-list, .document-row, .mobile-calendar-grid,
  .calendar-batch-card, .calendar-main, .calendar-template, .document-policy-list,
  .mandatory-documents, .employee-mandatory-documents, .profile-watch, .attendance-status,
  .day-summary, .vacation-balance, .leave-row, .mobile-notification-list,
  .mobile-notification-item, .team-summary, .team-list, .team-row,
  .work-center-card, .incident-card, .vacation-expiry-card,
  .vacation-settlement-card
) {
  border-radius: var(--tajofy-card-radius);
}

/* Web admin surfaces: Mi jornada uses attendance-main, while corrections paint
   the list container (the empty-state itself has no border/background).
   Keep existing table scrolling and menu overflow; never clip whole cards. */
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .attendance-main, .table-wrap,
  .incident-correction-section > .correction-request-list,
  .daily-report-list, .company-timeline
) {
  border-radius: var(--tajofy-card-radius);
}

/* Menu tables deliberately allow overflow. Round only perimeter paint, including
   row hover backgrounds, without changing collapsed borders or sticky headers. */
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .table-wrap > table > thead,
  .table-wrap > table > thead > tr:first-child
) {
  border-start-start-radius: calc(var(--tajofy-card-radius) - 1px);
  border-start-end-radius: calc(var(--tajofy-card-radius) - 1px);
}
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .table-wrap > table > thead > tr:first-child > :first-child {
  border-start-start-radius: calc(var(--tajofy-card-radius) - 1px);
}
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .table-wrap > table > thead > tr:first-child > :last-child {
  border-start-end-radius: calc(var(--tajofy-card-radius) - 1px);
}
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .table-wrap > table > tbody:last-child > tr:last-child,
  .daily-report-list > .daily-report-row:last-child
) {
  border-end-start-radius: calc(var(--tajofy-card-radius) - 1px);
  border-end-end-radius: calc(var(--tajofy-card-radius) - 1px);
}
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .table-wrap > table > tbody:last-child > tr:last-child > :first-child {
  border-end-start-radius: calc(var(--tajofy-card-radius) - 1px);
}
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .table-wrap > table > tbody:last-child > tr:last-child > :last-child {
  border-end-end-radius: calc(var(--tajofy-card-radius) - 1px);
}
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .daily-report-list > .daily-report-row:first-child {
  border-start-start-radius: calc(var(--tajofy-card-radius) - 1px);
  border-start-end-radius: calc(var(--tajofy-card-radius) - 1px);
}

/* History's table joins its summary: only its bottom edge is exposed. */
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .leave-history > .table-wrap,
  .leave-history > .table-wrap > table > thead,
  .leave-history > .table-wrap > table > thead > tr:first-child,
  .leave-history > .table-wrap > table > thead > tr:first-child > th
) {
  border-start-start-radius: 0;
  border-start-end-radius: 0;
}

/* These two menu tables become cards with hidden headers at this breakpoint.
   Their first row, rather than a header cell, paints the exposed top edge. */
@media (max-width: 1100px) {
  html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
    .table-wrap > .employee-document-grid > tbody > tr:first-child,
    .template-library .table-wrap > table > tbody > tr:first-child
  ) {
    border-start-start-radius: calc(var(--tajofy-card-radius) - 1px);
    border-start-end-radius: calc(var(--tajofy-card-radius) - 1px);
  }
}

/* Monthly attendance paints non-working summaries and expanded events over the
   panel. Only the last day's visible face reaches the bottom perimeter; keep
   an open summary square where it joins its events. Details can also paint an
   incident-focus background, so its own perimeter must follow the panel. */
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(.month-attendance, .employee-month-attendance) > .month-day-list:last-child > .month-day:last-child,
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(.month-attendance, .employee-month-attendance) > .month-day-list:last-child > .month-day:last-child:not([open]) > summary,
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(.month-attendance, .employee-month-attendance) > .month-day-list:last-child > .month-day:last-child[open] > .month-day-events:last-child {
  border-end-start-radius: calc(var(--tajofy-card-radius) - 1px);
  border-end-end-radius: calc(var(--tajofy-card-radius) - 1px);
}

/* Employee/report panels start directly with the list. A headed month panel
   keeps the first summary square against its heading, including on hover. */
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(.month-attendance, .employee-month-attendance) > .month-day-list:first-child > .month-day:first-child,
html:not(.tajofy-mobile):is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(.month-attendance, .employee-month-attendance) > .month-day-list:first-child > .month-day:first-child > summary {
  border-start-start-radius: calc(var(--tajofy-card-radius) - 1px);
  border-start-end-radius: calc(var(--tajofy-card-radius) - 1px);
}

/* Painted headers must follow their card's top corners without introducing
   overflow clipping (which could cut calendar selection/focus indicators). */
html:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .annual-month > h3, .notification-panel > header,
  .document-list > .mobile-document-group:first-child > h2
) {
  border-start-start-radius: calc(var(--tajofy-card-radius) - 1px);
  border-start-end-radius: calc(var(--tajofy-card-radius) - 1px);
}

html:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  button.primary, button.secondary, button.danger, .button-link,
  .mobile-attendance-action, .document-row-actions button
):not(.icon-button):not(.avatar-button):not(.mobile-notification-shortcut):not(.calendar-day):not(.attendance-state-action) {
  border-radius: var(--tajofy-button-radius);
}

/* Only neutral surfaces receive card color; attendance, alerts, selection and
   calendar event colors retain their semantic backgrounds and foregrounds. */
html[data-tajofy-preset][data-tajofy-card-color="custom"] :is(
  .panel-section, .metric, .profile-head, .profile-details, .profile-security
) {
  background-color: var(--tajofy-card-color);
  color: var(--tajofy-card-ink);
}
html[data-tajofy-preset][data-tajofy-card-color="custom"] :is(
  .panel-section, .metric, .profile-head, .profile-details, .profile-security
) :is(h1, h2, h3, label, dt, dd, .muted):not(.tajofy-appearance-editor *),
html[data-tajofy-preset][data-tajofy-card-color="custom"] .metric > span,
html[data-tajofy-preset][data-tajofy-card-color="custom"] .profile-head > p,
html[data-tajofy-preset][data-tajofy-card-color="custom"] .profile-security small {
  color: var(--tajofy-card-ink);
}

/* Contrast increases neutral text/separation without recoloring status cues.
   Inset borders do not change element dimensions or touch areas. */
html[data-tajofy-preset="contrast"] :is(
  .panel-section, .metric, .profile-head, .profile-details, .profile-security,
  .mobile-section, .document-list, .annual-month
) {
  box-shadow: inset 0 0 0 1px var(--tajofy-card-ink, #46515c);
}
html[data-tajofy-preset="contrast"] :is(
  .panel-section .muted, .metric > span, .profile-head > p, .profile-details dt,
  .profile-security small
) {
  color: var(--tajofy-card-ink, #35434e);
}
html[data-tajofy-preset="contrast"] :is(button, a, input, select, textarea):focus-visible {
  outline: 3px solid #167c72;
  outline-offset: 3px;
}

/* The existing MDI circle + arrow share a single path: never hide that path.
   A fine same-color stroke visibly reinforces the silhouette even when the
   host has no shadow. 0.4 SVG units on the existing 24-unit icons; viewBox,
   paths, fills, state colors, dimensions and button targets remain unchanged.
   Direct children only, so nested charts/maps and loading spinners are safe. */
html[data-tajofy-preset][data-tajofy-attendance-icon="simple"] .attendance-state-action > svg,
html[data-tajofy-preset][data-tajofy-attendance-icon="simple"] .attendance-actions > button > svg {
  filter: none;
  stroke: currentColor;
  stroke-width: 0.4px;
  stroke-linejoin: round;
  paint-order: stroke fill;
}

html[data-tajofy-preset] .tajofy-appearance-editor {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  padding: 16px;
  border: 1px solid #aab6bf;
  border-radius: 14px;
  background: #ffffff;
  color: #17212b;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
html[data-tajofy-preset] .tajofy-appearance-editor fieldset {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid #aab6bf;
}
html[data-tajofy-preset] .tajofy-appearance-editor label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #35434e;
}
html[data-tajofy-preset] .tajofy-appearance-editor :is(input, select) {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #66727e;
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
  color: #17212b;
  font: inherit;
}
html[data-tajofy-preset] .tajofy-appearance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
html[data-tajofy-preset] .tajofy-appearance-editor button {
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
  padding: 8px 14px;
  border-radius: 10px;
  font: inherit;
}
html[data-tajofy-preset] .tajofy-appearance-editor .primary {
  border: 1px solid #0d5e56;
  background: #0d5e56;
  color: #ffffff;
}
html[data-tajofy-preset] .tajofy-appearance-editor .secondary {
  border: 1px solid #66727e;
  background: #ffffff;
  color: #17212b;
}
html[data-tajofy-preset] .tajofy-appearance-editor :is(button, input, select):focus-visible {
  outline: 3px solid #167c72;
  outline-offset: 2px;
}
html[data-tajofy-preset] .tajofy-appearance-editor fieldset:disabled { opacity: .7; }

/* Mobile surfaces include painted children: rounding only their container leaves
   square corners when a heading or expanded row has its own background. Keep
   list interiors joined and round the exposed outer corners without clipping
   focus rings, calendar selections, maps or signature strokes. */
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .mobile-header, .view-heading, .offline-banner, .mobile-incident-alerts,
  .mobile-calendar-day-detail, .mobile-calendar-selection, .mobile-toast,
  .missing-attendance-summary, .vacation-period, .pause-resolution-options,
  .attendance-location-map, #mobile-totp-setup, #mobile-recovery-codes pre,
  .mobile-notification-categories, .mobile-notification-tabs
) { border-radius: var(--tajofy-card-radius); }

html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) dialog {
  border-radius: 18px;
}
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) body.native-app .mobile-week-dialog {
  width: calc(100% - 24px);
  height: calc(100dvh - 24px);
  max-height: calc(100dvh - 24px);
  border-radius: 18px;
}
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .mobile-week-sheet > header
) { border-start-start-radius: 18px; border-start-end-radius: 18px; }
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .mobile-week-sheet > footer {
  border-end-start-radius: 18px; border-end-end-radius: 18px;
}

html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  select, textarea, .status, .mobile-week-pending, #mobile-signature-canvas
) { border-radius: var(--tajofy-button-radius); }

html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .mobile-document-group {
  border-radius: var(--tajofy-card-radius);
  background: var(--white);
}
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .mobile-document-group + .mobile-document-group {
  border-top: 0; margin-top: 12px;
}
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .mobile-document-group > h2 {
  border-start-start-radius: var(--tajofy-card-radius);
  border-start-end-radius: var(--tajofy-card-radius);
}
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .mobile-document-group > .document-row, .team-person > .team-row,
  .mobile-notification-list > .mobile-notification-item, .mobile-section .leave-row
) { border-radius: 0; }
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .mobile-document-group > .document-row:last-child,
  .team-person:last-child > .team-row[aria-expanded="false"],
  .team-person:last-child > .team-events, .mobile-notification-list > :last-child,
  .mobile-section .leave-row:last-child, .mobile-incident-alerts > :last-child
) { border-end-start-radius: var(--tajofy-card-radius); border-end-end-radius: var(--tajofy-card-radius); }
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) :is(
  .team-person:first-child > .team-row, .mobile-notification-list > :first-child,
  .mobile-incident-alerts > :first-child
) { border-start-start-radius: var(--tajofy-card-radius); border-start-end-radius: var(--tajofy-card-radius); }

/* The weekend's painted cells must follow the grid perimeter; selected/today
   circles keep their existing outlines and their full touch targets. */
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .mobile-calendar-grid > :last-child:not(.today):not(.selected):not(.holiday):not(.vacation):not(.absence):not(.pending) {
  border-end-end-radius: 10px;
}
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .calendar-weekdays {
  border-start-start-radius: var(--tajofy-card-radius);
  border-start-end-radius: var(--tajofy-card-radius);
}
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .mobile-nav {
  border-start-start-radius: var(--tajofy-card-radius);
  border-start-end-radius: var(--tajofy-card-radius);
}
html.tajofy-mobile:is([data-tajofy-preset="soft"], [data-tajofy-preset="contrast"]) .document-icon {
  border-radius: 6px;
}
