/* ==========================================================================
   Modules 382–385 — Agile Care. Brand tokens only (brand.css / system.css),
   the same patterns as the rest of the app: payroll.css's stats strip and
   tables, the property cards' facts, the app's modals and chips.
   ========================================================================== */

/* Chips — semantic, separate from the brand green */
.ac-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.ac-chip.ok { background: var(--ac-green-tint, #E7EDE8); color: var(--ac-green, #1E3D2B); }
.ac-chip.warn { background: #F6EBD4; color: #7A5E1F; }
.ac-chip.bad { background: #F2E1DC; color: var(--ac-error, #8C2F22); }
.ac-chip.info { background: #E2E8EC; color: var(--ac-info, #2B4468); }
.ac-chip.muted { background: var(--ac-sand-pale, #F1EBDD); color: var(--ac-ink-soft, #5E665C); }
.ac-muted { color: var(--ac-ink-soft, #5E665C); }
.ac-bad { color: var(--ac-error, #8C2F22); font-weight: 600; }
.small { font-size: 12px; }
.ac-link { background: none; border: 0; padding: 0; color: var(--ac-green, #1E3D2B); text-decoration: underline; cursor: pointer; font: inherit; font-size: 12px; }
.ac-hint { margin: 0; font-size: 12.5px; color: var(--ac-ink-soft, #5E665C); }
.ac-err { margin: 0; padding: 8px 10px; color: var(--ac-error, #8C2F22); background: #F2E1DC; border-radius: 6px; font-size: 13px; }
.ac-spacer { flex: 1; }
.ac-pre { white-space: pre-wrap; margin: 0; }
.nowrap { white-space: nowrap; }

/* The client card panel */
.ac-panel { margin: 12px 0 14px; padding: 12px 14px; background: #fff; border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 8px; }
.ac-panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ac-mark { font-family: var(--font-display, 'Cormorant Garamond', Garamond, serif); font-size: 19px; font-weight: 600; color: var(--ac-green, #1E3D2B); }
.ac-panel-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.ac-sub { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ac-sand-light, #EAE2D2); }
.ac-sub-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ac-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px 16px; margin: 8px 0 0; }
.ac-facts.wide { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 12px 0; padding: 12px 14px; background: var(--ac-ivory, #F6F2E8); border-radius: 6px; }
.ac-facts dt { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ac-ink-soft, #5E665C); }
.ac-facts dd { margin: 2px 0 0; font-size: 13.5px; color: var(--ac-ink, #1F241E); font-variant-numeric: tabular-nums; }
.ac-flags { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ac-flag { font-size: 12.5px; padding: 4px 8px 4px 22px; border-radius: 4px; position: relative; background: #F2E1DC; color: var(--ac-error, #8C2F22); }
.ac-flag::before { content: '⚑'; position: absolute; left: 7px; top: 4px; }
.ac-flag.to_plan { background: #E2E8EC; color: var(--ac-info, #2B4468); }
.ac-flag.kept { background: var(--ac-sand-pale, #F1EBDD); color: var(--ac-ink-soft, #5E665C); }
.ac-sub-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* Modals */
.ac-modal { position: fixed; inset: 0; background: rgba(31, 36, 30, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 4100; overflow-y: auto; }
.ac-card { background: #fff; border-radius: 8px; padding: 18px 20px; width: min(520px, 100%); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.ac-card.wide { width: min(860px, 100%); }
.ac-card h3 { margin: 0; font-family: var(--font-display, 'Cormorant Garamond', Garamond, serif); font-weight: 600; font-size: 24px; color: var(--ac-ink, #1F241E); }
.ac-h4 { margin: 10px 0 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ac-ink-soft, #5E665C); }
.ac-eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ac-ink-soft, #5E665C); }
.ac-mhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ac-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.ac-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ac-form { display: flex; flex-direction: column; gap: 10px; }
.ac-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin: 0; }
.ac-form input:not([type=checkbox]), .ac-form select, .ac-form textarea { font: inherit; font-size: 14px; }
.ac-grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ac-check { flex-direction: row !important; align-items: center; gap: 8px !important; font-size: 13px; }
.ac-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ac-green, #1E3D2B); }
.ac-window { font-size: 13px; padding: 7px 10px; border-radius: 6px; background: var(--ac-ivory, #F6F2E8); }
.ac-window.ok { background: var(--ac-green-tint, #E7EDE8); color: var(--ac-green, #1E3D2B); }
.ac-window.bad { background: #F2E1DC; color: var(--ac-error, #8C2F22); }
.ac-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; padding: 8px 12px; border-radius: 6px; }
.ac-banner.bad { background: #F2E1DC; color: var(--ac-error, #8C2F22); }
.ac-banner.muted { background: var(--ac-sand-pale, #F1EBDD); color: var(--ac-ink-soft, #5E665C); }
.ac-history { font-size: 13px; }
.ac-history summary { cursor: pointer; color: var(--ac-ink-soft, #5E665C); }
.ac-history ul { margin: 6px 0 0; padding-left: 18px; }
.ac-history li { margin: 3px 0; }
.ac-scroll { overflow-x: auto; }
.ac-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ac-table th { text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ac-ink-soft, #5E665C); padding: 6px 8px; border-bottom: 1px solid var(--ac-sand-light, #EAE2D2); background: none; }
.ac-table td { padding: 7px 8px; border-bottom: 1px solid var(--ac-sand-light, #EAE2D2); vertical-align: top; }
.ac-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ac-table tr.off td { opacity: .5; text-decoration: line-through; }
.ac-click { cursor: pointer; }
.ac-table tr.ac-click:hover td { background: var(--ac-ivory, #F6F2E8); }
.ac-arrow { color: var(--ac-ink-soft, #5E665C); text-align: right; }

/* The report */
.ac-check-group { border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 6px; overflow: hidden; }
.ac-check-head { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ac-ink-soft, #5E665C); padding: 7px 10px; background: var(--ac-ivory, #F6F2E8); }
.ac-check-row { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 10px; border-top: 1px solid var(--ac-sand-light, #EAE2D2); }
.ac-check-item { font-size: 13px; }
.ac-check-note { font-size: 13px !important; padding: 4px 8px; min-width: 0; }
.ac-seg { display: inline-flex; }
.ac-seg button { font: inherit; font-size: 12px; padding: 3px 9px; border: 1px solid var(--ac-sand, #D8CCB4); background: #fff; color: var(--ac-ink, #1F241E); cursor: pointer; }
.ac-seg button + button { border-left: 0; }
.ac-seg button:first-child { border-radius: 4px 0 0 4px; }
.ac-seg button:last-child { border-radius: 0 4px 4px 0; }
.ac-seg button.on { background: var(--ac-green, #1E3D2B); border-color: var(--ac-green, #1E3D2B); color: #fff; }
.ac-seg button.att.on { background: var(--ac-warning, #A36A16); border-color: var(--ac-warning, #A36A16); }
.ac-seg button:focus-visible { outline: 2px solid var(--ac-green, #1E3D2B); outline-offset: 1px; }
.ac-photos { border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 6px; overflow: hidden; }
.ac-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; padding: 10px; }
.ac-photo-grid figure { margin: 0; display: flex; flex-direction: column; gap: 3px; }
.ac-photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; background: var(--ac-sand-pale, #F1EBDD); }
.ac-upload { margin: 0 10px 10px; align-self: flex-start; display: inline-flex !important; cursor: pointer; }

/* Sales ▾ Agile Care */
.ac-view { display: flex; flex-direction: column; gap: 14px; }
.ac-vhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ac-vhead h2 { margin: 0 0 4px; font-family: var(--font-display, 'Cormorant Garamond', Garamond, serif); font-weight: 600; font-size: 28px; color: var(--ac-ink, #1F241E); }
.ac-vhead .hint { margin: 0; max-width: 70ch; }
.ac-vactions { display: flex; gap: 8px; flex-wrap: wrap; }
.ac-tabs { margin: 0; }
.ac-stats { display: flex; flex-wrap: wrap; border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 6px; background: #fff; }
.ac-stats > div { flex: 1 1 120px; padding: 10px 14px; display: flex; align-items: baseline; gap: 8px; border-right: 1px solid var(--ac-sand-light, #EAE2D2); }
.ac-stats > div:last-child { border-right: 0; }
.ac-stats b { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ac-ink, #1F241E); }
.ac-stats span { font-size: 12.5px; color: var(--ac-ink-soft, #5E665C); }
.ac-stats .attn b { color: var(--ac-warning, #A36A16); }
.ac-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.ac-search { min-width: 220px; }
.ac-seg2 { display: inline-flex; flex-wrap: wrap; }
.ac-seg2 .seg-btn:first-child { border-radius: 4px 0 0 4px; }
.ac-seg2 .seg-btn:last-child { border-radius: 0 4px 4px 0; }
.ac-seg2 .seg-btn + .seg-btn { border-left: 0; }
.ac-members td { background: #fff; }
.ac-empty { padding: 28px 16px; text-align: center; color: var(--ac-ink-soft, #5E665C); background: #fff; border: 1px dashed var(--ac-sand, #D8CCB4); border-radius: 6px; }
.ac-day { margin-bottom: 12px; }
.ac-day-head { font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--ac-sand, #D8CCB4); margin-bottom: 4px; }
.ac-visit { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 10px; background: #fff; border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 6px; margin-top: 4px; font-size: 13px; }
.ac-visit:hover { border-color: var(--ac-green, #1E3D2B); }
.ac-visit.off { opacity: .55; }
.ac-visit-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ac-plan-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin: 12px 0; }
.ac-plan-controls { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.ac-plan-controls label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; margin: 0; }
.ac-plan-controls input[type=number] { width: 80px; }
.ac-run { background: #fff; border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.ac-run-head { padding: 9px 12px; background: var(--ac-ivory, #F6F2E8); font-size: 14px; }
.ac-run-head b { font-family: var(--font-display, 'Cormorant Garamond', Garamond, serif); font-size: 18px; }
.ac-run-day { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--ac-sand-light, #EAE2D2); }
.ac-run-date input { font: inherit; font-size: 13px; }
.ac-run-stops { margin: 0; padding-left: 20px; font-size: 13px; }
.ac-run-stops li { margin: 2px 0; }
.ac-run-stops li .ac-check { display: inline-flex; }
.ac-run-stops li.out { color: var(--ac-error, #8C2F22); }
.ac-plan-foot { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 12px; background: #fff; border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 8px; position: sticky; bottom: 8px; box-shadow: 0 4px 18px rgba(0,0,0,.06); }
.ac-plan-foot label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; margin: 0; }
.ac-settings h3 { margin: 8px 0 0; font-size: 18px; }
.ac-settings { max-width: 760px; background: #fff; border: 1px solid var(--ac-sand-light, #EAE2D2); border-radius: 8px; padding: 16px 18px; }

/* Calendar layer */
.ac-cal-bar { display: inline-flex; gap: 8px; align-items: center; margin-left: 6px; }
.ac-cal-note { font-size: 12.5px; margin: 6px 0; padding: 6px 10px; background: var(--ac-green-tint, #E7EDE8); color: var(--ac-ink, #1F241E); border-radius: 6px; }
.cal-cell { position: relative; }
.cal-cell.ac-win { background-image: linear-gradient(0deg, rgba(30, 61, 43, .045), rgba(30, 61, 43, .045)); }
.cal-event.ac-cal-ev { background: var(--ac-green, #1E3D2B) !important; color: #fff; cursor: pointer; }
.cal-event.ac-cal-ev.out { background: var(--ac-error, #8C2F22) !important; }
.cal-event.ac-cal-ev.done { opacity: .7; }
.ac-cal-add { position: absolute; top: 2px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--ac-sand, #D8CCB4); background: #fff; color: var(--ac-green, #1E3D2B); font-size: 14px; line-height: 16px; padding: 0; cursor: pointer; opacity: 0; transition: opacity .12s; }
.cal-cell:hover .ac-cal-add, .ac-cal-add:focus-visible { opacity: 1; }
.dot.ac-leg-win { background: rgba(30, 61, 43, .18) !important; }
@media (hover: none) { .ac-cal-add { opacity: .8; } }

/* The Crew Planner layer */
.crp-tools .ac-cal-bar { margin: 0 4px 0 0; }
.crp-day.ac-win, .crp-cell.ac-win { background-image: linear-gradient(0deg, rgba(30, 61, 43, .05), rgba(30, 61, 43, .05)); }
.crp-day { flex-wrap: wrap; }
.ac-cp { flex-basis: 100%; display: flex; flex-direction: column; gap: 2px; position: relative; }
.ac-cp-ev { display: block; width: 100%; text-align: left; border: 0; border-radius: 4px; background: var(--ac-green, #1E3D2B); color: #fff; font: inherit; font-size: 11px; line-height: 1.3; padding: 2px 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-cp-ev.out { background: var(--ac-error, #8C2F22); }
.ac-cp-ev.done { opacity: .7; }
.ac-cp-add { position: absolute; right: 0; top: -22px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--ac-sand, #D8CCB4); background: #fff; color: var(--ac-green, #1E3D2B); font-size: 13px; line-height: 14px; padding: 0; cursor: pointer; opacity: 0; transition: opacity .12s; }
.crp-day:hover .ac-cp-add, .ac-cp-add:focus-visible { opacity: 1; }
.ac-crt-care .ac-crt-name { color: var(--ac-green, #1E3D2B); }
.ac-crt-track { cursor: copy; }
.ac-crt-win { position: absolute; top: 6px; bottom: 6px; background: rgba(30, 61, 43, .07); border-top: 1px dashed rgba(30, 61, 43, .3); border-bottom: 1px dashed rgba(30, 61, 43, .3); pointer-events: none; }
.ac-crt-ev { position: absolute; top: 9px; height: 22px; box-sizing: border-box; border: 0; border-radius: 5px; background: var(--ac-green, #1E3D2B); color: #fff; font: inherit; font-size: 11px; padding: 0 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; z-index: 2; }
.ac-crt-ev.out { background: var(--ac-error, #8C2F22); }
.ac-crt-ev.done { opacity: .7; }
@media (hover: none) { .ac-cp-add { opacity: .8; } }

/* Mobile */
.ac-mob { margin: 0 0 12px; background: #fff; border: 1px solid var(--ac-sand-light, #EAE2D2); border-left: 3px solid var(--ac-green, #1E3D2B); border-radius: 8px; padding: 8px 10px; }
.ac-mob-head { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ac-ink-soft, #5E665C); margin-bottom: 4px; }
.ac-mob-visit { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--ac-sand-light, #EAE2D2); padding: 8px 0; font: inherit; font-size: 14px; color: var(--ac-ink, #1F241E); cursor: pointer; }
.ac-mob-visit:first-of-type { border-top: 0; }
.ac-mob-visit span { display: block; font-size: 12px; color: var(--ac-ink-soft, #5E665C); }

@media (max-width: 640px) {
  .ac-check-row { grid-template-columns: 1fr; }
  .ac-run-day { grid-template-columns: 1fr; }
  .ac-stats > div { flex-basis: 45%; border-right: 0; border-bottom: 1px solid var(--ac-sand-light, #EAE2D2); }
  .ac-card { padding: 14px; }
}
.ac-tabs { display: flex; flex-wrap: wrap; }
.ac-card, .ac-view, .ac-body { min-width: 0; max-width: 100%; }
.ac-plan-controls input[type=number] { width: 80px !important; }

/* Module 386 — Agile Care Antigua */
.ac-chip.ant { background: #E3ECF1; color: #23465A; }
.ac-pkgrates input { width: 110px; }
.ac-pkgrates td, .ac-pkgrates th { text-align: center; }
.ac-pkgrates td:first-child { text-align: left; }
