﻿* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #1a7a40; --green-dark: #145f32; --green-light: #e8f5ed;
  --red: #d63031; --gray: #6c757d; --border: #dee2e6;
  --bg: #f4f6f9; --white: #fff;
  --shadow: 0 2px 8px rgba(0,0,0,.10); --radius: 12px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: #212529; min-height: 100vh; }
.login-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-title { font-size: 28px; font-weight: 700; color: var(--green); margin-bottom: 4px; }
.login-sub { color: var(--gray); font-size: 14px; margin-bottom: 32px; }
.login-card { background: var(--white); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #495057; margin-bottom: 6px; }
.form-control { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; outline: none; }
.form-control:focus { border-color: var(--green); }
.btn { width: 100%; padding: 13px; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all .2s; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-sm { width: auto; padding: 8px 18px; font-size: 13px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; }
.btn-outline { background: transparent; border: 1.5px solid var(--green); color: var(--green); }
.btn-danger { background: var(--red); color: #fff; }
.error-msg { color: var(--red); font-size: 13px; margin-top: 10px; text-align: center; }
.app { display: none; flex-direction: column; height: 100vh; }
.app.active { display: flex; }
.topbar { background: var(--green); color: #fff; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-sub { font-size: 12px; opacity: .8; }
.main-content { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 80px; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--white); border-top: 1px solid var(--border); display: flex; z-index: 100; box-shadow: 0 -2px 8px rgba(0,0,0,.08); }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 10px 0; cursor: pointer; color: var(--gray); font-size: 11px; font-weight: 500; gap: 3px; }
.nav-item.active { color: var(--green); }
.nav-icon { font-size: 22px; }
.date-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; background: var(--white); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.date-nav-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--green); padding: 4px 8px; }
.date-label { font-weight: 700; font-size: 15px; }
.card { background: var(--white); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s; }
.card:active { transform: scale(.99); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.card-name { font-size: 16px; font-weight: 700; }
.card-ref { font-size: 12px; color: var(--gray); }
.card-address { font-size: 13px; color: #495057; margin-bottom: 6px; }
.card-phone { font-size: 13px; color: var(--green); font-weight: 500; }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.card-purpose { font-size: 12px; color: var(--gray); flex: 1; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-scheduled { background: #fff3cd; color: #856404; }
.badge-in_progress { background: #cff4fc; color: #055160; }
.badge-completed { background: #d1e7dd; color: #0a3622; }
.badge-rapport { background: var(--green-light); color: var(--green); }
.detail-header { background: var(--white); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.detail-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.detail-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-row:last-child { border-bottom: none; }
.detail-icon { font-size: 16px; width: 24px; text-align: center; flex-shrink: 0; }
.detail-label { color: var(--gray); font-size: 12px; }
.detail-value { font-weight: 500; }
.action-row { display: flex; gap: 10px; margin-bottom: 12px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; margin-top: 18px; }
.form-select { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; background: var(--white); outline: none; }
.form-select:focus { border-color: var(--green); }
.form-textarea { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; resize: none; outline: none; font-family: inherit; min-height: 80px; }
.form-textarea:focus { border-color: var(--green); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle-label { font-size: 14px; font-weight: 500; }
.toggle { position: relative; width: 48px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ccc; border-radius: 26px; cursor: pointer; transition: .3s; }
.toggle-slider:before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .3s; }
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider:before { transform: translateX(22px); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photo-thumb { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--border); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-add { aspect-ratio: 1; border-radius: 8px; border: 2px dashed var(--green); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--green); font-size: 11px; font-weight: 600; gap: 4px; }
.photo-add-icon { font-size: 26px; }
.sig-canvas { width: 100%; height: 160px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); cursor: crosshair; touch-action: none; display: block; }
.sig-actions { display: flex; gap: 8px; margin-top: 8px; }
.sig-name { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; margin-top: 8px; }
.sig-name:focus { border-color: var(--green); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--gray); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-sub { font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.loading { display: flex; align-items: center; justify-content: center; padding: 48px; }
.loading-spinner { width: 36px; height: 36px; border: 4px solid var(--border); border-top-color: var(--green); border-radius: 50%; animation: spin .7s linear infinite; }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: #212529; color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 14px; z-index: 9999; opacity: 0; transition: opacity .3s; }
.toast.show { opacity: 1; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.back-btn { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 2px 6px; margin-right: 8px; }
.page { display: none; flex-direction: column; min-height: 100vh; }
.page.active { display: flex; }
.page-content { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 80px; }