/* Confirmed appointments page (activity-page.js): the week strip, the
   approval settings, the day's tabs and tables, the edit dialog.
   Same palette as the theme (naqaa-theme.css). */

.apt-page { display: grid; gap: 14px; min-width: 0; }

/* the day's numbers */
.apt-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.apt-stat { position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 14px; padding: 20px 22px; border: 1px solid var(--nq-line); border-radius: 18px; background: var(--nq-surface); color: var(--nq-ink); font: inherit; text-align: start; cursor: pointer; transition: border-color 150ms ease, box-shadow 150ms ease; }
.apt-stat:hover { border-color: var(--nq-line-3); box-shadow: var(--nq-shadow); }
.apt-stat.is-on { border-color: var(--nq-blue); box-shadow: 0 0 0 3px var(--nq-line-3); }
.apt-stat-ic { grid-row: span 2; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 16px; }
.apt-stat-label { color: var(--nq-muted); font-size: 14px; font-weight: 800; }
.apt-stat strong { font-size: 40px; font-weight: 800; line-height: 1.05; }
.apt-stat-parts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.apt-stat-parts span { padding: 3px 10px; border-radius: 999px; background: var(--nq-tint-2); color: var(--nq-muted); font-size: 12px; font-weight: 700; }
.apt-stat-parts b { color: var(--nq-ink); }
.apt-stat-parts .is-done { background: var(--nq-ok-bg); color: var(--nq-ok); }
.apt-stat-parts .is-moved { background: #efe7fb; color: #6d28d9; }
.apt-stat-parts .is-no { background: var(--nq-danger-bg); color: var(--nq-danger); }
.apt-stat-parts .is-done b, .apt-stat-parts .is-moved b, .apt-stat-parts .is-no b { color: inherit; }
.apt-stat.is-install .apt-stat-ic { background: #eaf1fe; color: #1668e3; }
.apt-stat.is-install strong { color: #1668e3; }
.apt-stat.is-maint .apt-stat-ic { background: #e6f6f8; color: #0e7490; }
.apt-stat.is-maint strong { color: #0e7490; }
.apt-stat.is-approval .apt-stat-ic { background: var(--nq-idle-bg); color: var(--nq-idle); }
.apt-stat.is-approval.has-pending .apt-stat-ic { background: #fdf1dd; color: #a35a00; }
.apt-stat.is-approval.has-pending strong { color: #d97706; }

/* the week */
.apt-week { display: grid; gap: 12px; }
.apt-week-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.apt-arrow { display: inline-grid; place-items: center; width: 38px; height: 36px; padding: 0; }
.apt-flip { display: inline-flex; transform: scaleX(-1); }
.apt-range { color: var(--nq-ink); font-size: 15px; font-weight: 800; }
.apt-week-tools { display: inline-flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.apt-date .compact-input { min-width: 150px; }
.apt-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.apt-day { position: relative; display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border: 1px solid var(--nq-line-2); border-radius: 12px; background: #fff; color: var(--nq-ink-2); font: inherit; cursor: pointer; transition: border-color 150ms ease, background 150ms ease; }
.apt-day:hover { border-color: var(--nq-line-3); background: var(--nq-tint-2); }
.apt-day-name { font-size: 12px; font-weight: 700; color: var(--nq-muted); }
.apt-day b { font-size: 14px; font-weight: 800; color: var(--nq-ink); }
.apt-day-count { font-size: 11.5px; color: var(--nq-muted); }
.apt-day.is-today { border-color: var(--nq-blue); }
.apt-day.is-today .apt-day-name { color: var(--nq-blue); }
.apt-day.is-on { border-color: var(--nq-blue); background: var(--nq-blue); }
.apt-day.is-on .apt-day-name, .apt-day.is-on b, .apt-day.is-on .apt-day-count { color: #fff; }
.apt-day-pending { position: absolute; top: -7px; inset-inline-end: -5px; min-width: 20px; height: 20px; padding: 0 6px; border: 2px solid var(--nq-surface); border-radius: 999px; background: #d97706; color: #fff; font-size: 11px; font-weight: 800; line-height: 16px; text-align: center; }

/* approval settings */
.apt-settings { padding: 0; }
.apt-settings summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 13px 17px; color: var(--nq-ink); font-size: 14px; font-weight: 800; cursor: pointer; list-style: none; }
.apt-settings summary::-webkit-details-marker { display: none; }
.apt-settings summary small { color: var(--nq-muted); font-size: 12px; font-weight: 600; }
.apt-settings-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding: 0 17px 15px; }
.apt-settings-body p { grid-column: 1 / -1; margin: 0; }
.apt-setting { display: grid; gap: 5px; color: var(--nq-ink-2); font-size: 13px; font-weight: 700; }

/* the day */
.apt-panel { display: grid; gap: 12px; }
.apt-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.apt-panel-head h2 { margin: 0; color: var(--nq-ink); font-size: 16px; font-weight: 800; }
.apt-today { margin-inline-start: 4px; padding: 1px 9px; border-radius: 999px; background: var(--nq-tint); color: var(--nq-blue-dark); font-size: 11.5px; font-weight: 800; vertical-align: middle; }
.apt-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--nq-tint-2); border: 1px solid var(--nq-line); }
.apt-tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 0; border-radius: 9px; background: transparent; color: var(--nq-ink-2); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.apt-tab b { min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--nq-idle-bg); color: var(--nq-idle); font-size: 11.5px; text-align: center; }
.apt-tab.is-on { background: #fff; color: var(--nq-blue-dark); box-shadow: 0 1px 4px rgba(11, 31, 58, 0.1); }
.apt-tab.is-on b { background: var(--nq-tint); color: var(--nq-blue-dark); }
.apt-tab.has-pending b { background: #d97706; color: #fff; }

.apt-table-wrap { overflow-x: auto; }
.apt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.apt-table th { padding: 9px 10px; border-bottom: 1px solid var(--nq-line-2); color: var(--nq-muted); font-size: 12px; font-weight: 800; text-align: start; white-space: nowrap; }
.apt-table td { padding: 10px; border-bottom: 1px solid var(--nq-line); color: var(--nq-ink); vertical-align: middle; }
.apt-table tbody tr:hover { background: var(--nq-tint-2); }
.apt-customer, .apt-order { display: table-cell; }
.apt-customer > *, .apt-order > * { display: block; }
.apt-customer .order-link { font-weight: 700; }
.apt-clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apt-slot { display: inline-flex !important; align-items: center; gap: 4px; margin-top: 2px; padding: 1px 8px; border-radius: 999px; background: #efe7fb; color: #6d28d9; font-size: 11.5px; font-weight: 700; }
.apt-kind { display: inline-block !important; width: fit-content; margin: 2px 0; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 800; }
.apt-kind.is-maint { background: #e6f6f8; color: #0e7490; }
.apt-kind.is-install { background: #eaf1fe; color: #1668e3; }
.apt-kind.is-repair { background: #fdecec; color: #b42318; }
.apt-assign { min-width: 150px; }
.apt-status-select { min-width: 165px; font-weight: 700; }
.apt-status-select.is-wait { border-color: #f0b35a; background: #fffaf0; color: #8a5a00; }
.apt-status-select.is-yes { border-color: #9fd5b2; background: var(--nq-ok-bg); color: var(--nq-ok); }
.apt-status { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.apt-status.is-moved { background: #efe7fb; color: #6d28d9; }
.apt-status.is-no { background: var(--nq-danger-bg); color: var(--nq-danger); }
.apt-status.is-done { background: var(--nq-ok-bg); color: var(--nq-ok); }
.apt-moved { display: block; margin-top: 4px; padding: 0; border: 0; background: none; color: #6d28d9; font: inherit; font-size: 11.5px; font-weight: 700; text-decoration: underline; cursor: pointer; text-align: start; }
.apt-moved.is-from { color: var(--nq-muted); }
.apt-table tr.is-moved td { background: #faf7ff; }
.apt-table tr.is-moved .apt-customer .order-link { color: var(--nq-muted); }
.apt-assign.is-empty { border-color: #f0b35a; background: #fffaf0; }
.apt-actions { white-space: nowrap; }
.apt-actions .mini-button { display: inline-flex; align-items: center; gap: 4px; }
.apt-actions .mini-button + .mini-button { margin-inline-start: 6px; }
.apt-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--nq-idle-bg); color: var(--nq-idle); font-size: 12px; font-weight: 700; white-space: nowrap; }
.apt-chip.is-yes { background: var(--nq-ok-bg); color: var(--nq-ok); }
.apt-chip.is-edit { background: var(--nq-warn-bg); color: var(--nq-warn); }
.apt-warn { display: flex; align-items: center; gap: 6px; margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--nq-warn-bg); color: var(--nq-warn); font-size: 12.5px; font-weight: 700; }
/* what the technician recorded: no answer, a request to cancel */
.apt-flag { display: block; width: fit-content; margin-top: 4px; padding: 1px 9px; border: 0; border-radius: 999px; font: inherit; font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.apt-flag.is-wait { background: var(--nq-warn-bg); color: var(--nq-warn); }
.apt-flag.is-no { background: var(--nq-danger-bg); color: var(--nq-danger); cursor: pointer; }
.apt-flag.is-go { background: var(--nq-tint); color: var(--nq-blue-dark); }
.apt-cancels { display: grid; gap: 8px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--nq-line, #e5e9f0); }
.apt-cancels h3 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; color: var(--nq-danger); }
.apt-cancels h3 b { padding: 0 8px; border-radius: 999px; background: var(--nq-danger-bg); font-size: 12px; }
.apt-reason { min-width: 180px; }
.apt-reason b, .apt-reason span, .apt-reason small { display: block; }
.apt-reason span { margin: 2px 0; font-size: 12.5px; }
.apt-empty { display: grid; justify-items: center; gap: 8px; padding: 34px 12px; color: var(--nq-muted); text-align: center; }
.apt-empty p { margin: 0; font-size: 13px; }

/* the edit dialog */
.apt-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(11, 31, 58, 0.4); }
.apt-modal-card { display: grid; gap: 12px; width: min(420px, 100%); padding: 18px; border-radius: 16px; background: var(--nq-surface); box-shadow: var(--nq-shadow); }
.apt-modal-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.apt-modal-card h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--nq-ink); }
.apt-modal-card p { margin: 0; }
.apt-modal-card .field { display: grid; gap: 5px; font-size: 13px; font-weight: 700; color: var(--nq-ink-2); }
.apt-modal-card footer { display: flex; gap: 8px; }
.apt-check { display: flex; align-items: center; gap: 8px; color: var(--nq-ink); font-size: 13px; font-weight: 700; cursor: pointer; }
.apt-check input { width: 17px; height: 17px; accent-color: var(--nq-blue); }
.apt-msg select:disabled { opacity: 0.55; }

@media (max-width: 1100px) {
  .apt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .apt-stat.is-approval { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .apt-stats { gap: 10px; }
  .apt-stat { padding: 14px; gap: 2px 10px; border-radius: 14px; }
  .apt-stat-ic { width: 42px; height: 42px; border-radius: 12px; }
  .apt-stat strong { font-size: 30px; }
  .apt-days { display: flex; overflow-x: auto; padding-top: 8px; scroll-snap-type: x mandatory; }
  .apt-day { flex: 0 0 92px; scroll-snap-align: start; }
  .apt-week-tools { margin-inline-start: 0; width: 100%; }
  .apt-date { flex: 1; }
  .apt-date .compact-input, .apt-date .date-field { width: 100%; }
  .apt-settings-body { grid-template-columns: 1fr; }
  .apt-tabs { width: 100%; }
  .apt-tab { flex: 1 1 auto; justify-content: center; padding: 7px 8px; }
  /* tables become cards */
  .apt-table thead { display: none; }
  .apt-table, .apt-table tbody, .apt-table tr, .apt-table td { display: block; width: 100%; }
  .apt-table tr { margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--nq-line); border-radius: 12px; }
  .apt-table td { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--nq-line); }
  .apt-table td:last-child { border-bottom: 0; }
  .apt-table td::before { content: attr(data-label); flex: none; color: var(--nq-muted); font-size: 11.5px; font-weight: 700; }
  .apt-customer::before, .apt-order::before { display: none; }
  .apt-customer, .apt-order { display: grid !important; justify-content: start !important; }
  .apt-assign { min-width: 0; flex: 1; }
}

/* search, notes column, follow-up tasks (2026-11-01) */
.apt-search { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 220px; max-width: 340px; padding: 0 10px; border: 1px solid var(--nq-line); border-radius: 10px; background: #fff; color: var(--nq-ink-3, #6b7a90); }
.apt-search input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 8px 0 !important; }
.apt-search:focus-within { border-color: var(--nq-blue, #1f6feb); box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12); }
.apt-notes { min-width: 170px; max-width: 260px; }
.apt-note-last { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 6px 8px; margin-bottom: 4px; border: 1px solid var(--nq-line); border-radius: 9px; background: var(--nq-tint-2, #f5f8fc); color: var(--nq-ink); font: inherit; font-size: 12.5px; text-align: start; cursor: pointer; }
.apt-note-last:hover { border-color: var(--nq-blue, #1f6feb); }
.apt-clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.apt-note-add { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 12px; }
.apt-notes-card { max-width: 520px; }
.apt-note-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.apt-note-list li { padding: 8px 10px; border-radius: 10px; background: var(--nq-tint-2, #f5f8fc); border: 1px solid var(--nq-line); }
.apt-note-list p { margin: 0 0 3px; white-space: pre-wrap; color: var(--nq-ink); font-size: 13px; }
.apt-follow-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.apt-follow-head p { margin: 0; }
.apt-kind.is-follow { background: #fff4e5; color: #9a5b00; }
.apt-late { color: #c0392b; font-weight: 700; }
.apt-link { padding: 0; border: 0; background: none; color: var(--nq-blue-dark, #0b4fb3); font: inherit; font-weight: 700; text-align: start; cursor: pointer; }
.apt-link:hover { text-decoration: underline; }
.apt-customer .nq-label { margin-inline-start: 4px; }
@media (max-width: 760px) {
  .apt-search { max-width: none; width: 100%; }
  .apt-notes { max-width: none; }
}

/* Closing a «إصلاح عطل» visit: was the maintenance done too? (app.js askRepairClose) */
.repair-close-dialog { border: 0; border-radius: 16px; padding: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(15, 23, 42, .25); }
.repair-close-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.repair-close-dialog h2 { margin: 0 0 4px; font-size: 18px; }
.repair-close-actions { display: grid; gap: 8px; margin: 14px 0 8px; }
.repair-close-actions button { width: 100%; }
