:root {
  --green:      #1D9E75;
  --green-dark: #0F6E56;
  --green-light:#E1F5EE;
  --amber:      #BA7517;
  --amber-light:#FAEEDA;
  --red:        #E24B4A;
  --red-light:  #FCEBEB;
  --blue:       #185FA5;
  --blue-light: #E6F1FB;
  --gray:       #888780;
  --gray-light: #F1EFE8;
  --text:       #2C2C2A;
  --text-muted: #5F5E5A;
  --border:     rgba(0,0,0,0.12);
  --bg:         #f8f8f6;
  --white:      #ffffff;
  --radius:     10px;
  --radius-lg:  14px;
  --shadow:     0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* LOGIN */
.login-screen { position: fixed; inset: 0; background: var(--green); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-card { background: var(--white); border-radius: var(--radius-lg); padding: 2rem 1.5rem; width: min(360px, 90vw); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.logo-icon { width: 64px; height: 64px; background: var(--green); color: #fff; border-radius: 16px; font-size: 22px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-bottom: .75rem; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-hint { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 1rem; line-height: 1.6; }

/* HEADER */
.app-header { position: fixed; top: 0; left: 0; right: 0; height: 56px; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; z-index: 100; }
.header-left { display: flex; align-items: center; gap: 10px; }
.header-title { font-size: 16px; font-weight: 600; }
.btn-icon { background: none; border: none; color: #fff; font-size: 20px; padding: 6px; display: flex; align-items: center; }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #fff; }

/* MAIN + SCREENS */
.app-main { position: fixed; top: 56px; bottom: 0; left: 0; right: 0; overflow-y: auto; }
.screen { display: none; min-height: 100%; }
.screen.active { display: block; }

/* BOTTOM NAV */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: 60px; background: var(--white); border-top: 1px solid var(--border); display: flex; }
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: none; background: none; color: var(--text-muted); font-size: 10px; padding: 6px 0; transition: color .2s; }
.nav-btn .nav-icon { font-size: 20px; line-height: 1; }
.nav-btn.active { color: var(--green); }

/* CARDS */
.card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 14px; margin-bottom: 12px; }
.card-sm { background: var(--bg); border-radius: var(--radius); padding: 11px 13px; margin-bottom: 8px; border: 1px solid var(--border); }

/* FORMS */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time],
textarea, select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; background: var(--white); color: var(--text); outline: none;
  transition: border-color .2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--green); }
textarea { resize: vertical; min-height: 80px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 18px; border-radius: var(--radius); border: 1px solid var(--border); font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity .2s; }
.btn:active { opacity: .8; }
.btn-primary  { background: var(--green);  color: #fff; border-color: var(--green); }
.btn-danger   { background: var(--red);    color: #fff; border-color: var(--red); }
.btn-outline  { background: transparent; color: var(--green); border-color: var(--green); }
.btn-gray     { background: var(--gray-light); color: var(--text-muted); border-color: transparent; }
.btn-block    { width: 100%; }
.btn-sm       { padding: 7px 13px; font-size: 13px; }

/* BADGES */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-green  { background: var(--green-light); color: var(--green-dark); }
.badge-amber  { background: var(--amber-light); color: var(--amber); }
.badge-red    { background: var(--red-light);   color: var(--red); }
.badge-blue   { background: var(--blue-light);  color: var(--blue); }
.badge-gray   { background: var(--gray-light);  color: var(--gray); }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.stat-box { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); padding: 13px; }
.stat-num { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-lbl { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* PROGRESS */
.progress { height: 6px; background: var(--gray-light); border-radius: 999px; overflow: hidden; margin: 8px 0 3px; }
.progress-bar { height: 100%; background: var(--green); border-radius: 999px; transition: width .4s; }

/* LIST ITEMS */
.list-item { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-body h4 { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-body p  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.icon-circle { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.icon-circle.green  { background: var(--green-light); }
.icon-circle.amber  { background: var(--amber-light); }
.icon-circle.red    { background: var(--red-light); }
.icon-circle.blue   { background: var(--blue-light); }
.icon-circle.gray   { background: var(--gray-light); }

/* SECTION TITLE */
.section-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; padding: 14px 14px 6px; }

/* ALERTS */
.alert { padding: 11px 13px; border-radius: var(--radius); margin-bottom: 12px; font-size: 13px; }
.alert-success { background: var(--green-light); color: var(--green-dark); }
.alert-danger  { background: var(--red-light);   color: var(--red); }
.alert-warning { background: var(--amber-light); color: var(--amber); }
.alert-info    { background: var(--blue-light);  color: var(--blue); }

/* CHIP SELECTOR */
.chip-group { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; font-weight: 500; cursor: pointer; background: var(--white); color: var(--text-muted); transition: all .2s; }
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }

/* FIRMA CANVAS */
.firma-wrap { border: 2px dashed var(--border); border-radius: var(--radius); overflow: hidden; position: relative; }
.firma-wrap canvas { display: block; width: 100%; touch-action: none; }
.firma-clear { position: absolute; top: 6px; right: 8px; background: var(--white); border: 1px solid var(--border); border-radius: 6px; padding: 3px 9px; font-size: 11px; cursor: pointer; }

/* MAP */
#leaflet-map { width: 100%; height: 280px; }

/* TIMER */
.timer-badge { background: var(--blue-light); color: var(--blue); font-size: 14px; font-weight: 700; padding: 6px 14px; border-radius: 999px; font-variant-numeric: tabular-nums; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 500; display: flex; align-items: flex-end; }
.modal-box { background: var(--white); border-radius: var(--radius-lg) var(--radius-lg) 0 0; width: 100%; max-height: 90vh; overflow-y: auto; padding: 1.5rem 1rem; }

/* TOAST */
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: 13px; z-index: 999; white-space: nowrap; }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

/* ONLINE DOT */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot-green { background: var(--green); }
.dot-gray  { background: var(--gray); }

/* PHOTO GRID */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.photo-thumb { aspect-ratio: 1; border-radius: var(--radius); object-fit: cover; width: 100%; display: block; }
.photo-add { aspect-ratio: 1; border-radius: var(--radius); border: 2px dashed var(--border); display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--text-muted); cursor: pointer; background: var(--bg); }

/* UTIL */
.row        { display: flex; align-items: center; gap: 10px; }
.row-between{ display: flex; align-items: center; justify-content: space-between; }
.p14        { padding: 14px; }
.mt8        { margin-top: 8px; }
.mt12       { margin-top: 12px; }
.mb12       { margin-bottom: 12px; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.bold       { font-weight: 700; }
.divider    { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.skeleton   { background: linear-gradient(90deg, var(--gray-light) 25%, #e8e8e4 50%, var(--gray-light) 75%); background-size: 200%; animation: skel 1.2s infinite; border-radius: var(--radius); height: 16px; margin-bottom: 8px; }
@keyframes skel { 0%{background-position:200%} 100%{background-position:-200%} }

.screen-padding { padding: 14px; }

/* DRAWER LATERAL */
.drawer-item {
  display: block; width: 100%; padding: 13px 20px;
  border: none; background: none; text-align: left;
  font-size: 14px; font-weight: 500; color: var(--text);
  cursor: pointer; border-left: 3px solid transparent;
}
.drawer-item.active { color: #1D9E75; border-left-color: #1D9E75; background: #E1F5EE; font-weight: 700; }
.drawer-item:active { background: var(--bg); }
