* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { background: #f2f3f7; color: #222; font-size: 16px; -webkit-text-size-adjust: 100%; }

a { color: #3f51b5; text-decoration: none; }
.muted { color: #767a86; }
.small { font-size: 13px; }
.empty { padding: 18px; text-align: center; }

/* App shell */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; }
.content { padding: 14px 14px 40px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  background: #3f51b5; color: #fff; padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.topbar .brand { flex: 1; font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn, .avatar-link { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px; }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .2s; }
.drawer-menu {
  position: absolute; top: 0; left: 0; bottom: 0; width: 260px;
  background: #fff; list-style: none; padding: 20px 0;
  transform: translateX(-100%); transition: transform .22s ease;
  box-shadow: 2px 0 10px rgba(0,0,0,.2);
}
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-overlay { opacity: 1; }
.drawer.open .drawer-menu { transform: translateX(0); }
.drawer-menu li a { display: block; padding: 14px 20px; color: #333; font-size: 16px; border-bottom: 1px solid #f0f0f0; }
.drawer-menu li a:active { background: #f0f0f0; }

/* Cards */
.card { background: #fff; border-radius: 14px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 14px; }
.list .card { display: block; }
.task-card { display: block; }
.task-title { font-weight: 600; font-size: 16px; line-height: 1.35; }
.task-meta { font-size: 13px; color: #767a86; margin-top: 3px; }
.task-card.late { border-left: 4px solid #e53935; }
.late-tag { color: #e53935; font-weight: 600; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { text-align: center; padding: 18px 10px; }
.stat-num { display: block; font-size: 30px; font-weight: 700; color: #3f51b5; }
.stat-label { color: #767a86; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }

/* Buttons */
.btn {
  display: inline-block; border: none; cursor: pointer; border-radius: 10px;
  padding: 12px 16px; font-size: 15px; text-align: center; font-weight: 600;
  transition: transform .05s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: #3f51b5; color: #fff; }
.btn-outline { background: #fff; color: #3f51b5; border: 2px solid #3f51b5; }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 15px; font-size: 16px; }
.btn-small { padding: 8px 12px; font-size: 13px; }
.quick-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.quick-actions .btn { flex: 1; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.alert-success { background: #e8f5e9; color: #1b5e20; }
.alert-error { background: #fdecea; color: #b71c1c; }

/* Section titles */
.section-title { font-size: 15px; color: #5a5e6a; margin: 20px 0 10px; text-transform: uppercase; letter-spacing: .4px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 10px; }
.field-label { font-size: 12px; color: #767a86; margin-bottom: 2px; text-transform: uppercase; letter-spacing: .4px; }
input, select, textarea {
  width: 100%; padding: 12px; border: 1.5px solid #d5d8e0; border-radius: 10px;
  font-size: 16px; background: #fff; color: #222;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #3f51b5; }
textarea { resize: vertical; }
.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; }
.form .field-row > div { display: flex; flex-direction: column; gap: 6px; }

/* Login */
.login-body { background: linear-gradient(160deg,#3f51b5,#5c6bc0); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border-radius: 18px; padding: 32px 24px; width: 100%; max-width: 360px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-logo { font-size: 52px; margin-bottom: 6px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card form { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.code-input { text-align: center; font-size: 30px; letter-spacing: 12px; padding: 12px; }

/* Person cards */
.person-card { display: flex; align-items: center; gap: 12px; }
.person-avatar {
  width: 44px; height: 44px; border-radius: 50%; background: #3f51b5; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.person-avatar.big { width: 56px; height: 56px; font-size: 26px; }
.person-info { flex: 1; min-width: 0; }
.profile-head { display: flex; align-items: center; gap: 14px; }

/* Progress */
.progress { height: 6px; background: #ececf1; border-radius: 6px; margin: 8px 0; overflow: hidden; }
.progress-fill { height: 100%; background: #3f51b5; }

/* Badges & chips */
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-progress { background: #cfe2ff; color: #084298; }
.badge-done { background: #d1e7dd; color: #0f5132; }
.chip { display: inline-block; background: #f0f1f5; color: #3f3f46; font-size: 13px; padding: 4px 10px; border-radius: 20px; margin-right: 6px; }
.info-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* Filter bar */
.filter-bar { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }

/* Voice */
.voice-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #eef1ff; border: 2px solid #d6dcff; }
.mic-btn {
  width: 56px; height: 56px; border-radius: 50%; border: none; background: #3f51b5; color: #fff;
  font-size: 26px; cursor: pointer; flex-shrink: 0;
}
.mic-btn.listening { background: #e53935; animation: pulse 1s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(229,57,53,.5);} 100%{box-shadow:0 0 0 16px rgba(229,57,53,0);} }
.voice-info { flex: 1; min-width: 200px; }
.voice-transcript { flex-basis: 100%; background: #fff; border-radius: 10px; padding: 10px; font-size: 15px; }
.voice-assigned-chip { display: inline-block; background: #3f51b5; color: #fff; font-size: 13px; padding: 4px 10px; border-radius: 20px; margin: 4px 4px 0 0; }

/* Photos */
.file-input { padding: 10px; }
.photo-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-preview .ph { position: relative; width: 88px; height: 88px; }
.photo-preview .ph img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-item { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.photo-item img { width: 100%; height: 150px; object-fit: cover; display: block; }
.photo-item figcaption { padding: 8px; }
.gps-link { color: #3f51b5; word-break: break-all; }

/* Users & logs */
.user-card { display: flex; align-items: flex-start; gap: 12px; }
.user-body { flex: 1; min-width: 0; }
.user-actions { flex-shrink: 0; }
.user-actions summary { list-style: none; }
.user-actions summary::-webkit-details-marker { display: none; }
.inline-form { margin-top: 8px; padding: 10px; background: #f7f8fb; border-radius: 10px; display: flex; flex-direction: column; gap: 6px; }
.inline-form input[type=text], .inline-form input[type=password] { font-size: 14px; padding: 9px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0; }
.check input { width: auto; }
.log-item { padding: 12px 14px; }
.log-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.log-action { display: inline-block; background: #eef1ff; color: #3f51b5; font-weight: 600; font-size: 12px; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; }
.log-who { font-weight: 600; }
.log-time { margin-top: 4px; word-break: break-word; }

/* WhatsApp button */
.wa-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: #25D366; color: #fff; border-radius: 10px;
  padding: 10px 14px; font-size: 14px; font-weight: 600; text-decoration: none;
  border: none; cursor: pointer; line-height: 1;
}
.wa-btn:hover { background: #1ebe57; color: #fff; }
.wa-btn:active { transform: scale(.97); }
.wa-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.task-link { display: block; text-decoration: none; color: inherit; }
