:root {
    --ink: #12343b;
    --teal: #0f4c5c;
    --teal-dark: #0a3340;
    --gold: #c9a227;
    --sand: #f4efe6;
    --card: #fffdf8;
    --line: #ddd4c4;
    --danger: #9b2c2c;
    --ok: #276749;
    --muted: #6b7280;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body {
    font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif;
    background: var(--sand);
    color: var(--ink);
    min-height: 100vh;
    overflow-x: clip;
    letter-spacing: 0;
    line-height: 1.7;
    word-break: normal;
    overflow-wrap: normal;
    word-wrap: normal;
    hyphens: none;
    -webkit-hyphens: none;
    -ms-hyphens: none;
    line-break: auto;
}
body.nav-locked { overflow: hidden; }

/* منع كسر الكلمات العربية — الالتفاف عند المسافات فقط */
h1, h2, h3, h4, p, label, span, li, td, th, a, button, .btn,
.hint, .flash, .muted, .summary-title, .card h3, .action-list li,
.pager-info, .highlight-box {
    word-break: normal;
    overflow-wrap: normal;
    word-wrap: normal;
    hyphens: none;
    -webkit-hyphens: none;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--gold); }
a.employee-name-link {
    color: var(--teal-dark);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}
a.employee-name-link:hover { color: var(--danger); }
.container { width: min(1120px, calc(100% - 24px)); margin: 0 auto; }

.site-header, .dash-top {
    background: linear-gradient(135deg, var(--teal-dark), var(--teal));
    color: #fff;
}
.site-header { padding: 10px 0; position: relative; z-index: 5; }
.site-header .container, .dash-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: nowrap; }
.site-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 14px;
    padding: 4px 8px;
    line-height: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.site-logo img {
    display: block;
    width: auto;
    height: auto;
}
.site-logo.is-header img { width: 118px; }
.site-logo.is-top img { width: 108px; }
.site-logo.is-side {
    display: grid;
    width: 100%;
    padding: 10px 8px;
    border-radius: 16px;
}
.site-logo.is-side img { width: 100%; max-width: 196px; }
.site-logo.is-hero {
    display: block;
    width: fit-content;
    max-width: min(280px, 100%);
    padding: 10px 14px;
    border-radius: 20px;
    margin: 0 0 8px;
    box-shadow: 0 10px 28px rgba(15, 76, 92, .12);
}
.site-logo.is-hero img { width: min(248px, 72vw); }
a.site-logo:hover { color: inherit; opacity: .94; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.side-brand { display: grid; gap: 8px; margin: 0 8px 16px; text-align: center; justify-items: center; }
a.side-brand,
a.side-brand:hover {
    color: inherit;
    background: transparent;
    padding: 0;
    border-radius: 0;
}
.brand-code {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: .04em;
    direction: ltr;
    unicode-bidi: isolate;
    white-space: nowrap;
}
.dash-identity { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.dash-user {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    color: #d7e6ea;
    font-weight: 700;
    min-width: 0;
    max-width: min(260px, 48vw);
}
.dash-user-role {
    font-size: .78rem;
    font-weight: 700;
    color: #b8d0d6;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.dash-user-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.2;
}
.nav-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,.35);
    background: rgba(255,255,255,.12);
    color: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    content: "";
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before { position: absolute; top: -6px; }
.nav-toggle-bars::after { position: absolute; top: 6px; }
.nav-backdrop {
    display: none;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(10, 51, 64, .45);
    cursor: pointer;
}
.nav-links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.nav-links a { color: #fff; white-space: nowrap; }
.nav-links form { margin: 0; }
.nav-links .btn-light { color: var(--teal); }

.hero { padding: 72px 0 48px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0 0 12px; }
.hero p { color: #4b5563; max-width: 640px; line-height: 1.8; }
.hero-lead { font-size: 1.15rem; font-weight: 700; color: var(--teal); max-width: 640px; margin: 8px 0 12px; }
.hero-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; position: relative; z-index: 2; }
.hero-actions a, .nav-links a, .nav-links .btn { pointer-events: auto; }

img { max-width: 100%; height: auto; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(15, 76, 92, .06);
}
.card h3 { margin-top: 0; }
a.card, a.form-card { color: inherit; transition: border-color .15s ease, transform .15s ease; }
a.card:hover, a.form-card:hover { border-color: var(--gold); color: inherit; transform: translateY(-2px); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 0;
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    white-space: nowrap;
    max-width: 100%;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-gold { background: var(--gold); color: #1a1a1a; }
.btn-light { background: #fff; color: var(--teal); border: 1px solid var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
a.btn-danger, a.btn-danger:hover { color: #fff; }
a.btn-danger:hover { background: #7a1f1f; }
.btn-warn { background: #c05621; color: #fff; }
a.btn-warn, a.btn-warn:hover { color: #fff; }
a.btn-warn:hover { background: #9c4221; }
.btn-sm { padding: 7px 12px; font-size: .9rem; }
.btn-xs { padding: 4px 8px; font-size: .78rem; border-radius: 8px; white-space: nowrap; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(560px, 100%); }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-weight: 700; margin-bottom: 6px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    font-family: inherit;
    background: #fff;
}
textarea { min-height: 90px; }
.hint { color: var(--muted); font-size: .85rem; }
.error { color: var(--danger); font-size: .88rem; margin: 4px 0 0; }
code { direction: ltr; unicode-bidi: isolate; font-weight: 700; }
.flash { background: #e8f5e9; color: var(--ok); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.flash-error { background: #fde8e8; color: var(--danger); }
.flash-warn { background: #fff4d6; color: #5c2e0a; border: 1px solid #e6c56a; }
.excuse-types-table .excuse-attach-form { margin: 0; gap: 8px; }
.excuse-types-table .excuse-status-col {
    min-width: 7.5rem;
    padding-inline: 1.25rem;
    text-align: center;
    white-space: nowrap;
    border-inline-start: 1px solid var(--line);
}
.excuse-types-table .excuse-status {
    display: inline-block;
    font-weight: 700;
}
.excuse-types-table .excuse-status.is-active { color: var(--ok); }
.excuse-types-table .excuse-status.is-inactive { color: var(--muted); }
a.dash-alert {
    display: block;
    text-decoration: none;
    color: #5c2e0a;
    font-weight: 800;
    margin-bottom: 16px;
}
a.dash-alert:hover { color: #5c2e0a; border-color: var(--gold); }
.dash-alert-flag {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fde8e8;
    border: 2px solid var(--danger);
    color: var(--danger);
    font-weight: 800;
    padding: 14px 18px;
    border-radius: 16px;
    text-decoration: none;
    margin-bottom: 16px;
}
.dash-alert-flag:hover { color: #fff; background: var(--danger); }
.dash-alert-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    flex: 0 0 auto;
    line-height: 1;
}
.dash-alert-flag strong { font-size: 2rem; margin-inline-end: 6px; }
.alert-type-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0 20px;
}
a.alert-type-card.is-saved { background: #eff6ff; border-color: #1d4ed8; }
a.alert-type-card.is-saved span,
a.alert-type-card.is-saved b { color: #1d4ed8; }
a.alert-type-card.is-saved:hover,
a.alert-type-card.is-saved.is-active { background: #1d4ed8; }
a.alert-type-card.is-saved:hover span,
a.alert-type-card.is-saved.is-active span,
a.alert-type-card.is-saved:hover b,
a.alert-type-card.is-saved.is-active b { color: #fff; }
a.alert-type-card {
    background: #fff5f5;
    border: 2px solid var(--danger);
    border-radius: 14px;
    padding: 16px 12px;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
}
a.alert-type-card span { display: block; font-weight: 800; color: var(--danger); }
a.alert-type-card b { display: block; font-size: 2.1rem; margin-top: 6px; color: var(--danger); }
a.alert-type-card:hover,
a.alert-type-card.is-active {
    background: var(--danger);
    color: #fff;
}
a.alert-type-card:hover span,
a.alert-type-card.is-active span,
a.alert-type-card:hover b,
a.alert-type-card.is-active b { color: #fff; }
.flash-list { margin: 8px 0; padding-inline-start: 22px; }
.flash-action { margin: 10px 0 0; }
.flash-action .btn { margin-top: 0; }

.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row img { height: 48px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.captcha-row input { max-width: 140px; letter-spacing: 4px; text-align: center; font-size: 1.2rem; }

.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; width: 100%; }
.layout > div { min-width: 0; }
.side {
    background: var(--teal-dark);
    color: #fff;
    padding: 20px 14px;
}
.side a { color: #d7e6ea; display: block; padding: 10px 12px; border-radius: 10px; white-space: nowrap; }
.side a.active, .side a:hover { background: rgba(255,255,255,.1); color: #fff; }
.side a.side-brand,
.side a.side-brand:hover {
    color: inherit;
    background: transparent;
    padding: 0;
    border-radius: 0;
}
.side .meta { color: #b7c9cf; font-size: .85rem; margin: 18px 8px; line-height: 1.7; }
.main { padding: 24px; }
.dash-top { padding: 10px 24px; }
.dash-top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.support-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.55rem;
    height: 1.55rem;
    margin-inline-start: 6px;
    padding: 0 6px;
    border-radius: 999px;
    background: #d32f2f;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(211, 47, 47, .18);
    flex: 0 0 auto;
}
.support-chat { display: grid; gap: 10px; }
.support-bubble {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
    max-width: min(85%, 100%);
    min-width: 0;
}
.support-bubble header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: .9rem;
    flex-wrap: wrap;
}
.support-bubble p {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.7;
    overflow-wrap: break-word;
}
.support-bubble.is-user { justify-self: start; background: #f7fbfc; }
.support-bubble.is-admin { justify-self: end; background: #fff8e8; border-color: #e6c56a; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
a.stat { color: inherit; text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
a.stat:hover { border-color: var(--gold); transform: translateY(-2px); }
.stat b { display: block; font-size: 1.6rem; color: var(--teal); }

.card:has(table) { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.nid, input.nid {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
    text-align: left;
    font-variant-numeric: tabular-nums;
}
input.nid { width: 100%; }
.employee-name-cell { min-width: 16rem; }
input.employee-name {
    min-width: 16rem;
    width: max(16rem, 100%);
    font-weight: 700;
}
.employee-mobile-cell { min-width: 8.5rem; }
input.employee-mobile {
    min-width: 8.5rem;
    width: max(8.5rem, 100%);
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
    font-variant-numeric: tabular-nums;
}
.employee-section-cell { min-width: 11rem; }
select.employee-section {
    min-width: 11rem;
    width: max(11rem, 100%);
}
.distribute-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 0 0 14px;
}
.distribute-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    align-items: start;
}
.distribute-col {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafb;
    min-height: 220px;
    display: flex;
    flex-direction: column;
}
.distribute-col.is-manager { background: #eef6f7; border-color: #b7d3d8; }
.distribute-col.is-over { outline: 2px dashed var(--primary, #0f4c5c); background: #e7f3f5; }
.distribute-col-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
}
.distribute-col-head .count {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: .85rem;
    color: var(--muted);
}
.distribute-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.distribute-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    cursor: grab;
    user-select: none;
}
.distribute-item:active { cursor: grabbing; }
.distribute-item.is-dragging { opacity: .45; }
.distribute-item .name { font-weight: 700; flex: 1; min-width: 0; }
.distribute-item .nid {
    color: var(--muted);
    font-size: .85rem;
}
.distribute-empty {
    margin: 18px 8px;
    text-align: center;
    color: var(--muted);
    font-size: .92rem;
}
.distribute-actions {
    position: sticky;
    bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 76, 92, .08);
}
.distribute-bulk {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.distribute-bulk select { min-width: 12rem; }
.sections-headbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.section-panel {
    margin: 12px 0 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafb;
}
.sections-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.sections-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.sections-row-actions form { margin: 0; }
.sections-edit-row td { background: #f8fafb; }
.section-features {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #eef6f7;
}
.section-features ul {
    margin: 8px 0 0;
    padding-right: 18px;
}
.section-features li { margin: 4px 0; }
.sections-table { margin-top: 8px; }
th { color: var(--muted); font-size: .9rem; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: .8rem; background: #eee; white-space: nowrap; }
.badge-trial { background: #fff3cd; }
.badge-subscribed { background: #d1fae5; }
.badge-pending { background: #e0e7ff; }
.badge-expired { background: #fee2e2; }
.badge-exempted { background: #dbeafe; color: #1e3a8a; }
.badge-suspended { background: #f3f4f6; }

.day-date-filter {
    display: grid;
    gap: 12px;
    margin: 8px 0 12px;
}
.day-date-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.day-date-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    min-width: 0;
    display: grid;
    gap: 6px;
    position: relative;
}
.day-date-card label {
    margin: 0;
    font-size: .85rem;
    color: var(--muted);
    font-weight: 700;
}
.day-date-card input,
.day-date-card select {
    width: 100%;
    margin: 0;
}
.day-date-card input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}
.day-date-card input[type="date"] {
    appearance: none;
}
.day-date-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}
.day-date-field.has-weekday {
    grid-template-columns: minmax(0, 1fr) auto auto;
}
.day-weekday {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.5rem;
    height: 42px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #f7f4ef;
    color: var(--ink, #1b2a4a);
    font-weight: 800;
    white-space: nowrap;
}
.day-weekday[hidden] {
    display: none;
}
.day-date-pick {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    min-width: 58px;
    height: 42px;
    cursor: pointer;
    line-height: 1;
    padding: 0 8px;
    color: var(--teal-dark);
    font-weight: 700;
    font-size: .82rem;
}
.day-date-pick:hover { border-color: var(--teal); }
.hijri-picker {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    z-index: 40;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(15, 40, 50, .12);
    padding: 12px;
}
.hijri-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.hijri-picker-head button {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}
.hijri-picker-head strong {
    color: var(--teal-dark);
    font-size: .95rem;
}
.hijri-picker-weekdays,
.hijri-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    text-align: center;
}
.hijri-picker-weekdays span {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 700;
    padding: 4px 0;
}
.hijri-picker-grid button {
    border: 0;
    background: transparent;
    border-radius: 8px;
    min-height: 34px;
    cursor: pointer;
    color: var(--teal-dark);
    font-weight: 700;
}
.hijri-picker-grid button:hover { background: #eef7f6; }
.hijri-picker-grid button.is-selected {
    background: var(--teal);
    color: #fff;
}
.hijri-picker-grid button.is-muted {
    color: #9aa7ab;
    font-weight: 500;
}
.day-date-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}
.day-date-card.is-status {
    min-width: min(100%, 160px);
    flex: 0 1 180px;
}
.date-search-range {
    display: grid;
    gap: 12px;
    width: 100%;
    flex: 1 1 100%;
}
@media (min-width: 960px) {
    .date-search-range {
        grid-template-columns: 1fr 1fr;
    }
}
.toolbar .date-search-pair {
    flex: 1 1 100%;
    min-width: min(100%, 420px);
}
.muted { color: var(--muted); }
.summary-title {
    margin: 0 0 8px;
    color: var(--teal-dark);
    font-size: clamp(1.35rem, 4.5vw, 2.3rem);
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0;
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.summary-grid.is-absence-off .summary-item.is-danger,
.summary-grid.is-late-off .summary-item.is-warn {
    opacity: .55;
}
.employees-summary { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.summary-item { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.summary-item span { color: var(--muted); display: block; }
.summary-item b { display: block; font-size: 2rem; margin: 6px 0 2px; color: var(--teal); }
.summary-item small { color: var(--muted); font-weight: 700; }
.summary-item.is-ok b { color: var(--ok); }
.summary-item.is-danger b { color: var(--danger); }
.summary-item.is-warn b { color: #b7791f; }
.logo-preview { display: block; max-height: 72px; margin-top: 8px; background: #fff; padding: 4px; border: 1px solid var(--line); border-radius: 8px; }
.highlight-box {
    border: 2px solid var(--gold);
    background: #fff8e1;
    border-radius: 14px;
    padding: 14px 16px;
}
.highlight-box label { color: var(--teal-dark); }
.highlight-box input[type="date"] { max-width: 260px; background: #fff; }
a.date-link { font-weight: 800; text-decoration: underline; }
a.back-absence, a.back-absence:hover {
    color: #5c2e0a;
    font-weight: 800;
    font-size: 1.05rem;
}
tr.is-focus { background: #fff8e1; outline: 2px solid var(--gold); outline-offset: -2px; }
.excuse-form { display: grid; gap: 6px; margin-top: 8px; min-width: 210px; }
.excuse-form select, .excuse-form input[type="file"], .excuse-form textarea { width: 100%; }
.excuse-form textarea { min-height: 56px; resize: vertical; }
.absence-note-form { display: grid; gap: 6px; min-width: 180px; }
.absence-note-form textarea { width: 100%; min-height: 56px; resize: vertical; }

.dash-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    background: var(--card);
    border: 2px solid var(--gold);
    border-radius: 18px;
    padding: 20px 24px;
    margin-bottom: 16px;
    min-width: 0;
}
.dash-hero b {
    display: block;
    font-size: clamp(1.8rem, 6vw, 3.2rem);
    line-height: 1;
    margin: 6px 0;
    color: var(--teal);
}
.dash-hero.is-ok b { color: var(--ok); }
.dash-hero.is-warn b { color: #b7791f; }
.dash-hero.is-danger b { color: var(--danger); }
.dash-hero.is-empty b { color: var(--muted); }
.dash-hero span, .dash-hero small { color: var(--muted); font-weight: 700; }
.dash-hero ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; min-width: min(220px, 100%); }
.dash-hero li { color: var(--ink); }
.dash-kpis { margin-bottom: 16px; }
.absence-split { margin-bottom: 16px; }
.absence-split-head {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}
.absence-split-head span { color: var(--muted); display: block; font-weight: 700; }
.absence-split-head b { font-size: 2rem; color: var(--teal); }
.absence-split-head .is-ok b { color: var(--ok); }
.absence-split-head .is-danger b { color: var(--danger); }
.meter {
    height: 10px;
    background: #eee6d8;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}
.meter span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.dash-panels { grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.dash-date { font-size: 1.4rem; font-weight: 800; color: var(--teal-dark); margin: 0 0 10px; }
.mini-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.mini-stats span { color: var(--muted); }
.mini-stats b { color: var(--ink); }
.action-list { list-style: none; margin: 0 0 12px; padding: 0; }
.action-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.action-list li:last-child { border-bottom: 0; }
.rank-row {
    display: grid;
    grid-template-columns: minmax(min-content, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}
.rank-row span, .rank-row b, .rank-row small { white-space: nowrap; }
.rank-row small { color: var(--muted); }
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}
.pager-info { margin: 0; color: var(--muted); font-weight: 700; }
.pager-size { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); }
.pager-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pager-buttons .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.is-just-saved {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}
.alert-print-wrap { display: inline-flex; align-items: center; gap: 6px; }
.print-mark {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font: inherit;
    font-size: .75rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.print-mark:hover { background: #7a1f1f; }
.print-log-dialog { border: 0; padding: 0; background: transparent; }
.print-log-dialog::backdrop { background: rgba(18, 52, 59, .45); }
.print-log-card {
    width: min(420px, calc(100vw - 32px));
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 16px 40px rgba(15, 76, 92, .18);
}
.print-log-card h3 { margin: 0 0 12px; color: var(--teal-dark); }
.print-log-item {
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
}
.print-log-item:last-child { border-bottom: 0; }
.print-log-item b { display: block; margin-bottom: 4px; }

h1, h2, h3 {
    line-height: 1.45;
}
.hint, .flash, .muted, p {
    line-height: 1.7;
}

.cal-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.cal-page-head h1 { margin: 0 0 6px; }
.cal-page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cal-page-actions select { min-width: 140px; }
.cal-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
    margin: 0 0 16px;
}
.cal-legend-dot {
    width: 18px;
    height: 18px;
    border: 2px solid #c53030;
    border-radius: 50%;
    display: inline-block;
}
.year-calendar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    direction: rtl;
}
.cal-month {
    background: #e7eef2;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.cal-month h3 {
    background: var(--teal);
    color: #fff;
    margin: 0;
    padding: 8px 10px;
    text-align: center;
    font-size: .95rem;
}
.cal-weekdays, .cal-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-weekdays span {
    text-align: center;
    font-size: .68rem;
    padding: 6px 0 2px;
    color: var(--teal);
    font-weight: 800;
    white-space: nowrap;
}
.cal-day {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    font-size: .82rem;
    color: var(--ink);
    font-weight: 700;
}
.cal-day.is-outside { color: #9aa7ad; font-weight: 500; }
a.cal-day.has-pdf {
    width: 26px;
    height: 26px;
    min-height: 26px;
    margin: 2px auto;
    border: 2px solid #c53030;
    border-radius: 50%;
    color: #c53030;
    font-weight: 800;
}
a.cal-day.has-pdf:hover {
    background: #c53030;
    color: #fff;
}

.alert-section { scroll-margin-top: 16px; margin-top: 24px; }
.alert-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}
.alert-dates li {
    background: #fff8e1;
    border: 1px solid var(--gold);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: .85rem;
    font-weight: 700;
    color: var(--teal-dark);
    white-space: nowrap;
}

@media (max-width: 1100px) {
    .year-calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .layout { display: block; }
    .form-grid, .split-2 { grid-template-columns: 1fr; }
    .nav-toggle { display: inline-flex; }
    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 35;
    }
    .nav-backdrop[hidden] { display: none !important; }
    .side {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(300px, 88vw);
        z-index: 40;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(110%);
        transition: transform .22s ease;
        box-shadow: -12px 0 32px rgba(10, 51, 64, .28);
        padding: 18px 14px 28px;
    }
    .layout.is-nav-open .side { transform: translateX(0); }
    .side-brand { margin: 0 8px 16px; width: 100%; }
    .site-logo.is-side { width: 100%; padding: 8px; }
    .site-logo.is-side img { width: 100%; max-width: 180px; }
    .site-logo.is-header img { width: 96px; }
    .site-logo.is-top img { width: 88px; }
    .site-header .container, .dash-top {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 10px;
    }
    .dash-top-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .side a { white-space: normal; }
    .side .meta {
        margin: 18px 8px;
        white-space: normal;
        overflow-wrap: normal;
    }
    .summary-grid, .employees-summary, .stats, .alert-type-grid { grid-template-columns: 1fr; }
    .day-date-cards { grid-template-columns: 1fr 1fr; }
    .day-date-actions { width: 100%; }
    .day-date-actions .btn { flex: 1 1 auto; text-align: center; }
    .dash-hero, .dash-panels, .absence-split-head { grid-template-columns: 1fr; display: grid; }
    .dash-hero { padding: 16px; gap: 14px; }
    .dash-hero ul { min-width: 0; }
    .rank-row { grid-template-columns: minmax(0, 1fr) auto; }
    .rank-row span, .rank-row b, .rank-row small { white-space: normal; }
    .main { padding: 14px 12px; }
    .dash-top { padding: 10px 12px; }
    .year-calendar { grid-template-columns: 1fr; }
    .hero { padding: 40px 0 28px; }
    .hero p { max-width: none; }
    .auth-wrap { padding: 16px; }
    .captcha-row { flex-wrap: wrap; }
    .captcha-row input { max-width: none; flex: 1 1 120px; }
    .distribute-board { grid-template-columns: 1fr; }
    .distribute-bulk select { min-width: 0; width: 100%; }
    .excuse-form { min-width: 0; width: 100%; }
    .support-bubble { max-width: 100%; }
    .cal-page-actions { width: 100%; }
    .cal-page-actions select { min-width: 0; flex: 1 1 140px; }
    .toolbar .btn, .dash-top-actions .btn { white-space: normal; text-align: center; }
}

@media (max-width: 560px) {
    .container { width: min(1120px, calc(100% - 16px)); }
    .card { padding: 14px; border-radius: 14px; }
    .main { padding: 12px 10px; }
    .dash-user { max-width: min(160px, 36vw); }
    .site-logo.is-top img { width: 76px; }
    .site-logo.is-header img { width: 84px; }
    .site-logo.is-hero img { width: min(220px, 78vw); }
    .btn { padding: 9px 12px; }
    .btn-sm { padding: 7px 10px; font-size: .86rem; }
    .stat, .summary-item { padding: 14px; }
    .summary-item b, .stat b { font-size: 1.45rem; }
    .absence-split-head b { font-size: 1.55rem; }
    .dash-date { font-size: 1.15rem; }
    .cal-weekdays span { font-size: .62rem; }
    .cal-day { min-height: 26px; font-size: .78rem; }
    a.cal-day.has-pdf { width: 24px; height: 24px; min-height: 24px; }
    .employee-name-cell,
    input.employee-name,
    .employee-mobile-cell,
    input.employee-mobile,
    .employee-section-cell,
    select.employee-section {
        min-width: 10rem;
    }
    input.employee-name { width: max(10rem, 100%); }
    input.employee-mobile { width: max(8rem, 100%); }
    select.employee-section { width: max(10rem, 100%); }
}

@media (max-width: 380px) {
    .dash-identity { gap: 8px; }
    .dash-top-actions { gap: 6px; }
    .nav-toggle { padding: 7px 10px; font-size: .9rem; }
    .brand-code { font-size: 1.05rem; }
}

.layout > div { display: flex; flex-direction: column; }
.layout > div > .main { flex: 1 0 auto; }
.site-footer {
    background: linear-gradient(135deg, var(--teal-dark), var(--teal));
    color: #fff;
    text-align: center;
    padding: 26px 16px 30px;
}
.site-footer p { margin: 0; font-weight: 700; line-height: 1.9; }
.site-footer-name { font-size: 1rem; }
.site-footer-owner { font-size: .92rem; color: #d7e6ea; }
.site-footer-logo {
    display: inline-block;
    margin-top: 10px;
    background: #fff;
    border-radius: 12px;
    padding: 8px 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    transition: transform .15s ease, box-shadow .15s ease;
}
.site-footer-logo:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 0, 0, .24); }
.site-footer-logo img { display: block; width: 200px; max-width: 60vw; height: auto; }

@media print {
    .site-footer { display: none; }
}

.attachment-link {
    color: #1d4ed8;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.attachment-link:hover {
    color: #1e3a8a;
}

.departure-card {
    background: #fff7ed;
    border: 2px solid #f97316;
    border-top-width: 6px;
}
.departure-card h3,
.departure-card h4 {
    color: #c2410c;
}
.departure-card label {
    color: #9a3412;
}
.departure-card input,
.departure-card select,
.departure-card textarea {
    border-color: #fdba74;
    background: #fff;
}
.departure-card .btn-primary {
    background: #ea580c;
    border-color: #ea580c;
}
.departure-card .btn-primary:hover {
    background: #c2410c;
    border-color: #c2410c;
}
.departure-card table th {
    background: #ffedd5;
    color: #9a3412;
}

.departure-summary th {
    width: 190px;
    background: #fff7ed;
    color: #9a3412;
    text-align: right;
}
.departure-attachment-preview {
    margin-top: 14px;
    padding: 10px;
    border: 1px dashed #fdba74;
    border-radius: 12px;
    background: #fff;
    text-align: center;
}
.departure-attachment-preview img {
    max-width: 100%;
    max-height: 520px;
    border-radius: 8px;
}
.departure-attachment-preview iframe {
    width: 100%;
    height: 560px;
    border: 0;
}

.signed-letter-form {
    margin: 6px 0 0;
}
.departure-card .signed-letter-form label.btn {
    display: inline-block;
    margin: 0;
    cursor: pointer;
    color: #1f2937;
}
.sms-custom-dialog {
    max-width: min(620px, 94vw);
    width: 100%;
}
.sms-custom-card {
    border-top-color: var(--primary, #0f4c5c);
}
.sms-custom-card h3 {
    color: inherit;
}
.confirm-dialog.roster-print-dialog {
    width: min(640px, 94vw);
    max-width: min(640px, 94vw);
    overflow-x: hidden;
}
.roster-print-card {
    border-top-color: var(--primary, #0f4c5c);
}
.confirm-dialog.letter-preview-dialog {
    width: min(1280px, 96vw);
    max-width: min(1280px, 96vw);
    height: 92vh;
}
.letter-preview-card {
    border-top-color: var(--primary, #0f4c5c);
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.letter-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.letter-preview-head h3 {
    margin: 0;
    color: inherit;
}
.letter-preview-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(280px, 380px) 1fr;
    gap: 14px;
}
.letter-preview-form {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 6px;
}
.letter-preview-form input,
.letter-preview-form textarea {
    width: 100%;
    box-sizing: border-box;
}
.letter-preview-form textarea {
    line-height: 1.9;
    resize: vertical;
}
.letter-preview-frame {
    width: 100%;
    height: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}
@media (max-width: 860px) {
    .letter-preview-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 70vh;
        overflow-y: auto;
    }
}
.roster-print-card h3 {
    color: inherit;
}
.roster-print-list {
    max-height: 55vh;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #e5e0d5;
    border-radius: 8px;
    padding: 4px 10px;
    margin-bottom: 12px;
}
.roster-print-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    margin: 0;
    border-bottom: 1px solid #f1ece2;
    cursor: pointer;
    font-weight: 400;
}
.roster-print-item:last-child {
    border-bottom: 0;
}
.roster-print-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
}
.roster-print-name {
    font-weight: 700;
    line-height: 1.6;
}
.roster-print-meta {
    font-size: .85rem;
    white-space: nowrap;
}
.sms-custom-form {
    display: grid;
    gap: 10px;
}
.roster-print-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
}
.roster-print-actions input[type="search"] {
    flex: 1;
    min-width: 160px;
}
.sms-custom-form .roster-print-list {
    max-height: 38vh;
    margin-bottom: 0;
}
.sms-custom-form textarea {
    width: 100%;
    font: inherit;
    line-height: 1.6;
    resize: vertical;
}
.sms-compose > summary {
    display: inline-block;
    list-style: none;
    cursor: pointer;
}
.sms-compose > summary::-webkit-details-marker {
    display: none;
}
.sms-compose[open] > summary {
    opacity: .75;
}
.sms-compose form {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    min-width: 280px;
}
.sms-compose textarea {
    width: 100%;
    min-height: 110px;
    font: inherit;
    line-height: 1.6;
    resize: vertical;
}

.departure-type-checks {
    align-self: end;
    padding: 8px 12px;
    border: 2px solid #f97316;
    border-radius: 10px;
    background: #fff7ed;
}
.departure-type-checks > label {
    color: #c2410c;
    font-weight: 800;
}
.departure-type-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}
.departure-type-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 700;
    color: #9a3412;
    cursor: pointer;
}
.departure-type-option input {
    width: 18px;
    height: 18px;
    accent-color: #ea580c;
}
.departure-rows th {
    background: #ffedd5;
    color: #9a3412;
}

.confirm-dialog {
    border: none;
    border-radius: 16px;
    padding: 0;
    max-width: min(460px, 92vw);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.confirm-dialog::backdrop {
    background: rgba(15, 23, 42, 0.55);
}
.confirm-dialog-card {
    padding: 22px 24px;
    border-top: 6px solid #dc2626;
    text-align: right;
}
.confirm-dialog-card h3 {
    margin: 0 0 10px;
    color: #b91c1c;
}
.confirm-dialog-card p {
    margin: 0 0 18px;
    line-height: 1.9;
    font-weight: 700;
}
.confirm-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

