:root {
  --verde: #1a5c3a;
  --verde-hover: #14472d;
  --verde-md: #2d7a52;
  --verde-bg: #e8f5ee;
  --laranja: #e8621a;
  --laranja-hover: #c5501a;
  --laranja-bg: #fef3ed;
  --bg: #f7faf8;
  --card: #ffffff;
  --texto: #1a2a22;
  --texto-sec: #5a7a6a;
  --borda: #d0e8d9;
  --sombra: 0 2px 16px rgba(26,92,58,0.10);
  --radius: 14px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--texto);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

/* LOADING */
.loading-full {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg);
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--borda);
  border-top-color: var(--verde);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* SCREEN WRAPPER */
.screen { min-height: 100vh; display: flex; flex-direction: column; }

/* HEADER */
.header {
  background: var(--verde);
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  position: sticky; top: 0; z-index: 10;
}
.header-logo {
  width: 36px; height: 36px; flex-shrink: 0;
}
.header-title { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.header-sub { font-size: .75rem; opacity: .8; }
.btn-back {
  background: none; border: none; color: white; cursor: pointer;
  padding: .5rem; margin-left: -.25rem; margin-right: .25rem;
  font-size: 1.25rem; line-height: 1; flex-shrink: 0;
}
.header-spacer { flex: 1; }

/* CONTENT */
.content { flex: 1; padding: 1.5rem 1.25rem 2rem; max-width: 600px; margin: 0 auto; width: 100%; }

/* WELCOME SCREEN */
.welcome-hero {
  text-align: center;
  padding: 2.5rem 1.25rem 1.75rem;
  background: #ffffff;
  color: var(--texto);
  border-bottom: 3px solid var(--verde);
}
.welcome-logo-wrap {
  width: 220px; height: 220px; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
}
.welcome-logo-wrap img { width: 220px; height: 220px; object-fit: contain; }
.welcome-title { font-size: 1.75rem; font-weight: 800; margin-bottom: .25rem; color: var(--verde); }
.welcome-sub { font-size: .9rem; color: var(--texto-sec); font-weight: 400; }
.welcome-body { padding: 1.5rem 1.25rem 2rem; max-width: 600px; margin: 0 auto; }
.welcome-text { font-size: .95rem; color: var(--texto-sec); line-height: 1.7; white-space: pre-line; margin-bottom: 1.5rem; }

/* INSTALL BANNER */
.install-banner {
  background: var(--laranja-bg);
  border: 1.5px solid var(--laranja);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex; gap: 1rem; align-items: flex-start;
}
.install-banner-icon { font-size: 1.75rem; flex-shrink: 0; }
.install-banner h4 { color: var(--laranja-hover); font-size: .95rem; margin-bottom: .25rem; }
.install-banner p { font-size: .82rem; color: var(--texto-sec); line-height: 1.5; }
.install-steps { font-size: .82rem; color: var(--texto-sec); margin-top: .5rem; line-height: 1.6; }

/* BUTTONS */
.btn {
  display: block; width: 100%;
  padding: .875rem 1.25rem;
  border: none; border-radius: var(--radius);
  font-size: 1rem; font-weight: 600;
  cursor: pointer; text-align: center;
  text-decoration: none;
  transition: background .15s, transform .1s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--verde); color: white; box-shadow: 0 2px 8px rgba(26,92,58,.25); }
.btn-primary:hover { background: var(--verde-hover); }
.btn-secondary { background: var(--card); color: var(--verde); border: 2px solid var(--verde); }
.btn-secondary:hover { background: var(--verde-bg); }
.btn-laranja { background: var(--laranja); color: white; box-shadow: 0 2px 8px rgba(232,98,26,.25); }
.btn-laranja:hover { background: var(--laranja-hover); }
.btn-ghost { background: none; color: var(--texto-sec); font-weight: 400; font-size: .9rem; }
.btn + .btn { margin-top: .75rem; }
.btn-sm { padding: .5rem 1rem; font-size: .875rem; width: auto; display: inline-block; }

/* MENU GRID */
.menu-greeting {
  font-size: .95rem; color: var(--texto-sec);
  margin-bottom: 1.5rem; padding: 0 .25rem;
}
.menu-greeting strong { color: var(--verde); }
.menu-grid { display: flex; flex-direction: column; gap: .75rem; }
.menu-card {
  background: var(--card);
  border: 1.5px solid var(--borda);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  cursor: pointer; text-decoration: none; color: var(--texto);
  transition: border-color .15s, box-shadow .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.menu-card:hover, .menu-card:focus { border-color: var(--verde); box-shadow: var(--sombra); outline: none; }
.menu-card:active { transform: scale(.99); }
.menu-card.destaque { border-color: var(--laranja); background: var(--laranja-bg); }
.menu-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--verde-bg); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--verde); font-size: 1.4rem;
}
.menu-card.destaque .menu-card-icon { background: #fde8d4; color: var(--laranja); }
.menu-card-text { flex: 1; }
.menu-card-title { font-weight: 600; font-size: 1rem; margin-bottom: .15rem; }
.menu-card.destaque .menu-card-title { color: var(--laranja-hover); }
.menu-card-desc { font-size: .82rem; color: var(--texto-sec); line-height: 1.4; }
.menu-card-arrow { color: var(--borda); font-size: 1.1rem; }

/* FORMS */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; font-size: .875rem; font-weight: 600;
  color: var(--texto); margin-bottom: .4rem;
}
.form-label .req { color: var(--laranja); margin-left: .2rem; }
.form-input, .form-select, .form-textarea {
  display: block; width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--borda);
  border-radius: var(--radius-sm);
  font-size: 1rem; color: var(--texto);
  background: var(--card);
  transition: border-color .15s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(26,92,58,.1);
}
.form-textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.form-hint { font-size: .78rem; color: var(--texto-sec); margin-top: .3rem; }

/* FILE UPLOAD */
.upload-zone {
  border: 2px dashed var(--borda);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .15s, background .15s;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--verde); background: var(--verde-bg); }
.upload-zone input[type=file] { display: none; }
.upload-icon { font-size: 2rem; margin-bottom: .5rem; }
.upload-label { font-size: .9rem; color: var(--texto-sec); }
.upload-label strong { color: var(--verde); }
.upload-list { margin-top: 1rem; }
.upload-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; background: var(--verde-bg);
  border-radius: var(--radius-sm); margin-bottom: .4rem;
  font-size: .85rem;
}
.upload-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item-remove { background: none; border: none; color: #c0392b; cursor: pointer; font-size: 1.1rem; padding: 0; }

/* CARD */
.card {
  background: var(--card); border: 1.5px solid var(--borda);
  border-radius: var(--radius); padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title { font-weight: 700; font-size: 1.05rem; color: var(--verde); margin-bottom: .75rem; }

/* PATIENT SUMMARY */
.patient-summary { background: var(--verde-bg); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.patient-summary-row { display: flex; gap: .5rem; margin-bottom: .35rem; font-size: .9rem; }
.patient-summary-row:last-child { margin-bottom: 0; }
.patient-summary-label { color: var(--texto-sec); min-width: 90px; }
.patient-summary-value { color: var(--texto); font-weight: 500; }

/* ALERT */
.alert {
  padding: .875rem 1rem; border-radius: var(--radius-sm);
  font-size: .875rem; line-height: 1.5; margin-bottom: 1rem;
}
.alert-warning { background: #fff8e1; border: 1px solid #ffe082; color: #7a5f00; }
.alert-danger { background: #fdecea; border: 1px solid #f5c6cb; color: #7a1e1e; }
.alert-success { background: var(--verde-bg); border: 1px solid var(--verde); color: var(--verde); }

/* TERMS */
.terms-box {
  background: var(--card); border: 1.5px solid var(--borda);
  border-radius: var(--radius); padding: 1.25rem;
  max-height: 260px; overflow-y: auto;
  font-size: .875rem; line-height: 1.7; color: var(--texto-sec);
  margin-bottom: 1.25rem;
}
.checkbox-row { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: 1.25rem; cursor: pointer; }
.checkbox-row input[type=checkbox] { width: 20px; height: 20px; flex-shrink: 0; margin-top: .15rem; accent-color: var(--verde); }
.checkbox-row span { font-size: .9rem; line-height: 1.5; color: var(--texto); }

/* SUCCESS SCREEN */
.success-hero { text-align: center; padding: 3rem 1.25rem 2rem; }
.success-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--verde-bg); display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem; font-size: 2.5rem; color: var(--verde);
}
.success-title { font-size: 1.5rem; font-weight: 700; color: var(--verde); margin-bottom: .75rem; }
.success-msg { font-size: .95rem; color: var(--texto-sec); line-height: 1.6; }

/* PHARMACIES */
.pharmacy-card {
  background: var(--card); border: 1.5px solid var(--borda);
  border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: .75rem;
}
.pharmacy-name { font-weight: 700; font-size: 1rem; color: var(--verde); margin-bottom: .25rem; }
.pharmacy-cat { font-size: .78rem; background: var(--verde-bg); color: var(--verde-md); padding: .2rem .6rem; border-radius: 20px; display: inline-block; margin-bottom: .5rem; }
.pharmacy-row { font-size: .875rem; color: var(--texto-sec); margin-bottom: .2rem; }
.pharmacy-link { color: var(--laranja); text-decoration: none; font-weight: 500; }
.pharmacy-link:hover { text-decoration: underline; }

/* INFO PAGE */
.info-text { font-size: .95rem; line-height: 1.75; color: var(--texto-sec); white-space: pre-line; margin-bottom: 1.5rem; }
.info-text ul, .info-text li { margin-left: 1.25rem; }
.section-title { font-size: 1.25rem; font-weight: 700; color: var(--verde); margin-bottom: 1rem; }

/* FIXED NOTICE */
.notice-fixed {
  background: #fff8e1; border-top: 1px solid #ffe082;
  padding: .75rem 1.25rem; font-size: .8rem; color: #7a5f00;
  text-align: center; line-height: 1.5;
}

/* TOAST */
.toast-container { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 1000; width: calc(100% - 2rem); max-width: 400px; }
.toast {
  padding: .875rem 1.25rem; border-radius: var(--radius);
  font-size: .9rem; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  animation: slideUp .3s ease;
  margin-top: .5rem;
}
.toast-success { background: var(--verde); color: white; }
.toast-error { background: #c0392b; color: white; }
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

/* PROGRESS */
.progress-bar { height: 4px; background: var(--borda); border-radius: 2px; margin-bottom: 1.5rem; overflow: hidden; }
.progress-fill { height: 100%; background: var(--verde); border-radius: 2px; transition: width .3s ease; }

/* DIVIDER */
.divider { height: 1px; background: var(--borda); margin: 1.5rem 0; }

/* LINK */
a.link { color: var(--verde); text-decoration: underline; }

/* LOADING INLINE */
.btn-loading { opacity: .7; pointer-events: none; }
.btn-loading::after { content: ' ...'; }

@media (min-width: 500px) {
  .content { padding: 2rem 1.5rem 3rem; }
  .welcome-hero { padding: 3rem 2rem 2rem; }
  .welcome-title { font-size: 2.2rem; }
}
