/* Services Timer Realtime — banner sticky + stop modal + Mode Pelayanan section.
   Mobile-first, dengan breakpoint tablet (≥640px) dan dark-mode parity. */

/* ============================================================
   BANNER (sticky di top setiap admin page)
   ============================================================ */
.rst-banner {
  position: sticky;
  /* top 64px = tinggi header Unfold (h-16) yang dibikin sticky oleh
     perluasan-overrides.css (#main > div:first-child). Dulu top:0 membuat
     banner menyelip DI BAWAH header saat scroll (z-20 < z-40) sehingga
     timer tak terlihat (fix 2026-10-01). */
  top: 64px;
  /* z-index 20 = di atas konten normal tapi di bawah unfold sidebar drawer (z-30)
     dan header (z-40). Jadi saat hamburger di-tap, drawer menutupi banner. */
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(90deg, #F4F7F3 0%, #E0E9DC 100%);
  border-bottom: 2px solid #84A98C;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.88rem;
  color: #344E41;
}
html.dark .rst-banner {
  background: linear-gradient(90deg, #1F2620 0%, #2A322C 100%);
  border-bottom-color: #4A6852;
  color: #DCE3D8;
}
.rst-banner.rst-warning {
  background: linear-gradient(90deg, #FFF3CD 0%, #FFE69C 100%);
  border-bottom-color: #C99846;
}
html.dark .rst-banner.rst-warning {
  background: linear-gradient(90deg, #3A2F1A 0%, #4D3F22 100%);
  border-bottom-color: #C99846;
}

.rst-info {
  display: flex;
  gap: 6px 12px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}
.rst-icon { font-size: 1.15rem; flex: 0 0 auto; }
.rst-label { min-width: 0; word-break: break-word; }
.rst-label strong { color: #2A3D2F; }
html.dark .rst-label strong { color: #B5D1BB; }
.rst-time { color: #6B7565; font-size: 0.85rem; }
html.dark .rst-time { color: #9DA89E; }
.rst-time [data-elapsed] { font-variant-numeric: tabular-nums; }
.rst-warn-msg { color: #8B5E16; font-weight: 600; font-size: 0.85rem; }
html.dark .rst-warn-msg { color: #E5C580; }

.rst-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}
.rst-btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.2;
}
.rst-btn-stop { background: #84A98C; color: #fff; }
.rst-btn-stop:hover { background: #6B8C73; }
.rst-btn-cancel {
  background: transparent;
  color: #6B7565;
  border: 1px solid #C0C9BD;
}
.rst-btn-cancel:hover { background: #ECEFE7; color: #344E41; }
html.dark .rst-btn-cancel { color: #9DA89E; border-color: #4A6852; }
html.dark .rst-btn-cancel:hover { background: #2A322C; color: #DCE3D8; }

/* Mobile (≤640px): stack info + actions vertically, full-width touch targets */
@media (max-width: 640px) {
  .rst-banner {
    padding: 10px 12px;
    gap: 8px;
    font-size: 0.85rem;
  }
  .rst-info {
    flex: 1 1 100%;
    gap: 4px 10px;
  }
  .rst-label, .rst-time { flex: 1 1 100%; }
  .rst-actions {
    flex: 1 1 100%;
    margin-left: 0;
  }
  .rst-btn {
    flex: 1 1 50%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}

/* ============================================================
   STOP MODAL (HTML5 <dialog>)
   ============================================================ */
.rst-modal {
  border: 0;
  border-radius: 12px;
  padding: 22px;
  max-width: 480px;
  width: 92%;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  font-family: 'Inter', system-ui, sans-serif;
  box-sizing: border-box;
}
.rst-modal::backdrop { background: var(--scrim-bg, rgba(20, 30, 22, 0.55)); }
.rst-modal h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: #344E41;
  line-height: 1.3;
}
.rst-modal .rst-modal-sub {
  margin: 0 0 14px;
  color: #6B7565;
  font-size: 0.85rem;
  line-height: 1.4;
}
.rst-modal label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: #344E41;
  margin-bottom: 6px;
}
.rst-required { color: #b91c1c; }
.rst-modal textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 16px;
  border: 1px solid #C0C9BD;
  border-radius: 6px;
  resize: vertical;
  min-height: 96px;
  box-sizing: border-box;
}
.rst-modal textarea:focus { border-color: #84A98C; outline: 0; }
.rst-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
.rst-btn-primary {
  background: #84A98C;
  color: #fff;
  padding: 10px 18px;
  min-height: 44px;
}
.rst-btn-primary:disabled { background: #C0C9BD; cursor: not-allowed; }
.rst-btn-secondary {
  background: transparent;
  color: #344E41;
  border: 1px solid #C0C9BD;
  padding: 10px 18px;
  min-height: 44px;
}

html.dark .rst-modal { background: #1F2620; color: #DCE3D8; }
html.dark .rst-modal h3,
html.dark .rst-modal label { color: #B5D1BB; }
html.dark .rst-modal .rst-modal-sub { color: #9DA89E; }
html.dark .rst-modal textarea {
  background: #2A322C;
  color: #DCE3D8;
  border-color: #4A6852;
}
html.dark .rst-btn-secondary {
  color: #DCE3D8;
  border-color: #4A6852;
}
html.dark .rst-btn-secondary:hover { background: #2A322C; }

/* Mobile (≤640px): tighter padding, stack buttons full-width with primary on top */
@media (max-width: 640px) {
  .rst-modal {
    padding: 16px;
    width: 94%;
    border-radius: 10px;
  }
  .rst-modal h3 { font-size: 1rem; }
  .rst-modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .rst-modal-actions .rst-btn {
    width: 100%;
    padding: 12px;
  }
}

/* ============================================================
   SERVICES ADD: Mode Pelayanan Real-time section
   ============================================================ */
.rst-mode-section {
  margin: 0 0 18px;
  padding: 16px 20px;
  background: #FAFAF7;
  border: 1px solid #E4E7E0;
  border-radius: 12px;
}
html.dark .rst-mode-section {
  background: #1F2620;
  border-color: #36403A;
}
.rst-mode-section h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #344E41;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
html.dark .rst-mode-section h2 { color: #B5D1BB; }
.rst-mode-desc {
  margin: 0 0 14px;
  color: #6B7565;
  font-size: 0.88rem;
  line-height: 1.5;
}
html.dark .rst-mode-desc { color: #9DA89E; }
.rst-mode-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rst-mode-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #344E41;
}
html.dark .rst-mode-form label { color: #DCE3D8; }
.rst-mode-form select,
.rst-mode-form input,
.rst-mode-form textarea {
  padding: 10px 12px;
  border: 1px solid #C0C9BD;
  border-radius: 6px;
  font-family: inherit;
  font-size: 16px;
  min-height: 44px;
  background: #fff;
  color: #344E41;
  box-sizing: border-box;
}
.rst-mode-form textarea {
  min-height: 64px;
  resize: vertical;
}
.rst-mode-form select:focus,
.rst-mode-form input:focus,
.rst-mode-form textarea:focus {
  border-color: #84A98C;
  outline: 0;
}
html.dark .rst-mode-form select,
html.dark .rst-mode-form input,
html.dark .rst-mode-form textarea {
  background: #2A322C;
  color: #DCE3D8;
  border-color: #4A6852;
}
.rst-mode-start {
  align-self: flex-start;
  padding: 12px 22px;
  font-size: 0.95rem;
  min-height: 44px;
}
.rst-mode-active {
  padding: 10px 14px;
  background: #FFF6E0;
  border: 1px solid #E8C77A;
  border-radius: 8px;
  color: #745B2A;
  font-size: 0.9rem;
  line-height: 1.5;
}
html.dark .rst-mode-active {
  background: #3A2F1A;
  border-color: #8B6E2F;
  color: #E5C580;
}
.rst-mode-divider {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid #E4E7E0;
}
html.dark .rst-mode-divider { border-top-color: #36403A; }
.rst-mode-manual-hint {
  color: #6B7565;
  font-size: 0.88rem;
  line-height: 1.5;
}
html.dark .rst-mode-manual-hint { color: #9DA89E; }

/* Mobile (≤640px): tighter padding, full-width start button */
@media (max-width: 640px) {
  .rst-mode-section {
    padding: 12px 14px;
    border-radius: 10px;
  }
  .rst-mode-section h2 {
    font-size: 0.95rem;
    letter-spacing: 0.02em;
  }
  .rst-mode-desc { font-size: 0.85rem; }
  .rst-mode-start {
    align-self: stretch;
    padding: 13px 18px;
    font-size: 1rem;
  }
  .rst-mode-divider { margin: 18px 0; }
}

/* ── Dark-mode contrast patch (UI review 2026-06-08) ─────────────────────── */
html.dark .rst-required { color: #F08A8A; }
html.dark .rst-btn-primary:disabled { background: #3A4239; color: #6B7565; }
