/* ---------- Design tokens ---------- */
:root {
    --hrm-accent: #0F766E;
    --hrm-accent-hover: #115E59;
    --hrm-accent-soft: #E3F4F1;
    --hrm-hover: #F2F4F7;
    --hrm-sidebar-bg: #FFFFFF;
    --hrm-sidebar-fg: #475467;
    --hrm-page-bg: #F7F8FA;
    --hrm-surface: #FFFFFF;
    --hrm-text: #101828;
    --hrm-muted: #566072;
    --hrm-border: #E4E7EC;
    --hrm-radius: 12px;
    --hrm-radius-sm: 8px;
    --hrm-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    --hrm-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
    --hrm-shadow-lg: 0 16px 40px rgba(16, 24, 40, 0.16);
    --hrm-touch: 44px;
    --hrm-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --hrm-font-heading: var(--hrm-font);

    --bs-primary: #0F766E;
    --bs-primary-rgb: 15, 118, 110;
    --bs-link-color: #0F766E;
    --bs-link-color-rgb: 15, 118, 110;
    --bs-link-hover-color: #115E59;
    --bs-link-hover-color-rgb: 17, 94, 89;
    --bs-body-font-family: var(--hrm-font);
    --bs-body-font-size: 0.9375rem;
    --bs-body-color: #101828;
    --bs-secondary-color: #566072;
    --bs-border-color: var(--hrm-border);
}

/* A mouse can use slightly tighter controls; touch screens keep 44px. */
@media (pointer: fine) {
    :root { --hrm-touch: 40px; }
}

html, body {
    font-family: var(--hrm-font);
    color: var(--hrm-text);
    background: var(--hrm-page-bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .h1, .h2, .h3, .h4, .hrm-heading {
    font-family: var(--hrm-font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.text-muted { color: var(--hrm-muted) !important; }

.hrm-icon { flex-shrink: 0; }

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--hrm-accent);
}

/* ---------- Controls: 44px touch targets ---------- */
.btn, .form-control, .form-select {
    min-height: var(--hrm-touch);
    border-radius: var(--hrm-radius-sm);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding-inline: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.btn-sm {
    min-height: 34px;
    padding-inline: 0.75rem;
    font-size: 0.8125rem;
}

.form-control, .form-select {
    font-size: 0.9rem;
    border-color: #D0D5DD;
    box-shadow: var(--hrm-shadow);
}

.form-control::placeholder { color: #667085; }

@media (pointer: coarse) {
    .btn-sm { min-height: var(--hrm-touch); }
}

.btn-primary {
    --bs-btn-bg: var(--hrm-accent);
    --bs-btn-border-color: var(--hrm-accent);
    --bs-btn-hover-bg: var(--hrm-accent-hover);
    --bs-btn-hover-border-color: var(--hrm-accent-hover);
    --bs-btn-active-bg: var(--hrm-accent-hover);
    --bs-btn-active-border-color: var(--hrm-accent-hover);
    --bs-btn-disabled-bg: var(--hrm-accent);
    --bs-btn-disabled-border-color: var(--hrm-accent);
}

.btn-light {
    --bs-btn-color: #344054;
    --bs-btn-bg: #FFFFFF;
    --bs-btn-border-color: #D0D5DD;
    --bs-btn-hover-color: #101828;
    --bs-btn-hover-bg: var(--hrm-hover);
    --bs-btn-hover-border-color: #D0D5DD;
    --bs-btn-active-color: #101828;
    --bs-btn-active-bg: #E9ECF0;
    --bs-btn-active-border-color: #D0D5DD;
    --bs-btn-disabled-color: #667085;
    --bs-btn-disabled-bg: #F9FAFB;
    --bs-btn-disabled-border-color: var(--hrm-border);
    box-shadow: var(--hrm-shadow);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
}

.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus, a:focus-visible, button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.3);
    border-color: var(--hrm-accent);
}

.hrm-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: var(--hrm-touch);
    padding-left: 0;
}

    .hrm-check .form-check-input {
        width: 1.35rem;
        height: 1.35rem;
        margin: 0;
        float: none;
    }

.hrm-icon-btn {
    width: var(--hrm-touch);
    padding: 0;
}

/* ---------- Page structure ---------- */
.hrm-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

    .hrm-page-header h1 {
        font-size: 1.625rem;
        font-weight: 700;
        margin: 0;
    }

.hrm-subtitle {
    color: var(--hrm-muted);
    font-size: 0.9rem;
    margin: 0.2rem 0 0;
}

.hrm-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 0.75rem;
}

.hrm-back {
    display: inline-flex;
    align-items: center;
    min-height: var(--hrm-touch);
    margin-bottom: 0.25rem;
    text-decoration: none;
    font-weight: 500;
}

.hrm-card {
    background: var(--hrm-surface);
    border: 1px solid var(--hrm-border);
    border-radius: var(--hrm-radius);
    box-shadow: var(--hrm-shadow);
    padding: 1.25rem;
}

.hrm-card-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.hrm-card-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
}

a.hrm-card {
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

    a.hrm-card:hover {
        border-color: #C5CBD5;
        box-shadow: var(--hrm-shadow-md);
    }

.hrm-stat {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
}

    .hrm-stat:hover { color: inherit; }

.hrm-stat-icon {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--hrm-radius-sm);
    background: var(--hrm-hover);
    color: var(--hrm-sidebar-fg);
}

.hrm-stat-attention { border-color: #F2C879; }
.hrm-stat-attention .hrm-stat-icon { background: #FEF3C7; color: #92400E; }

.hrm-stat-label {
    color: var(--hrm-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

.hrm-stat-value {
    font-family: var(--hrm-font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-top: 0.15rem;
    font-variant-numeric: tabular-nums;
}

.hrm-punch .hrm-card-toolbar {
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
}

.hrm-punch-body {
    flex: 1;
    min-width: 12rem;
}

.hrm-punch .btn {
    min-width: 8rem;
}

@media (max-width: 575.98px) {
    .hrm-punch .hrm-stat-icon { display: none; }
    .hrm-punch .d-flex.gap-2, .hrm-punch .btn { width: 100%; }
}

/* ---------- Tabs ---------- */
.hrm-tabs {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--hrm-border);
}

.hrm-tab {
    display: inline-flex;
    align-items: center;
    min-height: var(--hrm-touch);
    padding: 0 0.875rem;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--hrm-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

    .hrm-tab:hover { color: var(--hrm-text); }

    .hrm-tab.active {
        color: var(--hrm-accent);
        border-bottom-color: var(--hrm-accent);
    }

/* ---------- Tables ---------- */
/* Keeps visually hidden header text inside the scroll area, so wide tables cannot widen the page on phones. */
.table-responsive { position: relative; }

.hrm-table {
    --bs-table-bg: transparent;
    margin: 0;
    font-size: 0.875rem;
}

    .hrm-table thead th {
        background: #F9FAFB;
        color: var(--hrm-muted);
        font-size: 0.75rem;
        font-weight: 600;
        border-bottom-color: var(--hrm-border);
        white-space: nowrap;
    }

    .hrm-table td, .hrm-table th {
        padding: 0.7rem 1rem;
        border-color: var(--hrm-border);
    }

    .hrm-table tbody tr:last-child td { border-bottom: 0; }

    .hrm-table tbody tr { transition: background-color 0.1s ease; }
    .hrm-table tbody tr:hover { background: #F9FAFB; }

.hrm-card.p-0 { overflow: hidden; }

.hrm-row-actions {
    text-align: right;
    white-space: nowrap;
}

    .hrm-row-actions .btn + .btn { margin-left: 0.35rem; }

.hrm-person {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--hrm-touch);
    text-decoration: none;
}

.hrm-avatar {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--hrm-accent-soft);
    color: var(--hrm-accent);
    font-weight: 600;
    font-size: 0.8rem;
}

.hrm-avatar-lg {
    width: 4rem;
    height: 4rem;
    font-size: 1.25rem;
    font-family: var(--hrm-font-heading);
}

.hrm-avatar-photo {
    display: block;
    object-fit: cover;
}

.hrm-photo-editor {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.hrm-photo-field {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hrm-logo-editor {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.hrm-logo-preview {
    display: grid;
    place-items: center;
    width: 10rem;
    height: 4rem;
    padding: 0.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: #fff;
}

.hrm-logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.hrm-filters {
    display: grid;
    grid-template-columns: minmax(14rem, 2fr) repeat(3, minmax(10rem, 1fr));
    gap: 0.75rem;
}

@media (max-width: 991.98px) {
    .hrm-filters { grid-template-columns: 1fr 1fr; }
    .hrm-filter-search { grid-column: 1 / -1; }
}

@media (max-width: 575.98px) {
    .hrm-filters { grid-template-columns: 1fr; }
}

.hrm-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--hrm-border);
}

/* ---------- Status pills ---------- */
.hrm-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

    .hrm-pill::before {
        content: "";
        width: 0.375rem;
        height: 0.375rem;
        border-radius: 50%;
        background: currentColor;
    }

.hrm-pill-active, .hrm-pill-ok { background: #ECFDF3; color: #067647; }
.hrm-pill-probation, .hrm-pill-info { background: #EFF6FF; color: #1D4ED8; }
.hrm-pill-onnotice, .hrm-pill-warn { background: #FFFAEB; color: #93370D; }
.hrm-pill-exited, .hrm-pill-muted { background: #F2F4F7; color: #475467; }
.hrm-pill-error { background: #FEF3F2; color: #B42318; }

/* ---------- Side panel & dialog ---------- */
.hrm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1040;
}

/* Add/edit forms open as their own screen beside the navigation, replacing the list. */
.hrm-panel {
    position: fixed;
    inset: 0 0 0 248px;
    background: var(--hrm-page-bg);
    z-index: 1025;
    display: flex;
    flex-direction: column;
    outline: none;
    animation: hrm-screen-in 0.16s ease-out;
}

@keyframes hrm-screen-in {
    from { transform: translateY(6px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .hrm-panel { animation: none; }
}

.hrm-panel-header {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.875rem;
    min-height: 3.75rem;
    padding: 0.5rem 2rem;
    background: var(--hrm-surface);
    border-bottom: 1px solid var(--hrm-border);
}

.hrm-panel-title {
    min-width: 0;
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    overflow-wrap: anywhere;
}

.hrm-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem 2rem 0;
}

.hrm-panel-content {
    width: 100%;
    margin: 0 0 1.75rem;
    padding: 1.5rem;
    background: var(--hrm-surface);
    border: 1px solid var(--hrm-border);
    border-radius: var(--hrm-radius);
    box-shadow: var(--hrm-shadow);
}

.hrm-panel-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin: 1.5rem -1.5rem -1.5rem;
    padding: 1rem 1.5rem;
    background: var(--hrm-surface);
    border-top: 1px solid var(--hrm-border);
    border-radius: 0 0 var(--hrm-radius) var(--hrm-radius);
}

.hrm-fieldset {
    margin-bottom: 1.5rem;
}

    .hrm-fieldset legend {
        font-family: var(--hrm-font-heading);
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.75rem;
    }

.hrm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - 2rem));
    background: var(--hrm-surface);
    border-radius: var(--hrm-radius);
    box-shadow: var(--hrm-shadow-lg);
    padding: 1.5rem;
    z-index: 1050;
}

.hrm-dialog-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.hrm-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* ---------- Employee picker ---------- */
.hrm-picker {
    position: relative;
}

.hrm-picker-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: var(--hrm-touch);
    padding: 0 0.25rem 0 0.75rem;
    border: 1px solid var(--hrm-border);
    border-radius: var(--hrm-radius-sm);
    background: #FAFAFD;
}

.hrm-picker-list {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 10;
    margin: 0.25rem 0 0;
    padding: 0.25rem;
    list-style: none;
    background: var(--hrm-surface);
    border: 1px solid var(--hrm-border);
    border-radius: var(--hrm-radius-sm);
    box-shadow: var(--hrm-shadow);
    max-height: 16rem;
    overflow-y: auto;
}

    .hrm-picker-list button {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        min-height: var(--hrm-touch);
        padding: 0.4rem 0.75rem;
        border: 0;
        border-radius: 8px;
        background: none;
        text-align: left;
    }

        .hrm-picker-list button:hover, .hrm-picker-list button:focus-visible { background: var(--hrm-accent-soft); }

.hrm-picker-empty {
    padding: 0.5rem 0.25rem;
}

/* ---------- Profile ---------- */
.hrm-profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.hrm-profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

/* ---------- Sign-in pages ---------- */
.hrm-auth {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1.5rem 1rem;
    background: radial-gradient(60rem 30rem at 50% -10%, var(--hrm-accent-soft), transparent), var(--hrm-page-bg);
}

.hrm-auth-card {
    width: min(420px, 100%);
    padding: 2rem;
    background: var(--hrm-surface);
    border: 1px solid var(--hrm-border);
    border-radius: 16px;
    box-shadow: var(--hrm-shadow-md);
}

    .hrm-auth-card h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
    .hrm-auth-card h2 { font-size: 1.05rem; }
    .hrm-auth-card h3 { font-size: 1rem; }
    .hrm-auth-card .row { --bs-gutter-x: 0; }
    .hrm-auth-card .row > [class*="col-"] { flex: 0 0 100%; width: 100%; max-width: 100%; }
    .hrm-auth-card .btn-lg { min-height: var(--hrm-touch); font-size: 0.9rem; }

.hrm-auth-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.hrm-auth-mark {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    background: var(--hrm-accent);
    color: #fff;
}

.hrm-auth-subtitle {
    color: var(--hrm-muted);
    margin-bottom: 1.5rem;
}

.hrm-auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    color: var(--hrm-muted);
    font-size: 0.8125rem;
}

    .hrm-auth-divider::before, .hrm-auth-divider::after {
        content: "";
        flex: 1;
        border-top: 1px solid var(--hrm-border);
    }

.hrm-auth-external {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.hrm-dl {
    display: grid;
    grid-template-columns: minmax(9rem, auto) 1fr;
    gap: 0.6rem 1rem;
    margin: 0;
}

    .hrm-dl dt { color: var(--hrm-muted); font-weight: 500; }
    .hrm-dl dd { margin: 0; }

@media (max-width: 575.98px) {
    .hrm-dl { grid-template-columns: 1fr; gap: 0.15rem; }
    .hrm-dl dd { margin-bottom: 0.6rem; }
}

/* ---------- Org chart ---------- */
.hrm-tree, .hrm-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .hrm-tree ul {
        margin-left: 1.4rem;
        padding-left: 1rem;
        border-left: 2px solid var(--hrm-border);
    }

.hrm-tree-node {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0;
}

.hrm-tree-toggle {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: var(--hrm-touch);
    height: var(--hrm-touch);
    border: 1px solid var(--hrm-border);
    border-radius: var(--hrm-radius-sm);
    background: var(--hrm-surface);
    font-weight: 600;
}

.hrm-tree-leaf {
    border-color: transparent;
    background: none;
}

.hrm-tree-card {
    display: block;
    min-height: var(--hrm-touch);
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--hrm-border);
    border-radius: var(--hrm-radius-sm);
    background: var(--hrm-surface);
    color: var(--hrm-text);
    text-decoration: none;
}

a.hrm-tree-card:hover { border-color: var(--hrm-accent); }

/* ---------- Framework bits ---------- */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #B91C1C;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Notification bell */
.hrm-bell { position: relative; display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--hrm-radius-sm); color: var(--hrm-sidebar-fg); text-decoration: none; }
.hrm-bell:hover { background: var(--hrm-hover); color: var(--hrm-text); }
.hrm-bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; padding: 0 4px; border: 2px solid #fff; border-radius: 10px; background: #D92D20; color: #fff; font-size: 0.625rem; font-weight: 700; line-height: 14px; text-align: center; box-sizing: content-box; }

/* Month calendars (attendance and leave) */
.hrm-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.hrm-cal-head { font-size: 0.75rem; font-weight: 600; color: var(--hrm-muted); text-align: center; padding: 4px 0; }
.hrm-cal-day { min-height: 92px; padding: 6px 8px; border: 1px solid var(--hrm-border); border-radius: var(--hrm-radius-sm); background: var(--hrm-surface); color: var(--hrm-text); text-align: left; font-size: 0.75rem; display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; }
button.hrm-cal-day:hover { border-color: var(--hrm-accent); }
.hrm-cal-num { font-weight: 600; font-size: 0.85rem; }
.hrm-cal-today { border-color: var(--hrm-accent); box-shadow: inset 0 0 0 1px var(--hrm-accent); }
.hrm-cal-present { background: #F3FBF6; border-color: #CDEBD8; }
.hrm-cal-present .hrm-cal-line:first-of-type { color: #067647; font-weight: 500; }
.hrm-cal-halfday, .hrm-cal-onleave { background: #F3F7FF; border-color: #D5E3FB; }
.hrm-cal-halfday .hrm-cal-line:first-of-type, .hrm-cal-onleave .hrm-cal-line:first-of-type { color: #1D4ED8; font-weight: 500; }
.hrm-cal-absent { background: var(--hrm-surface); }
.hrm-cal-absent .hrm-cal-line:first-of-type { color: #B42318; font-weight: 500; }
.hrm-cal-holiday { background: #FFFBEF; border-color: #F7E6B5; }
.hrm-cal-holiday .hrm-cal-line:first-of-type { color: #93370D; font-weight: 500; }
.hrm-cal-weeklyoff, .hrm-cal-notemployed { background: #F7F8FA; border-color: transparent; color: var(--hrm-muted); }
.hrm-cal-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 767.98px) {
    .hrm-cal { gap: 3px; }
    .hrm-cal-day { min-height: 58px; padding: 3px 4px; font-size: 0.625rem; }
    .hrm-cal-times { display: none; }
}

/* ---------- Phones ---------- */
@media (max-width: 767.98px) {
    /* 16px stops iOS zooming the page when a field gets focus. */
    .form-control, .form-select { font-size: 16px; }

    .hrm-card { padding: 1rem; }
    .hrm-page-header { align-items: stretch; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
    .hrm-page-header h1 { font-size: 1.375rem; }
    .hrm-page-header > .d-flex { width: 100%; }
    .hrm-page-header > .d-flex > .btn { flex: 1 1 auto; }
    .hrm-card-toolbar { align-items: stretch; }
    .hrm-card-toolbar > .d-flex { max-width: 100%; }
    .hrm-card-toolbar > .d-flex > div { flex: 1 1 10rem; min-width: 0; }
    .hrm-punch .hrm-card-toolbar { align-items: center; }

    .hrm-stat-icon { display: none; }
    .hrm-stat-value { font-size: 1.5rem; }

    /* All tabs stay visible instead of being cut off at the screen edge. */
    .hrm-tabs { flex-wrap: wrap; overflow: visible; gap: 0.375rem; padding-bottom: 0; border-bottom: 0; }
    .hrm-tab { min-height: 36px; margin: 0; padding: 0 0.75rem; border: 1px solid var(--hrm-border); border-radius: 999px; background: var(--hrm-surface); font-size: 0.8125rem; }
    .hrm-tab.active { border-color: var(--hrm-accent); background: var(--hrm-accent); color: #fff; }

    .hrm-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hrm-filters > * { min-width: 0; }
    /* Search and the first filter get a full row so long option text is not cut off. */
    .hrm-filter-search, .hrm-filters > :nth-child(2), .hrm-filters > :last-child:nth-child(odd) { grid-column: 1 / -1; }
    .hrm-filters .d-flex { flex-wrap: wrap; }
    .hrm-filters .d-flex > * { flex: 1 1 9rem; min-width: 0; }
    .hrm-filters input[type="date"] { min-width: 0; }

    .hrm-pager { justify-content: center; text-align: center; }

    .hrm-tree ul { margin-left: 0.75rem; padding-left: 0.5rem; }
    .hrm-tree-node { gap: 0.375rem; }
    .hrm-tree-toggle { width: 2.25rem; height: 2.25rem; }
    .hrm-tree-card { flex: 1; min-width: 0; overflow-wrap: anywhere; }

    /* Form screens fill the phone, with Save always reachable. */
    .hrm-panel { inset: 0; z-index: 1050; }
    .hrm-panel-header { position: sticky; top: 0; padding: 0.5rem 1rem; }
    .hrm-panel-body { padding: 0; background: var(--hrm-surface); }
    .hrm-panel-content { width: 100%; min-height: 100%; margin: 0; padding: 1rem; border: 0; border-radius: 0; box-shadow: none; }
    .hrm-panel-actions { margin: 1.25rem -1rem -1rem; padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom)); border-radius: 0; }
    .hrm-panel-actions > .btn { flex: 1; }

    /* Tables become a list of labelled records. responsive-tables.js supplies each label from its column header. */
    .hrm-table, .hrm-table tbody, .hrm-table tfoot { display: block; width: 100%; }
    .hrm-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .hrm-table tbody tr, .hrm-table tfoot tr { display: block; padding: 0.75rem 0; border-bottom: 1px solid var(--hrm-border); }
    .hrm-table tbody tr:last-child { border-bottom: 0; }
    .hrm-table tbody tr:hover { background: none; }
    .hrm-card.p-0 .hrm-table tbody tr, .hrm-card.p-0 .hrm-table tfoot tr { padding-inline: 1rem; }

    .hrm-table tbody td, .hrm-table tbody th, .hrm-table tfoot td, .hrm-table tfoot th {
        position: relative;
        display: block;
        width: 100% !important;
        min-height: 1.6rem;
        padding: 0.2rem 0 0.2rem 42%;
        border: 0;
        text-align: left !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    .hrm-table td[data-label]::before, .hrm-table th[data-label]::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 0.2rem;
        width: calc(42% - 0.75rem);
        color: var(--hrm-muted);
        font-size: 0.8125rem;
        font-weight: 500;
        overflow-wrap: normal;
    }

    .hrm-table td:empty, .hrm-table td.hrm-row-actions:empty { display: none; }
    .hrm-table td:not([data-label]), .hrm-table th:not([data-label]) { padding-left: 0; }
    .hrm-table td.hrm-cell-title { padding-left: 0; margin-bottom: 0.25rem; }
    .hrm-table td.hrm-cell-title::before { content: none; }
    .hrm-table td .form-control, .hrm-table td .form-select { width: 100%; }

    .hrm-table td.hrm-row-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.375rem;
        margin-top: 0.5rem;
        padding-left: 0;
    }

    .hrm-row-actions .btn + .btn { margin-left: 0; }
    .hrm-row-actions .btn { flex: 1 1 auto; min-height: var(--hrm-touch); }
}

/* User guide (/help), rendered from docs/USER-GUIDE.md */
.hrm-guide { max-width: 920px; line-height: 1.6; }
.hrm-guide h2 { font-size: 1.35rem; margin: 2rem 0 .75rem; padding-top: 1rem; border-top: 1px solid var(--bs-border-color, #EAECF0); scroll-margin-top: 1rem; }
.hrm-guide h2:first-of-type { border-top: 0; padding-top: 0; margin-top: .5rem; }
.hrm-guide h3 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; scroll-margin-top: 1rem; }
.hrm-guide table { margin: .5rem 0 1rem; }
.hrm-guide .table-responsive, .hrm-guide table { display: block; overflow-x: auto; }
.hrm-guide blockquote { border-left: 3px solid #F79009; background: #FFFAEB; padding: .6rem 1rem; margin: 1rem 0; border-radius: 4px; }
.hrm-guide blockquote p:last-child { margin-bottom: 0; }
