input,
select,
textarea {
  font-size: 16px;
}

* {
  touch-action: manipulation;
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
    system-ui, Arial, sans-serif;
  background: #f4f6f8;
}

/* =========================
   CONTAINER
========================= */
.detail-container {
  background: #f2f4f7;
  min-height: 100vh;
  padding-bottom: 90px;
}

/* =========================
   HEADER
========================= */
.detail-header {
  background: #0f2f5c;
  color: #fff;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 14px 16px;
}

.detail-header .title {
  font-weight: 600;
  font-size: 16px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.menu-btn {
  cursor: pointer;
}

/* =========================
   CARD BASE
========================= */
.card {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  margin: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* =========================
   CLIENT CARD
========================= */
.detail-client {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-icon {
  width: 50px;
  height: 50px;
  background: #2f80ed;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #fff;
  font-size: 22px;
}

.client-info {
  flex: 1;
}

.client-name {
  font-weight: 600;
  font-size: 15px;
}

.client-address {
  font-size: 12px;
  color: #666;
}

.client-pool {
  font-size: 12px;
  color: #444;
  display: flex;
  align-items: center;
  gap: 4px;
}

.client-status {
  text-align: right;
}

.status-badge {
  background: #f2994a;
  color: #fff;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
}

.started-time {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

/* =========================
   SUMMARY
========================= */
.detail-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  font-size: 12px;
}

.summary-item .label {
  color: #888;
  font-size: 11px;
}

/* =========================
   SECTION HEADER
========================= */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  font-weight: 600;
  font-size: 13px;
  margin-bottom: 10px;
}

/* =========================
   DOSAGES
========================= */

.dosages-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 🔥 FILA COMPLETA */
.dosage-row-pro {
  display: grid;
  grid-template-columns: 40% 20% 20% 20%;
  align-items: center;
  width: 100%;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  column-gap: 6px;
}

/* =========================
   COLUMNAS
========================= */

/* =========================
   ROWS
========================= */

.dosage-row-pro {
  display: grid;
  grid-template-columns: 40% 20% 20% 20%;
  align-items: center;
  width: 100%;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  column-gap: 6px;
}

/* CHEMICAL */
.dosage-name {
  font-weight: 500;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* SUGGESTED */
.dosage-suggested {
  text-align: right;
  font-size: 13px;
  color: #555;
  white-space: nowrap;
}

/* INPUT */
.dosage-input {
  width: 100%;
  text-align: right;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #ddd;
}

/* TOTAL */
.dosage-applied {
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #2c7;
  white-space: nowrap;
}

/* =========================
   CHECKLIST
========================= */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

/* =========================
   PHOTOS
========================= */
.photos-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
}

.photos-grid img {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  object-fit: cover;
}

.add-photo {
  width: 90px;
  height: 90px;
  border: 2px dashed #ccc;
  border-radius: 10px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  font-size: 12px;
  color: #888;
  cursor: pointer;
}

/* =========================
   NOTES
========================= */
.notes-input {
  width: 100%;
  min-height: 80px;
  border-radius: 8px;
  border: 1px solid #ddd;
  padding: 8px;
  resize: none;
  font-size: 13px;
}

.notes-footer {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #666;
  margin-top: 6px;
}

/* =========================
   LINKS
========================= */
.section-link {
  text-align: center;
  color: #2f80ed;
  font-size: 12px;
  margin-top: 8px;
  cursor: pointer;
}

/* =========================
   COMPLETE BUTTON
========================= */
.complete-container {
  position: fixed;
  bottom: 64px;
  left: 0;
  right: 0;
  padding: 10px;
  background: #f2f4f7;
}

.complete-btn {
  width: 100%;
  background: #2f80ed;
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.complete-btn:active {
  transform: scale(0.98);
}

.start-visit-container {
  padding: 0 16px; /* margen lateral */
  margin-top: 10px;
}

.btn-start-visit {
  width: 100%;
  padding: 12px;
  background: #16a34a;
  color: white;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.btn-start-visit:active {
  transform: scale(0.98);
}

/* =========================
   HEADER (MISMA GRID)
========================= */

.dosage-header {
  display: grid;
  grid-template-columns: 40% 20% 20% 20%;
  align-items: center;
  width: 100%;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  border-bottom: 1px solid #ddd;
  column-gap: 6px;
}

.dosage-header div {
  white-space: nowrap;
}

/* alineaciones iguales a filas */
.col-name {
  text-align: left;
}

.col-suggested,
.col-input,
.col-applied {
  text-align: right;
}

.photos-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
}

.photos-grid img,
.add-photo {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.add-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #ccc;
  cursor: pointer;
}

.photo-item {
  position: relative;
}

.photo-item img {
  width: 100%;
  border-radius: 10px;
}

.photo-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ========================================
   MAIN POOL PHOTO
======================================== */

.photo-main-btn {
  position: absolute;
  top: 6px;
  left: 6px;

  width: 22px;
  height: 22px;

  border-radius: 50%;

  background: rgba(0, 0, 0, 0.7);

  color: #fff;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 13px;
  cursor: pointer;

  transition: all 0.2s ease;
}

.photo-main-btn.active {
  background: #facc15;
  color: #111827;
}

.photo-main-btn:hover {
  transform: scale(1.08);
}

.photo-item.main-photo {
  outline: 3px solid #facc15;
  outline-offset: 2px;
  border-radius: 12px;
}

/* =========================================
   READINGS CARD
========================================= */

.readings-card {
  padding-bottom: 18px;
}

/* =========================================
   TABS
========================================= */

.reading-tabs {
  display: flex;
  justify-content: space-between;
  gap: 14px;

  margin-bottom: 18px;
}

.reading-tab {
  flex: 1;

  text-align: center;

  padding-bottom: 10px;

  border-bottom: 2px solid #e5e7eb;

  cursor: pointer;

  transition: all 0.2s ease;
}

.reading-tab.active {
  border-bottom: 3px solid #27ae60;
}

.reading-tab-name {
  font-size: 14px;
  font-weight: 700;

  color: #111827;
}

.reading-tab-step {
  margin-top: 4px;

  font-size: 12px;
  font-weight: 600;

  color: #888;
}

.reading-tab.active .reading-tab-name,
.reading-tab.active .reading-tab-step {
  color: #27ae60;
}

/* =========================================
   MAIN CONTAINER
========================================= */

.reading-wheel-container {
  width: 100%;
}

/* =========================================
   CARD
========================================= */

.reading-wheel-card {
  position: relative;
  overflow: hidden;
  background: #fff;
  border-radius: 24px;
  padding: 16px 16px 16px;
  border: 2px solid #27ae60;
  min-height: 390px;
}

.reading-wheel-card.ok {
  border: 2px solid #27ae60;
  background: #ffffff;
}

.reading-wheel-card.low {
  border: 2px solid #f59e0b;
  background: #fff7ed;
}

.reading-wheel-card.high {
  border: 2px solid #ef4444;
  background: #fef2f2;
}

/* =========================================
   HEADER
========================================= */

.reading-wheel-header {
  text-align: center;

  margin-bottom: 18px;
}

.reading-wheel-title {
  font-size: 22px;
  font-weight: 800;

  color: #16a34a;
}

.reading-wheel-range {
  margin-top: 6px;

  font-size: 15px;
  font-weight: 600;

  color: #7b8794;
}

/* =========================================
   BODY
========================================= */

.reading-wheel-body {
  display: grid;

  grid-template-columns: 50px 1fr 58px;

  gap: 10px;

  align-items: center;
}

/* =========================================
   SIDE
========================================= */

.reading-side {
  height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

.reading-scale-top,
.reading-scale-bottom {
  font-size: 16px;
  font-weight: 700;

  color: #444;
}

.reading-scale-bar {
  width: 5px;

  flex: 1;

  margin: 14px 0;

  border-radius: 999px;

  background: #d1d5db;
}

.reading-scale-bar.ok {
  background: #16a34a;
}

.reading-scale-bar.low {
  background: #f59e0b;
}

.reading-scale-bar.high {
  background: #ef4444;
}

/* =========================================
   STATUS RIGHT
========================================= */

.reading-status-high,
.reading-status-ok,
.reading-status-low {
  font-size: 15px;
  font-weight: 800;
}

.reading-status-high {
  color: #ef4444;
}

.reading-status-ok {
  color: #16a34a;
}

.reading-status-low {
  color: #f59e0b;
}

/* =========================================
   CENTER
========================================= */

.reading-wheel-center {
  position: relative;
  height: 140px;
  overflow: hidden;
}

/* =========================================
   FOCUS AREA
========================================= */

.reading-wheel-focus {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 42px;
  border-top: 2px solid #27ae60;
  border-bottom: 2px solid #27ae60;
  background: rgba(255, 255, 255, 0.75);
  z-index: 2;
  pointer-events: none;
}

/* =========================================
   WHEEL
========================================= */

.reading-wheel {
  position: relative;
  z-index: 5;
  height: 180px;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-top: 64px;
  padding-bottom: 64px;
}

.reading-wheel::-webkit-scrollbar {
  display: none;
}

/* =========================================
   ITEMS
========================================= */

.reading-wheel-item {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: #9ca3af;
  opacity: 0.35;
  transition: all 0.15s ease;
}

.reading-wheel-card.ok .reading-wheel-item.active {
  color: #16a34a;
}

.reading-wheel-card.low .reading-wheel-item.active {
  color: #f59e0b;
}

.reading-wheel-card.high .reading-wheel-item.active {
  color: #ef4444;
}

.reading-wheel-item.active {
  font-size: 18px;
  font-weight: 800;
  opacity: 1;
}

/* =========================================
   FOOTER
========================================= */

.reading-wheel-footer {
  margin-top: 10px;
  text-align: center;
}

.reading-range-status {
  font-size: 15px;
  font-weight: 700;
}

.reading-range-status.ok {
  color: #16a34a;
}

.reading-range-status.low {
  color: #f59e0b;
}

.reading-range-status.high {
  color: #ef4444;
}

/* =========================================
   NAV
========================================= */

.reading-wheel-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.reading-nav-btn {
  min-width: 118px;

  height: 52px;

  border-radius: 16px;

  border: none;

  padding: 0 22px;

  font-size: 16px;
  font-weight: 700;

  transition: all 0.2s ease;
}

.reading-nav-btn.prev {
  background: #fff;

  border: 1px solid #d1d5db;

  color: #111827;
}

.reading-nav-btn.next {
  background: #16a34a;

  color: #fff;
}

.reading-nav-btn:disabled {
  opacity: 0.35;
}

/* =========================================
   HELP MODAL
========================================= */

.reading-help-overlay {
  position: fixed;
  inset: 0;

  background: rgba(0, 0, 0, 0.45);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 999;
}

.reading-help-box {
  width: 85%;
  max-width: 340px;

  background: #fff;

  border-radius: 16px;

  padding: 18px;
}

.reading-help-title {
  text-align: center;

  font-size: 16px;
  font-weight: 700;

  margin-bottom: 14px;
}

.reading-help-item {
  font-size: 13px;

  line-height: 1.5;

  margin-bottom: 12px;
}

.reading-help-item strong {
  display: block;

  margin-bottom: 4px;
}
