:root {
    --brand: #1b5e4a;
    --brand-light: #e7f3ee;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e2e5e9;
    --danger: #b3261e;
    --warn: #92400e;
    --bg: #f7f8fa;
    --radius: 10px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-top: 34px; /* espacio para status-bar fija */
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

.status-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    text-align: center; font-size: 0.78rem; font-weight: 600; padding: 8px;
    color: #fff;
}
.status-offline { background: var(--danger); }
.status-online { background: var(--brand); }
.status-syncing { background: #92400e; }

.brand { font-weight: 700; font-size: 1.25rem; color: var(--brand); }
.brand span { font-weight: 400; color: var(--text); }

.screen { min-height: 100vh; }
.login-card {
    max-width: 340px; margin: 15vh auto 0; background: #fff; padding: 28px;
    border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    display: flex; flex-direction: column; gap: 12px;
}
.login-card label { display: flex; flex-direction: column; font-size: 0.85rem; gap: 4px; color: var(--muted); }
.login-card input { padding: 11px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; }

.topbar {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px;
    background: #fff; border-bottom: 1px solid var(--border);
    position: sticky; top: 34px; z-index: 10;
}
.topbar .brand { flex: 1; }
.btn-icon {
    width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border);
    background: #fff; font-size: 1.1rem; cursor: pointer;
}

.container { max-width: 480px; margin: 0 auto; padding: 14px; }

.btn-primary, .btn-secondary, .btn-danger {
    padding: 12px 16px; border-radius: var(--radius); border: 1px solid transparent;
    cursor: pointer; font-size: 0.95rem; font-weight: 600; width: 100%;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-secondary { background: #fff; border-color: var(--border); color: var(--text); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-sm { width: auto; padding: 8px 12px; font-size: 0.85rem; }

.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }

.ot-card { display: block; text-decoration: none; color: inherit; }
.ot-card .folio { font-weight: 700; color: var(--brand); }
.ot-card .client { font-size: 1.05rem; font-weight: 600; margin: 2px 0; }
.ot-card .meta { font-size: 0.85rem; color: var(--muted); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-en_proceso { background: #dbeafe; color: #1e40af; }
.badge-completada { background: #dcfce7; color: #166534; }
.badge-cancelada { background: #fee2e2; color: #991b1b; }
.badge-pending-sync { background: #fde68a; color: #78350f; }

.checklist-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 10px; }
.checklist-row .label { flex: 1; font-size: 0.95rem; }
.checklist-row .req { color: var(--danger); }

.toggle-yesno { display: flex; gap: 6px; }
.toggle-yesno button { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-weight: 600; }
.toggle-yesno button.active-yes { background: #dcfce7; border-color: #16a34a; color: #166534; }
.toggle-yesno button.active-no { background: #fee2e2; border-color: #dc2626; color: #991b1b; }

.checklist-row input[type=text], .checklist-row input[type=number], .checklist-row select {
    padding: 8px; border-radius: 8px; border: 1px solid var(--border); width: 130px; font-size: 0.9rem;
}

.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-strip .thumb { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.photo-strip .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-strip .thumb .pending-dot { position: absolute; top: 4px; right: 4px; width: 10px; height: 10px; border-radius: 50%; background: #f59e0b; }
.photo-add-btn { width: 84px; height: 84px; border-radius: 8px; border: 2px dashed var(--border); background: #fff; font-size: 1.6rem; color: var(--muted); }

.signature-pad-wrap canvas {
    width: 100%; height: 180px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); touch-action: none;
}

.error { background: #fee2e2; color: #991b1b; padding: 9px 10px; border-radius: var(--radius); font-size: 0.85rem; margin: 10px 0; }
.success { background: #dcfce7; color: #166534; padding: 9px 10px; border-radius: var(--radius); font-size: 0.85rem; margin: 10px 0; }

.back-link { display: inline-block; margin-bottom: 10px; color: var(--brand); font-weight: 600; text-decoration: none; }
