/* Daily contact statistics, matching the clinic's shared card layout. */
.stats-shell,
.stats-body,
.stats-scroll,
.stats-content { min-width: 0; }
.stats-scroll { padding-bottom: 24px; }
.stats-content { display: flex; flex-direction: column; gap: 16px; padding: 2px 1px 12px; }
.stats-panel,
.stats-summary-card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .055);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(26, 42, 46, .035);
}
.dark .stats-panel,
.dark .stats-summary-card { background: #1c1c1e; border-color: rgba(255, 255, 255, .08); box-shadow: none; }
.stats-toolbar { padding: 20px; }
.stats-toolbar-heading,
.stats-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.stats-toolbar-heading h2,
.stats-panel-heading h2 { margin: 0; color: #1d1d1f; font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.dark .stats-toolbar-heading h2,
.dark .stats-panel-heading h2 { color: #f5f5f7; }
.stats-toolbar-heading p,
.stats-panel-heading p { margin: 4px 0 0; color: #7b8490; font-size: 12px; line-height: 1.5; }
.stats-period-label { flex: 0 0 auto; max-width: 48%; border-radius: 999px; padding: 8px 12px; color: #397983; background: #eaf5f7; font-size: 12px; font-weight: 700; text-align: right; text-transform: capitalize; }
.dark .stats-period-label { color: #a2dbe2; background: #1e3b40; }
.stats-toolbar-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.stats-period-tabs { margin: 0; }
.stats-date-controls { display: flex; align-items: center; gap: 5px; min-width: 0; }
.stats-date-controls input,
.stats-period-input { min-height: 44px; padding: 0 12px; border: 1px solid #e2e7e9; border-radius: 11px; background: #fff; color: #1d1d1f; font: inherit; font-size: 14px; }
.stats-date-controls input { min-width: 0; width: 170px; }
.stats-date-controls button { min-width: 42px; min-height: 44px; padding: 0 9px; border: 1px solid #e2e7e9; border-radius: 11px; background: #f7f9f9; color: #36585e; font: inherit; font-size: 24px; line-height: 1; cursor: pointer; }
.stats-date-controls .stats-today-button { padding: 0 12px; font-size: 12px; font-weight: 700; }
.stats-year-input { width: 110px; }
.dark .stats-date-controls input,
.dark .stats-period-input,
.dark .stats-date-controls button { background: #24292a; border-color: #394346; color: #f5f5f7; }
.stats-refresh { min-height: 44px; margin-left: auto; padding: 0 14px; border: 1px solid #dce5e7; border-radius: 11px; background: #f7fbfb; color: #3c7780; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.dark .stats-refresh { background: #203035; border-color: #3a5055; color: #a2dbe2; }
.stats-refresh:disabled { opacity: .5; cursor: default; }
.stats-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.stats-button--primary { background: #6eb0ba; color: #fff; }
.stats-button--primary:hover { background: #4f97a1; }
.stats-button--quiet { background: #fff; color: #4f5960; border-color: #e2e7e9; }
.dark .stats-button--quiet { background: #24292a; border-color: #394346; color: #e1e9eb; }
.stats-button:disabled { opacity: .55; cursor: default; }
.stats-button:focus-visible,
.stats-toolbar button:focus-visible,
.stats-toolbar input:focus-visible,
.stats-record button:focus-visible,
.stats-modal button:focus-visible,
.stats-modal :is(input, select, textarea):focus-visible { outline: 2px solid #4f97a1; outline-offset: 2px; }
.stats-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stats-summary-card { display: flex; align-items: center; gap: 14px; min-height: 104px; padding: 17px 18px; }
.stats-summary-card--primary { border-color: #cde8ec; background: #f3fafb; }
.dark .stats-summary-card--primary { border-color: #31545a; background: #193439; }
.stats-summary-icon { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #eaf5f7; color: #4f97a1; }
.stats-summary-card--primary .stats-summary-icon { background: #d9eff2; color: #317e8a; }
.dark .stats-summary-icon { background: #263a3e; color: #8ec5ce; }
.stats-summary-copy { min-width: 0; }
.stats-summary-label { margin: 0; color: #78838b; font-size: 12px; font-weight: 600; line-height: 1.3; }
.dark .stats-summary-label { color: #a8b6b9; }
.stats-summary-value { margin: 5px 0 0; color: #1d1d1f; font-size: 25px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; }
.dark .stats-summary-value { color: #fff; }
.stats-source-panel,
.stats-records,
.stats-panel:has(.stats-day-list) { padding: 18px 20px 20px; }
.stats-source-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 24px; margin-top: 17px; }
.stats-source-row { min-width: 0; }
.stats-source-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #58636b; font-size: 13px; }
.stats-source-top strong { color: #1d1d1f; font-size: 14px; font-variant-numeric: tabular-nums; }
.dark .stats-source-top { color: #b5c0c3; }
.dark .stats-source-top strong { color: #fff; }
.stats-source-track { height: 7px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: #edf2f3; }
.stats-source-track span { display: block; height: 100%; border-radius: inherit; background: #6eb0ba; min-width: 0; }
.dark .stats-source-track { background: #303a3d; }
.stats-day-list { display: grid; gap: 6px; margin-top: 15px; }
.stats-day-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 45px; padding: 8px 12px; border: 0; border-radius: 11px; background: #f7f9f9; color: #5c6870; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.stats-day-row:hover { background: #eaf5f7; }
.stats-day-row strong { color: #1d1d1f; font-size: 14px; font-variant-numeric: tabular-nums; }
.dark .stats-day-row { background: #25292b; color: #bac5c8; }
.dark .stats-day-row:hover { background: #263a3e; }
.dark .stats-day-row strong { color: #fff; }
.stats-show-more { display: block; margin: 12px auto 0; padding: 7px 12px; border: 0; background: transparent; color: #347e88; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.stats-panel-heading { margin-bottom: 14px; }
.stats-text-action { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; border: 0; background: transparent; color: #347e88; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.stats-record-list { border-top: 1px solid #edf0f1; }
.dark .stats-record-list { border-top-color: #323a3c; }
.stats-record { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid #edf0f1; }
.stats-record:last-child { border-bottom: 0; padding-bottom: 0; }
.dark .stats-record { border-bottom-color: #323a3c; }
.stats-record-main { min-width: 0; flex: 1; }
.stats-record-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 10px; }
.stats-record-title strong { color: #1d1d1f; font-size: 14px; }
.stats-record-title time { color: #8a969c; font-size: 12px; }
.dark .stats-record-title strong { color: #f5f5f7; }
.stats-record-metrics { margin: 4px 0 0; color: #68747d; font-size: 12px; line-height: 1.5; }
.stats-record-note { margin: 4px 0 0; color: #8a969c; font-size: 12px; overflow-wrap: anywhere; }
.stats-record-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; }
.stats-record-actions strong { margin-right: 6px; color: #1d1d1f; font-size: 17px; font-variant-numeric: tabular-nums; }
.dark .stats-record-actions strong { color: #fff; }
.stats-record-actions button { min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px; background: #eaf5f7; color: #347e88; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.stats-record-actions .stats-delete { display: grid; place-items: center; width: 38px; padding: 0; background: #fff2f2; color: #d65a5a; }
.dark .stats-record-actions button { background: #253c40; color: #a2dbe2; }
.dark .stats-record-actions .stats-delete { background: #3b292b; color: #f18a8a; }
.stats-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 42px 16px; color: #8a969c; font-size: 13px; text-align: center; }
.stats-empty strong { color: #1d1d1f; font-size: 15px; }
.dark .stats-empty strong { color: #fff; }
.stats-empty .stats-button { margin-top: 12px; }
.stats-page-error,
.stats-form-error { margin: 0; padding: 12px 14px; border-radius: 12px; background: #fff0f0; color: #a93434; font-size: 13px; }
.dark .stats-page-error,
.dark .stats-form-error { background: #40292b; color: #ffb9b9; }
.stats-modal-backdrop { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); }
.stats-modal { width: min(100%, 620px); max-height: min(90dvh, 780px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid #e3e8e9; border-radius: 20px; background: #fff; color: #1d1d1f; box-shadow: 0 24px 70px rgba(0, 0, 0, .2); }
.dark .stats-modal { border-color: #394346; background: #1c1c1e; color: #f5f5f7; }
.stats-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 15px; border-bottom: 1px solid #edf0f1; }
.stats-modal-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.stats-modal-head p { margin: 4px 0 0; color: #7b8490; font-size: 12px; }
.stats-modal-head button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f2f5f5; color: #6b777b; font-size: 24px; line-height: 1; cursor: pointer; }
.dark .stats-modal-head { border-bottom-color: #333c3e; }
.dark .stats-modal-head button { background: #2d383a; color: #c9d3d5; }
.stats-modal-body { min-height: 0; padding: 18px 22px; overflow-y: auto; }
.stats-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stats-modal label { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: #5b656c; font-size: 12px; font-weight: 700; }
.stats-modal :is(input, select, textarea) { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; padding: 10px 12px; border: 1px solid #e0e6e8; border-radius: 11px; background: #f9fbfb; color: #1d1d1f; font: inherit; font-size: 14px; font-weight: 500; }
.stats-modal textarea { resize: vertical; }
.dark .stats-modal label { color: #d1d9db; }
.dark .stats-modal :is(input, select, textarea) { border-color: #3b4648; background: #252b2d; color: #f5f5f7; }
.stats-form-section { margin: 20px 0 12px; font-size: 13px; font-weight: 750; }
.stats-form-help { margin: 14px 0 18px; color: #7f8b90; font-size: 12px; line-height: 1.5; }
.stats-form-date { max-width: 240px; }
.stats-modal label small { color: #8a969c; font-size: 11px; font-weight: 500; line-height: 1.35; }
.stats-ad-box { display: flex; align-items: flex-end; gap: 16px; margin: 18px 0; padding: 14px 16px; border: 1px solid #d5e9eb; border-radius: 13px; background: #f3fafb; }
.stats-ad-box label { flex: 0 0 220px; }
.stats-ad-box p { margin: 0 0 4px; color: #63767b; font-size: 12px; line-height: 1.5; }
.dark .stats-ad-box { border-color: #31545a; background: #193439; }
.dark .stats-ad-box p { color: #afc7cc; }
.stats-day-note { margin: 16px 0 0; padding: 11px 13px; border-radius: 10px; background: #f7f9f9; color: #607078; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.dark .stats-day-note { background: #252b2d; color: #bac5c8; }
.stats-modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid #edf0f1; }
.dark .stats-modal-actions { border-top-color: #333c3e; }
@media (max-width: 1023px) {
  .mobile-app-main .stats-body,
  .mobile-app-main .stats-scroll { height: auto !important; overflow: visible !important; }
  .stats-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .stats-content { gap: 12px; padding: 0 0 10px; }
  .stats-panel,
  .stats-summary-card { border-radius: 18px; }
  .stats-toolbar,
  .stats-source-panel,
  .stats-records,
  .stats-panel:has(.stats-day-list) { padding: 16px; }
  .stats-toolbar-heading { flex-wrap: wrap; }
  .stats-period-label { max-width: 100%; }
  .stats-toolbar-controls { align-items: stretch; }
  .stats-period-tabs { width: 100%; }
  .stats-period-tabs .app-filter { flex: 1 1 0; justify-content: center; }
  .stats-date-controls { flex: 1 1 100%; }
  .stats-date-controls input { flex: 1 1 auto; width: 0; font-size: 16px; }
  .stats-period-input { width: 100%; font-size: 16px; }
  .stats-refresh { margin-left: 0; }
  .stats-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats-summary-card:first-child { grid-column: 1 / -1; }
  .stats-summary-card { min-height: 92px; gap: 9px; padding: 12px; }
  .stats-summary-icon { width: 34px; height: 34px; border-radius: 10px; }
  .stats-summary-icon svg { width: 18px; height: 18px; }
  .stats-summary-label { font-size: 11px; }
  .stats-summary-value { font-size: 23px; }
  .stats-source-list { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .stats-day-row { grid-template-columns: 1fr auto; }
  .stats-day-row > span:nth-child(2) { grid-row: 2; grid-column: 1 / -1; }
  .stats-record { align-items: flex-start; flex-direction: column; }
  .stats-record-actions { width: 100%; justify-content: flex-end; }
  .stats-record-actions strong { margin-right: auto; }
  .stats-modal-backdrop { align-items: flex-end; padding: 0; }
  .stats-modal { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .stats-modal-head { padding: 17px 16px 13px; }
  .stats-modal-body { padding: 16px; }
  .stats-modal-actions { padding: 12px 16px 16px; }
  .stats-modal-actions .stats-button { flex: 1; }
  .stats-modal :is(input, select, textarea) { font-size: 16px; }
  .stats-form-date { max-width: none; }
  .stats-ad-box { align-items: stretch; flex-direction: column; gap: 8px; }
  .stats-ad-box label { flex-basis: auto; }
}
@media (max-width: 360px) {
  .stats-date-controls { flex-wrap: wrap; }
  .stats-date-controls input { flex-basis: calc(100% - 94px); }
  .stats-date-controls .stats-today-button { width: 100%; }
  .stats-form-grid--numbers { grid-template-columns: minmax(0, 1fr); }
}
