/* Attendance page (attendance-page.js) and the "my attendance" card on the
   web page and the phone home screen. Same palette as inventory / reports. */

.att-page { display: grid; gap: 14px; }
.att-tabs { margin: 0; }

.att-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.att-pill.att-ok { background: #e6f7ef; color: #128c4a; }
.att-pill.att-warn { background: #fdf1dd; color: #a35a00; }
.att-pill.att-bad { background: #fdecea; color: #b42318; }
.att-pill.att-purple { background: #efe7fb; color: #6d28d9; }
.att-pill.att-blue { background: #eaf1fe; color: #2563eb; }
.att-pill.att-grey { background: #eef1f5; color: #55677f; }

.att-filters { flex-wrap: wrap; gap: 8px; }
.att-filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #33415c; }
.att-filters .compact-input { width: auto; }

.att-table td { vertical-align: middle; }
.att-table .att-day { white-space: nowrap; color: #33415c; font-weight: 600; }
.att-table .att-late { color: #b42318; font-weight: 700; }
.att-edited { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #eef2f9; color: #55677f; font-size: 11px; font-weight: 700; cursor: help; }
.att-meter { display: inline-block; width: 54px; height: 7px; margin-inline-end: 6px; border-radius: 999px; background: #eef2f9; overflow: hidden; vertical-align: middle; }
.att-meter i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #15803d, #34c27a); }

.att-days { display: flex; flex-wrap: wrap; gap: 4px; }
.att-days span { padding: 2px 8px; border-radius: 8px; background: #f3f4f8; color: #98a2b3; font-size: 11.5px; font-weight: 600; }
.att-days span.is-on { background: #eaf1fe; color: #2563eb; }

.att-day-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.att-day-picks label { cursor: pointer; }
.att-day-picks input { position: absolute; opacity: 0; pointer-events: none; }
.att-day-picks span { display: inline-block; padding: 6px 12px; border: 1px solid #e3e9f4; border-radius: 10px; background: #fff; color: #55677f; font-size: 13px; font-weight: 600; }
.att-day-picks input:checked + span { border-color: #2563eb; background: #eaf1fe; color: #2563eb; }
.att-day-picks input:focus-visible + span { outline: 2px solid #2563eb; outline-offset: 2px; }

.att-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; max-height: 220px; overflow: auto; padding: 2px; }
.att-people label { display: flex; align-items: flex-start; gap: 8px; padding: 7px 10px; border: 1px solid #e3e9f4; border-radius: 10px; cursor: pointer; }
.att-people label:has(input:checked) { border-color: #2563eb; background: #f5f8ff; }
.att-people span { display: grid; font-size: 13px; font-weight: 600; color: #0b1b3d; }
.att-people small { color: #6b7489; font-size: 11.5px; font-weight: 500; }
.att-people-search { margin-bottom: 4px; }

.att-history { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: #f5f7fb; font-size: 12px; }
.att-history small { color: #55677f; }

/* my attendance */
.att-me { display: grid; gap: 10px; }
.att-me-head { display: flex; align-items: center; gap: 10px; }
.att-me-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #e6f7ef; color: #128c4a; flex: none; }
.att-me-text { display: grid; }
.att-me-text b { font-size: 15px; color: #0b1b3d; }
.att-me-text small { color: #6b7489; font-size: 12.5px; }
.att-me-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.att-me-state small { color: #55677f; font-size: 12.5px; }
.att-me .att-act { justify-content: center; width: 100%; }
.att-me-month { color: #55677f; font-size: 12.5px; }
.att-me-month span { margin-inline-end: 6px; font-weight: 700; color: #33415c; }
.att-me-month b { color: #0b1b3d; }
.att-me-hint { color: #98a2b3; font-size: 11.5px; }
.panel.att-me { padding: 16px 18px; }
@media (min-width: 900px) {
  .panel.att-me { grid-template-columns: auto 1fr auto; align-items: center; column-gap: 18px; }
  .panel.att-me .att-me-month, .panel.att-me .att-me-hint { grid-column: 1 / -1; }
  .panel.att-me .att-act { width: auto; min-width: 180px; }
}
.m-card.att-me { margin-bottom: 12px; }

@media (max-width: 760px) {
  .att-page .att-filters { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .att-filters label { display: grid; gap: 2px; font-size: 12px; min-width: 0; }
  .att-filters .compact-input, .att-filters select { width: 100%; min-width: 0; max-width: 100%; }
}

/* leaves */
.att-me-leave { display: flex; gap: 8px; flex-wrap: wrap; }
.att-me-leave > * { flex: 1 1 140px; justify-content: center; }
.panel.att-me .att-me-leave { grid-column: 1 / -1; }
.att-me-perm { color: #6d28d9; font-weight: 700; }
.att-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-inline-start: 6px; padding: 0 6px; border-radius: 999px; background: #e5484d; color: #fff; font-size: 11px; }
.att-lfilters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.att-chip { padding: 6px 14px; border: 1px solid #e3e9f4; border-radius: 999px; background: #fff; color: #55677f; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.att-chip.is-on { border-color: #2563eb; background: #eaf1fe; color: #2563eb; }
.att-chip b { margin-inline-start: 4px; color: #e5484d; }
.att-requests { display: grid; gap: 10px; }
.att-request { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid #e3e9f4; border-radius: 14px; background: #fff; }
.att-request-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.att-request-head > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.att-request-head small { color: #98a2b3; font-size: 11.5px; }
.att-request-when { margin: 0; color: #0b1b3d; font-weight: 700; font-size: 13.5px; }
.att-request-reason { margin: 0; color: #55677f; font-size: 13px; }
.att-request .row-actions { justify-content: flex-start; flex-wrap: wrap; }
.att-type-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.att-type-picks label { cursor: pointer; }
.att-type-picks input { position: absolute; opacity: 0; pointer-events: none; }
.att-type-picks span { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border: 1px solid #e3e9f4; border-radius: 12px; color: #55677f; text-align: center; }
.att-type-picks b { color: #0b1b3d; font-size: 13px; }
.att-type-picks small { font-size: 11px; color: #98a2b3; }
.att-type-picks input:checked + span { border-color: #2563eb; background: #f5f8ff; color: #2563eb; }
.att-type-picks input:focus-visible + span { outline: 2px solid #2563eb; outline-offset: 2px; }
.att-req { color: #b42318; font-weight: 700; }
.att-leave-hint { margin: 0; color: #55677f; font-size: 12.5px; }
.att-balance { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.att-balance div { display: grid; justify-items: center; padding: 10px 4px; border-radius: 12px; background: #f5f7fb; }
.att-balance b { color: #0b1b3d; font-size: 20px; }
.att-balance span { color: #6b7489; font-size: 11.5px; }
.att-modal [hidden] { display: none !important; }
@media (max-width: 480px) {
  .att-type-picks span { padding: 8px 4px; }
  .att-type-picks small { display: none; }
  .att-balance { grid-template-columns: repeat(2, 1fr); }
}

/* phones: short cards instead of wide tables */
.att-mlist { display: none; }
.att-mrow { display: grid; gap: 5px; padding: 10px 12px; border: 1px solid #e3e9f4; border-radius: 14px; background: #fff; }
.att-mrow-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.att-mrow-top > b { color: #0b1b3d; font-size: 14px; }
.att-mrow-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: #55677f; font-size: 12.5px; }
.att-mrow-meta .bad { color: #b42318; font-weight: 700; }
.att-mrow .mini-button { justify-self: start; }
.att-commit { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: #0b1b3d; font-size: 13px; }
@media (max-width: 760px) {
  .att-page .att-twrap { display: none !important; }
  .att-mlist { display: grid; gap: 8px; }
  .att-page .panel-header { flex-wrap: wrap; gap: 10px; }
  .att-page .panel-header .row-actions { width: 100%; flex-wrap: wrap; }
  .att-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .att-request .row-actions { flex-direction: row; flex-wrap: wrap; }
  .att-request .row-actions > * { flex: 1 1 120px; justify-content: center; }
  .att-modal .inv-map { height: 230px; }
}
/* the modal body is a scrolling column: its parts keep their height */
/* messages stay above an open attendance window */
body:has(.att-modal) .toast-stack,
body:has(.att-modal) .wa-toast-stack { z-index: 9600 !important; }

.att-modal .inv-modal-body > * { flex-shrink: 0; }
@media (max-width: 760px) {
  .att-modal .inv-modal-body .form-grid.task-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .att-modal .task-form-grid > .field:first-child { grid-column: 1 / -1; }
  .att-modal .task-form-grid input, .att-modal .task-form-grid select { min-width: 0; width: 100%; }
}

/* Check-in alert on every screen (attendance-page.js) */
.att-strip { align-items: center; border-radius: 14px; display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 14px; padding: 10px 16px; }
.att-strip.is-late { background: #d92d20; box-shadow: 0 8px 22px rgba(217, 45, 32, .25); color: #fff; }
.att-strip.is-soon { background: #e8f0fe; border: 1px solid #c7d9fb; color: #0b2b5e; }
.att-strip-ic { display: inline-flex; }
.att-strip-text { flex: 1; font-size: 14px; font-weight: 700; min-width: 180px; }
.att-strip-clock { background: rgba(255, 255, 255, .18); border-radius: 8px; font-size: 16px; font-variant-numeric: tabular-nums; letter-spacing: .5px; margin: 0 4px; padding: 1px 8px; }
.att-strip-btn { background: #fff; border: 0; border-radius: 10px; color: #b42318; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 800; padding: 7px 18px; white-space: nowrap; }
.att-strip.is-soon .att-strip-btn { background: #1668e3; color: #fff; }
.att-strip-btn:disabled { opacity: .75; }
.att-strip.is-late { animation: att-pulse 2.4s ease-in-out infinite; }
@keyframes att-pulse { 0%, 100% { box-shadow: 0 8px 22px rgba(217, 45, 32, .25); } 50% { box-shadow: 0 8px 30px rgba(217, 45, 32, .5); } }
.att-strip.is-phone { border-radius: 0; left: 0; margin: 0; padding: calc(8px + env(safe-area-inset-top)) 14px 8px; position: fixed; right: 0; top: 0; z-index: 90; }
.att-strip.is-phone .att-strip-text { font-size: 13px; min-width: 0; }
.att-strip.is-phone .att-strip-btn { padding: 6px 12px; }
body.att-strip-on #mShell { top: var(--att-strip-h, calc(52px + env(safe-area-inset-top))); }
.att-chip-top { align-items: center; background: #fff; border: 1px solid #dbe4f0; border-radius: 999px; color: #0b2b5e; cursor: pointer; display: inline-flex; font: inherit; font-size: 13px; font-weight: 700; gap: 6px; padding: 6px 14px; white-space: nowrap; }
.att-chip-top.is-late { background: #fdecea; border-color: #f3b4ae; color: #b42318; }

/* «سجلي»: a person's own month */
.att-month { align-items: center; display: inline-flex; gap: 8px; font-size: 13px; }
.att-mine-tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-bottom: 14px; }
.att-mine-tile { background: #f5f8fd; border: 1px solid #e3eaf4; border-radius: 14px; display: grid; gap: 2px; padding: 10px 14px; }
.att-mine-tile span { color: #5b6b82; font-size: 12px; }
.att-mine-tile b { color: #0b2b5e; font-size: 18px; }
.att-mine-tile.ok b { color: #13804a; } .att-mine-tile.warn b { color: #a35a00; } .att-mine-tile.bad b { color: #b42318; }
